/* СГЕНЕРИРОВАНО scripts/build-site.mjs — токены и компоненты приложения 1:1 */
:root {
  /* ---- Cool paper surfaces (sapphire-tinted near-whites) ---- */
  --paper-0:  #F6F7FA;   /* page background, cool paper                */
  --paper-1:  #ECEFF5;   /* raised panel / app chrome                  */
  --paper-2:  #E0E5EF;   /* sunken / inset wells, table stripes        */
  --card:     #FFFFFF;   /* card surface — clean white                  */
  --card-sunk:#F3F5F9;   /* nested surface inside a card               */

  /* ---- Edges & rules ---- */
  --edge-hair:  #E3E7EF; /* hairline borders on cards & inputs         */
  --edge-soft:  #C9D2E2; /* stronger divider / input border            */
  --edge-strong:#A6B2CB; /* emphasized rule, table outer border        */

  /* ---- Ink (cool slate-black, never pure #000) ---- */
  --ink-0: #14192A;      /* primary text / numbers / headings          */
  --ink-1: #2B3345;      /* body copy                                  */
  --ink-2: #4E586F;      /* secondary / meta text                      */
  --ink-3: #5F6B87;      /* tertiary, placeholder, disabled (AA ≥4.5)  */
  --ink-on-wine: #F8FAFF;/* cool white text on sapphire primary fills  */

  /* ---- Sapphire (primary brand action ramp) ---- */
  --wine-900: #11296B;
  --wine-800: #173B96;
  --wine-700: #1E50C8;   /* PRIMARY — primary buttons, active chrome    */
  --wine-600: #3565DE;   /* hover (lighter)                            */
  --wine-500: #5C86EE;   /* active accents on dark                     */
  --wine-tint:#E3EAFB;   /* sapphire wash background (selected rows)    */

  /* ---- Antique gold / bronze (HERO accent & ornament) ---- */
  --gold-700: #7E5F12;   /* gold-as-TEXT/icon on light — ≥4.5:1 on cream */
  --gold-600: #C2941F;   /* decorative gold (fills/rules/seals), not text */
  --gold-500: #E0B53A;   /* decorative rules, flourishes, seal          */
  --gold-400: #ECCB6A;   /* soft gold line                             */
  --gold-tint:#F7EAC4;   /* gold wash background                       */

  /* ---- Semantic ---- */
  --positive:      #1F7A40;  /* healing, rest restored, available (≥4.5 on tint) */
  --positive-tint: #DFF1E3;
  --warning:       #8C5E1E;  /* limit reached, unmet requirement (≥4.5 on tint) */
  --warning-tint:  #F4E7CD;
  --danger:        #A8392C;  /* damage taken, destructive, error       */
  --danger-tint:   #F3DED9;
  --info:          #356179;  /* hints, neutral info (≥4.5 on tint)     */
  --info-tint:     #DEE9EF;

  /* ---- Card availability statuses (the signature 3) ---- */
  --status-known:      #6E520F;           /* изучено — gilded/your own (≥4.5) */
  --status-known-tint: #F7EAC4;
  --status-open:       #1F7A40;           /* доступно к изучению (≥4.5)  */
  --status-open-tint:  #DFF1E3;
  --status-locked:     #6B5942;           /* закрыто (откроется позже)  */
  --status-locked-tint:#EEE2CC;

  /* ---- Magic schools (8) — muted earthy coding ---- */
  --school-abjuration:    #3E5E7A;  /* Ограждение  — steel blue (darkened: white coin ≥4.5) */
  --school-conjuration:   #9A5824;  /* Вызов       — burnt amber       */
  --school-divination:    #41728A;  /* Прорицание  — sky (darkened)    */
  --school-enchantment:   #A84E78;  /* Очарование  — rose              */
  --school-evocation:     #B5402E;  /* Воплощение  — ember red         */
  --school-illusion:      #7A569C;  /* Иллюзия     — violet            */
  --school-necromancy:    #5E6B3A;  /* Некромантия — olive moss        */
  --school-transmutation: #2E7261;  /* Преобразование — teal (darkened) */
  --school-abjuration-tint:    #E0E7EE;
  --school-conjuration-tint:   #F1E2D0;
  --school-divination-tint:    #E1ECF0;
  --school-enchantment-tint:   #F1E0E8;
  --school-evocation-tint:     #F4DFDA;
  --school-illusion-tint:      #EAE2F0;
  --school-necromancy-tint:    #E6E9DC;
  --school-transmutation-tint: #DCEDE7;

  /* ---- Типы урона (13) — solid (иммунитет) + tint (сопротивление). Приглушённые,
     в тон сапфировой палитры; физические — стальная под-гамма. Контраст ≥4.5. ---- */
  --dmg-bludgeoning: #725F56; --dmg-bludgeoning-tint: #FEE8DE;
  --dmg-piercing: #536672; --dmg-piercing-tint: #DAF1FE;
  --dmg-slashing: #65616E; --dmg-slashing-tint: #EFEAFA;
  --dmg-fire: #A53B24; --dmg-fire-tint: #FFE6E0;
  --dmg-cold: #006E8C; --dmg-cold-tint: #D9F2FC;
  --dmg-lightning: #555BA3; --dmg-lightning-tint: #E8EBFF;
  --dmg-acid: #5E6B04; --dmg-acid-tint: #EBF0DA;
  --dmg-poison: #2B7444; --dmg-poison-tint: #DFF3E3;
  --dmg-psychic: #904476; --dmg-psychic-tint: #FCE5F2;
  --dmg-necrotic: #715978; --dmg-necrotic-tint: #F6E7FA;
  --dmg-radiant: #835B00; --dmg-radiant-tint: #F6ECD7;
  --dmg-force: #3F62A2; --dmg-force-tint: #E2EDFF;
  --dmg-thunder: #55338C; --dmg-thunder-tint: #E9E0F7;   /* грозовой пурпур (BG3), не бирюза */
  --dmg-on: #FFFFFF;               /* текст на solid-капсуле иммунитета */

  /* ---- Focus ring (gold — the hero accent) ---- */
  --focus-ring: 0 0 0 3px rgba(30, 80, 200, 0.45);  /* sapphire, stronger keyboard affordance */

  /* ---- Semantic surface aliases (use these in components) ---- */
  --bg-page:        var(--paper-0);
  --bg-chrome:      var(--paper-1);
  --bg-inset:       var(--paper-2);
  --surface-card:   var(--card);
  --surface-nested: var(--card-sunk);
  --text-heading:   var(--ink-0);
  --text-body:      var(--ink-1);
  --text-muted:     var(--ink-2);
  --text-faint:     var(--ink-3);
  --border-card:    var(--edge-hair);
  --border-field:   var(--edge-soft);
  --accent:         var(--gold-600);
  /* Текст ПОВЕРХ золотой заливки. Белым по светлому золоту выходит 2,6:1 —
     нечитаемо; поверх золота всегда тёмные чернила, в обеих темах. */
  --ink-on-accent:  #1B2330;
}

