/* ==============================================================================
 *  Steppe Master — Design Tokens
 *  Подключать ПЕРВЫМ перед всеми остальными CSS. Старые стили будут постепенно
 *  переписываться на эти переменные. Документация: wiki/dev/design-system.md
 * ============================================================================== */

/* Local typefaces keep the game shell deterministic when privacy tools block
 * cross-origin webfonts. These are the same families and weights previously
 * requested from Google Fonts. */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/vendor/fonts/dm-sans-400.ttf') format('truetype'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/vendor/fonts/dm-sans-500.ttf') format('truetype'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/vendor/fonts/dm-sans-700.ttf') format('truetype'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 800; font-display: swap; src: url('/static/vendor/fonts/dm-sans-800.ttf') format('truetype'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/vendor/fonts/jetbrains-mono-400.ttf') format('truetype'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/vendor/fonts/jetbrains-mono-500.ttf') format('truetype'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/vendor/fonts/jetbrains-mono-600.ttf') format('truetype'); }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/vendor/fonts/unbounded-400.ttf') format('truetype'); }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/vendor/fonts/unbounded-700.ttf') format('truetype'); }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 900; font-display: swap; src: url('/static/vendor/fonts/unbounded-900.ttf') format('truetype'); }

:root {
    /* ── База: глубокий тёмный фон, мягкий тёплый бежевый текст ────────────── */
    --bg-deep:      #0E0A06;
    --bg-base:      #15100A;
    --bg-elevated:  #1E1810;
    --bg-overlay:   #2A2218;

    --ink-strong:   #F5EBD8;
    --ink-base:     #C8B894;
    --ink-muted:    #8A7860;
    --ink-disabled: #54483A;

    --line-soft:    rgba(255, 235, 200, 0.06);
    --line-strong:  rgba(255, 235, 200, 0.12);

    /* ── Акценты: золото + степь + огонь + кровь + небо ────────────────────── */
    --gold:         #D4A24C;
    --gold-bright:  #E8BC6C;
    --gold-deep:    #9E7128;

    --steppe:       #5E8A3B;
    --steppe-bright:#7CA655;
    --steppe-deep:  #3F5E26;

    --ember:        #C25E2C;
    --ember-bright: #D67A4A;

    --blood:        #9E2B2B;
    --blood-bright: #C44B4B;

    --sky:          #4A7DA8;
    --sky-bright:   #6FA1CC;

    /* ── Игровая доска ──────────────────────────────────────────────────────── */
    --wood-dark:    #3A2613;
    --wood-mid:     #5A3F22;
    --wood-light:   #7D5530;
    --pit-bg:       #1A1108;
    --pit-border:   #3A2613;
    --pit-hover:    var(--gold);
    --pit-last:     var(--steppe);
    --pit-selected: var(--gold-bright);
    --stone:        #DCC698;
    --stone-shadow: #3A2613;
    --tuzdyk:       var(--blood);

    /* ── Радиусы ───────────────────────────────────────────────────────────── */
    --radius-sm:    6px;
    --radius-md:    12px;
    --radius-lg:    20px;
    --radius-xl:    28px;
    --radius-pill:  999px;

    /* ── Тени ──────────────────────────────────────────────────────────────── */
    --shadow-soft:        0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-medium:      0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-deep:        0 16px 48px rgba(0, 0, 0, 0.55);
    --shadow-glow-gold:   0 0 24px rgba(212, 162, 76, 0.40);
    --shadow-glow-steppe: 0 0 24px rgba( 94, 138, 59, 0.40);
    --shadow-glow-blood:  0 0 24px rgba(158,  43, 43, 0.40);

    /* ── Типографика ───────────────────────────────────────────────────────── */
    --font-display: 'Unbounded', 'Inter', system-ui, -apple-system, sans-serif;
    --font-body:    'DM Sans',  'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

    /* ── Tempo ──────────────────────────────────────────────────────────────── */
    --t-fast:    0.15s;
    --t-base:    0.25s;
    --t-slow:    0.45s;
    --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);

    /* ── Layout ─────────────────────────────────────────────────────────────── */
    --container-max: 1280px;
    --sidebar-w:     232px;
    --header-h:      64px;
    --mobile-tab-h:  64px;

    /* Foundations milestone: semantic application tokens. */
    /* Product surface hierarchy. Keep component styles token-led instead of
     * introducing page-specific white or navy surfaces. */
    /* Brown-gold is the no-preference / unavailable-storage baseline. The
     * complete three-theme registry is defined on html[data-theme] in
     * rewards-themes.css and maps these aliases for every product surface. */
    --tp-color-page: #100b07;
    --tp-color-header: #181009;
    --tp-color-surface: #21170e;
    --tp-color-surface-raised: #2b1f14;
    --tp-color-surface-soft: #352719;
    --tp-color-interactive: #3c2c1a;
    --tp-color-muted-surface: #150e09;
    --tp-color-text: #f5ebd8;
    --tp-color-text-muted: #c8b894;
    --tp-color-text-subtle: #8a7860;
    --tp-color-border: rgba(245, 235, 216, 0.12);
    --tp-color-border-strong: rgba(245, 235, 216, 0.22);
    --tp-color-primary: #d4a24c;
    --tp-color-primary-hover: #e8bc6c;
    --tp-color-primary-ink: #1a1007;
    --tp-color-success: #7ca655;
    --tp-color-danger: #c44b4b;
    --tp-color-focus: #e8bc6c;

    --tp-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.22);
    --tp-shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.2);
    --tp-shadow-md: 0 18px 48px rgba(0, 0, 0, 0.28);

    --tp-radius-xs: 8px;
    --tp-radius-sm: 12px;
    --tp-radius-md: 16px;
    --tp-radius-lg: 22px;
    --tp-radius-pill: 999px;

    --tp-space-1: 4px;
    --tp-space-2: 8px;
    --tp-space-3: 12px;
    --tp-space-4: 16px;
    --tp-space-5: 20px;
    --tp-space-6: 24px;
    --tp-space-8: 32px;
    --tp-space-10: 40px;
    --tp-space-12: 48px;

    --tp-font-sans: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --tp-font-display: 'Unbounded', 'DM Sans', system-ui, sans-serif;
    --tp-text-xs: 12px;
    --tp-text-sm: 14px;
    --tp-text-md: 16px;
    --tp-text-lg: 20px;
    --tp-text-xl: clamp(26px, 3vw, 36px);

    --tp-shell-max: 1240px;
    --tp-home-max: 1180px;
    --tp-topbar-height: 72px;
    --tp-mobile-nav-height: 68px;
    --tp-breakpoint-mobile: 767px;
    --tp-breakpoint-tablet: 1023px;
    --tp-breakpoint-wide: 1280px;

    --tp-focus-ring: 0 0 0 3px rgba(241, 198, 108, 0.42);
    --tp-motion-fast: 140ms;
    --tp-motion-base: 220ms;
    --tp-ease-standard: cubic-bezier(0.2, 0, 0, 1);
    --tp-ease-emphasized: cubic-bezier(0.2, 0, 0, 1.2);

}

