/* ═══════════════════════════════════════════════════════
   FABLE: Последняя Библиотека — стили
   Палитра: ночная библиотека, чернила, свеча, глитч Безмолвия
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-deep:    #0b0a12;
  --bg-panel:   #14121f;
  --bg-raise:   #1c1930;
  --line-soft:  #2b2745;
  --parchment:  #e8dcc0;
  --parch-dim:  #a99e83;
  --candle:     #e8b34b;
  --candle-hot: #ffd98a;
  --ink-glow:   #5ec8c2;
  --ink-deep:   #2a7f7a;
  --order:      #7fb8e8;
  --shadow-c:   #c05ec8;
  --danger:     #d8544f;
  --void:       #17101f;
  --font-display: 'Alegreya SC', 'Cormorant', Georgia, serif;
  --font-title:   'Cormorant', Georgia, serif;
  --font-body:    'Alegreya', Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--parchment);
  font-family: var(--font-body);
  overflow: hidden;
  user-select: none;
}

body::after { /* зерно плёнки */
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 200;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─────────── Экраны ─────────── */
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(6, 5, 12, .82);
  backdrop-filter: blur(6px);
}
.overlay.active { display: flex; animation: overlayIn .35s ease both; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* ─────────── Главное меню ─────────── */
#screen-menu {
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(94,200,194,.10), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(232,179,75,.10), transparent 60%),
    var(--bg-deep);
}
.menu-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 70% at 50% 45%, transparent 40%, rgba(4,3,9,.75) 100%);
  pointer-events: none;
}
.menu-dust { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.dust-mote {
  position: absolute;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--candle);
  opacity: 0;
  animation: motefloat linear infinite;
}
@keyframes motefloat {
  0%   { transform: translateY(20px) translateX(0); opacity: 0; }
  15%  { opacity: .55; }
  85%  { opacity: .25; }
  100% { transform: translateY(-90vh) translateX(40px); opacity: 0; }
}

.menu-inner {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  text-align: center;
  animation: menuRise 1s ease both;
}
@keyframes menuRise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.menu-sigil {
  font-size: 30px; color: var(--ink-glow);
  text-shadow: 0 0 24px var(--ink-glow);
  animation: sigilPulse 3.4s ease-in-out infinite;
}
@keyframes sigilPulse { 0%,100% { opacity:.7; transform: scale(1);} 50% { opacity:1; transform: scale(1.12);} }

.game-title {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(64px, 11vw, 128px);
  letter-spacing: .22em;
  line-height: .95;
  margin-left: .22em; /* компенсация трекинга */
  background: linear-gradient(180deg, var(--candle-hot) 0%, var(--candle) 45%, #8a6427 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 30px rgba(232,179,75,.35));
}
.game-subtitle {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.2vw, 24px);
  letter-spacing: .5em; margin-left: .5em;
  color: var(--parch-dim);
  text-transform: lowercase;
  font-variant: small-caps;
}
.title-rule {
  display: flex; align-items: center; gap: 14px;
  color: var(--line-soft); font-size: 15px;
  width: min(420px, 70vw);
}
.title-rule::before, .title-rule::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-soft));
}
.title-rule::after { background: linear-gradient(90deg, var(--line-soft), transparent); }
.title-rule span { color: var(--candle); opacity: .7; }

.menu-tagline {
  font-style: italic; color: var(--parch-dim);
  font-size: 17px; line-height: 1.55;
}

.menu-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; width: 280px; }