/* ============================================================
   Dark theme — "ночной справочник" (Stage 2 implementation,
   tokens defined now per TЗ §5.1). Aged-leather darks, warm
   parchment ink, schools brightened to read on dark.
   ============================================================ */
/* Тёмная тема приложения — на лендинге она единственная */
:root {
  --paper-0:  #141A24;
  --paper-1:  #1B2330;
  --paper-2:  #232E40;
  --card:     #1E2735;
  --card-sunk:#171F2B;

  --edge-hair:  #2C3950;
  --edge-soft:  #3A4A66;
  --edge-strong:#4E6188;

  --ink-0: #EAF1FB;
  --ink-1: #D2DDEE;
  --ink-2: #94A6C2;
  --ink-3: #8497B5;
  --ink-on-wine: #0C1430;

  --wine-900: #0C1A45;
  --wine-800: #14306E;
  --wine-700: #6FA0FF;   /* primary on dark = bright sapphire          */
  --wine-600: #93B8FF;
  --wine-500: #4E7FE0;
  --wine-tint:#1A2A4A;

  --gold-700: #C2A063;
  --gold-600: #D4B677;
  --ink-on-accent: #17202E;
  --gold-500: #B79A5C;
  --gold-400: #8A7440;
  --gold-tint:#2A2616;

  --positive: #6FCB87;  --positive-tint:#15281C;
  --warning:  #D7A356;  --warning-tint: #2A2315;
  --danger:   #E06B5C;  --danger-tint:  #2E1813;
  --info:     #6FA2BE;  --info-tint:    #142631;

  --status-known:       #D4B677;  --status-known-tint:  #2A2616;
  --status-open:        #6FCB87;  --status-open-tint:   #15281C;
  --status-locked:      #8497B5;  --status-locked-tint: #1F2836;

  /* School bases re-tuned brighter for dark (the :root muted values read too
     dark on night surfaces — both as text and behind ink-on-wine chip text). */
  --school-abjuration:    #7FA8CC;
  --school-conjuration:   #E0A35E;
  --school-divination:    #84B8CE;
  --school-enchantment:   #DB84AC;
  --school-evocation:     #EE7E6B;
  --school-illusion:      #B79AD6;
  --school-necromancy:    #A7B673;
  --school-transmutation: #6FC2AA;
  --school-abjuration-tint:    #18222E;
  --school-conjuration-tint:   #2A2114;
  --school-divination-tint:    #16242C;
  --school-enchantment-tint:   #2A1A24;
  --school-evocation-tint:     #2E1813;
  --school-illusion-tint:      #211A2C;
  --school-necromancy-tint:    #1E2216;
  --school-transmutation-tint: #14271F;

  /* ---- Типы урона — dark: solid ярче, tint глубокий (та же семантика) ---- */
  --dmg-bludgeoning: #BDA9A0; --dmg-bludgeoning-tint: #291A13;
  --dmg-piercing: #9DB1BE; --dmg-piercing-tint: #0F202A;
  --dmg-slashing: #B0ABBA; --dmg-slashing-tint: #201C27;
  --dmg-fire: #F88B72; --dmg-fire-tint: #32140D;
  --dmg-cold: #6ABAD9; --dmg-cold-tint: #002330;
  --dmg-lightning: #9EA7F3; --dmg-lightning-tint: #191B35;
  --dmg-acid: #A8B765; --dmg-acid-tint: #1C2103;
  --dmg-poison: #7CC08F; --dmg-poison-tint: #082512;
  --dmg-psychic: #E090C2; --dmg-psychic-tint: #2E1425;
  --dmg-necrotic: #BCA4C4; --dmg-necrotic-tint: #28162D;
  --dmg-radiant: #D0A84D; --dmg-radiant-tint: #291C00;
  --dmg-force: #8AAEF0; --dmg-force-tint: #111D36;
  --dmg-thunder: #B79AE8; --dmg-thunder-tint: #1C1233;
  --dmg-on: #14192A;               /* тёмный текст на светлой solid-капсуле */

  --focus-ring: 0 0 0 3px rgba(111, 160, 255, 0.50);  /* bright sapphire on dark */
}
:root {
  /* ---- Spacing scale (4px base) ---- */
  --space-0:  0;
  --space-1:  0.25rem;  /* 4  */
  --space-2:  0.5rem;   /* 8  */
  --space-3:  0.75rem;  /* 12 */
  --space-4:  1rem;     /* 16 */
  --space-5:  1.25rem;  /* 20 */
  --space-6:  1.5rem;   /* 24 */
  --space-8:  2rem;     /* 32 */
  --space-10: 2.5rem;   /* 40 */
  --space-12: 3rem;     /* 48 */
  --space-16: 4rem;     /* 64 */

  /* ---- Layout ---- */
  --tap-target:    2.75rem;  /* 44 — minimum touch target              */
  --bottom-nav-h:  3.625rem; /* 58 — mobile tab bar                    */
  --topbar-h:      3.25rem;  /* 52 — sheet header                      */
  --content-max:   25.875rem;/* 414 — mobile column max                */
  --gutter:        var(--space-4);

  /* ---- Radii (squared rulebook feel, remaster: crisper) ---- */
  --radius-xs:  3px;
  --radius-sm:  5px;
  --radius-md:  6px;    /* default cards, inputs                       */
  --radius-lg:  10px;   /* sheets, dialogs                             */
  --radius-pill:999px;
  --radius-coin:50%;    /* ability-score coins, proficiency dots       */

  /* ---- Borders ---- */
  --bw-hair: 1px;
  --bw-rule: 1.5px;     /* card frame                                  */
  --bw-thick:2px;       /* school accent edge, active states           */

  /* ---- Elevation — soft, cool-ink-toned (matches the slate ink) ---- */
  --shadow-xs:   0 1px 1px rgba(24, 32, 58, 0.05);
  --shadow-sm:   0 1px 2px rgba(24, 32, 58, 0.08), 0 1px 1px rgba(24, 32, 58, 0.04);
  --shadow-card: 0 1px 3px rgba(24, 32, 58, 0.10), 0 1px 2px rgba(24, 32, 58, 0.05);
  --shadow-pop:  0 6px 18px rgba(16, 24, 48, 0.16), 0 2px 6px rgba(16, 24, 48, 0.08);
  --shadow-sheet:0 -8px 28px rgba(16, 24, 48, 0.18);
  --shadow-inset:inset 0 1px 2px rgba(24, 32, 58, 0.10);

  /* ---- Motion — calm, paper-like; no bounce ---- */
  --ease-standard: cubic-bezier(0.2, 0.0, 0.2, 1);
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:   120ms;
  --dur-base:   190ms;
  --dur-slow:   280ms;

  /* ---- Z-index ---- */
  --z-nav:    100;
  --z-sticky: 200;
  --z-sheet:  900;
  --z-modal:  1000;
  --z-toast:  1100;
}
.gm-card {
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-body);
}
.gm-card--flat { box-shadow: none; }
.gm-card--inset { background: var(--surface-nested); box-shadow: var(--shadow-inset); }
.gm-card--pop { box-shadow: var(--shadow-pop); }
.gm-card--pad-sm { padding: var(--space-3); }
.gm-card--pad-md { padding: var(--space-4); }
.gm-card--pad-lg { padding: var(--space-6); }
.gm-card--pad-none { padding: 0; }

