/* =========================================
   CORE.CSS - Дизайн-система (UI Kit) и Базовые стили
   ========================================= */

:root {
    --gold: #d4af37;
    --gold-light: #fcf6ba;
    --blue: #2f80ed;
    --neon-blue: #00e5ff;
    --green: #34c759;
    --red: #ff3b30;

    --font-head: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", Roboto, sans-serif;
    --font-num: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", Roboto, sans-serif;

    --rad-sm: 8px;
    --rad-md: 12px;
    --rad-lg: 16px;
    --rad-xl: 24px;

    --pad-sm: 8px;
    --pad-md: 12px;
    --pad-lg: 20px;

    --shadow-glow-gold: 0 0 15px rgba(212, 175, 55, 0.3);
    --shadow-glow-blue: 0 0 15px rgba(47, 128, 237, 0.3);

    --btn-h: 50px;
    --btn-font: 14px;
    --btn-weight: 800;
    --btn-radius: var(--rad-md);
    --btn-letter: 1px;
    --btn-transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), background 0.3s, filter 0.3s;
}

[data-theme="dark"] {
    --bg-main: #080c24;
    --bg-surface: rgba(15, 20, 50, 0.7);
    --bg-surface-solid: #0f1535;
    --bg-glass: rgba(15, 20, 50, 0.5);
    --bg-inset: rgba(0, 5, 20, 0.5);
    --bg-elevated: rgba(255, 255, 255, 0.06);
    --text-main: #ffffff;
    --text-muted: #7a8bbf;
    --text-secondary: #b0bce0;
    --border-light: 1px solid rgba(100, 140, 255, 0.08);
    --border-med: 1px solid rgba(100, 140, 255, 0.15);
    --shadow-base: 0 10px 30px rgba(0, 0, 0, 0.6);
    --overlay-bg: rgba(0, 0, 0, 0.8);
    --orb-color: rgba(47, 100, 237, 0.35);
    --orb-size: 340px;
    --tg-header: #080c24;
    --bg-nav: rgba(8, 12, 36, 0.95);
    --input-bg: rgba(0, 5, 20, 0.6);
    --tab-bg: rgba(0, 5, 20, 0.5);
    --tab-active-bg: rgba(255, 255, 255, 0.1);
    --sheet-close-bg: rgba(255, 255, 255, 0.1);
    --toast-color: #ffffff;
}

[data-theme="light"] {
    --bg-main: #eef1f8;
    --bg-surface: rgba(200, 210, 235, 0.5);
    --bg-surface-solid: #dde3f0;
    --bg-glass: rgba(200, 210, 235, 0.4);
    --bg-inset: rgba(0, 20, 80, 0.06);
    --bg-elevated: rgba(255, 255, 255, 0.7);
    --text-main: #1a1e36;
    --text-muted: #6b7394;
    --text-secondary: #4a5280;
    --border-light: 1px solid rgba(0, 20, 80, 0.06);
    --border-med: 1px solid rgba(0, 20, 80, 0.1);
    --shadow-base: 0 10px 30px rgba(0, 0, 40, 0.12);
    --overlay-bg: rgba(0, 0, 20, 0.5);
    --orb-color: rgba(47, 100, 237, 0.18);
    --orb-size: 380px;
    --tg-header: #eef1f8;
    --bg-nav: rgba(238, 241, 248, 0.92);
    --input-bg: rgba(0, 20, 80, 0.05);
    --tab-bg: rgba(0, 20, 80, 0.05);
    --tab-active-bg: rgba(255, 255, 255, 0.8);
    --sheet-close-bg: rgba(0, 20, 80, 0.08);
    --toast-color: var(--text-main);
}

.bg-orb {
    position: fixed;
    width: var(--orb-size);
    height: var(--orb-size);
    border-radius: 50%;
    background: var(--orb-color);
    filter: blur(80px);
    -webkit-filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    animation: orbFloat 20s ease-in-out infinite;
    will-change: transform;
}

@keyframes orbFloat {
    0%   { transform: translate(10vw, 15vh); }
    25%  { transform: translate(55vw, 60vh); }
    50%  { transform: translate(30vw, 80vh); }
    75%  { transform: translate(60vw, 20vh); }
    100% { transform: translate(10vw, 15vh); }
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; scrollbar-width: none !important; }
::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }

html, body {
    width: 100vw !important;
    min-height: 100vh !important;
    background-color: var(--bg-main) !important;
    background-image: none !important;
    color: var(--text-main);
    font-family: var(--font-head);
    font-size: 14px;
    line-height: 1.4;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    margin: 0 !important;
    padding: 0 !important;
}