/* ─────────── Кнопки ─────────── */
.btn {
  font-family: var(--font-display);
  font-size: 17px; letter-spacing: .08em;
  padding: 13px 30px;
  color: var(--parchment);
  background: linear-gradient(180deg, var(--bg-raise), var(--bg-panel));
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  cursor: pointer;
  transition: all .22s ease;
  position: relative; overflow: hidden;
}
.btn:hover {
  border-color: var(--candle);
  color: var(--candle-hot);
  box-shadow: 0 0 22px rgba(232,179,75,.18), inset 0 0 18px rgba(232,179,75,.06);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn-primary {
  border-color: rgba(232,179,75,.5);
  color: var(--candle-hot);
  background: linear-gradient(180deg, #2a2138, #1c1626);
}
.btn-small { font-size: 13px; padding: 8px 14px; }
.btn-ghost {
  background: none; border: none;
  color: var(--parch-dim); opacity: .55;
  font-family: var(--font-body); font-style: italic; font-size: 14px;
  cursor: pointer; margin-top: 14px;
  transition: opacity .2s;
}
.btn-ghost:hover { opacity: 1; }

/* ─────────── Возвышение ─────────── */
.ascension-picker {
  margin-top: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 22px;
  border: 1px solid var(--line-soft); border-radius: 6px;
  background: rgba(20,18,31,.6);
}
.asc-label {
  font-family: var(--font-display); font-size: 13px;
  letter-spacing: .3em; color: var(--shadow-c);
}
.asc-controls { display: flex; align-items: center; gap: 16px; }
.asc-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line-soft); background: var(--bg-raise);
  color: var(--parchment); font-size: 17px; cursor: pointer;
  transition: all .2s;
}
.asc-btn:hover { border-color: var(--shadow-c); color: var(--shadow-c); }
.asc-value {
  font-family: var(--font-title); font-size: 30px; font-weight: 600;
  min-width: 40px; color: var(--shadow-c);
  text-shadow: 0 0 16px rgba(192,94,200,.5);
}
.asc-desc { font-size: 13px; font-style: italic; color: var(--parch-dim); max-width: 300px; }

/* ─────────── Мета-панель ─────────── */
.meta-panel {
  margin-top: 12px; padding: 10px 20px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.meta-row { display: flex; gap: 20px; align-items: baseline; }
.meta-shards { color: var(--ink-glow); font-size: 15px; }
.meta-shards b { font-size: 18px; }
.meta-title { font-style: italic; color: var(--candle); font-size: 14px; }
.meta-unlocks { font-size: 12.5px; color: var(--parch-dim); font-style: italic; max-width: 460px; }

/* ═══════════ ИГРОВОЙ ЭКРАН ═══════════ */
#screen-game {
  background:
    radial-gradient(ellipse 60% 45% at 50% 0%, rgba(94,200,194,.06), transparent 60%),
    radial-gradient(ellipse 55% 40% at 50% 100%, rgba(232,179,75,.07), transparent 55%),
    var(--bg-deep);
}
.game-layout {
  height: 100vh;
  display: flex;
  align-items: center; justify-content: center;
  gap: 22px;
  padding: 12px;
}

.panel {
  width: 218px;
  display: flex; flex-direction: column; gap: 14px;
  animation: panelIn .6s ease both;
}
.panel-right { animation-delay: .1s; }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.wave-block, .core-block, .ink-block, .relics-block, .align-block, .run-stats, .piece-previews, .controls-hint, .abilities {
  background: linear-gradient(180deg, rgba(28,25,48,.75), rgba(20,18,31,.75));
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 12px 14px;
}

.act-name {
  font-family: var(--font-display); font-size: 12px;
  letter-spacing: .32em; color: var(--candle);
}
.wave-name { font-family: var(--font-title); font-size: 21px; font-weight: 600; margin-top: 2px; }
.wave-status { font-size: 12.5px; font-style: italic; color: var(--parch-dim); min-height: 17px; }

.core-label {
  font-family: var(--font-display); font-size: 11.5px;
  letter-spacing: .18em; color: var(--parch-dim); margin-bottom: 7px;
}
.core-bar {
  position: relative; height: 20px;
  background: var(--void); border-radius: 3px;
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.core-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #8a3b30, var(--danger), #ff8a6a);
  box-shadow: 0 0 14px rgba(216,84,79,.55);
  transition: width .4s ease;
}
.core-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; letter-spacing: .06em;
  color: #fff; text-shadow: 0 1px 3px #000;
}

