/* ================= DANCE OF DRAGONS — theblackdread.com =================
   Dark Valyrian aesthetic: obsidian surfaces, ember fire, old gold.       */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../assets/fonts/cinzel-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2212;
}

:root {
  --bg0: #0a0709;
  --bg1: #120c10;
  --bg2: #1b1218;
  --bg3: #241820;
  --line: rgba(214, 168, 92, 0.16);
  --line-hi: rgba(214, 168, 92, 0.42);
  --gold: #d0a75c;
  --gold-hi: #efd9a0;
  --ember: #ff6b2b;
  --ember-hi: #ffb347;
  --blood: #c24052;
  --frost: #8fc8e8;
  --green: #7fb08a;
  --text: #efe6d6;
  --muted: #a2917d;
  --dim: #6d5f52;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --r: 14px;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --body: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg0);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  background-image:
    radial-gradient(1200px 700px at 75% -10%, rgba(120, 40, 20, 0.14), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(180, 110, 40, 0.08), transparent 55%);
}
#fx-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 40;
}
#app { position: relative; z-index: 10; min-height: 100dvh; }

h1, h2, h3, .display { font-family: var(--display); letter-spacing: 0.04em; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
a { color: var(--gold-hi); }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ---------- screen scaffold ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; animation: screenIn 0.45s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 12, 16, 0.92), rgba(20, 12, 16, 0.75));
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--gold-hi); letter-spacing: 0.12em; text-transform: uppercase; }
.topbar .spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; color: var(--muted);
  background: rgba(0, 0, 0, 0.25); white-space: nowrap;
}
.pill b { color: var(--gold-hi); font-family: var(--display); }
.pill .flame-ico { color: var(--ember-hi); }
.iconbtn { padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; transition: 0.2s; }
.iconbtn:hover { color: var(--gold-hi); border-color: var(--line-hi); }
.backbtn { font-size: 13px; letter-spacing: 0.06em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: 12px; padding: 13px 26px; font-size: 14px;
  border: 1px solid var(--line-hi); color: var(--gold-hi);
  background: linear-gradient(180deg, rgba(214, 168, 92, 0.14), rgba(214, 168, 92, 0.05));
  transition: transform 0.15s ease, box-shadow 0.2s, background 0.2s;
  cursor: pointer;
}
.btn:hover { background: linear-gradient(180deg, rgba(214, 168, 92, 0.24), rgba(214, 168, 92, 0.08)); box-shadow: 0 6px 24px rgba(214, 140, 60, 0.18); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  border-color: rgba(255, 130, 60, 0.55); color: #fff;
  background: linear-gradient(180deg, #b8451f, #7e2a14);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.btn.primary:hover { background: linear-gradient(180deg, #d0522a, #92311a); box-shadow: 0 8px 30px rgba(255, 100, 40, 0.3); }
.btn.ghost { border-color: var(--line); color: var(--muted); background: transparent; }
.btn.ghost:hover { color: var(--text); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.small { padding: 8px 16px; font-size: 12px; }

/* ---------- title screen ---------- */
.title-screen {
  align-items: center; justify-content: center; text-align: center;
  position: relative; overflow: hidden;
}
.title-bg {
  position: absolute; inset: -40px; z-index: -1;
  background-size: cover; background-position: center 30%;
  filter: brightness(0.32) saturate(1.1) blur(2px);
  animation: slowZoom 30s ease-in-out infinite alternate;
}
@keyframes slowZoom { from { transform: scale(1); } to { transform: scale(1.08); } }
.title-screen::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 45%, transparent 30%, rgba(10, 7, 9, 0.9) 85%);
}
.title-kicker { font-family: var(--display); color: var(--gold); letter-spacing: 0.5em; font-size: clamp(11px, 2.4vw, 14px); text-transform: uppercase; opacity: 0; animation: fadeUp 1s 0.2s ease both; }
.title-main {
  font-size: clamp(40px, 9vw, 92px); font-weight: 900; line-height: 1.02;
  margin: 14px 0 6px;
  background: linear-gradient(180deg, #f7e8c4 15%, var(--gold) 55%, #8a5a28 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px rgba(214, 140, 60, 0.25);
  opacity: 0; animation: fadeUp 1s 0.45s ease both;
}
.title-sub { color: var(--muted); font-style: italic; font-size: clamp(14px, 2.6vw, 18px); opacity: 0; animation: fadeUp 1s 0.7s ease both; }
.title-rule { width: 220px; height: 1px; margin: 26px auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0; animation: fadeUp 1s 0.9s ease both; }
.title-cta { opacity: 0; animation: fadeUp 1s 1.1s ease both; }
.title-foot { position: absolute; bottom: 18px; width: 100%; text-align: center; color: var(--dim); font-size: 12px; opacity: 0; animation: fadeUp 1s 1.4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- menu ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; padding: 22px 0 40px; }
.menu-card {
  position: relative; text-align: left; border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(160deg, var(--bg2), var(--bg1));
  padding: 20px; min-height: 130px; overflow: hidden;
  transition: transform 0.18s ease, border-color 0.2s, box-shadow 0.25s;
  cursor: pointer; display: block; width: 100%;
}
.menu-card:hover { transform: translateY(-3px); border-color: var(--line-hi); box-shadow: var(--shadow); }
.menu-card h3 { color: var(--gold-hi); font-size: 17px; margin-bottom: 6px; }
.menu-card p { color: var(--muted); font-size: 13.5px; }
.menu-card .tagnum { position: absolute; right: 14px; top: 10px; font-family: var(--display); font-size: 40px; color: rgba(214, 168, 92, 0.12); font-weight: 900; }
.menu-card.daily-done { border-color: rgba(127, 176, 138, 0.35); }
.menu-hero { padding: 34px 0 8px; text-align: center; }
.menu-hero h1 { font-size: clamp(26px, 5vw, 40px); background: linear-gradient(180deg, #f7e8c4, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.menu-hero p { color: var(--muted); font-style: italic; margin-top: 4px; font-size: 14px; }

/* era cards */
.era-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 10px 0 6px; }
.era-card { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; background: linear-gradient(160deg, var(--bg2), var(--bg1)); text-align: left; cursor: pointer; transition: 0.2s; position: relative; overflow: hidden; }
.era-card:hover:not(.locked) { border-color: var(--line-hi); transform: translateY(-2px); }
.era-card .num { font-family: var(--display); font-size: 30px; color: var(--gold); opacity: 0.6; }
.era-card h4 { font-size: 16px; color: var(--gold-hi); margin: 4px 0; }
.era-card p { color: var(--muted); font-size: 12.5px; }
.era-card.locked { opacity: 0.45; cursor: not-allowed; }
.era-card.cleared::after { content: '✦ CLEARED'; position: absolute; top: 10px; right: 12px; color: var(--green); font-size: 11px; letter-spacing: 0.15em; font-family: var(--display); }
.era-card.apex { border-color: rgba(194, 64, 82, 0.5); }
.era-card.apex .num, .era-card.apex h4 { color: var(--blood); }

/* ---------- dragon cards / roster ---------- */
.section-title { font-size: 20px; color: var(--gold-hi); margin: 22px 0 4px; }
.section-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; font-size: 12.5px; color: var(--muted); cursor: pointer; transition: 0.15s; background: transparent; }
.chip.on { color: var(--bg0); background: var(--gold); border-color: var(--gold); font-weight: bold; }
.chip:hover:not(.on) { color: var(--gold-hi); border-color: var(--line-hi); }

.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding-bottom: 50px; }
.dcard {
  position: relative; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: var(--bg2); cursor: pointer; text-align: left;
  transition: transform 0.16s ease, border-color 0.2s, box-shadow 0.25s;
  aspect-ratio: 3 / 4.1; display: flex; flex-direction: column; width: 100%;
}
.dcard:hover { transform: translateY(-4px) scale(1.015); border-color: var(--line-hi); box-shadow: var(--shadow); z-index: 2; }
.dcard .art { flex: 1; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 35%, #241a20, #0d090c); }
.dcard .art img, .dcard .art svg { width: 100%; height: 100%; object-fit: cover; }
.dcard .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(10, 7, 9, 0.95)); }
.dcard .meta { position: relative; padding: 8px 10px 10px; margin-top: -34px; z-index: 2; }
.dcard .nm { font-family: var(--display); font-weight: 700; font-size: 13.5px; color: var(--gold-hi); line-height: 1.15; text-shadow: 0 2px 6px #000; }
.dcard .sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; letter-spacing: 0.04em; }
.dcard .tiertag { position: absolute; top: 8px; left: 8px; z-index: 3; font-size: 9.5px; letter-spacing: 0.12em; font-family: var(--display); font-weight: 700; color: var(--gold-hi); background: rgba(10, 7, 9, 0.7); border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
.dcard .divinetag { position: absolute; top: 8px; right: 8px; z-index: 3; color: var(--frost); font-size: 12px; }
.dcard.locked .art { filter: grayscale(0.9) brightness(0.4); }
.dcard.locked .nm { color: var(--muted); }
.dcard .lock {
  position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgba(8, 5, 8, 0.45); color: var(--gold); font-family: var(--display); font-size: 12px; letter-spacing: 0.08em;
}
.dcard .lock .cost { border: 1px solid var(--line-hi); padding: 4px 12px; border-radius: 999px; background: rgba(10, 7, 9, 0.8); font-weight: 700; }
.dcard.selected { border-color: var(--ember); box-shadow: 0 0 0 2px rgba(255, 107, 43, 0.4), var(--shadow); }

/* stat bars */
.statbars { display: grid; gap: 5px; margin: 10px 0; }
.statrow { display: grid; grid-template-columns: 76px 1fr 30px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.statrow .bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.statrow .bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #8a5a28, var(--gold)); }
.statrow.hp .bar i { background: linear-gradient(90deg, #5f8a68, var(--green)); }
.statrow.fire .bar i { background: linear-gradient(90deg, #a33d16, var(--ember)); }
.statrow.fero .bar i { background: linear-gradient(90deg, #8a2f3c, var(--blood)); }
.statrow.agi .bar i { background: linear-gradient(90deg, #4a7a96, var(--frost)); }
.statrow b { color: var(--text); text-align: right; font-size: 12px; }

/* ---------- detail modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 3, 5, 0.78); backdrop-filter: blur(5px); padding: 16px;
  animation: fadeIn 0.25s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto;
  border: 1px solid var(--line-hi); border-radius: 18px;
  background: linear-gradient(170deg, var(--bg3), var(--bg1));
  box-shadow: var(--shadow); animation: modalIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.94) translateY(12px); } to { opacity: 1; transform: none; } }
.modal .mhead { position: relative; height: 210px; overflow: hidden; border-radius: 17px 17px 0 0; }
.modal .mhead img, .modal .mhead svg { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.modal .mhead::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(20, 12, 16, 0.98)); }
.modal .mhead .mtitle { position: absolute; bottom: 12px; left: 18px; right: 18px; z-index: 2; }
.modal .mhead .mtitle h2 { font-size: clamp(20px, 4vw, 28px); color: var(--gold-hi); text-shadow: 0 2px 8px #000; }
.modal .mbody { padding: 16px 18px 20px; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.tag { font-size: 11px; letter-spacing: 0.06em; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 3px 9px; text-transform: uppercase; font-family: var(--display); }
.tag.canon { color: var(--green); border-color: rgba(127, 176, 138, 0.4); }
.tag.fanfill { color: var(--frost); border-color: rgba(143, 200, 232, 0.35); }
.tag.divine { color: var(--frost); }
.lore-p { color: #cfc2ae; font-size: 14px; margin: 10px 0; }
.trait-box { border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; padding: 9px 12px; margin: 8px 0; background: rgba(214, 168, 92, 0.04); }
.trait-box b { color: var(--gold-hi); font-family: var(--display); font-size: 13px; }
.trait-box p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.trait-box.sig { border-left-color: var(--ember); background: rgba(255, 107, 43, 0.05); }
.trait-box.sig b { color: var(--ember-hi); }
.mfoot { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.mclose { position: absolute; top: 10px; right: 12px; z-index: 5; width: 34px; height: 34px; border-radius: 50%; background: rgba(10, 7, 9, 0.7); border: 1px solid var(--line); color: var(--muted); font-size: 16px; }
.mclose:hover { color: var(--text); border-color: var(--line-hi); }

/* ---------- run path ---------- */
.runbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0; }
.runbar .hpbox { flex: 1; min-width: 200px; }
.hpbar { height: 14px; border-radius: 7px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); overflow: hidden; position: relative; }
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #7e2a14, var(--ember)); transition: width 0.5s cubic-bezier(0.2, 0.8, 0.3, 1); }
.hpbar.green i { background: linear-gradient(90deg, #3f6b4a, var(--green)); }
.hpbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10.5px; letter-spacing: 0.08em; color: #fff; text-shadow: 0 1px 2px #000; font-family: var(--display); }
.boonstrip { display: flex; gap: 6px; flex-wrap: wrap; }
.boonchip { font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; color: var(--gold); background: rgba(214, 168, 92, 0.06); cursor: help; }
.depth-track { display: flex; align-items: center; gap: 4px; margin: 6px 0 18px; flex-wrap: wrap; }
.depth-dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line-hi); background: transparent; transition: 0.3s; }
.depth-dot.done { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px rgba(214, 168, 92, 0.5); }
.depth-dot.now { background: var(--ember); border-color: var(--ember-hi); box-shadow: 0 0 12px rgba(255, 107, 43, 0.7); transform: scale(1.25); }
.depth-dot.boss { width: 15px; height: 15px; border-radius: 3px; transform: rotate(45deg); }
.depth-line { flex: 0 0 14px; height: 1px; background: var(--line-hi); }

.node-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding-bottom: 40px; }
.node-card {
  border: 1px solid var(--line); border-radius: var(--r); padding: 22px 18px; text-align: center;
  background: linear-gradient(165deg, var(--bg2), var(--bg1)); cursor: pointer;
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.25s; width: 100%;
}
.node-card:hover { transform: translateY(-4px); border-color: var(--line-hi); box-shadow: var(--shadow); }
.node-card .nico { font-size: 34px; margin-bottom: 8px; display: block; filter: drop-shadow(0 2px 8px rgba(255, 107, 43, 0.3)); }
.node-card h4 { font-size: 15px; color: var(--gold-hi); letter-spacing: 0.06em; }
.node-card p { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.node-card.setpiece, .node-card.boss { border-color: rgba(194, 64, 82, 0.45); background: linear-gradient(165deg, #241318, var(--bg1)); }
.node-card.setpiece h4, .node-card.boss h4 { color: var(--blood); }

/* ---------- battle ---------- */
.battle-screen { min-height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.env-banner { text-align: center; padding: 7px 14px; font-size: 12px; color: var(--frost); background: rgba(143, 200, 232, 0.06); border-bottom: 1px solid rgba(143, 200, 232, 0.15); }
.arena {
  position: relative; flex: 1; min-height: 320px; overflow: hidden;
  background:
    linear-gradient(180deg, #171019 0%, #241722 34%, #322029 67%, #1c1014 100%);
}
.arena::before { /* altitude band lines */
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent calc(33% - 1px), rgba(214, 168, 92, 0.09) 33%, transparent calc(33% + 1px)),
    linear-gradient(180deg, transparent calc(66% - 1px), rgba(214, 168, 92, 0.09) 66%, transparent calc(66% + 1px));
}
.alt-label { position: absolute; left: 10px; font-size: 9.5px; letter-spacing: 0.25em; color: rgba(214, 168, 92, 0.3); font-family: var(--display); }
.alt-label.high { top: 8px; } .alt-label.mid { top: calc(33% + 8px); } .alt-label.low { top: calc(66% + 8px); }
.combatant {
  position: absolute; width: var(--msize, 120px); height: var(--msize, 120px);
  transition: top 0.7s cubic-bezier(0.3, 0.9, 0.3, 1), transform 0.35s ease;
  z-index: 5;
}
.combatant .medallion {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden; position: relative;
  border: 2px solid var(--line-hi);
  box-shadow: 0 0 0 3px rgba(10, 7, 9, 0.8), 0 0 28px rgba(214, 140, 60, 0.22), 0 12px 30px rgba(0, 0, 0, 0.6);
  background: #16101a;
}
.combatant.enemy .medallion { border-color: rgba(194, 64, 82, 0.55); box-shadow: 0 0 0 3px rgba(10, 7, 9, 0.8), 0 0 28px rgba(194, 64, 82, 0.25), 0 12px 30px rgba(0, 0, 0, 0.6); }
.combatant .medallion img, .combatant .medallion svg { width: 100%; height: 100%; object-fit: cover; }
.combatant .nameplate {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  font-family: var(--display); font-size: 11px; letter-spacing: 0.08em; color: var(--gold-hi);
  white-space: nowrap; text-shadow: 0 2px 6px #000;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis;
}
.combatant.hover-anim { animation: hover 3.4s ease-in-out infinite; }
.combatant.enemy.hover-anim { animation-delay: -1.7s; }
@keyframes hover { 0%, 100% { margin-top: 0; } 50% { margin-top: -9px; } }
.combatant.lunge-r { transform: translateX(46px) rotate(4deg) scale(1.06); }
.combatant.lunge-l { transform: translateX(-46px) rotate(-4deg) scale(1.06); }
.combatant.recoil { animation: recoil 0.4s ease; }
@keyframes recoil { 0% { filter: brightness(2.2); transform: translateX(0); } 30% { transform: translateX(-14px) rotate(-3deg); } 100% { transform: none; } }
.combatant.enemy.recoil { animation: recoilR 0.4s ease; }
@keyframes recoilR { 0% { filter: brightness(2.2); } 30% { transform: translateX(14px) rotate(3deg); } 100% { transform: none; } }
.combatant.dead { transition: all 1.4s ease; transform: translateY(60vh) rotate(24deg) !important; opacity: 0; }
.combatant.evading .medallion { box-shadow: 0 0 0 3px rgba(10, 7, 9, 0.8), 0 0 30px rgba(143, 200, 232, 0.5); }
.combatant.ghosted { opacity: 0.35; filter: blur(1px); }

.float-num {
  position: absolute; z-index: 20; font-family: var(--display); font-weight: 900;
  font-size: 24px; color: #ffd9a0; text-shadow: 0 0 12px rgba(255, 107, 43, 0.8), 0 2px 4px #000;
  pointer-events: none; animation: floatUp 1.1s ease-out forwards;
}
.float-num.crit { font-size: 34px; color: #ff8451; }
.float-num.heal { color: #a9e6b4; text-shadow: 0 0 12px rgba(127, 176, 138, 0.7), 0 2px 4px #000; }
.float-num.status { font-size: 14px; letter-spacing: 0.1em; color: var(--frost); }
.float-num.missy { font-size: 18px; color: #b9c6cf; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(6px) scale(0.7); } 15% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-56px) scale(1); } }

.sig-flash {
  position: absolute; inset: 0; z-index: 15; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(255, 107, 43, 0.16), rgba(10, 7, 9, 0.75));
  animation: sigIn 1.5s ease forwards;
}
.sig-flash span {
  font-family: var(--display); font-weight: 900; font-size: clamp(22px, 5.5vw, 46px);
  letter-spacing: 0.12em; text-transform: uppercase; text-align: center; padding: 0 20px;
  background: linear-gradient(180deg, #fff3d6, var(--ember-hi) 60%, var(--ember));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 107, 43, 0.6));
}
@keyframes sigIn { 0% { opacity: 0; transform: scale(1.25); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* battle HUD plates */
.plate { padding: 10px 14px; display: flex; align-items: center; gap: 12px; }
.plate .pinfo { flex: 1; min-width: 0; }
.plate .pname { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--gold-hi); display: flex; gap: 8px; align-items: baseline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .pname .alt { font-size: 10px; color: var(--frost); letter-spacing: 0.15em; }
.plate .pname .boss-tag { color: var(--blood); font-size: 10px; letter-spacing: 0.2em; }
.plate .hpbar { margin-top: 5px; height: 12px; }
.plate .subbars { display: flex; gap: 10px; margin-top: 5px; align-items: center; }
.stabar { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.stabar i { display: block; height: 100%; background: linear-gradient(90deg, #3f6b4a, #9fd0aa); transition: width 0.4s; }
.furybar { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.furybar i { display: block; height: 100%; background: linear-gradient(90deg, #7e2a14, var(--ember-hi)); transition: width 0.4s; }
.furybar.full { box-shadow: 0 0 10px rgba(255, 107, 43, 0.7); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }
.sub-lab { font-size: 9px; letter-spacing: 0.14em; color: var(--dim); font-family: var(--display); }
.fx-icons { display: flex; gap: 4px; margin-left: 6px; }
.fx-ico { font-size: 12px; line-height: 1; padding: 3px 5px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); cursor: help; }

.enemy-plate { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(36, 19, 24, 0.9), rgba(20, 12, 16, 0.6)); }
.player-dock { border-top: 1px solid var(--line); background: linear-gradient(0deg, rgba(20, 12, 16, 0.97), rgba(20, 12, 16, 0.85)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }

.battle-log { min-height: 40px; max-height: 58px; overflow: hidden; padding: 4px 16px; font-size: 12.5px; color: var(--muted); font-style: italic; display: flex; flex-direction: column; justify-content: flex-end; }
.battle-log div { animation: logIn 0.3s ease both; }
@keyframes logIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.battle-log .hl { color: var(--ember-hi); }

.actionbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 14px 12px; }
.act-btn {
  position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 9px 4px 7px;
  background: linear-gradient(180deg, rgba(214, 168, 92, 0.07), rgba(20, 12, 16, 0.4));
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: 0.15s; min-height: 62px;
}
.act-btn:hover:not(:disabled) { border-color: var(--line-hi); background: linear-gradient(180deg, rgba(214, 168, 92, 0.16), rgba(20, 12, 16, 0.4)); transform: translateY(-2px); }
.act-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.act-btn .aico { width: 24px; height: 24px; }
.act-btn .alab { font-family: var(--display); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--text); text-align: center; line-height: 1.1; }
.act-btn .acost { display: flex; gap: 2px; }
.act-btn .acost i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.act-btn.sig-btn { border-color: rgba(255, 107, 43, 0.4); }
.act-btn.sig-btn.ready { border-color: var(--ember); background: linear-gradient(180deg, rgba(255, 107, 43, 0.22), rgba(126, 42, 20, 0.25)); box-shadow: 0 0 18px rgba(255, 107, 43, 0.35); animation: pulse 1.3s ease-in-out infinite; }
.act-btn.sig-btn .alab { color: var(--ember-hi); }

.turnflag { text-align: center; font-family: var(--display); font-size: 10.5px; letter-spacing: 0.3em; color: var(--dim); padding: 3px 0 0; text-transform: uppercase; }
.turnflag.yours { color: var(--gold); }

/* shake */
.shake-s { animation: shk 0.25s linear; } .shake-m { animation: shk 0.4s linear; } .shake-l { animation: shkL 0.55s linear; }
@keyframes shk { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-4px, 2px); } 50% { transform: translate(4px, -2px); } 75% { transform: translate(-3px, -2px); } }
@keyframes shkL { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-9px, 4px); } 40% { transform: translate(8px, -5px); } 60% { transform: translate(-7px, -3px); } 80% { transform: translate(6px, 4px); } }

/* ---------- boon / event / result overlays ---------- */
.pick-grid { display: grid; gap: 10px; margin-top: 14px; }
.pick-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-align: left; background: rgba(214, 168, 92, 0.04); cursor: pointer; transition: 0.15s; width: 100%; }
.pick-card:hover { border-color: var(--line-hi); background: rgba(214, 168, 92, 0.1); transform: translateY(-2px); }
.pick-card b { font-family: var(--display); color: var(--gold-hi); font-size: 14px; }
.pick-card .rar { float: right; font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; font-family: var(--display); }
.rar.common { color: var(--muted); } .rar.rare { color: var(--frost); } .rar.epic { color: var(--ember-hi); }
.pick-card p { color: var(--muted); font-size: 13px; margin-top: 3px; }

.result-hero { text-align: center; padding: 28px 18px 10px; }
.result-hero h2 { font-size: clamp(26px, 6vw, 42px); }
.result-hero.win h2 { background: linear-gradient(180deg, #f7e8c4, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-hero.loss h2 { color: var(--blood); }
.result-hero p { color: var(--muted); font-style: italic; margin-top: 6px; }
.reward-row { display: flex; justify-content: center; gap: 14px; margin: 16px 0; flex-wrap: wrap; }
.reward-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 20px; text-align: center; }
.reward-box .rv { font-family: var(--display); font-size: 22px; color: var(--gold-hi); font-weight: 700; }
.reward-box .rl { font-size: 10.5px; color: var(--dim); letter-spacing: 0.15em; text-transform: uppercase; }

/* codex */
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding-bottom: 50px; }
.lore-link { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-hi); font-size: 13.5px; text-decoration: none; border: 1px solid var(--line-hi); padding: 8px 14px; border-radius: 10px; transition: 0.2s; font-family: var(--display); letter-spacing: 0.05em; }
.lore-link:hover { background: rgba(214, 168, 92, 0.12); }
.codex-count { color: var(--muted); font-size: 13px; }

/* unlock toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px);
  z-index: 60; border: 1px solid var(--line-hi); background: linear-gradient(180deg, var(--bg3), var(--bg1));
  border-radius: 12px; padding: 12px 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px; opacity: 0;
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.3s; max-width: 92vw;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast b { color: var(--gold-hi); font-family: var(--display); font-size: 13px; }
.toast span { color: var(--muted); font-size: 12.5px; }

/* how to play */
.help-list { margin: 10px 0; }
.help-list li { margin: 8px 0 8px 18px; color: #cfc2ae; font-size: 14px; }
.help-list b { color: var(--gold-hi); }

/* daily banner */
.daily-hero { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 14px 0; background: linear-gradient(160deg, #1c1520, var(--bg1)); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.daily-hero .dportrait { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; border: 2px solid var(--line-hi); flex: 0 0 84px; }
.daily-hero .dportrait img, .daily-hero .dportrait svg { width: 100%; height: 100%; object-fit: cover; }
.streak-flame { font-family: var(--display); color: var(--ember-hi); font-size: 15px; }

@media (max-width: 640px) {
  .actionbar { grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px 8px 10px; }
  .act-btn { min-height: 56px; padding: 7px 2px 6px; }
  .act-btn .alab { font-size: 9px; }
  .arena { min-height: 260px; }
  .combatant { --msize: 88px; }
  .plate { padding: 8px 10px; }
  .modal .mhead { height: 160px; }
  .roster-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 9px; }
  .battle-log { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