.view {
    display: none; padding: var(--pad-lg); padding-bottom: 90px;
    animation: fadeIn 0.3s ease; position: relative; z-index: 1; min-height: 100vh;
}
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ======= КНОПКИ (ЕДИНАЯ СИСТЕМА) ======= */
.act-btn {
    width: 100%; height: var(--btn-h); background: var(--blue); color: #fff; border: none;
    border-radius: var(--btn-radius); font-size: var(--btn-font); font-weight: var(--btn-weight);
    font-family: var(--font-head); text-transform: uppercase; letter-spacing: var(--btn-letter);
    cursor: pointer; transition: var(--btn-transition);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.act-btn:active { transform: scale(0.95); filter: brightness(0.8); }
.act-btn:disabled { background: var(--bg-surface-solid) !important; color: var(--text-muted) !important; border: var(--border-light) !important; transform: none; cursor: not-allowed; box-shadow: none !important; }

.btn-mini {
    padding: 8px 14px; border-radius: var(--rad-sm); font-size: 11px;
    font-weight: var(--btn-weight); font-family: var(--font-head);
    border: none; cursor: pointer; transition: var(--btn-transition);
    background: var(--blue); color: #fff; text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-mini:active { transform: scale(0.92); filter: brightness(0.8); }

.btn-ghost {
    background: transparent; color: var(--text-muted); border: var(--border-med);
    height: var(--btn-h); border-radius: var(--btn-radius); font-size: var(--btn-font);
    font-weight: var(--btn-weight); font-family: var(--font-head); text-transform: uppercase;
    letter-spacing: var(--btn-letter); cursor: pointer; transition: var(--btn-transition);
    display: flex; align-items: center; justify-content: center; width: 100%;
}
.btn-ghost:active { transform: scale(0.95); background: var(--bg-elevated); }

/* ======= ИНПУТЫ (ЕДИНАЯ СИСТЕМА) ======= */
.inp, .pass-inp, .bet-inp {
    width: 100%; height: var(--btn-h); background: var(--input-bg); border: var(--border-med);
    border-radius: var(--btn-radius); color: var(--text-main); padding: 0 15px;
    font-size: 16px; font-weight: 700; font-family: var(--font-num);
    text-align: center; margin-bottom: var(--pad-lg); transition: border-color 0.3s;
}
.inp:focus, .pass-inp:focus, .bet-inp:focus { border-color: var(--gold); }
.inp::placeholder, .pass-inp::placeholder, .bet-inp::placeholder { color: var(--text-muted); }

/* ======= ОВЕРЛЕЙ И МОДАЛКА ======= */
.overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--overlay-bg); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    z-index: 1000; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: 0.3s ease;
}
.overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-surface-solid); border: var(--border-light); box-shadow: var(--shadow-base);
    border-radius: var(--rad-xl); padding: 25px 20px; width: 92%; max-width: 400px; margin: 0 auto;
    transform: scale(0.9) translateY(20px); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative;
}
.overlay.active .modal { transform: scale(1) translateY(0); }

.modal-title {
    text-align: center; font-weight: 900; font-size: 20px;
    margin-bottom: var(--pad-lg); font-family: var(--font-head); color: var(--text-main);
}
.modal-subtitle {
    text-align: center; font-size: 12px; color: var(--text-muted);
    margin-bottom: var(--pad-lg); font-weight: 600;
}

/* ======= ШИТ-МОДАЛКА ======= */
.sheet-modal {
    position: absolute; bottom: 0; left: 0; width: 100%; border-radius: var(--rad-xl) var(--rad-xl) 0 0;
    margin: 0; max-width: 100%; height: 85vh; display: flex; flex-direction: column; padding: 0; transform: translateY(100%);
}
.overlay.active .sheet-modal { transform: translateY(0); }
.sheet-head { padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: var(--border-light); }
.sheet-title { font-size: 20px; font-weight: 800; font-family: var(--font-head); color: var(--text-main); }
.sheet-close {
    background: var(--sheet-close-bg); border: none; color: var(--text-muted);
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; transition: 0.2s; font-weight: 800;
}
.sheet-close:active { transform: scale(0.8); background: var(--red); color: #fff; }

/* ======= ТАБЫ (ЕДИНАЯ СИСТЕМА) ======= */
.tabs {
    display: flex; background: var(--tab-bg); padding: 6px;
    border-radius: var(--btn-radius); border: var(--border-light); margin-bottom: var(--pad-lg);
}
.tab {
    flex: 1; text-align: center; padding: 12px; font-size: 12px;
    font-weight: var(--btn-weight); font-family: var(--font-head);
    color: var(--text-muted); cursor: pointer; border-radius: var(--rad-sm);
    transition: 0.2s; text-transform: uppercase; letter-spacing: 0.5px;
}
.tab.active { background: var(--tab-active-bg); color: var(--text-main); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }

/* ======= ТЕМА ======= */
.theme-btn.active { border-color: var(--blue) !important; box-shadow: 0 0 12px rgba(47, 128, 237, 0.4); }

/* ======= НАВБАР ======= */
.nav {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: var(--bg-nav); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: var(--border-light); display: flex; justify-content: space-around;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); z-index: 500;
}
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--text-muted); transition: 0.3s; cursor: pointer; }
.nav-item span, .nav-item div { font-size: 10px; margin-top: 2px; font-weight: 700; font-family: var(--font-head); }
.nav-svg { width: 24px; height: 24px; fill: currentColor; margin-bottom: 4px; transition: 0.3s; }
.nav-item.active { color: var(--gold); }
.nav-item.active .nav-svg { transform: translateY(-3px); filter: drop-shadow(0 2px 5px rgba(212,175,55,0.5)); }

/* ======= ТОСТЫ ======= */
#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 99999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
    background: var(--bg-surface-solid); border: var(--border-med); padding: 12px 20px;
    border-radius: var(--btn-radius); font-size: 13px; font-weight: var(--btn-weight);
    font-family: var(--font-head); color: var(--toast-color); box-shadow: var(--shadow-base);
    opacity: 0; transform: translateY(-20px); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: var(--green); box-shadow: 0 5px 15px rgba(52,199,89,0.2); }
.toast.error { border-color: var(--red); box-shadow: 0 5px 15px rgba(255,59,48,0.2); }

/* ======= КАРТОЧКА НА ГЛАВНОЙ (LIGHT FIXES) ======= */
[data-theme="light"] .card-number { color: var(--text-muted); text-shadow: none; }
[data-theme="light"] .system-logo { color: rgba(26, 30, 54, 0.5); }
[data-theme="light"] .card-lbl { color: var(--text-muted); }
[data-theme="light"] .card-name { color: var(--text-main); }