.ink-block { display: flex; align-items: baseline; gap: 8px; }
.ink-icon { color: var(--ink-glow); font-size: 17px; text-shadow: 0 0 10px var(--ink-glow); }
.ink-value { font-family: var(--font-title); font-size: 27px; font-weight: 700; color: var(--ink-glow); }
.ink-label { font-size: 12.5px; color: var(--parch-dim); font-style: italic; }
.ink-block.ink-flash { animation: inkFlash .4s ease; }
@keyframes inkFlash { 30% { box-shadow: 0 0 22px rgba(94,200,194,.5); border-color: var(--ink-glow); } }

/* Способности */
.abilities { display: flex; gap: 8px; padding: 10px; }
.ability {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px;
  background: var(--bg-raise);
  border: 1px solid var(--line-soft); border-radius: 5px;
  color: var(--parchment);
  cursor: pointer; position: relative;
  transition: all .2s;
  font-family: var(--font-body);
}
.ability:hover:not(:disabled) { border-color: var(--ink-glow); box-shadow: 0 0 14px rgba(94,200,194,.25); }
.ability:disabled { opacity: .38; cursor: default; }
.ab-icon { font-size: 19px; color: var(--ink-glow); }
.ab-name { font-size: 11px; letter-spacing: .04em; }
.ab-cost { font-size: 11.5px; color: var(--ink-glow); }
.ab-cost::before { content: '◉ '; font-size: 9px; }
.ab-hint {
  position: absolute; top: 3px; right: 5px;
  font-size: 9.5px; color: var(--parch-dim);
  border: 1px solid var(--line-soft); border-radius: 3px;
  padding: 0 3px;
}

.piece-previews { display: flex; gap: 10px; padding: 10px; }
.preview-box { flex: 1; text-align: center; }
.preview-label { font-size: 10.5px; letter-spacing: .1em; color: var(--parch-dim); margin-bottom: 5px; }
.preview-box canvas { width: 100%; height: auto; }
.kbd-inline {
  font-size: 9px; border: 1px solid var(--line-soft); border-radius: 3px;
  padding: 0 3px; color: var(--parchment);
}

.controls-hint { font-size: 12px; color: var(--parch-dim); line-height: 2; }
.kbd {
  display: inline-block;
  border: 1px solid var(--line-soft); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 6px;
  font-size: 11px; color: var(--parchment);
  background: var(--bg-raise);
}

/* Доска */
.board-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: panelIn .5s ease both;
}
.board-frame {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  box-shadow:
    0 0 0 4px rgba(11,10,18,.8),
    0 0 60px rgba(94,200,194,.08),
    0 24px 70px rgba(0,0,0,.6);
  background: var(--void);
  line-height: 0;
}
.board-frame::before { /* угловые виньетки-скобы */
  content: '';
  position: absolute; inset: -7px;
  border: 1px solid rgba(232,179,75,.16);
  border-radius: 6px;
  pointer-events: none;
}
#board-canvas, #fx-canvas { display: block; border-radius: 3px; }
#fx-canvas { position: absolute; inset: 0; pointer-events: none; }