/* Optional accent: a full hairline border in the school/brand color (not a side stripe). */
.gm-card[data-accent] { border-color: var(--_accent, var(--border-card)); }

.gm-card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-2);
}
.gm-card__title {
  font-family: var(--font-serif); font-weight: var(--weight-semibold);
  font-size: var(--text-md); color: var(--text-heading); line-height: var(--leading-snug);
}

.gm-btn {
  --_bg: var(--wine-700); --_fg: var(--ink-on-wine); --_bd: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); box-sizing: border-box;
  font-family: var(--font-sans); font-weight: var(--weight-bold);
  letter-spacing: 0.01em; line-height: 1; white-space: nowrap;
  border: var(--bw-hair) solid var(--_bd); border-radius: var(--radius-md);
  background: var(--_bg); color: var(--_fg); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
}
.gm-btn:hover { background: var(--wine-600); }
.gm-btn:active { transform: translateY(0.5px) scale(0.985); box-shadow: var(--shadow-inset); }
.gm-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.gm-btn--secondary { --_bg: var(--card); --_fg: var(--wine-700); --_bd: var(--edge-soft); box-shadow: var(--shadow-xs); }
.gm-btn--secondary:hover { background: var(--paper-1); border-color: var(--edge-strong); }

.gm-btn--ghost { --_bg: transparent; --_fg: var(--wine-700); --_bd: transparent; }
.gm-btn--ghost:hover { background: var(--wine-tint); }

.gm-btn--danger { --_bg: var(--danger); --_fg: #fff; }
.gm-btn--danger:hover { background: #98301f; }

.gm-btn--sm { height: 2rem;   padding: 0 var(--space-3); font-size: var(--text-sm); }
.gm-btn--md { height: 2.5rem; padding: 0 var(--space-4); font-size: var(--text-base); }
.gm-btn--lg { height: var(--tap-target); padding: 0 var(--space-6); font-size: var(--text-md); }

.gm-btn--block { width: 100%; }
.gm-btn--icon-only { padding: 0; aspect-ratio: 1; }
.gm-btn__icon { display: inline-flex; flex: none; }