/* ────────────────────────────────────────────────────────────────────────────── */
/*  Базовые типографические классы                                                */
/* ────────────────────────────────────────────────────────────────────────────── */
.t-display { font-family: var(--font-display); font-size: 56px; line-height: 1.05; letter-spacing: -0.02em; font-weight: 700; color: var(--ink-strong); }
.t-h1      { font-family: var(--font-display); font-size: 36px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; color: var(--ink-strong); }
.t-h2      { font-family: var(--font-display); font-size: 28px; line-height: 1.2;  letter-spacing: -0.01em; font-weight: 600; color: var(--ink-strong); }
.t-h3      { font-family: var(--font-body);    font-size: 20px; line-height: 1.3;  letter-spacing:  0;      font-weight: 600; color: var(--ink-strong); }
.t-body    { font-family: var(--font-body);    font-size: 16px; line-height: 1.55; font-weight: 400; color: var(--ink-base);   }
.t-small   { font-family: var(--font-body);    font-size: 14px; line-height: 1.5;  font-weight: 400; color: var(--ink-muted);  }
.t-mono    { font-family: var(--font-mono);    font-size: 14px; line-height: 1.4;  letter-spacing: -0.01em; font-weight: 500; color: var(--ink-base); }
.t-caption { font-family: var(--font-body);    font-size: 12px; line-height: 1.4;  letter-spacing:  0.05em; font-weight: 600; text-transform: uppercase; color: var(--ink-muted); }

/* ────────────────────────────────────────────────────────────────────────────── */
/*  Утилитарные компоненты                                                        */
/* ────────────────────────────────────────────────────────────────────────────── */

/* Кнопка primary (CTA) */
.btn-primary {
    background: var(--gold);
    color: var(--bg-deep);
    font-family: var(--font-body);
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--t-fast) var(--ease);
    box-shadow: var(--shadow-soft);
}
.btn-primary:hover  { background: var(--gold-bright); box-shadow: var(--shadow-glow-gold); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled {
    background: var(--ink-disabled); color: var(--ink-muted);
    cursor: not-allowed; box-shadow: none; transform: none;
}

/* Вторичная кнопка */
.btn-secondary {
    background: transparent;
    color: var(--ink-base);
    font-family: var(--font-body);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--ink-muted);
    cursor: pointer;
    transition: all var(--t-fast) var(--ease);
}
.btn-secondary:hover  { background: var(--bg-overlay); border-color: var(--ink-base); color: var(--ink-strong); }
.btn-secondary:active { transform: scale(0.98); }

/* Ghost-кнопка (для иконок в навбаре) */
.btn-ghost {
    background: transparent;
    color: var(--ink-base);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease);
}
.btn-ghost:hover { background: var(--bg-overlay); color: var(--ink-strong); }

/* Карточка */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.card:hover { border-color: var(--line-strong); }
.card.is-interactive:hover {
    border-color: rgba(212, 162, 76, 0.35);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    cursor: pointer;
}

/* Badge / pill */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-family: var(--font-body); font-size: 12px; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
}
.badge--gold   { background: rgba(212, 162, 76, 0.15); color: var(--gold-bright); }
.badge--steppe { background: rgba( 94, 138, 59, 0.15); color: var(--steppe-bright); }
.badge--blood  { background: rgba(158,  43, 43, 0.15); color: var(--blood-bright); }
.badge--sky    { background: rgba( 74, 125,168, 0.15); color: var(--sky-bright); }

/* Инпут */
.input {
    background: var(--bg-deep);
    color: var(--ink-strong);
    font-family: var(--font-body); font-size: 16px;
    padding: 12px 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    width: 100%;
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 162, 76, 0.20);
}
.input::placeholder { color: var(--ink-disabled); }

/* Скрыть до миграции старых классов: scoped reset */
.steppe-master-app {
    background: var(--bg-base);
    color: var(--ink-base);
    font-family: var(--font-body);
}

/* ────────────────────────────────────────────────────────────────────────────── */
/*  Глобальные настройки                                                          */
/* ────────────────────────────────────────────────────────────────────────────── */
::selection {
    background: rgba(212, 162, 76, 0.30);
    color: var(--ink-strong);
}

::-webkit-scrollbar       { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
    background: var(--bg-overlay);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-disabled); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration:   0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration:  0.01ms !important;
    }
}