.board-announce {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  font-family: var(--font-title);
  font-size: 42px; font-weight: 600;
  color: var(--candle-hot);
  text-shadow: 0 0 30px rgba(232,179,75,.8), 0 2px 8px #000;
  opacity: 0;
  text-align: center;
  line-height: 1.2;
}
.board-announce.show { animation: announce 2s ease both; }
@keyframes announce {
  0% { opacity: 0; transform: scale(.85); }
  15% { opacity: 1; transform: scale(1.02); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}

.core-visual {
  margin-top: -2px;
  font-size: 22px; color: var(--danger);
  text-shadow: 0 0 18px rgba(216,84,79,.8);
  animation: corePulse 2.2s ease-in-out infinite;
}
@keyframes corePulse { 0%,100% { opacity:.75; } 50% { opacity:1; transform: scale(1.1); } }
.core-visual.core-hurt { animation: coreHurt .5s ease; }
@keyframes coreHurt { 0%,100% { transform: none; } 25% { transform: translateX(-5px) scale(1.25); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* Босс-бар */
.boss-bar { width: 100%; max-width: 420px; }
.boss-name {
  font-family: var(--font-display); font-size: 14px;
  letter-spacing: .25em; text-align: center;
  color: var(--shadow-c);
  text-shadow: 0 0 12px rgba(192,94,200,.6);
  margin-bottom: 4px;
}
.boss-track {
  height: 9px; background: var(--void);
  border: 1px solid var(--line-soft); border-radius: 4px; overflow: hidden;
}
.boss-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #6a2a70, var(--shadow-c), #e89ae8);
  box-shadow: 0 0 12px rgba(192,94,200,.7);
  transition: width .3s ease;
}

/* Правая панель */
.align-labels {
  display: flex; justify-content: space-between;
  font-family: var(--font-display); font-size: 11px; letter-spacing: .12em;
  margin-bottom: 7px;
}
.align-labels span:first-child { color: var(--order); }
.align-labels span:last-child { color: var(--shadow-c); }
.align-track {
  position: relative; height: 7px; border-radius: 4px;
  background: linear-gradient(90deg, rgba(127,184,232,.4), var(--void) 50%, rgba(192,94,200,.4));
  border: 1px solid var(--line-soft);
}
.align-marker {
  position: absolute; top: 50%; left: 50%;
  width: 13px; height: 13px;
  transform: translate(-50%,-50%) rotate(45deg);
  background: var(--parchment);
  box-shadow: 0 0 10px rgba(232,220,192,.7);
  transition: left .6s ease;
}

.relics-block { flex: 1; min-height: 120px; overflow: hidden; display: flex; flex-direction: column; }
.relics-label {
  font-family: var(--font-display); font-size: 11.5px;
  letter-spacing: .18em; color: var(--parch-dim); margin-bottom: 8px;
}
.relics-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; flex: 1; scrollbar-width: thin; }
.relics-empty { font-size: 12.5px; font-style: italic; color: var(--parch-dim); opacity: .6; }
.relic-item {
  font-size: 12.5px; line-height: 1.35;
  padding: 6px 9px;
  background: rgba(11,10,18,.55);
  border-left: 2px solid var(--candle);
  border-radius: 0 4px 4px 0;
  animation: relicIn .4s ease both;
}
@keyframes relicIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.relic-item.rare { border-left-color: var(--ink-glow); }
.relic-item.epic { border-left-color: var(--shadow-c); }
.relic-item.cursed { border-left-color: var(--danger); }
.relic-item b { display: block; font-family: var(--font-display); font-size: 12px; letter-spacing: .05em; }
.relic-item span { color: var(--parch-dim); }

.run-stats { font-size: 13px; }
.stat-row { display: flex; justify-content: space-between; padding: 2px 0; color: var(--parch-dim); }
.stat-row b { color: var(--parchment); }

/* ═══════════ ДИАЛОГИ ═══════════ */
.dialogue-box {
  width: min(860px, 94vw);
  display: flex; gap: 26px;
  padding: 34px 38px;
  background:
    radial-gradient(ellipse at top left, rgba(232,179,75,.05), transparent 55%),
    linear-gradient(180deg, #191627, #110f1c);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,.8), 0 0 50px rgba(94,200,194,.05);
  animation: dlgIn .45s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes dlgIn { from { opacity: 0; transform: translateY(30px) scale(.97); } to { opacity: 1; transform: none; } }

.dialogue-portrait {
  flex-shrink: 0;
  width: 130px; height: 130px;
  border-radius: 50%;
  border: 2px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.dialogue-portrait svg { width: 84px; height: 84px; }
.dialogue-portrait.p-yol   { border-color: rgba(232,179,75,.55); box-shadow: 0 0 34px rgba(232,179,75,.22); background: radial-gradient(circle, rgba(232,179,75,.12), transparent 70%); }
.dialogue-portrait.p-whisper { border-color: rgba(192,94,200,.55); box-shadow: 0 0 34px rgba(192,94,200,.25); background: radial-gradient(circle, rgba(192,94,200,.12), transparent 70%); animation: whisperShake 5s ease-in-out infinite; }
@keyframes whisperShake { 0%,92%,100% { transform: none; } 94% { transform: translateX(-2px); } 96% { transform: translateX(2px); } 98% { transform: translateX(-1px); } }
.dialogue-portrait.p-inka  { border-color: rgba(94,200,194,.55); box-shadow: 0 0 34px rgba(94,200,194,.25); background: radial-gradient(circle, rgba(94,200,194,.12), transparent 70%); }

.dialogue-content { flex: 1; display: flex; flex-direction: column; }
.dialogue-speaker {
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: .22em;
  margin-bottom: 12px;
}
.speaker-yol { color: var(--candle); }
.speaker-whisper { color: var(--shadow-c); }
.speaker-inka { color: var(--ink-glow); }

.dialogue-text {
  font-size: 18.5px; line-height: 1.62;
  min-height: 92px;
  font-style: italic;
  color: var(--parchment);
}
.dialogue-text .cursor { opacity: .7; animation: blink .8s step-start infinite; }
@keyframes blink { 50% { opacity: 0; } }

.dialogue-choices { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.choice-btn {
  text-align: left;
  font-family: var(--font-body); font-size: 15.5px;
  padding: 12px 18px;
  color: var(--parchment);
  background: rgba(28,25,48,.6);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--parch-dim);
  border-radius: 4px;
  cursor: pointer;
  transition: all .2s;
  animation: choiceIn .4s ease both;
}
.choice-btn:nth-child(2) { animation-delay: .08s; }
.choice-btn:nth-child(3) { animation-delay: .16s; }
@keyframes choiceIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.choice-btn:hover { background: rgba(43,39,69,.8); transform: translateX(4px); }
.choice-btn.c-order  { border-left-color: var(--order); }
.choice-btn.c-order:hover  { box-shadow: 0 0 18px rgba(127,184,232,.2); }
.choice-btn.c-shadow { border-left-color: var(--shadow-c); }
.choice-btn.c-shadow:hover { box-shadow: 0 0 18px rgba(192,94,200,.2); }
.choice-btn .choice-fx {
  display: block; font-size: 12.5px; font-style: italic;
  color: var(--parch-dim); margin-top: 3px;
}
.dialogue-next { align-self: flex-end; margin-top: 20px; }

/* ═══════════ КАРТЫ ═══════════ */
.cards-wrap { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.cards-title {
  font-family: var(--font-title); font-size: 34px; font-weight: 600;
  color: var(--candle-hot);
  text-shadow: 0 0 30px rgba(232,179,75,.4);
  animation: dlgIn .4s ease both;
}
.cards-row { display: flex; gap: 20px; }
.card {
  width: 212px; min-height: 268px;
  padding: 22px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
  background: linear-gradient(168deg, #1e1a31 0%, #141021 100%);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
  animation: cardIn .55s cubic-bezier(.2,.9,.3,1.15) both;
  position: relative;
  overflow: hidden;
}
.card:nth-child(2) { animation-delay: .1s; }
.card:nth-child(3) { animation-delay: .2s; }
.card:nth-child(4) { animation-delay: .3s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(40px) rotate(2deg); } to { opacity: 1; transform: none; } }
.card::before { /* блик */
  content: '';
  position: absolute; top: -60%; left: -60%;
  width: 60%; height: 220%;
  background: linear-gradient(78deg, transparent, rgba(255,255,255,.06), transparent);
  transform: rotate(18deg);
  transition: left .5s ease;
}
.card:hover::before { left: 130%; }
.card:hover {
  transform: translateY(-10px) scale(1.03);
  border-color: var(--candle);
  box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 34px rgba(232,179,75,.18);
}
.card.rare:hover { border-color: var(--ink-glow); box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 34px rgba(94,200,194,.22); }
.card.epic:hover { border-color: var(--shadow-c); box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 34px rgba(192,94,200,.25); }
.card-rarity {
  font-family: var(--font-display); font-size: 10px; letter-spacing: .3em;
  color: var(--parch-dim);
}
.card.rare .card-rarity { color: var(--ink-glow); }
.card.epic .card-rarity { color: var(--shadow-c); }
.card-icon { font-size: 38px; line-height: 1.4; color: var(--candle); text-shadow: 0 0 18px rgba(232,179,75,.5); }
.card.rare .card-icon { color: var(--ink-glow); text-shadow: 0 0 18px rgba(94,200,194,.5); }
.card.epic .card-icon { color: var(--shadow-c); text-shadow: 0 0 18px rgba(192,94,200,.5); }
.card-name { font-family: var(--font-display); font-size: 16.5px; letter-spacing: .04em; line-height: 1.25; }
.card-desc { font-size: 13.5px; line-height: 1.45; color: var(--parch-dim); flex: 1; }
.card-flavor { font-size: 11.5px; font-style: italic; color: var(--parch-dim); opacity: .65; }

/* ═══════════ МОДАЛКИ ═══════════ */
.modal {
  width: min(560px, 92vw);
  padding: 40px 44px;
  text-align: center;
  background: linear-gradient(180deg, #191627, #110f1c);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,.8);
  animation: dlgIn .4s ease both;
}
.modal h2 {
  font-family: var(--font-title); font-size: 33px; font-weight: 600;
  margin-bottom: 8px;
}
.modal-sub { font-style: italic; color: var(--parch-dim); margin-bottom: 22px; }
.modal-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 26px; }

.end-sigil { font-size: 44px; margin-bottom: 12px; }
.defeat-sigil { color: var(--danger); text-shadow: 0 0 30px rgba(216,84,79,.6); }
.victory-sigil { color: var(--candle); text-shadow: 0 0 30px rgba(232,179,75,.7); animation: sigilPulse 2.5s ease-in-out infinite; }
.modal-defeat h2 { color: var(--danger); }
.modal-victory h2 { color: var(--candle-hot); }
.end-text { font-style: italic; font-size: 16.5px; line-height: 1.6; color: var(--parchment); }
.end-rewards {
  margin-top: 20px; padding: 14px;
  background: rgba(11,10,18,.5); border-radius: 6px;
  font-size: 14.5px; line-height: 1.8; color: var(--parch-dim);
}
.end-rewards b { color: var(--ink-glow); }

.modal-howto { width: min(760px, 94vw); text-align: left; }
.modal-howto h2 { text-align: center; margin-bottom: 24px; }
.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.howto-item { display: flex; gap: 12px; align-items: flex-start; }
.howto-icon { font-size: 23px; color: var(--candle); flex-shrink: 0; width: 30px; text-align: center; }
.howto-item p { font-size: 13.5px; line-height: 1.5; color: var(--parch-dim); }
.howto-item b { color: var(--parchment); }

/* ─────────── Тост ─────────── */
.toast {
  position: fixed;
  left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  padding: 11px 26px;
  background: rgba(20,18,31,.95);
  border: 1px solid var(--candle);
  border-radius: 6px;
  font-size: 15px; font-style: italic;
  color: var(--candle-hot);
  box-shadow: 0 8px 30px rgba(0,0,0,.6), 0 0 24px rgba(232,179,75,.15);
  opacity: 0;
  pointer-events: none;
  z-index: 120;
  transition: all .3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─────────── Тряска экрана ─────────── */
.shake { animation: shakeAnim .4s ease; }
@keyframes shakeAnim {
  0%,100% { transform: none; }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-4px, 1px); }
  80% { transform: translate(3px, -1px); }
}

/* ─────────── Адаптив ─────────── */
@media (max-width: 1100px) {
  .panel { width: 190px; }
  .game-layout { gap: 14px; }
}
@media (max-height: 760px) {
  .controls-hint { display: none; }
}
