:root {
  --bg-1: #05070c;
  --bg-2: #0b0f17;
  --panel: rgba(12, 10, 14, 0.82);
  --panel-border: rgba(178, 144, 88, 0.16);
  --text: #e8dfd2;
  --muted: #9d9488;
  --accent: #c08a4a;
  --accent-2: #6a7b47;
  --danger: #b84b4b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --mobile-bottom-stack: 0px;
}

/* =========================================================
   Shared primary navigation — the War Council.
   One graphical, responsive menu shared by every page.
   ========================================================= */
.site-nav-shell{
  position:relative;
  z-index:80;
  width:min(1180px, calc(100% - 28px));
  margin:14px auto 0;
}
.site-nav{
  position:relative;
  isolation:isolate;
  display:flex;
  align-items:stretch;
  gap:14px;
  padding:10px;
  border:1px solid rgba(226,184,114,.3);
  border-radius:18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 35%),
    radial-gradient(circle at 12% 0%, rgba(192,138,74,.16), transparent 34%),
    linear-gradient(135deg, rgba(17,13,12,.97), rgba(5,7,11,.98));
  box-shadow:
    0 18px 46px rgba(0,0,0,.46),
    inset 0 1px 0 rgba(255,255,255,.06),
    inset 0 -1px 0 rgba(0,0,0,.8);
}
.site-nav::before,
.site-nav::after{
  content:"";
  position:absolute;
  z-index:-1;
  top:50%;
  width:7px;
  height:42%;
  min-height:28px;
  border:1px solid rgba(226,184,114,.34);
  background:linear-gradient(180deg, #5b4329, #17120f 48%, #6d4d2b);
  box-shadow:0 0 12px rgba(0,0,0,.75), inset 0 0 2px rgba(255,255,255,.25);
  transform:translateY(-50%);
}
.site-nav::before{ left:-5px; border-radius:7px 2px 2px 7px; }
.site-nav::after{ right:-5px; border-radius:2px 7px 7px 2px; }
.site-nav-brand{
  position:relative;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:184px;
  padding:7px 14px 7px 8px;
  border-right:1px solid rgba(226,184,114,.2);
  color:#f2e8d8;
  text-decoration:none;
}
.site-nav-brand::after{
  content:"";
  position:absolute;
  right:-1px;
  top:12%;
  width:1px;
  height:76%;
  background:linear-gradient(transparent, rgba(226,184,114,.55), transparent);
}
.site-nav-sigil{
  position:relative;
  display:grid;
  place-items:center;
  flex:0 0 45px;
  width:45px;
  height:49px;
  clip-path:polygon(50% 0, 90% 15%, 84% 73%, 50% 100%, 16% 73%, 10% 15%);
  background:linear-gradient(145deg, #f3d79f 0%, #b77b31 45%, #563114 100%);
  filter:drop-shadow(0 5px 8px rgba(0,0,0,.62));
}
.site-nav-sigil::before{
  content:"";
  position:absolute;
  inset:3px;
  clip-path:inherit;
  background:
    radial-gradient(circle at 50% 25%, rgba(255,220,142,.24), transparent 36%),
    linear-gradient(160deg, #211712, #08090d 72%);
}
.site-nav-sigil span{
  position:relative;
  z-index:1;
  color:#e8bb6e;
  font-size:22px;
  line-height:1;
  text-shadow:0 0 10px rgba(226,166,75,.48);
}
.site-nav-brand-copy,
.site-nav-copy{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.site-nav-brand-copy strong{
  font-family:Cinzel, Georgia, serif;
  font-size:14px;
  letter-spacing:.055em;
  white-space:nowrap;
}
.site-nav-brand-copy small{
  margin-top:3px;
  color:#9e8d78;
  font-size:9px;
  font-weight:700;
  letter-spacing:.2em;
  text-transform:uppercase;
}
.site-nav-links{
  display:grid;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:7px;
  flex:1;
  min-width:0;
}
.site-nav-link{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-width:0;
  padding:10px 9px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.075);
  border-radius:11px;
  color:#c9beae;
  text-decoration:none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 42%),
    linear-gradient(145deg, rgba(38,30,25,.82), rgba(9,10,14,.9));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035);
  transition:transform .16s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.site-nav-link::before{
  content:"";
  position:absolute;
  inset:auto 13% 0;
  height:2px;
  border-radius:999px;
  background:linear-gradient(90deg, transparent, #d5a557, transparent);
  opacity:0;
  transform:scaleX(.4);
  transition:opacity .18s ease, transform .18s ease;
}
.site-nav-link:hover{
  z-index:1;
  color:#fff1da;
  border-color:rgba(226,184,114,.42);
  background:
    linear-gradient(180deg, rgba(226,184,114,.105), transparent 46%),
    linear-gradient(145deg, rgba(48,35,25,.92), rgba(10,10,14,.96));
  box-shadow:0 8px 22px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.07);
  transform:translateY(-2px);
}
.site-nav-link:hover::before,
.site-nav-link.is-current::before{
  opacity:1;
  transform:scaleX(1);
}
.site-nav-link.is-current{
  color:#fff2dc;
  border-color:rgba(226,184,114,.58);
  background:
    radial-gradient(circle at 50% 0%, rgba(229,170,78,.22), transparent 62%),
    linear-gradient(145deg, rgba(62,41,24,.94), rgba(12,11,14,.96));
  box-shadow:
    0 0 22px rgba(192,138,74,.13),
    inset 0 1px 0 rgba(255,228,178,.1);
}
.site-nav-link:focus-visible,
.site-nav-brand:focus-visible{
  outline:2px solid #e6bb7a;
  outline-offset:3px;
}
.site-nav-icon{
  display:grid;
  place-items:center;
  flex:0 0 31px;
  width:31px;
  height:31px;
  border:1px solid rgba(226,184,114,.24);
  border-radius:50%;
  color:#e2b76e;
  font-size:15px;
  line-height:1;
  background:radial-gradient(circle at 38% 28%, rgba(226,184,114,.17), rgba(8,9,12,.88) 68%);
  box-shadow:inset 0 0 0 2px rgba(0,0,0,.3), 0 3px 8px rgba(0,0,0,.3);
  text-shadow:0 0 8px rgba(226,174,87,.42);
}
.site-nav-copy strong{
  overflow:hidden;
  font-family:Cinzel, Georgia, serif;
  font-size:11px;
  font-weight:700;
  letter-spacing:.035em;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.site-nav-copy small{
  overflow:hidden;
  margin-top:3px;
  color:#82796f;
  font-size:8px;
  font-weight:700;
  letter-spacing:.09em;
  text-overflow:ellipsis;
  text-transform:uppercase;
  white-space:nowrap;
}
.site-nav-link.is-current .site-nav-copy small,
.site-nav-link:hover .site-nav-copy small{ color:#bba98f; }

@media (max-width:980px){
  .site-nav{ gap:9px; }
  .site-nav-brand{ min-width:auto; padding-right:10px; }
  .site-nav-brand-copy{ display:none; }
  .site-nav-link{ gap:6px; padding-inline:7px; }
  .site-nav-icon{ flex-basis:29px; width:29px; height:29px; }
  .site-nav-copy strong{ font-size:10px; }
}
@media (max-width:720px){
  .site-nav-shell{
    width:min(100% - 18px, 620px);
    margin-top:9px;
  }
  .site-nav{
    display:block;
    padding:8px;
    border-radius:15px;
  }
  .site-nav-brand{
    justify-content:center;
    min-height:38px;
    margin:0 2px 8px;
    padding:2px 8px 7px;
    border-right:0;
    border-bottom:1px solid rgba(226,184,114,.16);
  }
  .site-nav-brand::after{
    top:auto;
    right:18%;
    bottom:-1px;
    width:64%;
    height:1px;
    background:linear-gradient(90deg, transparent, rgba(226,184,114,.5), transparent);
  }
  .site-nav-brand-copy{ display:flex; }
  .site-nav-sigil{ flex-basis:34px; width:34px; height:37px; }
  .site-nav-sigil span{ font-size:17px; }
  .site-nav-links{
    grid-template-columns:repeat(5, minmax(0, 1fr));
    gap:5px;
  }
  .site-nav-link{
    flex-direction:column;
    gap:5px;
    min-height:68px;
    padding:7px 4px 6px;
    text-align:center;
  }
  .site-nav-copy strong{ font-size:9px; }
  .site-nav-copy small{ display:none; }
}
@media (max-width:430px){
  .site-nav-shell{ width:calc(100% - 12px); }
  .site-nav{ padding:6px; }
  .site-nav-brand{ margin-bottom:6px; }
  .site-nav-link{ min-height:62px; }
  .site-nav-icon{ flex-basis:27px; width:27px; height:27px; font-size:13px; }
  .site-nav-copy strong{ font-size:8px; letter-spacing:0; }
}
@media (prefers-reduced-motion:reduce){
  .site-nav-link,
  .site-nav-link::before{ transition:none; }
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(120, 60, 28, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(89, 107, 62, 0.12), transparent 18%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
body { position: relative; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 20%, rgba(192,138,74,0.08), transparent 24%),
    radial-gradient(circle at 15% 75%, rgba(84,36,24,0.12), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(74,90,52,0.10), transparent 20%);
  mix-blend-mode: screen;
  opacity: .9;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 48%, rgba(0,0,0,0.34) 100%);
  z-index: 0;
}

.page-shell {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 90%);
}
.global-account-bar{
  position:sticky;
  top:0;
  z-index:30;
  padding:calc(10px + var(--safe-top)) calc(24px + var(--safe-right)) 10px calc(24px + var(--safe-left));
  backdrop-filter:blur(16px);
  background:linear-gradient(180deg, rgba(5,7,12,.92), rgba(5,7,12,.72));
  border-bottom:1px solid rgba(178, 144, 88, 0.14);
}
.global-account-bar-inner{
  max-width:1540px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.global-account-brand{
  display:inline-flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.global-account-brand a{
  color:var(--text);
  text-decoration:none;
  font-family:Cinzel, serif;
  font-size:22px;
  font-weight:700;
  letter-spacing:.04em;
}
.global-account-status{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  flex-wrap:wrap;
}
.dd-crest{
  --crest-hue: 32;
  --crest-hue-alt: 68;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border-radius:14px 14px 12px 12px;
  clip-path:polygon(50% 0%, 88% 14%, 88% 68%, 50% 100%, 12% 68%, 12% 14%);
  background:
    radial-gradient(circle at 30% 28%, hsla(var(--crest-hue), 90%, 86%, .88), transparent 34%),
    linear-gradient(160deg, hsla(var(--crest-hue), 74%, 58%, .96), hsla(var(--crest-hue-alt), 70%, 30%, .98));
  border:1px solid hsla(var(--crest-hue), 60%, 78%, .34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.18),
    0 10px 24px rgba(0,0,0,.24);
  color:#fff9ee;
  font-size:13px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  flex:0 0 auto;
  overflow:hidden;
}
.dd-crest span{
  transform:translateY(-1px);
}
.dd-crest-image-wrap{
  clip-path:none;
  border-radius:16px;
  padding:0;
  background:rgba(8,17,31,.22);
  border-color:rgba(255,255,255,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px rgba(0,0,0,.22);
}
.dd-crest-image{
  width:100%;
  height:100%;
  display:block;
  object-fit:contain;
}
.dd-crest-sm{
  width:34px;
  height:34px;
  font-size:11px;
  border-radius:12px 12px 10px 10px;
}
.dd-crest-lg{
  width:84px;
  height:84px;
  font-size:24px;
  border-radius:24px 24px 18px 18px;
}
.global-account-pill{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid rgba(192,138,74,.16);
  background:rgba(12, 10, 14, 0.78);
  color:#f3e8d4;
  text-decoration:none;
  font-weight:700;
  min-width:0;
}
.global-account-pill strong{
  display:block;
  max-width:240px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.global-account-kicker{
  color:#c09b68;
  text-transform:uppercase;
  letter-spacing:.16em;
  font-size:11px;
}
.global-account-links{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.global-account-links .btn{
  min-height:42px;
}
.global-account-logout{
  cursor:pointer;
}
.app { max-width: 1540px; margin: 0 auto; padding: 24px; position: relative; z-index: 1; }
.glass { background: var(--panel); border: 1px solid var(--panel-border); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.side-card, .game-panel, .overlay-card, .notification-panel { position: relative; }
.side-card::before, .game-panel::before, .overlay-card::before, .notification-panel::before { content: ""; position:absolute; inset:0; pointer-events:none; border-radius:inherit; background:linear-gradient(180deg, rgba(255,255,255,0.03), transparent 28%); }

.hero {
  border-radius: 28px; padding: 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px;
  background: linear-gradient(135deg, rgba(129,78,40,0.18), rgba(255,255,255,0.02)), rgba(12,10,14,0.78);
}
.hero-home-banner{
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    /* Left-to-right scrim: keeps the copy legible, lets the
       fortress read clearly on the right half. */
    linear-gradient(90deg,
      rgba(6,7,10,0.97) 0%,
      rgba(6,7,10,0.94) 26%,
      rgba(6,7,10,0.84) 44%,
      rgba(6,7,10,0.58) 60%,
      rgba(6,7,10,0.30) 76%,
      rgba(6,7,10,0.14) 100%),
    linear-gradient(135deg, rgba(129,78,40,0.16), rgba(255,255,255,0.02)),
    url("assets/ui/hero-fortress.webp");
  background-size: auto, auto, cover;
  background-position: center, center, center right;
  background-repeat: no-repeat;
}
.hero-home-banner::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:-1;
  background:
    /* Ember glow over the lava fissures on the right. */
    radial-gradient(circle at 82% 66%, rgba(234,120,42,0.16), transparent 26%),
    radial-gradient(circle at 70% 30%, rgba(198,164,110,0.10), transparent 24%),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 30%),
    /* Vignette so the art fades into the panel edge. */
    radial-gradient(circle at 78% 50%, transparent 30%, rgba(0,0,0,0.42) 100%);
}
.hero-home-banner .hero-copy,
.hero-home-banner .hero-actions-leaderboard{
  position: relative;
  z-index: 1;
}
.hero h1 { font-size: clamp(34px, 4vw, 52px); line-height: .96; margin: 0 0 12px; }
.hero p { margin:0; max-width:760px; color:var(--muted); line-height:1.6; font-size:16px; }
.hero-actions { display:flex; flex-wrap:wrap; gap:12px; }
.layout { display:grid; grid-template-columns:1fr; gap:18px; }
.game-panel, .side-card { border-radius: 28px; overflow:hidden; }
.game-panel{overflow:visible;}
.side-card { padding:20px; }
.panel-header {
  padding:22px 24px 18px; border-bottom:1px solid rgba(148,163,184,.10);
  display:flex; justify-content:space-between; align-items:flex-start; gap:18px; flex-wrap:wrap;
  position:relative;
}
.panel-kicker, .section-label { text-transform:uppercase; letter-spacing:.12em; color:#c09b68; font-size:12px; }
.panel-header h2, .side-card h3 { margin:0; }
.panel-header-user{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:10px 16px;
  border-radius:999px;
  border:1px solid rgba(192,155,104,.18);
  background:
    linear-gradient(180deg, rgba(27,20,18,.92), rgba(14,12,18,.88));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 10px 24px rgba(0,0,0,.18);
  text-decoration:none;
}
.panel-header-user-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.panel-header-user-label{
  text-transform:uppercase;
  letter-spacing:.18em;
  font-size:11px;
  color:rgba(192,155,104,.8);
}
.panel-header-user-value{
  font-size:14px;
  color:#f3e8d4;
  letter-spacing:.04em;
}
.panel-header-user:hover .panel-header-user-value{
  color:#fff5db;
}
.panel-header-logout{
  min-height:44px;
  padding-inline:18px;
}
.badges { display:flex; flex-wrap:wrap; gap:10px; }
.badge, .mini-pill {
  border-radius:999px; padding:10px 14px; font-weight:700; font-size:14px; border:1px solid rgba(255,255,255,.08);
  background:rgba(15,23,42,.9);
}
.badge.money{color:#d9b56e}.badge.lives{color:#d18b8b}.badge.wave{color:#c8b8a0}.badge.level{color:#90a26a}
.canvas-wrap { position:relative; padding:18px; --hud-top-offset: 0px; }
#gameCanvas {
  width:100%; max-width:100%; display:block; border-radius:22px; border:1px solid rgba(148,163,184,.14); background:#08111f;
}
.canvas-overlay { position:absolute; top:30px; left:30px; right:30px; display:flex; justify-content:flex-start; pointer-events:none; }
.overlay-chip {
  display:none !important;
  padding:8px 12px; border-radius:999px; background:rgba(8,17,31,.74); border:1px solid rgba(148,163,184,.15); color:#cbd5e1; font-size:13px;
}
.sidebar { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:18px; }
.sidebar .side-card{height:100%;}
.sidebar .side-card{
  background:linear-gradient(180deg, rgba(28,20,16,.50), rgba(12,10,9,.58));
  border-color:rgba(171,131,84,.16);
  box-shadow:0 18px 36px rgba(0,0,0,.18);
}
.command-card{order:1;}
.overview-card{order:2;}
.side-title-row { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:14px; }
.mini-pill { padding:6px 10px; font-size:12px; color:#d2b07b; border-color:rgba(192,138,74,.22); background:rgba(192,138,74,.12); }
.mini-pill.neutral { color:#e7dcc7; background:rgba(92,72,50,.18); border-color:rgba(171,131,84,.16); }
.section-label { margin:16px 0 10px; color:var(--muted); }
.unit-grid,.action-row,.stats-grid { display:grid; gap:12px; }
.stats-grid,.action-row.two-cols { grid-template-columns:1fr 1fr; }
.action-row.three-cols { grid-template-columns:repeat(3,1fr); }
.unit-grid { grid-template-columns:1fr; }
.unit-card,.btn {
  appearance:none; border:1px solid rgba(148,163,184,.15); border-radius:18px; cursor:pointer;
  transition:transform .14s ease, border-color .14s ease, background .14s ease, opacity .14s ease;
}
.unit-card:hover,.btn:hover { transform:translateY(-1px); }
.unit-card { background:rgba(15,23,42,.86); color:var(--text); padding:14px; text-align:left; }
.unit-card.active { border-color:rgba(192,138,74,.58); box-shadow:inset 0 0 0 1px rgba(192,138,74,.20); background:linear-gradient(180deg, rgba(58,37,22,.92), rgba(20,16,19,.94));}
.unit-top,.selected-name-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.unit-top{justify-content:flex-start}
.unit-dot{width:12px;height:12px;border-radius:999px;display:inline-block}

.reserve-count {
  margin-left:auto; min-width:28px; text-align:center; padding:3px 8px; border-radius:999px; font-size:12px; font-weight:800;
  color:#ead7b7; background:rgba(192,138,74,.16); border:1px solid rgba(192,138,74,.24);
}
.reserve-levels { margin-top:8px; min-height:18px; color:#bda17f; font-size:12px; line-height:1.35; }
.progress-box{margin-top:16px}
.progress-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-size:14px;color:var(--muted)}
.progress-track{width:100%;height:12px;overflow:hidden;border-radius:999px;background:rgba(12,10,8,.72);border:1px solid rgba(171,131,84,.12)}
.progress-fill{width:0%;height:100%;border-radius:999px;background:linear-gradient(90deg,var(--accent),var(--accent-2))}
.wave-forecast-card{
  margin-top:16px;
  padding:10px 12px;
  border-radius:14px;
  background:linear-gradient(180deg, rgba(17,24,39,.92), rgba(8,17,31,.88));
  border:1px solid rgba(148,163,184,.12);
}
.wave-forecast-label{
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.wave-forecast-inline-tag{
  display:inline-flex;
  align-items:center;
  margin-left:8px;
  margin-right:8px;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(148,163,184,.12);
  border:1px solid rgba(148,163,184,.14);
  color:#e2e8f0;
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}
.wave-forecast-text,
.wave-forecast-inline-text{
  color:#dbe7f7;
  line-height:1.4;
  font-size:12px;
}
.wave-forecast-card.wave-forecast-overlay{
  display:flex;
  align-items:center;
  gap:0;
  flex-wrap:wrap;
}

.wave-forecast-overlay{
  position:absolute;
  top:38px;
  left:auto;
  right:0;
  width:min(420px, 44vw);
  margin-top:0;
  pointer-events:none;
  padding:10px 12px;
  border-radius:14px;
  background:linear-gradient(180deg, rgba(10,16,28,.82), rgba(7,12,22,.72));
  border-color:rgba(96,165,250,.14);
  box-shadow:0 10px 20px rgba(0,0,0,.20);
}
.btn{padding:13px 14px;font-weight:800}
.btn:disabled{opacity:.58;cursor:not-allowed;transform:none}
.btn-primary{background:linear-gradient(180deg,#d3a15d,#8c5a2f);color:#140f0b}
.btn-secondary{background:rgba(30,41,59,.9);color:#e2e8f0}
.message-box,.selected-empty,.selected-panel{
  margin-top:16px; min-height:88px; padding:14px 16px; border-radius:18px; background:rgba(16,12,9,.62);
  border:1px solid rgba(171,131,84,.10); color:#e6ddd0; line-height:1.55;
}
.selected-panel.hidden,.screen-overlay.hidden,.hidden{display:none}
.top-gap{margin-top:12px}
.stats-card .stats-grid{margin-top:14px}
.stat-item{padding:14px;border-radius:18px;background:rgba(16,12,9,.58);border:1px solid rgba(171,131,84,.10)}
.stat-item span{display:block;color:var(--muted);font-size:13px;margin-bottom:8px}
.stat-item strong{font-size:24px}
.notification-panel { margin:0 18px 18px; border-radius:22px; padding:16px 18px; }
.notification-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.notification-header h3 { margin:0; font-size:18px; }
.notification-empty { color:var(--muted); padding:10px 4px 4px; min-height:42px; }
.notification-feed { display:flex; flex-direction:column; gap:10px; }
.notification-item {
  border:1px solid rgba(148,163,184,.12); background:rgba(8,17,31,.78); border-radius:16px; padding:12px 14px; animation:notificationPop 220ms ease-out;
}
.notification-item.achievement { border-color: rgba(106, 123, 71, 0.34); }
.notification-item.stage { border-color: rgba(192, 138, 74, 0.34); }
.notification-item .notification-title { font-weight:800; margin-bottom:4px; }
.notification-item .notification-meta { color:var(--muted); font-size:13px; }
@keyframes notificationPop { from { transform:translateY(6px); opacity:0; } to { transform:translateY(0); opacity:1; } }

.screen-overlay{
  position:fixed; inset:0; z-index:30; display:flex; align-items:center; justify-content:center; padding:24px;
  background:rgba(3,7,18,.74); backdrop-filter:blur(8px);
}
.overlay-card{
  width:min(100%,620px); border-radius:28px; padding:32px; border:1px solid rgba(148,163,184,.16);
  background:linear-gradient(180deg, rgba(15,23,42,.96), rgba(8,17,31,.96)); box-shadow:var(--shadow);
}
.overlay-danger{ border-color:rgba(251,113,133,.24); }

/* ============================================================
   World Map — full illustrated map inside the battlefield frame
   ============================================================ */
.worldmap-layer{
  position:absolute; inset:0; z-index:20;
  display:flex; align-items:center; justify-content:center;
  background:#05070f;
  overflow:hidden;
}
.worldmap-layer.hidden{ display:none; }
/* The frame shrink-wraps the letterboxed image; hotspots overlay it exactly,
   so a hotspot at x%/y% always lands on the same banner regardless of the
   battlefield frame's shape. */
.worldmap-frame{
  position:relative;
  display:flex;
  max-width:100%; max-height:100%;
}
.worldmap-image{
  display:block;
  max-width:100%; max-height:100%;
  width:auto; height:auto;
  object-fit:contain;
  user-select:none; -webkit-user-drag:none; pointer-events:none;
  transition:filter .25s ease, opacity .25s ease;
}
.worldmap-layer.showing-act-two .worldmap-image{
  filter:none;
  opacity:1;
}
.worldmap-layer.showing-act-three .worldmap-image{
  filter:saturate(.9) contrast(1.04);
  opacity:1;
}
.worldmap-hotspots{ position:absolute; inset:0; }

.worldmap-act-switch{
  --act-switch-accent:#cf914a;
  position:absolute;
  left:50%;
  top:10px;
  z-index:4;
  display:grid;
  grid-template-columns:minmax(148px, 170px) 14px minmax(148px, 170px);
  align-items:center;
  gap:4px;
  width:max-content;
  padding:5px;
  transform:translateX(-50%);
  border:1px solid rgba(207,145,74,.34);
  border-radius:12px;
  background:
    linear-gradient(180deg,rgba(255,255,255,.045),transparent 42%),
    linear-gradient(90deg,rgba(44,27,14,.96),rgba(5,7,11,.97) 43%,rgba(5,7,11,.97) 57%,rgba(31,29,25,.96));
  box-shadow:
    0 14px 36px rgba(0,0,0,.62),
    inset 0 0 0 1px rgba(255,255,255,.025),
    inset 0 -14px 26px rgba(0,0,0,.24);
}
.worldmap-act-switch.act-three-visible{
  grid-template-columns:minmax(132px, 156px) 12px minmax(132px, 156px) 12px minmax(132px, 156px);
}
.worldmap-act-switch::before,
.worldmap-act-switch::after{
  content:"";
  position:absolute;
  top:10px;
  bottom:10px;
  width:2px;
  border-block:1px solid rgba(215,167,92,.45);
  opacity:.72;
  pointer-events:none;
}
.worldmap-act-switch::before{
  left:10px;
  border-left:1px solid rgba(215,167,92,.45);
}
.worldmap-act-switch::after{
  right:10px;
  border-right:1px solid rgba(215,167,92,.45);
}
.worldmap-act-switch button{
  --act-color:#b0793f;
  position:relative;
  display:grid;
  grid-template-columns:46px minmax(0,1fr);
  align-items:center;
  min-width:0;
  height:56px;
  padding:5px 10px 5px 5px;
  overflow:hidden;
  border:1px solid rgba(142,119,88,.22);
  border-radius:8px;
  color:#a69e92;
  background:
    radial-gradient(circle at 18% 50%,color-mix(in srgb,var(--act-color) 9%,transparent),transparent 42%),
    linear-gradient(180deg,rgba(255,255,255,.028),rgba(255,255,255,.008));
  cursor:pointer;
  font-family:"Cinzel",Georgia,serif;
  text-align:left;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.26);
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease,filter .18s ease,background .18s ease;
}
#worldMapActTwoBtn{--act-color:#d9c27f}
#worldMapActThreeBtn{--act-color:#9b87f5}
.worldmap-act-switch button::after{
  content:"";
  position:absolute;
  inset:4px;
  pointer-events:none;
  border:1px solid color-mix(in srgb,var(--act-color) 14%,transparent);
  border-radius:5px;
}
.act-switch-emblem{
  position:relative;
  z-index:1;
  display:block;
  width:44px;
  height:44px;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--act-color) 68%,#21170f);
  border-radius:50%;
  background:#080706;
  box-shadow:
    0 0 0 2px rgba(0,0,0,.62),
    0 0 0 3px color-mix(in srgb,var(--act-color) 26%,transparent),
    0 0 16px color-mix(in srgb,var(--act-color) 26%,transparent);
  filter:saturate(.94) brightness(.92);
  transition:filter .2s ease,box-shadow .2s ease,transform .2s ease;
}
.act-switch-emblem::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  box-shadow:inset 0 0 8px rgba(0,0,0,.5),inset 0 0 0 1px rgba(255,255,255,.08);
}
.act-switch-emblem img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  transform:scale(1.05);
}
.act-switch-emblem-locked{
  display:grid;
  place-items:center;
  color:#c4b5fd;
  font:900 17px/1 "Cinzel",Georgia,serif;
  letter-spacing:.08em;
  text-shadow:0 0 12px rgba(139,92,246,.72);
}
.act-switch-copy{
  position:relative;
  z-index:1;
  display:flex;
  min-width:0;
  flex-direction:column;
  padding-left:9px;
}
.act-switch-kicker{
  overflow:hidden;
  color:#6d675f;
  font:800 6.5px/1.1 "Inter",Arial,sans-serif;
  letter-spacing:.15em;
  text-overflow:ellipsis;
  text-transform:uppercase;
  white-space:nowrap;
}
.act-switch-copy strong{
  margin:2px 0 1px;
  color:#bbb2a5;
  font:800 14px/1 "Cinzel",Georgia,serif;
  letter-spacing:.11em;
  text-transform:uppercase;
  text-shadow:0 2px 8px rgba(0,0,0,.9);
}
.act-switch-copy small{
  overflow:hidden;
  color:#66635e;
  font:700 7.5px/1.1 "Inter",Arial,sans-serif;
  letter-spacing:.045em;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.act-switch-divider{
  position:relative;
  z-index:2;
  color:#76583a;
  font-size:8px;
  text-align:center;
  text-shadow:0 0 9px rgba(215,167,92,.4);
}
.worldmap-act-switch button:hover,
.worldmap-act-switch button:focus-visible{
  outline:none;
  transform:translateY(-1px);
  border-color:color-mix(in srgb,var(--act-color) 54%,#44301d);
  filter:brightness(1.08);
}
.worldmap-act-switch button:hover .act-switch-emblem,
.worldmap-act-switch button:focus-visible .act-switch-emblem{
  filter:saturate(1.05) brightness(1.04);
  transform:scale(1.04);
}
.worldmap-act-switch button.active{
  border-color:color-mix(in srgb,var(--act-color) 72%,#6f4a27);
  color:#fff1da;
  background:
    radial-gradient(circle at 17% 50%,color-mix(in srgb,var(--act-color) 24%,transparent),transparent 43%),
    linear-gradient(180deg,color-mix(in srgb,var(--act-color) 13%,rgba(255,255,255,.05)),rgba(17,12,8,.68));
  box-shadow:
    inset 0 0 0 1px rgba(255,231,190,.06),
    inset 0 0 24px color-mix(in srgb,var(--act-color) 8%,transparent),
    0 0 16px color-mix(in srgb,var(--act-color) 12%,transparent);
}
.worldmap-act-switch button.active .act-switch-emblem{
  filter:saturate(1.16) brightness(1.14);
  box-shadow:
    0 0 0 2px rgba(0,0,0,.6),
    0 0 0 3px color-mix(in srgb,var(--act-color) 62%,transparent),
    0 0 22px color-mix(in srgb,var(--act-color) 46%,transparent);
}
.worldmap-act-switch button.active .act-switch-kicker{color:color-mix(in srgb,var(--act-color) 82%,#e7dfd4)}
.worldmap-act-switch button.active .act-switch-copy strong{color:#fff2dc}
.worldmap-act-switch button.active .act-switch-copy small{color:#b4a797}
.worldmap-act-switch button.active::before{
  content:"SELECTED";
  position:absolute;
  right:8px;
  top:5px;
  color:color-mix(in srgb,var(--act-color) 66%,transparent);
  font:900 6px/1 "Inter",Arial,sans-serif;
  letter-spacing:.12em;
}
.worldmap-act-switch button:disabled{
  color:#5f5b56;
  cursor:not-allowed;
  filter:grayscale(1) brightness(.55);
}

.worldmap-act3-teaser{
  position:absolute;
  left:50%;
  bottom:clamp(28px, 7%, 72px);
  z-index:3;
  display:flex;
  width:min(82%, 590px);
  padding:clamp(18px, 2.5vw, 30px) clamp(24px, 4vw, 48px);
  transform:translateX(-50%);
  flex-direction:column;
  align-items:center;
  border:1px solid rgba(167,139,250,.42);
  border-radius:12px;
  background:
    linear-gradient(180deg,rgba(112,80,180,.11),transparent 42%),
    rgba(4,5,13,.88);
  color:#f5f3ff;
  text-align:center;
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.48),
    inset 0 0 34px rgba(109,40,217,.11),
    0 18px 54px rgba(0,0,0,.68),
    0 0 30px rgba(109,40,217,.13);
  backdrop-filter:blur(5px);
  pointer-events:none;
}
.worldmap-act3-teaser::before{
  content:"";
  position:absolute;
  inset:7px;
  border:1px solid rgba(196,181,253,.13);
  border-radius:7px;
}
.worldmap-act3-seal{
  display:grid;
  width:44px;
  height:44px;
  margin-top:-43px;
  place-items:center;
  border:1px solid rgba(196,181,253,.55);
  border-radius:50%;
  background:#080713;
  color:#c4b5fd;
  font:900 17px/1 "Cinzel",Georgia,serif;
  box-shadow:0 0 22px rgba(139,92,246,.38);
}
.worldmap-act3-teaser p{
  margin:12px 0 3px;
  color:#b8a8ea;
  font:800 9px/1.2 "Inter",Arial,sans-serif;
  letter-spacing:.3em;
  text-transform:uppercase;
}
.worldmap-act3-teaser h3{
  margin:0;
  color:#f8f3ff;
  font:800 clamp(25px, 3.2vw, 43px)/1 "Cinzel",Georgia,serif;
  letter-spacing:.08em;
  text-shadow:0 3px 20px rgba(0,0,0,.95),0 0 24px rgba(109,40,217,.25);
  text-transform:uppercase;
}
.worldmap-act3-teaser > span{
  margin-top:9px;
  color:#d8b4fe;
  font:900 11px/1.2 "Inter",Arial,sans-serif;
  letter-spacing:.28em;
  text-transform:uppercase;
}
.worldmap-act3-teaser small{
  max-width:470px;
  margin-top:10px;
  color:#b9b3c8;
  font:600 12px/1.45 "Inter",Arial,sans-serif;
}

@media (max-width:620px){
  .worldmap-act-switch{
    top:7px;
    grid-template-columns:minmax(104px,1fr) 10px minmax(104px,1fr);
    width:min(92%, 312px);
    gap:2px;
    padding:4px;
  }
  .worldmap-act-switch.act-three-visible{
    grid-template-columns:minmax(82px,1fr) 8px minmax(82px,1fr) 8px minmax(82px,1fr);
    width:min(97%, 430px);
  }
  .worldmap-act-switch button{
    grid-template-columns:36px minmax(0,1fr);
    height:44px;
    padding:4px 6px 4px 4px;
  }
  .act-switch-emblem{width:34px;height:34px}
  .act-switch-copy{padding-left:7px}
  .act-switch-kicker,
  .act-switch-copy small,
  .worldmap-act-switch button.active::before{display:none}
  .act-switch-copy strong{margin:0;font-size:12px}
  .worldmap-act-switch.act-three-visible button{
    grid-template-columns:31px minmax(0,1fr);
    padding-inline:4px;
  }
  .worldmap-act-switch.act-three-visible .act-switch-emblem{
    width:29px;
    height:29px;
  }
  .worldmap-act3-teaser{
    bottom:18px;
    width:min(90%, 430px);
    padding:16px 17px;
  }
  .worldmap-act3-teaser h3{font-size:clamp(21px, 7vw, 31px)}
  .worldmap-act3-teaser small{font-size:10px}
}
@media (max-height:520px){
  .worldmap-act-switch{top:5px}
  .worldmap-act-switch button{height:44px}
  .act-switch-emblem{width:34px;height:34px}
}

.worldmap-hotspot{
  position:absolute;
  transform:translate(-50%,-50%);
  width:150px; height:96px;
  padding:0; border:0; background:none; cursor:pointer;
  z-index:2;
}
/* The glow sits BEHIND the banner (the art already draws the banner), so hover
   reads as the region lighting up — not a hard box stuck on top of it. */
.worldmap-hotspot-ring{
  position:absolute; left:50%; top:44%;
  transform:translate(-50%,-50%);
  width:130px; height:130px; border-radius:50%;
  background:radial-gradient(circle, rgba(56,189,248,0) 0%, rgba(56,189,248,0) 100%);
  opacity:0;
  transition:opacity .2s ease, background .2s ease;
  pointer-events:none;
}
.worldmap-hotspot-label{
  position:absolute; left:50%; bottom:2px; transform:translate(-50%,100%);
  display:flex; align-items:center; gap:4px;
  padding:3px 10px; border-radius:999px;
  background:rgba(6,10,20,.9);
  border:1px solid rgba(148,163,184,.3);
  box-shadow:0 4px 12px rgba(0,0,0,.5);
  opacity:0; pointer-events:none; white-space:nowrap;
  transition:opacity .16s ease;
  z-index:3;
}
.worldmap-hotspot-status{ font-size:9.5px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:#7dd3fc; }

.worldmap-hotspot:hover:not(.locked) .worldmap-hotspot-ring,
.worldmap-hotspot:focus-visible:not(.locked) .worldmap-hotspot-ring{
  opacity:1;
  background:radial-gradient(circle, rgba(125,211,252,.34) 0%, rgba(56,189,248,.12) 45%, rgba(56,189,248,0) 70%);
}
.worldmap-hotspot:hover:not(.locked) .worldmap-hotspot-label,
.worldmap-hotspot:focus-visible:not(.locked) .worldmap-hotspot-label{ opacity:1; }

/* Current region: a soft amber aura that gently breathes — no hard outline. */
.worldmap-hotspot.current .worldmap-hotspot-ring{
  opacity:1;
  background:radial-gradient(circle, rgba(251,191,36,.32) 0%, rgba(251,191,36,.1) 46%, rgba(251,191,36,0) 70%);
  animation:worldmapAura 2.2s ease-in-out infinite;
}
.worldmap-hotspot.current .worldmap-hotspot-label{ opacity:1; }
.worldmap-hotspot.current .worldmap-hotspot-status{ color:#fbbf24; }
@keyframes worldmapAura{
  0%,100%{ opacity:.62; }
  50%{ opacity:1; }
}

.worldmap-hotspot.cleared .worldmap-hotspot-status{ color:#6ee7b7; }
.worldmap-hotspot.cleared:hover .worldmap-hotspot-ring{
  background:radial-gradient(circle, rgba(110,231,183,.28) 0%, rgba(110,231,183,.1) 45%, rgba(110,231,183,0) 70%);
}

/* Locked: darken the region with a soft vignette, no outline box. */
.worldmap-hotspot.locked{ cursor:not-allowed; }
.worldmap-hotspot.locked .worldmap-hotspot-label{ opacity:1; background:rgba(4,6,12,.92); }
.worldmap-hotspot.locked .worldmap-hotspot-status{ color:#94a3b8; }
.worldmap-hotspot.locked::before{
  content:""; position:absolute; left:50%; top:46%;
  width:300px; height:270px; transform:translate(-50%,-50%);
  border-radius:50%;
  background:radial-gradient(circle, rgba(3,5,12,.82) 0%, rgba(3,5,12,.55) 42%, rgba(3,5,12,0) 70%);
  z-index:-1; pointer-events:none;
}

.worldmap-resume-chip{
  position:absolute; top:12px; right:12px; z-index:3;
  padding:9px 16px; border-radius:999px; cursor:pointer;
  font-size:13px; font-weight:800; letter-spacing:.03em; color:#5eead4;
  background:rgba(6,12,16,.9);
  border:1px solid rgba(94,234,212,.42);
  box-shadow:0 8px 22px rgba(0,0,0,.45);
  transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.worldmap-resume-chip:hover{ transform:translateY(-1px); border-color:rgba(94,234,212,.8); box-shadow:0 0 20px rgba(94,234,212,.25); }
.worldmap-resume-chip.hidden{ display:none; }
.worldmap-endless-chip{
  position:absolute; top:12px; left:12px; z-index:3;
  padding:9px 16px; border-radius:999px; cursor:pointer;
  font-size:13px; font-weight:800; letter-spacing:.03em; color:#e9d5ff;
  background:rgba(17,8,28,.92);
  border:1px solid rgba(192,132,252,.44);
  box-shadow:0 8px 22px rgba(0,0,0,.45);
  transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.worldmap-endless-chip:hover{
  transform:translateY(-1px);
  border-color:rgba(216,180,254,.82);
  box-shadow:0 0 20px rgba(168,85,247,.24);
}
.worldmap-endless-chip.hidden{ display:none; }

.canvas-wrap.worldmap-active .canvas-overlay,
.canvas-wrap.worldmap-active .settings-toggle,
.canvas-wrap.worldmap-active .speed-toggle,
.canvas-wrap.worldmap-active .fullscreen-toggle,
.canvas-wrap.worldmap-active .tower-menu,
.canvas-wrap.worldmap-active .unit-info-panel,
.canvas-wrap.worldmap-active .campaign-objective{
  display:none !important;
}

@media (max-width:640px){
  .worldmap-hotspot{ width:118px; height:78px; }
  .worldmap-hotspot-ring{ width:104px; height:104px; }
}

.overlay-kicker{margin-bottom:10px;font-size:12px;font-weight:800;letter-spacing:.18em;text-transform:uppercase;color:#d8b789}
.overlay-kicker-danger{color:#ffb3b3}
.gameover-overlay{overflow:hidden}
.gameover-overlay::before{content:"";position:absolute;inset:0;background:radial-gradient(circle at center, rgba(150,14,14,.22), transparent 46%),linear-gradient(180deg, rgba(4,4,7,.38), rgba(4,4,7,.76));pointer-events:none}
.gameover-media{position:absolute;inset:0;pointer-events:none;opacity:.34}
.gameover-media img{width:100%;height:100%;object-fit:cover;filter:brightness(.48) contrast(1.08) saturate(.92)}
.gameover-card{position:relative;overflow:hidden;animation:gameOverCardIn 340ms ease-out;border-color:rgba(255,110,110,.26);background:linear-gradient(180deg, rgba(18,17,24,.88), rgba(7,10,18,.94))}
.gameover-card::after{content:"";position:absolute;inset:-20% auto auto -10%;width:220px;height:220px;background:radial-gradient(circle, rgba(255,76,76,.18), transparent 70%);pointer-events:none}
.gameover-card h1{margin:0 0 10px;font-size:clamp(42px, 7vw, 74px);line-height:.92;letter-spacing:.05em}
.gameover-subtitle{margin:0 0 10px;max-width:560px;color:#efe1d6;line-height:1.6}
.gameover-quote{margin:0 0 22px;max-width:560px;color:#d6b8ad;font-style:italic;line-height:1.6;opacity:.92}
.gameover-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0 0 22px}
.gameover-stat{padding:14px 12px;border-radius:18px;border:1px solid rgba(255,255,255,.08);background:rgba(10,14,24,.70);text-align:center}
.gameover-stat span{display:block;margin-bottom:8px;font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:#c3b0a6}
.gameover-stat strong{display:block;font-size:24px;color:#fff6ee}
.gameover-actions.two-buttons{grid-template-columns:repeat(2,minmax(0,1fr))}
@keyframes gameOverCardIn{from{opacity:0;transform:translateY(12px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}

.overlay-actions{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:12px;
  align-items:stretch;
}

.overlay-actions .btn{
  min-width:0;
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  white-space:normal;
  line-height:1.2;
}

.leaderboard-name-card{
  width:min(100%, 460px);
}

.leaderboard-name-label{
  display:block;
  margin:10px 0 8px;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.leaderboard-name-input{
  width:100%;
  margin-bottom:18px;
  padding:14px 16px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,.18);
  background:rgba(8,17,31,.86);
  color:var(--text);
  font:600 16px Inter, Arial, Helvetica, sans-serif;
  outline:none;
}

.leaderboard-name-input:focus{
  border-color:rgba(192,138,74,.55);
  box-shadow:0 0 0 3px rgba(192,138,74,.14);
}

.leaderboard-name-actions{
  grid-template-columns:repeat(2, minmax(0, 1fr));
}

.overlay-actions #startGameBtn{
  grid-column:span 1;
}

@media (max-width: 760px){
  .overlay-actions{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px){
  .overlay-actions{
    grid-template-columns:1fr;
  }
  .gameover-actions.two-buttons{grid-template-columns:1fr}
}


@media (max-width:1080px){ .hero{flex-direction:column; align-items:flex-start} }
@media (max-width:700px){
  .app{padding:14px}
  .hero,.side-card,.game-panel,.overlay-card{border-radius:22px}
  .stats-grid,.action-row.two-cols,.action-row.three-cols,.gameover-stats{grid-template-columns:1fr}
  .panel-header{padding:18px}
  .canvas-wrap{padding:12px}
  .canvas-overlay{top:20px;left:20px;right:20px}
  .wave-forecast-overlay{
    top:78px;
    left:auto;
    right:auto;
    width:min(252px, calc(100% - 104px));
    padding:10px 12px;
    border-radius:16px;
  }
  .wave-forecast-text,
  .wave-forecast-inline-text{
    font-size:12px;
    line-height:1.4;
  }
  .wave-forecast-inline-tag{
    margin-left:6px;
    margin-right:6px;
    padding:3px 7px;
    font-size:11px;
  }
}


.overlay-chip {
  transition: opacity .25s ease, transform .25s ease;
}

.overlay-chip.hidden-chip {
  opacity: 0;
  transform: translateY(-8px);
}


.tower-menu{
  position:absolute;
  min-width:182px;
  max-width:220px;
  padding:12px;
  border-radius:16px;
  background:rgba(8,17,31,.96);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 18px 40px rgba(0,0,0,.35);
  z-index:12;
  /* Positioning is handled in JS with clamping so the panel stays inside the map. */
  transform:none;
  opacity:1;
  transition:opacity .45s ease;
}

.tower-menu.fading{
  opacity:0;
  pointer-events:none;
}

.tower-menu.hidden{
  display:none;
}

.tower-menu-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:6px;
}

.tower-menu-header strong{
  font-size:15px;
}

#towerMenuLevel{
  color:#d7b06a;
  font-weight:800;
  font-size:13px;
}

.tower-menu-stats{
  color:#cbd5e1;
  font-size:12px;
  line-height:1.45;
  margin-bottom:10px;
}


.tower-specialization-panel{
  display:grid;
  gap:8px;
  margin-bottom:10px;
}

.tower-specialization-panel.hidden{
  display:none;
}

.tower-spec-btn{
  --spec-fill: rgba(139,92,246,.16);
  --spec-border: rgba(196,181,253,.30);
  --spec-accent: rgba(196,181,253,.72);
  --spec-icon: #f5f3ff;
  --spec-medallion: rgba(91,33,182,.88);
  --spec-glow: rgba(139,92,246,.24);
  display:grid;
  grid-template-columns:40px minmax(0,1fr);
  align-items:center;
  gap:10px;
  text-align:left;
  padding:10px 11px;
  border-radius:14px;
  border:1px solid var(--spec-border);
  background:linear-gradient(180deg, color-mix(in srgb, var(--spec-fill) 86%, rgba(15,23,42,.96)), rgba(15,23,42,.94));
  color:#e2e8f0;
  cursor:pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 20px rgba(2,6,23,.18);
}

.tower-spec-medallion{
  width:34px;
  height:34px;
  border-radius:999px;
  display:grid;
  place-items:center;
  background:radial-gradient(circle at 30% 30%, rgba(255,255,255,.18), transparent 34%), var(--spec-medallion);
  color:var(--spec-icon);
  border:1px solid var(--spec-accent);
  box-shadow:0 0 0 3px rgba(2,6,23,.28), 0 0 16px var(--spec-glow);
  font-size:16px;
  line-height:1;
}

.tower-spec-copy{
  display:grid;
  gap:3px;
  min-width:0;
}

.tower-spec-btn strong{
  font-size:13px;
}

.tower-spec-btn span,
.tower-spec-btn em{
  font-size:11px;
  color:#cbd5e1;
  font-style:normal;
}

.tower-spec-btn:hover{
  transform:translateY(-1px);
  border-color:var(--spec-accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 12px 24px rgba(2,6,23,.24);
}

.tower-spec-btn:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none;
}

.tower-menu-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.tower-menu-actions .btn{
  min-height:42px;
  padding:10px 10px;
  font-size:13px;
}

.canvas-wrap{
  overflow:hidden;
}

@media (max-width: 700px){
  .tower-menu{
    min-width:164px;
    max-width:184px;
    padding:10px;
  }

  .tower-menu-actions{
    grid-template-columns:1fr;
  }
}


.map-controls{
  position:absolute;
  right:18px;
  bottom:18px;
  display:grid;
  grid-template-columns:repeat(4, auto);
  gap:8px;
  z-index:11;
}

.map-btn{
  min-height:42px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,.18);
  background:rgba(8,17,31,.92);
  color:#e5eefc;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 10px 24px rgba(0,0,0,.28);
  backdrop-filter:blur(8px);
}

.map-btn:hover{
  transform:translateY(-1px);
}

.map-btn-primary{
  background:linear-gradient(180deg,#d3a15d,#8c5a2f);
  color:#140f0b;
}

.map-btn-small{
  min-width:42px;
  padding:10px;
}

@media (max-width:700px){
  .map-controls{
    right:12px;
    bottom:12px;
    grid-template-columns:repeat(2, auto);
  }

  .map-btn{
    min-height:40px;
    padding:9px 10px;
    font-size:13px;
  }
}


.map-controls{
  position:absolute;
  right:18px;
  bottom:18px;
  display:grid;
  grid-template-columns:repeat(2, 58px);
  gap:10px;
  z-index:11;
}

.map-btn{
  position:relative;
  width:58px;
  height:58px;
  min-height:58px;
  padding:0;
  border-radius:18px;
  border:1px solid rgba(148,163,184,.18);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.16), transparent 34%),
    linear-gradient(180deg, rgba(30,41,59,.98), rgba(8,17,31,.96));
  color:#e5eefc;
  font-size:24px;
  font-weight:900;
  line-height:1;
  cursor:pointer;
  box-shadow:
    0 10px 24px rgba(0,0,0,.32),
    inset 0 1px 0 rgba(255,255,255,.06),
    inset 0 -8px 18px rgba(0,0,0,.18);
  backdrop-filter:blur(8px);
  transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease, filter .14s ease;
}

.map-btn:hover{
  transform:translateY(-1px) scale(1.02);
}

.map-btn:active{
  transform:translateY(1px) scale(.98);
}

.map-btn::after{
  content:"";
  position:absolute;
  inset:6px;
  border-radius:13px;
  border:1px solid rgba(255,255,255,.05);
  pointer-events:none;
}

.map-btn-start{
  color:#d9fff0;
  border-color:rgba(74,222,128,.34);
  box-shadow:
    0 12px 30px rgba(16,185,129,.16),
    0 10px 24px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(74,222,128,.08);
}

.map-btn-start::before,
.map-btn-pause::before,
.map-btn-reset::before,
.map-btn-camera::before{
  position:absolute;
  left:50%;
  bottom:5px;
  transform:translateX(-50%);
  font-size:9px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:rgba(226,232,240,.72);
  font-weight:800;
}

.map-btn-start::before{ content:"Start"; }
.map-btn-pause::before{ content:""; }
.map-btn-reset::before{ content:"Reset"; }
.map-btn-camera::before{ content:"View"; }

.map-btn-pause{
  color:#dbeafe;
  border-color:rgba(96,165,250,.30);
  box-shadow:
    0 12px 30px rgba(59,130,246,.14),
    0 10px 24px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(96,165,250,.06);
}

.map-btn-reset{
  color:#ffe2e2;
  border-color:rgba(251,113,133,.30);
  box-shadow:
    0 12px 30px rgba(251,113,133,.12),
    0 10px 24px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(251,113,133,.06);
}

.map-btn-camera{
  color:#ede9fe;
  border-color:rgba(167,139,250,.30);
  box-shadow:
    0 12px 30px rgba(139,92,246,.14),
    0 10px 24px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(167,139,250,.06);
}

.map-btn:disabled{
  opacity:.58;
  filter:saturate(.7);
}

@media (max-width:700px){
  .map-controls{
    right:12px;
    bottom:12px;
    grid-template-columns:repeat(2, 52px);
    gap:8px;
  }

  .map-btn{
    width:52px;
    height:52px;
    min-height:52px;
    border-radius:16px;
    font-size:21px;
  }

  .map-btn::before{
    font-size:8px;
    bottom:4px;
  }
}


.map-unit-controls{
  position:absolute;
  left:18px;
  bottom:18px;
  display:grid;
  grid-template-columns:repeat(2, minmax(88px, 1fr));
  gap:10px;
  width:min(300px, calc(100% - 110px));
  z-index:11;
}

.map-unit-btn{
  position:relative;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:8px;
  min-height:54px;
  padding:10px 12px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,.18);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.14), transparent 34%),
    linear-gradient(180deg, rgba(30,41,59,.96), rgba(8,17,31,.94));
  color:#e5eefc;
  box-shadow:
    0 10px 24px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(255,255,255,.05);
  cursor:pointer;
  transition:transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.map-unit-btn:hover{
  transform:translateY(-1px);
}

.map-unit-btn.active{
  border-color:rgba(103,232,249,.52);
  box-shadow:
    0 12px 28px rgba(14,165,233,.18),
    0 10px 24px rgba(0,0,0,.28),
    inset 0 0 0 1px rgba(103,232,249,.14);
}



.map-unit-label{
  font-size:13px;
  font-weight:800;
  text-align:left;
}

.map-unit-count{
  min-width:24px;
  text-align:center;
  padding:2px 6px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  color:#dbeafe;
  background:rgba(56,189,248,.16);
  border:1px solid rgba(56,189,248,.2);
}

@media (max-width:700px){
  .map-unit-controls{
    left:12px;
    bottom:12px;
    width:calc(100% - 140px);
    gap:8px;
    grid-template-columns:repeat(2, minmax(72px, 1fr));
  }

  .map-unit-btn{
    min-height:48px;
    padding:8px 10px;
    gap:6px;
    border-radius:14px;
  }

  .map-unit-label{
    font-size:12px;
  }
}


/* Compact top HUD for phones */
@media (max-width: 760px){
  .hero{
    padding:16px;
    gap:14px;
    margin-bottom:14px;
  }

  .hero h1{
    font-size:28px;
    margin-bottom:8px;
  }

  .hero p{
    font-size:13px;
    line-height:1.45;
    max-width:100%;
  }

  .current-stage-hero{
    margin-top:10px;
    padding:7px 12px;
    font-size:13px;
  }

  .hero-mode{
    width:100%;
  }

  .mode-box{
    width:100%;
    min-width:0;
    padding:12px 14px;
    border-radius:16px;
  }

  .mode-title{
    margin-bottom:6px;
  }

  .mode-buttons{
    gap:6px;
    margin-bottom:8px;
  }

  .mode-buttons .btn{
    min-height:40px;
    padding:9px 10px;
    font-size:13px;
  }

  .mode-stats{
    font-size:12px;
    gap:2px;
  }

  .panel-header{
    padding:14px 14px 12px;
    gap:12px;
  }

  .panel-header h2{
    font-size:18px;
  }

  .panel-kicker{
    font-size:11px;
  }

  .badges{
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    width:100%;
    gap:8px;
  }

  .badge{
    padding:8px 10px;
    font-size:12px;
    text-align:center;
    min-width:0;
  }

  .canvas-wrap{
    padding:10px;
  }

  #gameCanvas{
    border-radius:18px;
  }

  .canvas-overlay{
    top:16px;
    left:16px;
    right:16px;
  }

  .overlay-chip{
    font-size:11px;
    padding:7px 9px;
    max-width:230px;
  }

  .notification-panel{
    margin:0 10px 10px;
    padding:12px;
    border-radius:18px;
  }

  .notification-header h3{
    font-size:16px;
  }

  .notification-item{
    padding:10px 12px;
  }

  .sidebar{
    grid-template-columns:1fr;
    gap:12px;
  }

  .side-card{
    padding:14px;
    border-radius:20px;
  }

  .stats-grid{
    gap:8px;
  }

  .stat-item{
    padding:10px 12px;
    border-radius:14px;
  }

  .stat-item span{
    font-size:12px;
    margin-bottom:5px;
  }

  .stat-item strong{
    font-size:16px;
  }
}

@media (max-width: 480px){
  .global-account-bar{
    padding:calc(10px + var(--safe-top)) calc(12px + var(--safe-right)) 10px calc(12px + var(--safe-left));
  }
  .global-account-bar-inner{
    align-items:flex-start;
    flex-direction:column;
  }
  .global-account-brand a{
    font-size:18px;
  }
  .global-account-pill{
    width:100%;
    justify-content:space-between;
  }
  .app{
    padding:10px;
  }

  .hero{
    padding:14px;
    border-radius:20px;
  }

  .hero h1{
    font-size:24px;
  }

  .hero p{
    font-size:12px;
  }

  .mode-box{
    padding:10px 12px;
  }

  .mode-buttons{
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .current-stage-hero{
    padding:6px 10px;
    font-size:12px;
  }

  .panel-header{
    padding:12px 12px 10px;
  }

  .panel-header h2{
    font-size:16px;
  }

  .panel-header-user{
    width:100%;
    justify-content:space-between;
    padding:9px 14px;
  }

  .panel-header-user-actions{
    width:100%;
  }

  .panel-header-logout{
    width:100%;
  }

  .panel-header-user-value{
    font-size:13px;
  }

  .badge{
    font-size:11px;
    padding:7px 8px;
    border-radius:14px;
  }

  .overlay-chip{
    font-size:11px;
    max-width:190px;
  }
}


.notification-header-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.notification-toggle{
  width:32px;
  height:32px;
  border:none;
  border-radius:999px;
  background:rgba(148,163,184,.12);
  color:#e5eefc;
  font-size:16px;
  font-weight:900;
  cursor:pointer;
  transition:transform .16s ease, background .16s ease;
}

.notification-toggle:hover{
  background:rgba(148,163,184,.18);
}

.notification-panel.collapsed .notification-feed,
.notification-panel.collapsed .notification-empty{
  display:none !important;
}

.notification-panel.collapsed{
  padding-top:12px;
  padding-bottom:12px;
}

.notification-panel.collapsed .notification-header{
  margin-bottom:0;
}

.notification-panel:not(.collapsed) #notificationToggle{
  transform:rotate(180deg);
}

.notification-toast{
  position:absolute;
  top:14px;
  left:50%;
  right:auto;
  transform:translateX(-50%);
  z-index:13;
  min-width:220px;
  max-width:340px;
  padding:8px 12px;
  border-radius:14px;
  background:rgba(8,17,31,.72);
  border:1px solid rgba(148,163,184,.12);
  box-shadow:0 10px 22px rgba(0,0,0,.18);
  backdrop-filter:blur(8px);
  animation:toastIn .22s ease-out;
}

.notification-toast .notification-title{
  font-weight:800;
  margin-bottom:2px;
  font-size:12px;
}

.notification-toast .notification-meta{
  color:rgba(226,232,240,.86);
  font-size:11px;
  line-height:1.35;
}

.notification-toast.achievement{
  border-color:rgba(34,197,94,.18);
}

.notification-toast.stage{
  border-color:rgba(56,189,248,.18);
}

@keyframes toastIn{
  from{ transform:translateX(-50%) translateY(-6px); opacity:0; }
  to{ transform:translateX(-50%) translateY(0); opacity:1; }
}

@media (max-width:760px){
  .notification-panel{
    margin:0 8px 8px;
    padding:10px 12px;
  }

  .notification-toast{
    top:10px;
    left:50%;
    right:auto;
    min-width:180px;
    max-width:240px;
    padding:8px 10px;
  }
}


.canvas-top-hud{
  position:absolute;
  top:0;
  right:0;
  display:grid;
  grid-template-columns:repeat(2, auto);
  gap:8px;
  justify-items:end;
  pointer-events:none;
}

.canvas-top-hud .badge{
  padding:8px 10px;
  font-size:12px;
  backdrop-filter:blur(8px);
  background:rgba(8,17,31,.82);
  box-shadow:0 8px 20px rgba(0,0,0,.22);
}

.panel-header{
  padding:18px 20px 14px;
}

.panel-header h2{
  font-size:26px;
}

/* tighter map controls */
.map-controls{
  grid-template-columns:58px 78px;
  align-items:start;
}

.map-btn-pause{
  width:78px;
  height:58px;
  min-height:58px;
  border-radius:18px;
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.map-btn-pause::before{
  content:"";
}

.map-btn-pause .pause-label{
  font-size:12px;
  letter-spacing:.08em;
  text-transform:uppercase;
  opacity:.9;
  margin-left:6px;
}

.map-btn-pause .pause-icon{
  font-size:18px;
  line-height:1;
}

/* Auto Play active state, shown on the Start button (toggled via double-tap) */
.map-btn-start.auto-active{
  color:#d9fff0;
  border-color:rgba(56,189,248,.55);
  background:rgba(56,189,248,.14);
  box-shadow:
    0 12px 30px rgba(56,189,248,.24),
    0 10px 24px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(56,189,248,.16);
}
.map-btn-start.auto-active::before{ content:"Auto"; color:#7dd3fc; }
.map-btn-start.auto-active::after{
  content:"";
  position:absolute;
  top:6px;
  right:6px;
  width:7px;
  height:7px;
  border-radius:50%;
  background:#38bdf8;
  box-shadow:0 0 8px rgba(56,189,248,.9);
  animation:autoPulse 1.4s ease-in-out infinite;
}
@keyframes autoPulse{ 0%,100%{ opacity:.4; } 50%{ opacity:1; } }

@media (max-width:700px){
  .canvas-top-hud{
    grid-template-columns:repeat(2, minmax(0, auto));
    gap:6px;
  }

  .canvas-top-hud .badge{
    font-size:11px;
    padding:7px 8px;
    border-radius:12px;
  }

  .panel-header{
    padding:12px 12px 10px;
  }

  .panel-header h2{
    font-size:16px;
  }

  .panel-kicker{
    font-size:10px;
  }

  .map-controls{
    grid-template-columns:50px 68px;
    gap:8px;
  }

  .map-btn{
    width:50px;
    height:50px;
    min-height:50px;
    font-size:20px;
  }

  .map-btn-pause{
    width:68px;
    height:50px;
    min-height:50px;
    font-size:16px;
  }

  .map-btn-pause .pause-label{
    font-size:11px;
    margin-left:4px;
  }
}


/* Single line HUD */
.canvas-top-hud.single-row{
  position:absolute;
  top:6px;
  right:10px;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
  pointer-events:none;
}

.canvas-top-hud.single-row .badge{
  font-size:11px;
  padding:6px 8px;
  border-radius:10px;
}

/* compact battlefield title */
.compact-kicker{
  font-size:10px;
  letter-spacing:.18em;
  opacity:.7;
}

.panel-header h2{
  font-size:20px;
}

/* more vertical space for map */
.panel-header{
  padding:10px 12px 8px;
}

/* mobile */
@media (max-width:700px){

  .canvas-top-hud.single-row{
    gap:6px;
    padding-top:4px;
  }

  .canvas-top-hud.single-row .badge{
    font-size:10px;
    padding:5px 7px;
  }

  .panel-header h2{
    font-size:16px;
  }

  .compact-kicker{
    font-size:9px;
  }
}


@media (max-width:700px){
  .canvas-top-hud.single-row{
    top:6px;
    right:8px;
    gap:6px;
  }
}


/* v27 pause button aligned with the rest */
.map-controls{
  grid-template-columns:repeat(2, 58px);
}

.map-btn-pause{
  width:58px;
  height:58px;
  min-height:58px;
  border-radius:18px;
  font-size:15px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
}

.map-btn-pause::before{
  content:"";
  position:absolute;
  left:50%;
  bottom:5px;
  transform:translateX(-50%);
  font-size:9px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:rgba(226,232,240,.72);
  font-weight:800;
}

.pause-icon-wrap{
  position:relative;
  width:14px;
  height:16px;
  display:block;
  margin-top:-6px;
}

.pause-icon-wrap::before,
.pause-icon-wrap::after{
  content:"";
  position:absolute;
  top:0;
  width:4px;
  height:16px;
  border-radius:3px;
  background:currentColor;
  box-shadow:0 0 8px rgba(255,255,255,.06);
}

.pause-icon-wrap::before{ left:1px; }
.pause-icon-wrap::after{ right:1px; }

.resume-icon{
  font-size:16px;
  line-height:1;
  margin-top:-4px;
}

.map-btn-pause .pause-label{
  display:none;
}

@media (max-width:700px){
  .map-controls{
    grid-template-columns:repeat(2, 50px);
  }

  .map-btn-pause{
    width:50px;
    height:50px;
    min-height:50px;
    border-radius:16px;
  }

  .map-btn-pause::before{
    font-size:8px;
    bottom:4px;
  }

  .pause-icon-wrap{
    width:12px;
    height:14px;
  }

  .pause-icon-wrap::before,
  .pause-icon-wrap::after{
    width:4px;
    height:14px;
  }

  .resume-icon{
    font-size:14px;
  }
}


/* refined pause button (single label like other buttons) */
.map-btn-pause{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
}

.pause-icon-wrap{
  position:relative;
  width:14px;
  height:14px;
  display:block;
}

.pause-icon-wrap::before,
.pause-icon-wrap::after{
  content:"";
  position:absolute;
  top:0;
  width:4px;
  height:14px;
  border-radius:2px;
  background:currentColor;
}

.pause-icon-wrap::before{ left:2px; }
.pause-icon-wrap::after{ right:2px; }

.map-btn-pause .btn-label{
  font-size:9px;
  letter-spacing:.12em;
  text-transform:uppercase;
  opacity:.8;
}

@media (max-width:700px){
  .pause-icon-wrap{
    width:12px;
    height:12px;
  }
  .pause-icon-wrap::before,
  .pause-icon-wrap::after{
    height:12px;
  }
  .map-btn-pause .btn-label{
    font-size:8px;
  }
}

/* FINAL pause button layout fix */
.map-btn-pause{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
}

.map-btn-pause::before{
  content:none !important;
}

.pause-icon-wrap{
  width:14px;
  height:14px;
  position:relative;
}

.pause-icon-wrap::before,
.pause-icon-wrap::after{
  content:"";
  position:absolute;
  top:0;
  width:4px;
  height:14px;
  background:currentColor;
  border-radius:2px;
}

.pause-icon-wrap::before{ left:2px; }
.pause-icon-wrap::after{ right:2px; }

.btn-label{
  font-size:9px;
  letter-spacing:.12em;
  text-transform:uppercase;
  opacity:.85;
}


.unit-info-panel{
  position:absolute;
  left:18px;
  top:62px;
  width:min(250px, calc(100% - 36px));
  padding:12px;
  border-radius:18px;
  background:rgba(8,17,31,.95);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 18px 40px rgba(0,0,0,.35);
  z-index:12;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.unit-info-panel.hidden{
  display:none;
}

.unit-info-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:2px;
}

.unit-info-header strong{
  font-size:14px;
  color:#e5eefc;
  letter-spacing:.04em;
}

.unit-info-close{
  width:28px;
  height:28px;
  border:none;
  border-radius:999px;
  background:rgba(148,163,184,.12);
  color:#e5eefc;
  cursor:pointer;
  font-weight:900;
}

.unit-info-card{
  width:100%;
  text-align:left;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,.14);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.10), transparent 34%),
    linear-gradient(180deg, rgba(30,41,59,.96), rgba(8,17,31,.94));
  color:#e5eefc;
  cursor:pointer;
  transition:transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.unit-info-card:hover{
  transform:translateY(-1px);
}

.unit-info-card.active{
  border-color:rgba(103,232,249,.50);
  box-shadow:0 10px 24px rgba(14,165,233,.12), inset 0 0 0 1px rgba(103,232,249,.12);
}

.unit-info-top{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:5px;
}

.unit-info-top strong{
  font-size:14px;
}

.unit-info-count{
  margin-left:auto;
  min-width:24px;
  text-align:center;
  padding:2px 6px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  color:#dbeafe;
  background:rgba(56,189,248,.16);
  border:1px solid rgba(56,189,248,.2);
}

.unit-info-meta{
  font-size:12px;
  color:#cbd5e1;
  line-height:1.35;
}

@media (max-width:700px){
  .unit-info-panel{
    left:12px;
    top:52px;
    width:min(220px, calc(100% - 24px));
    padding:10px;
    gap:8px;
  }

  .unit-info-card{
    padding:9px 10px;
  }

  .unit-info-top strong{
    font-size:13px;
  }

  .unit-info-meta{
    font-size:11px;
  }
}


.unit-info-panel{
  z-index:14;
}


/* Clean left corner: use only View panel content there */
.map-unit-controls{
  display:none !important;
}

.unit-info-panel{
  left:18px;
  top:auto;
  bottom:18px;
  width:min(300px, calc(100% - 110px));
  padding:10px;
  border-radius:18px;
  background:rgba(8,17,31,.94);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 18px 40px rgba(0,0,0,.35);
}

.unit-info-header{
  margin-bottom:2px;
}

.unit-info-header strong{
  font-size:13px;
  letter-spacing:.10em;
  text-transform:uppercase;
  color:#7dd3fc;
}

.unit-info-card{
  padding:10px 12px;
  border-radius:16px;
}

.unit-info-meta{
  opacity:.92;
}

/* remove leftover bottom-left stage strip if any visual remains strong */
.canvas-wrap .unit-info-panel + .tower-menu + *{
  isolation:isolate;
}

@media (max-width:700px){
  .unit-info-panel{
    left:12px;
    bottom:12px;
    width:calc(100% - 140px);
    padding:8px;
    border-radius:16px;
  }

  .unit-info-card{
    padding:8px 10px;
    border-radius:14px;
  }

  .unit-info-header strong{
    font-size:12px;
  }
}


.unit-info-panel{
  transform:translateY(0);
  opacity:1;
  transition:transform .22s ease, opacity .22s ease;
}

.unit-info-panel.hidden{
  display:flex;
  opacity:0;
  pointer-events:none;
  transform:translateY(14px);
}

@media (max-width:700px){
  .unit-info-panel.hidden{
    transform:translateY(10px);
  }
}


/* unit drawer: top-right, 2x2 cards */
.unit-info-panel{
  left:auto;
  right:18px;
  top:56px;
  bottom:auto;
  width:min(300px, calc(100% - 36px));
}

.unit-info-panel .unit-info-header{
  display:none;
}

.unit-info-panel{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.unit-info-card{
  margin:0;
}

.unit-info-card .unit-info-meta{
  font-size:11px;
}

@media (max-width:700px){
  .unit-info-panel{
    right:12px;
    top:52px;
    width:min(280px, calc(100% - 24px));
    gap:8px;
  }

  .unit-info-card .unit-info-meta{
    font-size:10px;
  }
}


.map-btn.map-btn-camera.active{
  border-color:rgba(167,139,250,.58);
  box-shadow:
    0 0 0 1px rgba(167,139,250,.12),
    0 12px 30px rgba(139,92,246,.24),
    0 10px 24px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(167,139,250,.10);
  color:#f3e8ff;
  filter:saturate(1.08);
}


/* ===== Fantasy Unit Panel (bottom-left) ===== */
.unit-info-panel{
  left:18px;
  right:auto;
  bottom:18px;
  top:auto;
  width:min(300px, calc(100% - 36px));
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  padding:12px;
  border-radius:20px;
  background:linear-gradient(180deg, rgba(12,22,40,.95), rgba(6,12,24,.96));
  border:1px solid rgba(148,163,184,.18);
  box-shadow:
    0 18px 40px rgba(0,0,0,.45),
    inset 0 0 0 1px rgba(255,255,255,.04);
}

/* hide header title for cleaner mobile UI */
.unit-info-panel .unit-info-header{
  display:none;
}

/* unit card fantasy style */
.unit-info-card{
  background:linear-gradient(180deg, rgba(25,45,75,.65), rgba(10,20,40,.7));
  border:1px solid rgba(148,163,184,.18);
  border-radius:16px;
  padding:10px 12px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.04),
    0 6px 18px rgba(0,0,0,.35);
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.unit-info-card:hover{
  transform:translateY(-2px);
  border-color:rgba(125,211,252,.45);
  box-shadow:
    0 10px 22px rgba(0,0,0,.45),
    0 0 0 1px rgba(125,211,252,.15);
}

/* icon + name */
.unit-info-card strong{
  font-size:13px;
  letter-spacing:.04em;
}

/* meta text */
.unit-info-meta{
  font-size:11px;
  opacity:.85;
  margin-top:4px;
}

/* mobile tweaks */
@media (max-width:700px){
  .unit-info-panel{
    left:12px;
    bottom:12px;
    width:min(280px, calc(100% - 24px));
    gap:8px;
    padding:10px;
  }

  .unit-info-card{
    padding:8px 10px;
  }

  .unit-info-meta{
    font-size:10px;
  }
}


.unit-info-top strong{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:13px;
}

/* stronger placement preview */

.unit-info-top{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:16px;
}

.unit-info-top strong{
  display:flex;
  align-items:center;
  gap:6px;
}


/* overlay quick guide */
.overlay-quick-guide{
  margin:18px 0 22px;
  padding:14px 16px;
  border-radius:18px;
  background:rgba(8,17,31,.62);
  border:1px solid rgba(148,163,184,.12);
}
.quick-guide-title{
  margin-bottom:10px;
  font-size:12px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:#7dd3fc;
  font-weight:800;
}
.quick-guide-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px 14px;
  color:#dbe7f7;
  font-size:13px;
}
.quick-guide-grid span{
  display:flex;
  align-items:center;
  gap:8px;
}
kbd{
  min-width:30px;
  padding:4px 8px;
  border-radius:8px;
  border:1px solid rgba(171,131,84,.18);
  background:rgba(62,42,28,.72);
  box-shadow:inset 0 -1px 0 rgba(255,255,255,.04);
  color:#f3e7d1;
  font:700 12px/1 Inter, Arial, sans-serif;
  text-align:center;
}

/* shortcut card */
.shortcuts-card .shortcut-list{
  display:grid;
  gap:10px;
  margin-top:14px;
}
.shortcuts-card .shortcut-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(16,12,9,.58);
  border:1px solid rgba(171,131,84,.10);
}
.shortcuts-card .shortcut-item span{
  color:#dbe7f7;
  font-size:13px;
  line-height:1.35;
}

/* top-right settings control */
.settings-toggle{
  position:absolute;
  top:8px;
  right:8px;
  z-index:18;
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.07);
  border-radius:14px;
  padding:0;
  margin:0;
  background:rgba(8,17,31,.92);
  color:#e5eefc;
  font-size:19px;
  line-height:1;
  cursor:pointer;
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.025);
  transition:transform .14s ease, opacity .14s ease, filter .14s ease, background .18s ease;
}
.settings-toggle:hover{
  transform:translateY(-1px) rotate(8deg);
}
.settings-toggle.muted{
  opacity:.68;
  filter:saturate(.65);
}
.settings-toggle.partial{
  background:rgba(84,58,20,.94);
}
.settings-toggle.active{
  background:rgba(20,83,45,.94);
}

.audio-settings-panel{
  position:absolute;
  top:48px;
  right:8px;
  z-index:40;
  width:min(286px, calc(100% - 24px));
  padding:14px;
  border:1px solid rgba(195,157,99,.34);
  border-radius:18px;
  background:linear-gradient(160deg, rgba(13,21,34,.985), rgba(8,13,23,.985));
  color:#e8eef8;
  box-shadow:0 22px 55px rgba(0,0,0,.52), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter:blur(12px);
}
.audio-settings-panel.hidden{ display:none; }
.audio-settings-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:1px 2px 11px;
  border-bottom:1px solid rgba(195,157,99,.16);
}
.audio-settings-kicker{
  display:block;
  margin-bottom:2px;
  color:#b9935a;
  font-size:9px;
  font-weight:800;
  letter-spacing:.16em;
}
.audio-settings-header h3{
  margin:0;
  color:#fff5df;
  font-family:"Cinzel", Georgia, serif;
  font-size:18px;
  line-height:1.1;
}
.audio-settings-close{
  width:30px;
  height:30px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:10px;
  background:rgba(255,255,255,.035);
  color:#cbd5e1;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}
.audio-settings-close:hover{ background:rgba(255,255,255,.08); color:#fff; }
.audio-settings-list{
  display:grid;
  gap:8px;
  padding-top:11px;
}
.audio-setting-row{
  display:grid;
  grid-template-columns:30px minmax(0,1fr) 38px 24px;
  align-items:center;
  gap:9px;
  width:100%;
  min-height:52px;
  padding:8px 9px;
  border:1px solid rgba(255,255,255,.065);
  border-radius:13px;
  background:rgba(255,255,255,.025);
  color:#e5edf8;
  text-align:left;
  cursor:pointer;
  transition:border-color .15s ease, background .15s ease, opacity .15s ease;
}
.audio-setting-row:hover{
  border-color:rgba(195,157,99,.3);
  background:rgba(195,157,99,.07);
}
.audio-setting-row.off{ opacity:.62; }
.audio-setting-glyph{
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  border-radius:9px;
  background:rgba(73,113,153,.18);
  color:#bed8f3;
  font-size:15px;
}
.audio-setting-copy{ display:grid; gap:2px; min-width:0; }
.audio-setting-copy strong{ font-size:13px; line-height:1.1; }
.audio-setting-copy small{ color:#8796aa; font-size:10px; line-height:1.15; white-space:nowrap; }
.audio-setting-switch{
  position:relative;
  width:38px;
  height:22px;
  border-radius:999px;
  background:#374151;
  box-shadow:inset 0 1px 3px rgba(0,0,0,.35);
  transition:background .16s ease;
}
.audio-setting-switch i{
  position:absolute;
  top:3px;
  left:3px;
  width:16px;
  height:16px;
  border-radius:50%;
  background:#cbd5e1;
  box-shadow:0 2px 6px rgba(0,0,0,.35);
  transition:transform .16s ease, background .16s ease;
}
.audio-setting-row[aria-pressed="true"] .audio-setting-switch{ background:#28775c; }
.audio-setting-row[aria-pressed="true"] .audio-setting-switch i{ transform:translateX(16px); background:#f0fff8; }
.audio-setting-state{
  color:#8fe0b7;
  font-size:10px;
  font-weight:800;
  text-align:right;
  text-transform:uppercase;
}
.audio-setting-row.off .audio-setting-state{ color:#94a3b8; }

.audio-setting-volume-row{
  display:grid;
  grid-template-columns:minmax(0,auto) minmax(0,1fr) 40px;
  align-items:center;
  gap:9px;
  padding:2px 11px 4px 12px;
}
.audio-setting-volume-label{
  font-size:10px;
  color:#8796aa;
  text-transform:uppercase;
  letter-spacing:.04em;
  white-space:nowrap;
}
.audio-setting-volume-value{
  font-size:10px;
  font-weight:800;
  color:#bed8f3;
  text-align:right;
}
.audio-setting-slider{
  -webkit-appearance:none;
  appearance:none;
  width:100%;
  height:5px;
  border-radius:999px;
  background:linear-gradient(90deg,#28775c,#3aa17a);
  outline:none;
  cursor:pointer;
}
.audio-setting-slider:disabled{
  background:#374151;
  cursor:not-allowed;
  opacity:.55;
}
.audio-setting-slider::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:15px;
  height:15px;
  border-radius:50%;
  background:#f0fff8;
  border:2px solid #28775c;
  box-shadow:0 2px 6px rgba(0,0,0,.4);
  cursor:pointer;
}
.audio-setting-slider:disabled::-webkit-slider-thumb{ border-color:#4b5563; background:#cbd5e1; }
.audio-setting-slider::-moz-range-thumb{
  width:15px;
  height:15px;
  border-radius:50%;
  background:#f0fff8;
  border:2px solid #28775c;
  box-shadow:0 2px 6px rgba(0,0,0,.4);
  cursor:pointer;
}
.audio-setting-slider:disabled::-moz-range-thumb{ border-color:#4b5563; background:#cbd5e1; }

@media (max-width:700px){
  .quick-guide-grid{
    grid-template-columns:1fr;
    font-size:12px;
  }
  .shortcuts-card .shortcut-item{
    padding:9px 10px;
  }
  .settings-toggle{
    width:32px;
    height:32px;
    border-radius:10px;
    font-size:17px;
  }
  .audio-settings-panel{
    top:calc(46px + var(--safe-top));
    right:calc(8px + var(--safe-right));
  }
}


/* Global endless bonus leaderboard */
.hero-actions-leaderboard{
  width:min(100%, 332px);
  align-self:center;
  flex:0 0 auto;
}

.hero-leaderboard{
  width:100%;
  padding:16px 18px;
  border-radius:22px;
  background:linear-gradient(180deg, rgba(34,26,20,.52), rgba(14,12,10,.60));
  border:1px solid rgba(171,131,84,.18);
  box-shadow:0 18px 36px rgba(0,0,0,.18);
  backdrop-filter:blur(6px);
}

.hero-leaderboard-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:8px;
  padding:12px 14px;
  border-radius:16px;
  background:rgba(26,19,14,.22);
  border:1px solid rgba(171,131,84,.14);
  backdrop-filter:blur(4px);
}

.hero-leaderboard-head h3{
  margin:2px 0 0;
  font-size:18px;
}

.hero-refresh-btn{
  padding:9px 12px;
  min-height:40px;
  font-size:13px;
}

.hero-leaderboard-sub{
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
  margin-bottom:10px;
}

.hero-leaderboard-list{
  display:grid;
  gap:8px;
}

.leaderboard-row{
  display:grid;
  grid-template-columns:26px 1fr auto;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(20,16,12,.34);
  border:1px solid rgba(171,131,84,.10);
}

.leaderboard-rank{
  width:26px;
  height:26px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-size:12px;
  font-weight:900;
  color:#f6e7c6;
  background:rgba(171,131,84,.18);
  border:1px solid rgba(210,170,118,.24);
}

.leaderboard-main{
  min-width:0;
}

.leaderboard-name{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  font-size:13px;
  color:#f8fafc;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.leaderboard-meta{
  display:block;
  margin-top:2px;
  font-size:11px;
  color:var(--muted);
}

.leaderboard-score{
  font-size:13px;
  font-weight:900;
  color:#d7b06a;
  white-space:nowrap;
}

.leaderboard-empty{
  padding:12px;
  border-radius:14px;
  color:var(--muted);
  background:rgba(8,17,31,.6);
  border:1px dashed rgba(148,163,184,.12);
  font-size:13px;
}

@media (max-width:1080px){
  .hero-actions-leaderboard{
    width:min(100%, 380px);
  }
}

@media (max-width:700px){
  .hero-leaderboard{
    padding:12px 14px;
    border-radius:18px;
  }

  .hero-leaderboard-head h3{
    font-size:16px;
  }

  .hero-refresh-btn{
    min-height:36px;
    padding:8px 10px;
    font-size:12px;
  }

  .leaderboard-row{
    grid-template-columns:22px 1fr auto;
    gap:8px;
    padding:9px 10px;
  }

  .leaderboard-rank{
    width:22px;
    height:22px;
    font-size:11px;
  }

  .leaderboard-name{
    font-size:12px;
  }

  .leaderboard-score{
    font-size:12px;
  }
}


/* Player spells */
.map-spells{
  position:absolute;
  left:18px;
  top:18px;
  z-index:12;
  display:grid;
  grid-template-columns:repeat(3, 78px);
  gap:10px;
}
.spell-btn{
  position:relative;
  min-height:68px;
  border:none;
  padding:8px 8px 7px;
  border-radius:18px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.16), transparent 35%),
    linear-gradient(180deg, rgba(30,41,59,.96), rgba(8,17,31,.96));
  color:#f8fafc;
  box-shadow:
    0 12px 28px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(255,255,255,.05);
  cursor:pointer;
  transition:transform .14s ease, box-shadow .14s ease, opacity .14s ease, border-color .14s ease;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
}
.spell-btn:hover{ transform:translateY(-1px); }
.spell-btn:disabled{ opacity:.6; cursor:not-allowed; transform:none; }
.spell-btn.active{
  box-shadow:
    0 0 0 1px rgba(255,255,255,.12),
    0 14px 32px rgba(0,0,0,.34),
    inset 0 0 0 1px rgba(255,255,255,.06);
}
.spell-frost{ color:#dbeafe; border:1px solid rgba(147,197,253,.32); }
.spell-fire{ color:#ffedd5; border:1px solid rgba(251,146,60,.34); }
.spell-light{ color:#fef9c3; border:1px solid rgba(250,204,21,.32); }
.spell-glyph{
  font-size:22px;
  line-height:1;
}
.spell-caption{
  font-size:10px;
  letter-spacing:.12em;
  text-transform:uppercase;
  opacity:.88;
}
.spell-timer{
  font-size:11px;
  font-weight:800;
  opacity:.95;
}
@media (max-width:700px){
  .map-spells{
    left:12px;
    top:12px;
    grid-template-columns:repeat(3, 64px);
    gap:8px;
  }
  .spell-btn{
    min-height:58px;
    border-radius:16px;
    padding:7px 6px;
  }
  .spell-glyph{ font-size:18px; }
  .spell-caption{ font-size:9px; }
  .spell-timer{ font-size:10px; }
}

/* ===== Boss Aura Reward System ===== */
.overlay-reward{
  width:min(100%, 860px);
}
.reward-kicker{
  margin-bottom:10px;
  font-size:12px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:#7dd3fc;
  font-weight:800;
}
.reward-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:14px;
  margin:20px 0 16px;
}
.reward-card{
  text-align:left;
  padding:16px;
  border-radius:20px;
  border:1px solid rgba(148,163,184,.16);
  background:linear-gradient(180deg, rgba(16,27,47,.96), rgba(8,17,31,.96));
  color:#f8fafc;
  box-shadow:0 16px 34px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.04);
  cursor:pointer;
  transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.reward-card:hover{
  transform:translateY(-2px);
}
.reward-card.inferno{ border-color:rgba(251,146,60,.45); box-shadow:0 16px 38px rgba(251,146,60,.18), inset 0 0 0 1px rgba(251,146,60,.12); }
.reward-card.focus{ border-color:rgba(96,165,250,.45); box-shadow:0 16px 38px rgba(59,130,246,.18), inset 0 0 0 1px rgba(96,165,250,.12); }
.reward-card.frost{ border-color:rgba(103,232,249,.45); box-shadow:0 16px 38px rgba(34,211,238,.18), inset 0 0 0 1px rgba(103,232,249,.12); }
.reward-card.storm{ border-color:rgba(250,204,21,.45); box-shadow:0 16px 38px rgba(250,204,21,.18), inset 0 0 0 1px rgba(250,204,21,.12); }
.reward-card.wealth{ border-color:rgba(251,191,36,.45); box-shadow:0 16px 38px rgba(245,158,11,.18), inset 0 0 0 1px rgba(251,191,36,.12); }
.reward-card-icon{
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  border-radius:16px;
  font-size:24px;
  margin-bottom:12px;
  background:rgba(255,255,255,.05);
}
.reward-card-title{
  font-size:18px;
  font-weight:800;
  margin-bottom:6px;
}
.reward-card-sub{
  font-size:12px;
  color:#cbd5e1;
  min-height:34px;
  line-height:1.45;
}
.reward-card-points{
  margin-top:12px;
  display:grid;
  gap:6px;
  font-size:12px;
  color:#dbeafe;
}
.reward-card-points span{
  display:block;
}
.boss-loot-reward{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  margin:16px 0 8px;
  padding:14px 16px;
  border:1px solid color-mix(in srgb, var(--loot-color, #60a5fa) 48%, transparent);
  border-radius:18px;
  background:
    radial-gradient(circle at 8% 50%, color-mix(in srgb, var(--loot-color, #60a5fa) 18%, transparent), transparent 38%),
    rgba(8,17,31,.88);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.035);
}
.boss-loot-reward.hidden{display:none}
.boss-loot-icon{
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  border-radius:15px;
  background:color-mix(in srgb, var(--loot-color, #60a5fa) 16%, rgba(15,23,42,.9));
  color:var(--loot-color, #60a5fa);
  font-size:25px;
}
.boss-loot-copy{min-width:0}
.boss-loot-label{
  color:#94a3b8;
  font-size:10px;
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.boss-loot-name{
  margin-top:3px;
  color:var(--loot-color, #60a5fa);
  font-size:17px;
  font-weight:800;
}
.boss-loot-meta{
  margin-top:3px;
  color:#cbd5e1;
  font-size:11px;
}
.boss-loot-power{
  text-align:right;
  color:#f8fafc;
  font-weight:800;
}
.boss-loot-power span{
  display:block;
  color:#94a3b8;
  font-size:9px;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.stat-item-loot strong{color:#c084fc}
.reward-note{
  min-height:22px;
  color:#fef3c7;
  font-size:13px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(8,17,31,.72);
  border:1px solid rgba(251,191,36,.16);
}
.aura-candidate{
  animation:auraPulse 1.2s ease-in-out infinite;
}
@keyframes auraPulse{
  0%,100%{ box-shadow:0 0 0 0 rgba(103,232,249,.0); }
  50%{ box-shadow:0 0 0 6px rgba(103,232,249,.08); }
}
@media (max-width:780px){
  #auraRewardOverlay{
    align-items:flex-start;
    overflow-y:auto;
    overscroll-behavior:contain;
    padding:16px 12px;
  }
  .reward-grid{ grid-template-columns:1fr; }
  .boss-loot-reward{grid-template-columns:auto minmax(0,1fr)}
  .boss-loot-power{grid-column:2;text-align:left}
}


.seo-copy{
  margin-bottom:22px;
  padding:22px 24px;
  border-radius:28px;
}

.seo-copy-grid{
  display:grid;
  grid-template-columns:1.3fr 1fr;
  gap:22px;
  align-items:start;
}

.seo-copy h2{
  margin:8px 0 10px;
  font-size:clamp(22px, 2.4vw, 32px);
}

.seo-copy p{
  margin:0;
  color:var(--muted);
  line-height:1.7;
}

.seo-feature-list{
  margin:8px 0 0;
  padding-left:18px;
  color:#dbe7f7;
  line-height:1.7;
}

.seo-feature-list li + li{
  margin-top:4px;
}

@media (max-width:900px){
  .seo-copy-grid{
    grid-template-columns:1fr;
    gap:16px;
  }
}

@media (max-width:700px){
  .seo-copy{
    padding:16px;
    border-radius:22px;
    margin-bottom:14px;
  }

  .seo-copy h2{
    font-size:20px;
  }

  .seo-copy p,
  .seo-feature-list{
    font-size:13px;
  }
}


/* === UI polish v2 === */
/* Larger map layout */
.canvas-wrap{ padding:16px; }
#gameCanvas{ max-width:100%; aspect-ratio: 1008 / 560; }
.sidebar .command-card .message-box{ min-height:72px; }
.sidebar .progress-box{ margin-top:10px; }
.sidebar .spotlight-item strong{ font-size:26px; }
.sidebar .compact-stats{ grid-template-columns:repeat(4, minmax(0,1fr)); }
.sidebar .compact-stats .stat-item{ padding:12px; }
.sidebar .compact-stats .stat-item strong{ font-size:18px; }
@media (max-width: 1200px){
  .sidebar{ grid-template-columns:1fr; }
  .sidebar .compact-stats{ grid-template-columns:1fr 1fr; }
}

.compact-label{margin:0 0 4px;font-size:10px;letter-spacing:.16em}
.command-card .message-box.emphasis{
  background:linear-gradient(180deg, rgba(28,20,14,.72), rgba(14,11,8,.68));
  border-color:rgba(171,131,84,.14);
  min-height:96px;
}
.overview-card .spotlight-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin:6px 0 14px;
}
.spotlight-item{
  padding:16px;
  border-radius:20px;
  background:linear-gradient(180deg, rgba(28,20,14,.68), rgba(14,11,8,.64));
  border:1px solid rgba(171,131,84,.12);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.03);
}
.spotlight-item span{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:8px;
}
.spotlight-item strong{
  display:block;
  font-size:30px;
  line-height:1;
}
.spotlight-item.bonus strong{color:#fde68a}
.compact-stats{grid-template-columns:1fr 1fr}
.compact-stats .stat-item strong{font-size:22px}
.meta-row{display:flex;gap:10px;margin-top:12px}
.meta-pill{
  width:100%;
  padding:11px 13px;
  border-radius:16px;
  background:rgba(8,17,31,.72);
  border:1px solid rgba(148,163,184,.1);
  color:var(--muted);
  font-size:13px;
}
.meta-pill strong{color:#f8fafc;font-size:18px;margin-left:8px}
.compact-help .shortcut-list{
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.compact-help .shortcut-item{
  min-height:52px;
  padding:10px 12px;
}
.compact-help .shortcut-item span{font-size:12px}

/* Shop panel */
.unit-info-panel{
  width:min(340px, calc(100% - 36px));
  padding:12px;
  gap:12px;
  grid-template-columns:1fr 1fr;
}
.unit-shop-header{
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:2px 2px 0;
}
.unit-shop-header strong{font-size:18px;color:#f8fafc}
.unit-info-card{
  padding:12px;
  border-radius:18px;
  background:linear-gradient(180deg, rgba(22,38,63,.92), rgba(8,17,31,.96));
}
.unit-card-headline{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}
.unit-role-tag{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 8px;
  border-radius:999px;
  font-size:10px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#dbeafe;
  background:rgba(56,189,248,.14);
  border:1px solid rgba(56,189,248,.18);
}
.unit-role-tag.power{color:#ffedd5;background:rgba(251,146,60,.14);border-color:rgba(251,146,60,.22)}
.unit-role-tag.splash{color:#ede9fe;background:rgba(167,139,250,.14);border-color:rgba(167,139,250,.22)}
.unit-role-tag.blast{color:#fee2e2;background:rgba(251,113,133,.14);border-color:rgba(251,113,133,.22)}
.unit-role-tag.cryo{color:#cffafe;background:rgba(34,211,238,.14);border-color:rgba(103,232,249,.28)}
.unit-cost-badge{
  min-width:42px;
  text-align:center;
  padding:6px 8px;
  border-radius:12px;
  font-size:12px;
  font-weight:900;
  color:#d7b06a;
  background:rgba(250,204,21,.08);
  border:1px solid rgba(250,204,21,.16);
}

.unit-info-card.unit-locked{
  border-color:rgba(103,232,249,.16);
  filter:saturate(.72);
}

.unit-info-card.unit-locked:hover{
  border-color:rgba(103,232,249,.42);
  filter:saturate(1);
}

.unit-info-card.unit-locked .unit-info-top strong::after{
  content:"  LOCKED";
  color:#7dd3fc;
  font-size:9px;
  letter-spacing:.08em;
}

.unit-cost-badge.crystal-cost{
  color:#cffafe;
  border-color:rgba(94,234,212,.34);
  background:rgba(13,148,136,.16);
}
.unit-bar-group{display:grid;gap:7px;margin:10px 0 8px}
.unit-bar{
  display:grid;
  grid-template-columns:72px 1fr;
  align-items:center;
  gap:8px;
  font-size:10px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:#94a3b8;
}
.unit-bar i{
  position:relative;
  display:block;
  height:8px;
  border-radius:999px;
  background:rgba(148,163,184,.12);
  overflow:hidden;
}
.unit-bar i::after{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:var(--fill);
  border-radius:999px;
  background:linear-gradient(90deg, #67e8f9, #38bdf8);
}
.unit-card-footer{
  display:flex;
  justify-content:flex-end;
  margin-top:8px;
}
.unit-info-card.active{
  border-color:rgba(103,232,249,.64);
  box-shadow:0 14px 28px rgba(14,165,233,.15), inset 0 0 0 1px rgba(103,232,249,.14);
}

/* Tower popup */
.tower-menu{
  min-width:220px;
  max-width:250px;
  padding:14px;
  border-radius:18px;
}
.tower-menu-header{margin-bottom:10px}
.tower-menu-header strong{font-size:16px}
.tower-menu-level-sub{
  margin-top:4px;
  color:#cbd5e1;
  font-size:12px;
  font-weight:700;
}
.tower-menu-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:5px 9px;
  border-radius:999px;
  font-size:10px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#7dd3fc;
  background:rgba(56,189,248,.12);
  border:1px solid rgba(56,189,248,.18);
}
.tower-menu-stats{
  display:grid;
  gap:8px;
  margin-bottom:12px;
}
.tower-stat-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 10px;
  border-radius:12px;
  background:rgba(15,23,42,.86);
  border:1px solid rgba(148,163,184,.1);
  color:#cbd5e1;
  font-size:12px;
}
.tower-stat-row strong{color:#f8fafc;font-size:13px}
.tower-menu-actions{grid-template-columns:1fr 1fr}
.tower-sell-btn{
  background:rgba(60,18,28,.92);
  border-color:rgba(251,113,133,.18);
  color:#ffe4e6;
}

@media (max-width:700px){
  .overview-card .spotlight-grid,
  .compact-help .shortcut-list{grid-template-columns:1fr}
  .unit-info-panel{
    width:min(300px, calc(100% - 24px));
    gap:8px;
  }
  .unit-shop-header strong{font-size:16px}
  .unit-info-card{padding:10px}
  .tower-menu{
    min-width:190px;
    max-width:210px;
    padding:10px;
  }
}


.hero-cta-row{
  display:flex;
  align-items:flex-start;
  gap:14px;
  margin-top:18px;
}

.hero-play-btn{
  padding:12px 22px;
  min-width:132px;
  flex:0 0 auto;
  align-self:flex-start;
}

.hero-copy .hero-actions{
  display:flex;
  flex-wrap:wrap;
  width:auto;
  gap:10px;
}

.hero-nav-actions{
  align-items:flex-start;
}

.hero-nav-actions .btn{
  min-width:0;
  width:auto;
  padding:8px 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  white-space:nowrap;
  line-height:1.1;
  font-size:13px;
  flex:0 0 auto;
  opacity:.96;
}

@media (max-width: 760px){
  .hero-cta-row{
    flex-direction:column;
    align-items:stretch;
    gap:12px;
  }

  .hero-plate-btn{
    width:100%;
  }

  .hero-play-btn{
    min-width:0;
    width:100%;
  }

  .hero-nav-actions{
    gap:10px;
  }

  .hero-nav-actions .btn{
    flex:1 1 calc(50% - 5px);
    white-space:normal;
  }
}

@media (max-width: 460px){
  .hero-nav-actions .btn{
    flex:1 1 100%;
  }
}

.page-content{
  max-width:1120px;
  margin:0 auto;
  padding:24px;
}

.content-hero{
  padding:32px;
  border-radius:28px;
  margin-bottom:22px;
  text-align:center;
}

.content-hero h1{
  margin:0 0 12px;
  font-size:clamp(30px,4vw,48px);
}

.content-hero p{
  max-width:760px;
  margin:0 auto;
  color:var(--muted);
  line-height:1.7;
}

.content-grid{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:22px;
  margin-bottom:22px;
}

.content-card{
  padding:24px;
  border-radius:28px;
}

.content-card h2{
  margin:8px 0 12px;
  font-size:28px;
}

.content-card p, .content-card li{
  color:var(--muted);
  line-height:1.7;
}

.cta-row{
  display:flex;
  justify-content:center;
  gap:12px;
  margin:28px 0 8px;
  flex-wrap:wrap;
}

.guide-list{
  margin:0;
  padding-left:20px;
}

.site-footer{
  text-align:center;
  padding:22px 16px 28px;
  color:var(--muted);
  font-size:14px;
}

@media (max-width:900px){
  .content-grid{grid-template-columns:1fr;}
}

@media (max-width:700px){
  .page-content{padding:14px;}
  .content-hero,.content-card{border-radius:22px;padding:18px;}
  .content-card h2{font-size:22px;}
}


/* ===== Leaderboards WOW page ===== */
.leaderboard-page{
  max-width:1360px;
  margin:0 auto;
  padding:24px;
}
.leaderboard-hero-wow{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:20px;
  padding:30px;
  border-radius:30px;
  margin:24px 0 20px;
  background:
    radial-gradient(circle at top right, rgba(250,204,21,.16), transparent 28%),
    radial-gradient(circle at left center, rgba(56,189,248,.16), transparent 22%),
    linear-gradient(135deg, rgba(12,22,40,.96), rgba(8,17,31,.96));
}
.leaderboard-hero-wow h1{ margin:8px 0 12px; font-size:clamp(34px, 4vw, 54px); }
.leaderboard-hero-wow p{ margin:0; color:var(--muted); max-width:760px; line-height:1.7; }
.leaderboard-hero-actions{ display:flex; gap:12px; flex-wrap:wrap; }
.leaderboard-wow-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
  margin-bottom:20px;
}
.leaderboard-wow-card{
  padding:22px;
  border-radius:28px;
  position:relative;
  overflow:hidden;
}
.leaderboard-wow-card::before{
  content:"";
  position:absolute;
  inset:-1px;
  pointer-events:none;
  border-radius:inherit;
  background:linear-gradient(140deg, rgba(255,255,255,.08), transparent 30%, transparent 70%, rgba(255,255,255,.05));
  mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
  padding:1px;
}
.leaderboard-card-endless{
  background:linear-gradient(180deg, rgba(11,24,40,.94), rgba(8,17,31,.96));
}
.leaderboard-card-story{
  background:linear-gradient(180deg, rgba(22,18,40,.94), rgba(8,17,31,.96));
}
.leaderboard-card-topline{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:10px;
}
.leaderboard-card-topline h2{ margin:4px 0 0; font-size:28px; }
.leaderboard-card-copy{ color:var(--muted); line-height:1.6; margin:0 0 18px; }
.leaderboard-glow-badge{
  padding:10px 14px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  background:rgba(56,189,248,.14);
  border:1px solid rgba(56,189,248,.28);
  color:#bae6fd;
}
.leaderboard-glow-badge.story{
  background:rgba(167,139,250,.16);
  border-color:rgba(167,139,250,.30);
  color:#e9d5ff;
}
.leaderboard-table-shell{
  border-radius:22px;
  overflow:hidden;
  border:1px solid rgba(148,163,184,.12);
  background:rgba(8,17,31,.65);
}
.leaderboard-table{
  display:grid;
  grid-template-columns:88px minmax(0, 1.4fr) 100px 110px 110px;
  align-items:center;
  gap:10px;
}
.leaderboard-table-header{
  padding:14px 16px;
  color:#93c5fd;
  font-size:11px;
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;
  border-bottom:1px solid rgba(148,163,184,.12);
  background:rgba(15,23,42,.94);
}
.leaderboard-table-body{ display:grid; }
.leaderboard-table-row{
  padding:14px 16px;
  border-bottom:1px solid rgba(148,163,184,.08);
  min-height:72px;
}
.leaderboard-table-row:last-child{ border-bottom:none; }
.wow-row{
  background:linear-gradient(180deg, rgba(10,18,34,.72), rgba(8,17,31,.86));
}
.wow-row:nth-child(odd){
  background:linear-gradient(180deg, rgba(14,25,43,.82), rgba(8,17,31,.9));
}
.leaderboard-player-cell{ min-width:0; display:grid; gap:4px; }
.leaderboard-player-cell strong{
  display:block;
  font-size:15px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.leaderboard-player-cell a,
.leaderboard-podium-card a{
  color:inherit;
  text-decoration:none;
}
.leaderboard-player-cell a:hover strong,
.leaderboard-podium-card a:hover strong{
  color:#f8e7ba;
}
.leaderboard-player-link{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.leaderboard-player-link strong{
  min-width:0;
}
.leaderboard-podium-player{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:8px;
  min-width:0;
}
.leaderboard-podium-player strong{
  margin-bottom:0 !important;
}
.leaderboard-player-cell span{ color:var(--muted); font-size:12px; }
.medal{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:56px;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(148,163,184,.12);
  border:1px solid rgba(148,163,184,.16);
  font-size:12px;
  font-weight:900;
}
.medal.gold{ background:rgba(250,204,21,.18); border-color:rgba(250,204,21,.32); color:#fde68a; }
.medal.silver{ background:rgba(226,232,240,.16); border-color:rgba(226,232,240,.24); color:#e2e8f0; }
.medal.bronze{ background:rgba(251,146,60,.18); border-color:rgba(251,146,60,.30); color:#fdba74; }
.wow-empty{
  margin:14px;
  border-radius:16px;
  background:rgba(8,17,31,.64);
}
.leaderboard-detail-strip{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:14px;
  margin-bottom:20px;
  padding:18px;
  border-radius:26px;
}
.leaderboard-detail-card{
  padding:18px;
  border-radius:20px;
  background:linear-gradient(180deg, rgba(12,22,40,.9), rgba(8,17,31,.92));
  border:1px solid rgba(148,163,184,.10);
}
.leaderboard-detail-card span{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:8px;
}
.leaderboard-detail-card strong{
  display:block;
  font-size:22px;
}
.leaderboard-seo-copy{ margin-bottom:24px; }
@media (max-width: 1080px){
  .leaderboard-wow-grid{ grid-template-columns:1fr; }
  .leaderboard-hero-wow{ flex-direction:column; align-items:flex-start; }
}
@media (max-width: 820px){
  .leaderboard-detail-strip{ grid-template-columns:1fr; }
  .leaderboard-table,
  .leaderboard-table-header{
    grid-template-columns:72px minmax(0, 1.2fr) 80px 92px 92px;
    font-size:12px;
  }
}
@media (max-width: 640px){
  .leaderboard-page{ padding:14px; }
  .leaderboard-hero-wow,
  .leaderboard-wow-card,
  .leaderboard-detail-strip{ border-radius:22px; padding:16px; }
  .leaderboard-card-topline h2{ font-size:22px; }
  .leaderboard-table,
  .leaderboard-table-header{
    grid-template-columns:1fr;
    gap:6px;
  }
  .leaderboard-table-header{ display:none; }
  .leaderboard-table-row{
    gap:8px;
    padding:14px;
  }
  .leaderboard-table-row > div{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
  .leaderboard-table-row > div::before{
    color:var(--muted);
    font-size:11px;
    letter-spacing:.12em;
    text-transform:uppercase;
  }
  .leaderboard-table-row.endless > div:nth-child(1)::before,
  .leaderboard-table-row.story > div:nth-child(1)::before{ content:"Rank"; }
  .leaderboard-table-row.endless > div:nth-child(2)::before,
  .leaderboard-table-row.story > div:nth-child(2)::before{ content:"Player"; }
  .leaderboard-table-row.endless > div:nth-child(3)::before{ content:"Wave"; }
  .leaderboard-table-row.endless > div:nth-child(4)::before{ content:"Bonus"; }
  .leaderboard-table-row.endless > div:nth-child(5)::before{ content:"Total"; }
  .leaderboard-table-row.story > div:nth-child(3)::before{ content:"Stage"; }
  .leaderboard-table-row.story > div:nth-child(4)::before{ content:"Total"; }
  .leaderboard-table-row.story > div:nth-child(5)::before{ content:"Bonus"; }
  .leaderboard-player-cell{ display:flex !important; flex-direction:column; align-items:flex-end; text-align:right; }
}


/* ===== Leaderboards podium polish ===== */
.leaderboard-refresh-main{min-width:170px}
.leaderboard-podium-preview{
  margin:0 0 20px;
  padding:22px;
  border-radius:28px;
  background:
    radial-gradient(circle at top left, rgba(250,204,21,.10), transparent 24%),
    radial-gradient(circle at bottom right, rgba(167,139,250,.10), transparent 24%),
    linear-gradient(180deg, rgba(12,22,40,.94), rgba(8,17,31,.96));
}
.leaderboard-podium-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-end;
  margin-bottom:18px;
}
.leaderboard-podium-head h2{margin:4px 0 0;font-size:30px}
.leaderboard-podium-copy{max-width:460px;color:var(--muted);line-height:1.6}
.leaderboard-podium-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.leaderboard-podium-column{
  padding:18px;
  border-radius:22px;
  background:rgba(8,17,31,.58);
  border:1px solid rgba(148,163,184,.10);
}
.leaderboard-podium-label{
  margin-bottom:14px;
  font-size:11px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:#7dd3fc;
  font-weight:800;
}
.leaderboard-podium-cards{display:grid;grid-template-columns:repeat(3, minmax(0,1fr));gap:12px}
.leaderboard-podium-card{
  position:relative;
  padding:18px 14px 16px;
  border-radius:20px;
  min-height:150px;
  background:linear-gradient(180deg, rgba(18,31,54,.92), rgba(8,17,31,.96));
  border:1px solid rgba(148,163,184,.14);
  box-shadow:0 14px 34px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.03);
  overflow:hidden;
}
.leaderboard-podium-card::after{
  content:"";
  position:absolute;
  inset:auto -12% -48% -12%;
  height:80px;
  background:radial-gradient(circle, rgba(255,255,255,.16), transparent 70%);
  opacity:.28;
  pointer-events:none;
}
.leaderboard-podium-card strong{display:block;font-size:17px;margin-bottom:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.leaderboard-podium-card span,
.leaderboard-podium-card small{display:block}
.leaderboard-podium-card span{color:#e2e8f0;font-weight:700;margin-bottom:6px}
.leaderboard-podium-card small{color:var(--muted);font-size:12px}
.leaderboard-podium-rank{margin-bottom:14px;font-size:12px;font-weight:900;letter-spacing:.14em;text-transform:uppercase;color:#cbd5e1}
.leaderboard-podium-card.gold,
.wow-row:first-child{
  box-shadow:0 0 0 1px rgba(250,204,21,.14), 0 18px 42px rgba(250,204,21,.12), inset 0 0 0 1px rgba(255,255,255,.04);
}
.leaderboard-podium-card.gold{border-color:rgba(250,204,21,.30);background:linear-gradient(180deg, rgba(70,52,12,.34), rgba(8,17,31,.96));transform:translateY(-6px)}
.leaderboard-podium-card.silver{border-color:rgba(226,232,240,.22);background:linear-gradient(180deg, rgba(51,65,85,.28), rgba(8,17,31,.96))}
.leaderboard-podium-card.bronze{border-color:rgba(251,146,60,.24);background:linear-gradient(180deg, rgba(91,46,14,.28), rgba(8,17,31,.96))}
.leaderboard-podium-card.placeholder{
  min-height:auto;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
}
.wow-row:nth-child(1){
  background:linear-gradient(180deg, rgba(69,54,15,.30), rgba(8,17,31,.92));
}
.wow-row:nth-child(2){
  background:linear-gradient(180deg, rgba(51,65,85,.24), rgba(8,17,31,.90));
}
.wow-row:nth-child(3){
  background:linear-gradient(180deg, rgba(124,58,18,.22), rgba(8,17,31,.88));
}
.medal.gold,.medal.silver,.medal.bronze{box-shadow:0 8px 20px rgba(0,0,0,.18)}
@media (max-width:1080px){
  .leaderboard-podium-grid{grid-template-columns:1fr}
  .leaderboard-podium-head{flex-direction:column;align-items:flex-start}
}
@media (max-width:820px){
  .leaderboard-podium-cards{grid-template-columns:1fr 1fr 1fr}
  .leaderboard-podium-head h2{font-size:24px}
}
@media (max-width:640px){
  .leaderboard-podium-preview{padding:16px;border-radius:22px}
  .leaderboard-podium-column{padding:14px;border-radius:18px}
  .leaderboard-podium-cards{grid-template-columns:1fr;gap:10px}
  .leaderboard-podium-card{min-height:auto;padding:14px}
  .leaderboard-refresh-main{width:100%}
}


/* === Dark fantasy typography refresh === */
html, body {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  letter-spacing: 0.3px;
}

.hero h1,
.overlay-card h1,
.panel-header h2,
.side-card h3,
.notification-header h3,
.hero-leaderboard-head h3,
.seo-copy h2,
.content-hero h1,
.content-card h2,
.leaderboard-hero-wow h1,
.leaderboard-card-topline h2,
.leaderboard-podium-head h2,
.reward-kicker,
.quick-guide-title {
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
  letter-spacing: 0.08em;
  color: #d8d0c2;
  text-shadow:
    0 0 8px rgba(255, 200, 120, 0.14),
    0 0 22px rgba(255, 140, 0, 0.10);
}

.hero h1,
.overlay-card h1,
.content-hero h1,
.leaderboard-hero-wow h1 {
  letter-spacing: 0.1em;
}

.panel-kicker,
.section-label,
.reward-kicker,
.quick-guide-title {
  letter-spacing: 0.16em;
  color: #c7a26b;
}

.btn,
button,
.hero-actions .btn,
.overlay-actions .btn {
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
  letter-spacing: 0.06em;
}

.btn-primary {
  background: linear-gradient(180deg, #d4a562, #8f5c31);
  color: #140f0b;
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.10);
}

.btn-secondary {
  background: linear-gradient(180deg, rgba(42, 31, 26, 0.96), rgba(18, 13, 11, 0.96));
  color: #eadfc4;
  border-color: rgba(112, 86, 64, 0.72);
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.08);
}

.btn:hover,
button:hover {
  box-shadow: 0 0 16px rgba(255, 140, 0, 0.18);
}

.badge,
.mini-pill,
.overlay-chip,
kbd {
  font-family: "Inter", Arial, Helvetica, sans-serif;
}


/* ===== Mobile safe-area + non-overlap fixes ===== */
@media (max-width:700px){
  .canvas-wrap{
    padding-top:calc(12px + var(--safe-top));
    padding-right:calc(12px + var(--safe-right));
    padding-bottom:calc(12px + var(--safe-bottom));
    padding-left:calc(12px + var(--safe-left));
  }

  .canvas-overlay{
    top:calc(12px + var(--safe-top));
    left:calc(12px + var(--safe-left));
    right:calc(12px + var(--safe-right));
  }

  .settings-toggle{
    top:calc(8px + var(--safe-top));
    right:calc(8px + var(--safe-right));
  }

  .canvas-top-hud.single-row{
    top:calc(8px + var(--safe-top));
    left:calc(12px + var(--safe-left));
    right:calc(48px + var(--safe-right));
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    justify-content:stretch;
    align-items:stretch;
    gap:6px;
  }

  .canvas-top-hud.single-row .badge{
    width:100%;
    min-width:0;
    text-align:center;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .map-spells{
    left:calc(12px + var(--safe-left));
    top:calc(72px + var(--safe-top));
    grid-template-columns:repeat(3, minmax(0, 1fr));
    width:min(232px, calc(100% - 24px - var(--safe-left) - var(--safe-right)));
  }

  .wave-forecast-overlay{
    top:calc(82px + var(--safe-top));
    left:auto;
    right:calc(12px + var(--safe-right));
    width:min(250px, calc(100% - 104px - var(--safe-left) - var(--safe-right)));
  }

  .unit-info-panel{
    left:calc(12px + var(--safe-left));
    right:calc(12px + var(--safe-right));
    bottom:calc(12px + var(--safe-bottom));
    width:auto;
    max-width:none;
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .unit-info-card,
  .unit-card-headline,
  .unit-info-top{
    min-width:0;
  }

  .unit-info-card strong,
  .unit-info-meta,
  .unit-role-tag,
  .unit-cost-badge{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .map-controls{
    right:calc(12px + var(--safe-right));
    bottom:calc(12px + var(--safe-bottom) + var(--mobile-bottom-stack));
  }

  .tower-menu{
    max-width:min(220px, calc(100% - 24px - var(--safe-left) - var(--safe-right)));
  }
}


/* HUD toggle + placement hide */
.hud-toggle{
  position:absolute;
  top:42px;
  right:8px;
  width:34px;
  height:34px;
  border:none;
  border-radius:14px;
  background:rgba(8,17,31,.92);
  color:#e5eefc;
  font-size:20px;
  line-height:1;
  cursor:pointer;
  z-index:16;
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.06);
  transition:transform .14s ease, opacity .18s ease, background .18s ease;
}
.hud-toggle:hover{ transform:translateY(-1px); }
.fullscreen-toggle{
  position:absolute;
  top:114px;
  right:8px;
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border:none;
  border-radius:14px;
  padding:0;
  margin:0;
  background:rgba(8,17,31,.92);
  color:#cbd5e1;
  font-size:17px;
  line-height:1;
  cursor:pointer;
  z-index:16;
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.06);
  transition:transform .14s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
.fullscreen-toggle:hover{ transform:translateY(-1px); color:#e5eefc; }
.fullscreen-toggle.active{ background:rgba(20,83,45,.88); color:#e5eefc; }

/* ===== Fullscreen (native API) ===== */
.canvas-wrap:fullscreen{
  padding:0;
  margin:0;
  border-radius:0;
  background:#0b0f1a;
  display:grid;
  place-items:center;
  width:100%;
  height:100%;
}
.canvas-wrap:fullscreen #gameCanvas{
  width:min(100vw, calc(100vh * (1008 / 560)));
  height:auto;
  max-width:none;
  border-radius:0;
}

/* ===== Pseudo-fullscreen (fallback iPhone Safari) ===== */
.canvas-wrap.pseudo-fullscreen{
  position:fixed;
  inset:0;
  z-index:9999;
  margin:0;
  border-radius:0;
  background:#0b0f1a;
  display:grid;
  place-items:center;
  padding:var(--safe-top, 0px) 0 var(--safe-bottom, 0px);
}
.canvas-wrap.pseudo-fullscreen #gameCanvas{
  width:min(100vw, calc(100dvh * (1008 / 560)));
  height:auto;
  max-width:none;
  border-radius:0;
}
body.pseudo-fs-active{ overflow:hidden; }
.hud-toggle.active{ background:rgba(20,83,45,.88); }
.canvas-wrap.hud-hide-obstacles .map-controls,
.canvas-wrap.hud-hide-obstacles .map-spells,
.canvas-wrap.hud-hide-obstacles .unit-info-panel,
.canvas-wrap.hud-hide-obstacles .overlay-chip{
  opacity:0;
  pointer-events:none;
  transform:translateY(8px);
}
.canvas-wrap .map-controls,
.canvas-wrap .map-spells,
.canvas-wrap .unit-info-panel,
.canvas-wrap .overlay-chip{
  transition:opacity .18s ease, transform .18s ease;
}
@media (max-width:700px){
  .hud-toggle{
    top:calc(38px + var(--safe-top));
    right:calc(8px + var(--safe-right));
    width:32px;
    height:32px;
    border-radius:10px;
    font-size:15px;
  }
  .fullscreen-toggle{
    top:calc(106px + var(--safe-top));
    right:calc(8px + var(--safe-right));
    width:32px;
    height:32px;
    border-radius:10px;
    font-size:15px;
  }
}


.endless-unlocked-overlay{
  padding: 14px;
  background: rgba(2,0,0,.88);
  backdrop-filter: blur(2px);
}
.endless-unlocked-overlay::before{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(circle at center, rgba(255,80,40,.08), transparent 36%), linear-gradient(180deg, rgba(8,0,0,.22), rgba(5,0,0,.48));
  pointer-events:none;
}
.endless-unlocked-artwork{
  position: relative;
  display: inline-block;
  width: auto;
  height: auto;
  max-width: min(100%, 1500px);
  max-height: calc(100vh - 28px);
  line-height: 0;
}
.endless-unlocked-artwork img{
  display:block;
  width:auto;
  max-width:100%;
  max-height: calc(100vh - 28px);
  height:auto;
  object-fit:contain;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}

.reward-bonus{
  margin-top: 14px;
  text-align: center;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fbbf24;
  text-shadow: 0 2px 14px rgba(0,0,0,.45), 0 0 22px rgba(251,191,36,.18);
}

.endless-unlocked-copy{
  max-width: 100%;
  margin: 0;
  color: rgba(255,245,238,.96);
  text-align:center;
  text-shadow: 0 3px 18px rgba(0,0,0,.86), 0 0 26px rgba(140,10,10,.32);
}
.endless-unlocked-textstack{
  position:absolute;
  left:50%;
  top:53%;
  transform:translate(-50%, -50%);
  width: min(88%, 760px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: clamp(10px, 1.6vh, 22px);
  pointer-events:none;
}
.endless-unlocked-quote{
  max-width: 100%;
  font-size: clamp(18px, 1.8vw, 32px);
  line-height:1.35;
}
.endless-unlocked-reward{
  max-width: 100%;
  font-size: clamp(16px, 1.55vw, 25px);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fbbf24;
}
.endless-unlocked-copy.quote-fade-in{
  opacity: 0;
  transform: translateY(8px);
  animation: endlessQuoteFade .65s ease .22s forwards;
}
.artwork-hitbox{
  position:absolute;
  border-radius: 18px;
  border: 1px solid rgba(255,214,170,.18);
  background: rgba(255,255,255,0);
  color: transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.artwork-hitbox:hover,
.artwork-hitbox:focus-visible{
  outline:none;
  transform: translateY(-1px);
  background: rgba(255,255,255,.04);
  border-color: rgba(255,221,185,.46);
  box-shadow: 0 0 0 2px rgba(255,221,185,.18), 0 0 28px rgba(255,140,80,.18), inset 0 0 22px rgba(255,255,255,.06);
}
.artwork-hitbox:active{
  transform: translateY(0);
}
.artwork-hitbox-enter{
  left: 35.3%;
  top: 72.9%;
  width: 29.2%;
  height: 8.3%;
}
.artwork-hitbox-menu{
  left: 35.3%;
  top: 82.45%;
  width: 29.2%;
  height: 8.3%;
}
@keyframes endlessQuoteFade{
  from{
    opacity: 0;
    transform: translateY(8px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 900px){
  .endless-unlocked-overlay{
    padding: 8px;
  }
  .endless-unlocked-artwork img{
    max-height: calc(100vh - 16px);
  }
  .endless-unlocked-textstack{
    width: min(92%, 560px);
    gap: clamp(8px, 1.4vh, 16px);
  }
  .endless-unlocked-quote{
    font-size: clamp(13px, 2vw, 20px);
  }
  .endless-unlocked-reward{
    font-size: clamp(12px, 1.9vw, 18px);
  }
  .artwork-hitbox{
    border-radius: 12px;
  }
}
@media (max-width: 640px){
  .endless-unlocked-textstack{
    width: min(94%, 440px);
  }
  .endless-unlocked-quote{
    font-size: clamp(11px, 2.2vw, 16px);
  }
  .endless-unlocked-reward{
    font-size: clamp(11px, 2vw, 15px);
  }
}

/* ============================================================
   LEY ATTUNEMENT — meta progression overlay & crystal UI
   ============================================================ */
.ley-chip{
  display:inline-flex;align-items:center;gap:4px;margin-left:8px;padding:2px 9px;
  border-radius:999px;font-size:.78rem;font-weight:700;letter-spacing:.02em;
  background:rgba(94,234,212,.12);border:1px solid rgba(94,234,212,.35);color:#5eead4;
}
.btn-ley{position:relative}

.ley-card{
  max-width:960px;width:min(96vw,960px);max-height:92vh;overflow-y:auto;
}
.ley-intro{color:var(--muted);max-width:640px;margin:6px auto 14px}
.ley-balance{
  display:inline-flex;align-items:baseline;gap:8px;margin:0 auto 18px;padding:8px 22px;
  border-radius:14px;font-size:1.35rem;font-weight:800;color:#5eead4;
  background:rgba(94,234,212,.08);border:1px solid rgba(94,234,212,.30);
  box-shadow:0 0 26px rgba(94,234,212,.12) inset;
}
.ley-balance-label{font-size:.85rem;font-weight:600;color:var(--muted);letter-spacing:.04em}

.shop-tabs{
  display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin:0 auto 16px;
}
.shop-tab{
  padding:8px 20px;border-radius:12px;cursor:pointer;
  font-size:.82rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;
  color:var(--muted);
  background:rgba(148,163,184,.06);
  border:1px solid rgba(148,163,184,.16);
  transition:color .15s ease,background .15s ease,border-color .15s ease;
}
.shop-tab:hover{color:#e2e8f0;background:rgba(148,163,184,.12)}
.shop-tab.is-active{
  color:#5eead4;
  background:rgba(94,234,212,.10);
  border-color:rgba(94,234,212,.34);
  box-shadow:0 0 18px rgba(94,234,212,.12) inset;
}

.ley-branches{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px;text-align:left;margin-bottom:16px;
}
.ley-branch{
  border:1px solid rgba(178,144,88,.18);border-radius:16px;padding:14px;
  background:linear-gradient(180deg,rgba(18,16,22,.85),rgba(10,9,13,.9));
  box-shadow:0 -1px 0 color-mix(in srgb,var(--branch-color) 35%,transparent) inset;
}
.ley-branch-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.ley-branch-icon{font-size:1.5rem;filter:drop-shadow(0 0 8px color-mix(in srgb,var(--branch-color) 55%,transparent))}
.ley-branch-name{font-family:"Cinzel",Georgia,serif;font-size:1.05rem;font-weight:700;color:var(--branch-color)}
.ley-branch-tagline{font-size:.74rem;color:var(--muted)}
.ley-branch-nodes{display:flex;flex-direction:column;gap:10px}

.ley-node{
  border:1px solid rgba(178,144,88,.14);border-radius:12px;padding:10px 12px;
  background:rgba(12,10,14,.6);transition:border-color .18s ease, transform .18s ease;
}
.ley-node:hover{border-color:color-mix(in srgb,var(--branch-color) 45%,transparent);transform:translateY(-1px)}
.ley-node-maxed{border-color:rgba(94,234,212,.35);background:rgba(94,234,212,.05)}
.ley-node-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px}
.ley-node-name{font-weight:700;font-size:.92rem;color:var(--text)}
.ley-pips{display:inline-flex;gap:4px}
.ley-pip{
  width:9px;height:9px;border-radius:999px;border:1px solid rgba(232,223,210,.35);background:transparent;
}
.ley-pip.filled{background:var(--branch-color);border-color:var(--branch-color);box-shadow:0 0 6px color-mix(in srgb,var(--branch-color) 60%,transparent)}
.ley-node-desc{font-size:.8rem;color:var(--muted);margin:0 0 4px;line-height:1.35}
.ley-node-next{font-size:.74rem;color:#5eead4;margin:0 0 6px}
.ley-buy-btn{width:100%;padding:7px 10px;font-size:.82rem;border-radius:10px}
.ley-buy-locked{background:rgba(30,41,59,.55);color:var(--muted);cursor:not-allowed;border:1px solid rgba(178,144,88,.12)}
.ley-buy-maxed{background:rgba(94,234,212,.10);color:#5eead4;border:1px solid rgba(94,234,212,.30);cursor:default}

.gameover-stat-ley strong{color:#5eead4}

.reward-reroll{margin:10px auto 2px;display:inline-flex}
.reward-reroll.hidden{display:none}

@media (max-width:860px){
  .ley-branches{grid-template-columns:1fr}
  .ley-card{max-height:88vh}
}

/* ============================================================
   LEY ATTUNEMENT — HUD badge, glow & refined button shapes
   ============================================================ */
.badge.ley{
  color:#5eead4;
  border-color:rgba(94,234,212,.32);
  background:rgba(11,20,19,.92);
  cursor:pointer;
  font-family:inherit;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.badge.ley:hover{
  transform:translateY(-1px);
  border-color:rgba(94,234,212,.55);
  box-shadow:0 4px 14px rgba(94,234,212,.14);
}
.badge.ley:active{transform:translateY(0)}

@keyframes leyGlowPulse{
  0%,100%{box-shadow:0 0 0 0 rgba(94,234,212,.0), 0 0 10px rgba(94,234,212,.18)}
  50%{box-shadow:0 0 0 4px rgba(94,234,212,.10), 0 0 18px rgba(94,234,212,.32)}
}
.ley-glow{
  border-color:rgba(94,234,212,.60)!important;
  animation:leyGlowPulse 1.9s ease-in-out infinite;
}

/* refined pill buy buttons */
.ley-buy-btn{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  width:100%;padding:8px 14px;border-radius:999px;
  font-size:.82rem;font-weight:800;letter-spacing:.03em;
  border:1px solid rgba(178,144,88,.20);
  transition:transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.ley-buy-btn .ley-buy-label{white-space:nowrap}
.ley-buy-btn .ley-buy-cost{
  padding:2px 10px;border-radius:999px;font-size:.78rem;white-space:nowrap;
  background:rgba(5,7,12,.45);border:1px solid rgba(255,255,255,.10);
}
.ley-buy-btn.btn-primary{
  background:linear-gradient(180deg,#3fd6bd,#177a6b);
  color:#04110e;border-color:rgba(94,234,212,.55);
  box-shadow:0 3px 12px rgba(94,234,212,.18);
}
.ley-buy-btn.btn-primary:hover{transform:translateY(-1px);filter:brightness(1.06)}
.ley-buy-btn.btn-primary:active{transform:translateY(0)}
.ley-buy-btn.btn-primary .ley-buy-cost{background:rgba(4,17,14,.30);border-color:rgba(4,17,14,.25);color:#04110e}
.ley-buy-locked{justify-content:space-between;background:rgba(24,31,42,.55);color:#8b93a2}
.ley-buy-locked .ley-buy-cost{color:#8b93a2}
.ley-buy-maxed{justify-content:center;background:rgba(94,234,212,.10);color:#5eead4;border-color:rgba(94,234,212,.30);cursor:default}

/* reroll & overlay buttons — pill shape, consistent */
.reward-reroll{
  border-radius:999px;padding:9px 20px;font-size:.85rem;
  border:1px solid rgba(192,132,252,.45);
  background:linear-gradient(180deg,rgba(76,45,110,.85),rgba(40,22,60,.9));
  color:#e6d5ff;box-shadow:0 3px 12px rgba(192,132,252,.14);
  transition:transform .14s ease, filter .14s ease;
}
.reward-reroll:hover{transform:translateY(-1px);filter:brightness(1.08)}

.ley-card .overlay-actions{grid-template-columns:minmax(0,220px);justify-content:center}
.ley-card .overlay-actions .btn{border-radius:999px}

@media (max-width:860px){
  .badge.ley{padding:8px 12px}
}

/* ============================================================
   HEADER — player crest in pill + Ley Attunement header button
   ============================================================ */
.panel-header-user{padding:6px 16px 6px 8px}
.panel-header-user-crest{display:inline-flex;flex-shrink:0}
.panel-header-user-crest:empty{display:none}
.dd-crest-header{
  width:32px;height:32px;font-size:11px;
  border-radius:11px 11px 9px 9px;
  box-shadow:0 2px 8px rgba(0,0,0,.35);
}
.panel-header-user:hover .dd-crest-header{filter:brightness(1.1)}

/* ============================================================
   HUD action buttons — Skills / Bag / Shop
   Unified pill design with a themed accent per button.
   ============================================================ */
.panel-header-skills,
.panel-header-inventory,
.panel-header-ley{
  --phb-accent:#94a3b8;
  --phb-accent-soft:rgba(148,163,184,.16);
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:9px 15px 9px 12px;
  border-radius:999px;
  cursor:pointer;
  font:800 13px Inter,Arial,sans-serif;
  letter-spacing:.02em;
  color:#f1f5f9;
  border:1px solid color-mix(in srgb,var(--phb-accent) 34%,transparent);
  background:
    radial-gradient(120% 120% at 20% 0%, color-mix(in srgb,var(--phb-accent) 14%,transparent), transparent 60%),
    linear-gradient(180deg, rgba(19,26,40,.94), rgba(10,15,24,.94));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 8px 22px rgba(0,0,0,.22);
  transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.panel-header-skills:hover,
.panel-header-inventory:hover,
.panel-header-ley:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb,var(--phb-accent) 62%,transparent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 26px rgba(0,0,0,.26),
    0 0 20px color-mix(in srgb,var(--phb-accent) 22%,transparent);
}
.panel-header-skills:active,
.panel-header-inventory:active,
.panel-header-ley:active{transform:translateY(0)}

.phb-ico{
  display:grid;
  place-items:center;
  width:24px;height:24px;
  border-radius:50%;
  font-size:13px;line-height:1;
  color:var(--phb-accent);
  background:var(--phb-accent-soft);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--phb-accent) 24%,transparent);
}
.phb-label{color:#e2e8f0;font-weight:800}
.phb-count{
  min-width:22px;
  padding:2px 8px;
  border-radius:999px;
  text-align:center;
  font-weight:800;
  color:var(--phb-accent);
  background:var(--phb-accent-soft);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--phb-accent) 20%,transparent);
}

.panel-header-skills{
  --phb-accent:#fbbf24;
  --phb-accent-soft:rgba(245,158,11,.16);
}
.panel-header-inventory{
  --phb-accent:#c084fc;
  --phb-accent-soft:rgba(192,132,252,.16);
}
.panel-header-ley{
  --phb-accent:#5eead4;
  --phb-accent-soft:rgba(94,234,212,.16);
}

.panel-header-inventory.has-loot{
  border-color:rgba(251,191,36,.6);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05), 0 0 18px rgba(251,191,36,.18);
}
.panel-header-inventory.has-loot .phb-ico{
  color:#fbbf24;
  background:rgba(251,191,36,.16);
}
.panel-header-skills.has-points{
  border-color:rgba(251,191,36,.72);
  animation:skillPointGlow 1.9s ease-in-out infinite;
}
@keyframes skillPointGlow{
  0%,100%{box-shadow:0 0 0 0 rgba(251,191,36,0),0 0 10px rgba(251,191,36,.12)}
  50%{box-shadow:0 0 0 4px rgba(251,191,36,.08),0 0 19px rgba(251,191,36,.24)}
}

@media (max-width:860px){
  .panel-header-ley,.panel-header-inventory,.panel-header-skills{min-height:38px;padding:7px 12px 7px 9px;font-size:12px;gap:6px}
  .phb-ico{width:21px;height:21px;font-size:12px}
  .dd-crest-header{width:28px;height:28px;font-size:10px}
}

/* ============================================================
   Challenge of the Day button
   ============================================================ */
.daily-challenge-btn{
  display:inline-flex;
  align-items:center;
  gap:9px;
  flex:0 1 auto;
  padding:8px 13px;
  border-radius:13px;
  cursor:pointer;
  text-align:left;
  color:var(--text);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(192,138,74,0.20), transparent 60%),
    linear-gradient(180deg, rgba(28,22,16,0.92), rgba(14,11,9,0.92));
  border:1px solid rgba(192,138,74,0.38);
  box-shadow:0 12px 34px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,220,170,0.08);
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease, filter .16s ease;
}
.daily-challenge-btn:hover{
  transform:translateY(-2px);
  border-color:rgba(214,180,124,0.75);
  box-shadow:0 18px 44px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,220,170,0.14);
  filter:brightness(1.05);
}
.daily-challenge-btn:active{ transform:translateY(0); }
.daily-challenge-emoji{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  width:32px;height:32px;
  border-radius:10px;
  font-size:17px;
  background:linear-gradient(180deg, rgba(192,138,74,0.28), rgba(140,90,47,0.20));
  border:1px solid rgba(214,180,124,0.35);
  box-shadow:inset 0 0 18px rgba(255,190,120,0.14);
}
.daily-challenge-copy{ display:flex; flex-direction:column; gap:2px; flex:1 1 auto; min-width:0; }
.daily-challenge-kicker{ display:none; }
.daily-challenge-name{
  font-size:13px; font-weight:700; color:#f2e6d2; line-height:1.15;
  max-width:150px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.daily-challenge-best{ display:none; }
.daily-challenge-best.has-best{ color:#7fdca0; }
.daily-challenge-cta{ display:none; }
@media (max-width:600px){
  .daily-challenge-btn{ gap:10px; padding:10px 12px; }
  .daily-challenge-emoji{ width:38px;height:38px;font-size:19px; }
  .daily-challenge-name{ font-size:14.5px; }
  .daily-challenge-cta{ padding:7px 10px; font-size:12px; }
}

.endless-mode-btn{
  display:inline-flex;
  align-items:center;
  gap:9px;
  flex:0 1 auto;
  min-width:148px;
  padding:8px 13px;
  border:1px solid rgba(129,140,248,.42);
  border-radius:13px;
  cursor:pointer;
  color:var(--text);
  text-align:left;
  background:
    radial-gradient(120% 160% at 0% 0%,rgba(99,102,241,.19),transparent 60%),
    linear-gradient(180deg,rgba(20,22,38,.94),rgba(9,11,24,.96));
  box-shadow:0 12px 34px rgba(0,0,0,.44),inset 0 1px 0 rgba(205,210,255,.08);
  transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease,filter .16s ease,opacity .16s ease;
}
.endless-mode-btn:hover:not(:disabled){
  transform:translateY(-2px);
  border-color:rgba(165,180,252,.78);
  box-shadow:0 18px 44px rgba(0,0,0,.54),0 0 22px rgba(99,102,241,.18),inset 0 1px 0 rgba(220,225,255,.13);
  filter:brightness(1.06);
}
.endless-mode-btn:active:not(:disabled){transform:translateY(0)}
.endless-mode-btn:disabled{
  cursor:not-allowed;
  opacity:.55;
  filter:saturate(.42);
}
.endless-mode-btn.is-active:disabled{
  opacity:1;
  filter:none;
  border-color:rgba(45,212,191,.52);
  box-shadow:0 0 22px rgba(45,212,191,.12),inset 0 1px 0 rgba(204,251,241,.1);
}
.endless-mode-emoji{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  width:32px;
  height:32px;
  border:1px solid rgba(165,180,252,.3);
  border-radius:10px;
  color:#c7d2fe;
  font-size:19px;
  background:linear-gradient(180deg,rgba(99,102,241,.23),rgba(67,56,202,.13));
  box-shadow:inset 0 0 18px rgba(129,140,248,.12);
}
.endless-mode-copy{display:flex;flex:1 1 auto;min-width:0;flex-direction:column;gap:2px}
.endless-mode-kicker{display:none}
.endless-mode-name{
  overflow:hidden;
  color:#ecebff;
  font-size:13px;
  font-weight:800;
  line-height:1.1;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.endless-mode-state{
  overflow:hidden;
  color:#a5b4fc;
  font-size:9px;
  font-weight:700;
  letter-spacing:.03em;
  line-height:1.1;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.endless-mode-btn.is-locked .endless-mode-state{color:#8b8b98}
.endless-mode-btn.is-active .endless-mode-state{color:#5eead4}
.endless-mode-cta{
  flex:0 0 auto;
  color:#c7d2fe;
  font-size:9px;
  font-weight:900;
  letter-spacing:.05em;
  white-space:nowrap;
}

/* Center the "Battlefield" kicker + challenge button as a header block */
.panel-header-lead{ display:flex; flex-direction:row; flex-wrap:wrap; align-items:stretch; gap:10px 10px; padding-top:4px; }

.worldmap-open-btn{
  display:inline-flex;
  align-items:center;
  gap:9px;
  flex:0 1 auto;
  padding:8px 13px;
  border-radius:13px;
  cursor:pointer;
  text-align:left;
  color:var(--text);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(56,189,248,0.16), transparent 60%),
    linear-gradient(180deg, rgba(16,24,40,0.94), rgba(9,14,24,0.95));
  border:1px solid rgba(94,234,212,0.34);
  box-shadow:0 12px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(190,240,255,0.06);
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.worldmap-open-btn:hover{
  transform:translateY(-2px);
  border-color:rgba(125,211,252,0.7);
  box-shadow:0 16px 40px rgba(0,0,0,0.5), 0 0 22px rgba(56,189,248,0.18), inset 0 1px 0 rgba(190,240,255,0.12);
}
.worldmap-open-btn:active{ transform:translateY(0); }
.worldmap-open-emoji{
  flex:0 0 auto;
  display:grid;place-items:center;
  width:32px;height:32px;
  border-radius:10px;
  font-size:17px;line-height:1;
  background:rgba(56,189,248,0.14);
  box-shadow:inset 0 0 0 1px rgba(94,234,212,0.28);
}
.worldmap-open-copy{ display:flex; flex-direction:column; gap:1px; min-width:0; flex:1; }
.worldmap-open-kicker{ display:none; }
.worldmap-open-name{ font-size:13px;font-weight:800;color:#f1f5f9;line-height:1.1; }
.worldmap-open-cta{ display:none; }
@media (max-width:640px){
  .worldmap-open-btn{ gap:10px; padding:9px 12px; }
  .worldmap-open-emoji{ width:34px;height:34px;font-size:18px; }
}
.panel-header-lead .panel-kicker{
  margin:0 0 2px 2px; z-index:1; white-space:nowrap; align-self:flex-start;
  flex-basis:100%;
}
.panel-header-lead .daily-challenge-btn,
.panel-header-lead .endless-mode-btn{ margin-top:0; }

/* ===== Game speed toggle (stacked under settings + HUD buttons) ===== */
.speed-toggle{
  position:absolute;
  top:76px;
  right:8px;
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border:none;
  border-radius:14px;
  padding:0;
  margin:0;
  background:rgba(8,17,31,.92);
  color:#cbd5e1;
  font-size:13px;
  font-weight:800;
  letter-spacing:.02em;
  line-height:1;
  cursor:pointer;
  z-index:16;
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.06);
  transition:transform .14s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
.speed-toggle:hover{ transform:translateY(-1px); }
.speed-toggle.speed-x2{
  color:#5eead4;
  background:rgba(9,36,33,.94);
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(94,234,212,.35);
}
.speed-toggle.speed-x3{
  color:#fbbf24;
  background:rgba(45,30,8,.94);
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(251,191,36,.45);
  animation:speedGlow 1.1s ease-in-out infinite;
}
@keyframes speedGlow{
  0%,100%{ box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(251,191,36,.35); }
  50%{ box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(251,191,36,.75), 0 0 12px rgba(251,191,36,.3); }
}
@media (max-width:700px){
  .speed-toggle{
    top:calc(72px + var(--safe-top));
    right:calc(8px + var(--safe-right));
    width:32px;
    height:32px;
    border-radius:10px;
    font-size:12px;
  }
}

/* ===== Daily streak chip ===== */
.daily-streak-chip{
  position:absolute; top:-8px; right:-6px;
  font-size:.7rem; font-weight:800;
  background:linear-gradient(180deg,#fb923c,#c2410c); color:#fff7ed;
  border:1px solid rgba(255,237,213,.5);
  border-radius:999px; padding:2px 7px;
  box-shadow:0 2px 8px rgba(0,0,0,.45), 0 0 12px rgba(251,146,60,.35);
  pointer-events:none; z-index:2;
}
.daily-streak-chip.streak-at-risk{ animation:streakBlink 1.6s ease-in-out infinite; }
@keyframes streakBlink{
  0%,100%{ opacity:1; }
  50%{ opacity:.55; }
}
.daily-challenge-btn{ position:relative; }

/* ===== Game over — daily leaderboard board ===== */
.gameover-daily-board{
  margin:14px auto 2px; max-width:420px; width:100%;
  background:rgba(10,12,18,.55);
  border:1px solid rgba(148,163,184,.22);
  border-radius:14px; padding:10px 12px;
  text-align:left;
}
.gameover-daily-board-title{
  font-size:.78rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:#94a3b8; margin-bottom:8px; text-align:center;
}
.gameover-daily-board-list .leaderboard-row{ padding:5px 6px; }
.gameover-daily-board-list .leaderboard-row-own{
  background:rgba(94,234,212,.08);
  border-radius:10px;
  outline:1px solid rgba(94,234,212,.3);
}

/* ===== Daily Challenge leaderboard card ===== */
.leaderboard-card-daily{
  grid-column:1 / -1;
  border-color:rgba(251,146,60,.22);
}
.leaderboard-glow-badge.daily{
  background:rgba(251,146,60,.15);
  border-color:rgba(251,146,60,.32);
  color:#fed7aa;
}
.leaderboard-table-body-glow.daily .wow-row:hover{
  background:rgba(251,146,60,.07);
}

/* ===== Resume overlay — centered over the battlefield ===== */
.resume-overlay{
  position:absolute;
  inset:0;
  z-index:999;
  display:grid;
  place-items:center;
  pointer-events:auto;
  background:radial-gradient(ellipse at center, rgba(4,7,12,.42) 0%, rgba(4,7,12,.72) 100%);
  backdrop-filter:blur(1.5px);
  -webkit-backdrop-filter:blur(1.5px);
  animation:resumeFadeIn .35s ease both;
}
/* THE FIX: display:grid above would otherwise tie-break against the global
   .hidden{display:none} (same specificity, later in file wins). This rule
   is more specific, so hiding the overlay actually hides it. */
.resume-overlay.hidden{
  display:none;
}
@keyframes resumeFadeIn{
  from{ opacity:0; }
  to{ opacity:1; }
}
.resume-card{
  position:relative;
  isolation:isolate;
  z-index:2;
  pointer-events:auto;
  text-align:center;
  padding:34px 38px 28px;
  overflow:visible;
  background:
    radial-gradient(circle at 50% -12%, rgba(216,157,73,.16), transparent 46%),
    linear-gradient(145deg, rgba(35,25,19,.97), rgba(7,9,13,.98) 58%, rgba(18,13,12,.98));
  border:1px solid rgba(218,166,88,.72);
  border-radius:10px;
  box-shadow:
    0 28px 72px rgba(0,0,0,.7),
    0 0 0 4px rgba(7,8,11,.82),
    0 0 0 5px rgba(134,91,43,.44),
    inset 0 1px 0 rgba(255,226,174,.11),
    inset 0 -14px 30px rgba(0,0,0,.35);
  max-width:min(440px, calc(100% - 32px));
  animation:resumeCardIn .4s cubic-bezier(.22,1,.36,1) both;
}
.resume-card::before{
  content:"";
  position:absolute;
  inset:7px;
  z-index:0;
  pointer-events:none;
  border:1px solid rgba(191,134,64,.26);
  border-radius:6px;
  background:
    linear-gradient(90deg, #d4a05a, #d4a05a) left top / 25px 1px no-repeat,
    linear-gradient(180deg, #d4a05a, #d4a05a) left top / 1px 25px no-repeat,
    linear-gradient(270deg, #d4a05a, #d4a05a) right top / 25px 1px no-repeat,
    linear-gradient(180deg, #d4a05a, #d4a05a) right top / 1px 25px no-repeat,
    linear-gradient(90deg, #8e6336, #8e6336) left bottom / 25px 1px no-repeat,
    linear-gradient(0deg, #8e6336, #8e6336) left bottom / 1px 25px no-repeat,
    linear-gradient(270deg, #8e6336, #8e6336) right bottom / 25px 1px no-repeat,
    linear-gradient(0deg, #8e6336, #8e6336) right bottom / 1px 25px no-repeat;
  box-shadow:inset 0 0 24px rgba(0,0,0,.34);
}
.resume-card::after{
  content:"✦";
  position:absolute;
  left:50%;
  top:0;
  z-index:2;
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  color:#291807;
  font-size:15px;
  line-height:1;
  clip-path:polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background:linear-gradient(145deg, #f4d493, #c28a3b 52%, #71451d);
  box-shadow:0 5px 14px rgba(0,0,0,.55), 0 0 18px rgba(211,149,62,.25);
  transform:translate(-50%,-50%);
}
.resume-card > *{
  position:relative;
  z-index:1;
}
@keyframes resumeCardIn{
  from{ opacity:0; transform:translateY(14px) scale(.97); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}
.resume-kicker{
  font-size:.72rem; font-weight:700; letter-spacing:.22em; text-transform:uppercase;
  color:#c89b5b; margin:0 0 7px;
  text-shadow:0 0 12px rgba(212,156,75,.22);
}
.resume-title{
  margin:0 0 10px;
  font-family:"Cinzel", Georgia, serif;
  font-size:1.65rem;
  color:#f3e7d3;
  letter-spacing:.025em;
  text-shadow:0 2px 8px rgba(0,0,0,.78), 0 0 18px rgba(218,166,88,.12);
}
.resume-details{
  margin:0 0 20px;
  padding:11px 13px;
  border-top:1px solid rgba(200,146,74,.2);
  border-bottom:1px solid rgba(200,146,74,.14);
  font-size:.9rem;
  color:#c5b9a8;
  background:linear-gradient(90deg, transparent, rgba(200,146,74,.055), transparent);
}
.resume-actions{
  display:flex;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
}
.resume-btn-main{
  color:#2b1907;
  background:linear-gradient(180deg,#f0d18c 0%,#d2a353 46%,#9b6428 100%);
  border:1px solid rgba(246,210,143,.78);
  border-radius:7px;
  clip-path:polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  font-weight:800;
  padding:12px 26px;
  box-shadow:0 0 20px rgba(207,145,59,.22), inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 5px rgba(67,35,8,.34);
  text-shadow:0 1px 0 rgba(255,232,181,.35);
}
.resume-btn-main:hover{ filter:brightness(1.09); transform:translateY(-1px); box-shadow:0 0 28px rgba(220,158,67,.34), inset 0 1px 0 rgba(255,255,255,.4); }
.resume-btn-new{
  color:#d8ccbb;
  background:linear-gradient(180deg,rgba(39,31,27,.96),rgba(9,11,15,.96));
  border:1px solid rgba(171,121,61,.38);
  border-radius:7px;
  padding:12px 22px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.resume-btn-new:hover{ border-color:rgba(219,169,92,.64); color:#f5e8d3; transform:translateY(-1px); background:linear-gradient(180deg,rgba(55,39,28,.98),rgba(12,12,15,.98)); }
@media (max-width:700px){
  .resume-card{ padding:30px 20px 21px; }
  .resume-title{ font-size:1.3rem; }
  .resume-actions{ gap:8px; }
  .resume-btn-main, .resume-btn-new{ padding:11px 18px; }
}

/* =========================================================
   Unit Shop — compact sprite dock (overrides legacy panel)
   ========================================================= */
.unit-info-panel.unit-dock{
  left:18px;
  top:62px;
  bottom:auto;
  right:auto;
  height:auto;
  align-self:flex-start;
  width:auto;
  max-width:none;
  padding:8px;
  gap:8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  border-radius:16px;
  background:rgba(8,17,31,.90);
  border:1px solid rgba(148,163,184,.16);
  box-shadow:0 16px 36px rgba(0,0,0,.34);
  backdrop-filter:blur(4px);
}
.unit-info-panel.unit-dock.hidden{ display:none; }

.unit-dock .unit-info-card{
  position:relative;
  width:62px;
  height:62px;
  padding:5px 5px 17px;
  display:grid;
  place-items:center;
  border-radius:12px;
  border:1px solid rgba(148,163,184,.14);
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,.09), transparent 40%),
    linear-gradient(180deg, rgba(30,41,59,.96), rgba(8,17,31,.94));
  overflow:visible;
}
.unit-dock .unit-info-card:hover{ transform:translateY(-1px); }
.unit-dock .unit-info-card.active{
  border-color:rgba(103,232,249,.60);
  box-shadow:0 8px 20px rgba(14,165,233,.18), inset 0 0 0 1px rgba(103,232,249,.16);
}
.unit-dock .unit-info-card.unit-locked{
  filter:saturate(.35) brightness(.8);
  cursor:not-allowed;
}

.unit-dock .unit-sprite{
  width:40px;
  height:36px;
  object-fit:contain;
  pointer-events:none;
  filter:drop-shadow(0 3px 5px rgba(0,0,0,.45));
}
.unit-dock .unit-glyph{
  font-size:26px;
  line-height:36px;
  color:#a5f3fc;
  text-shadow:0 0 12px rgba(103,232,249,.45);
}

.unit-dock .unit-key-hint{
  position:absolute;
  top:3px;
  left:5px;
  font-size:9px;
  font-weight:700;
  color:rgba(148,163,184,.75);
}
.unit-dock .unit-info-count{
  position:absolute;
  top:-6px;
  right:-6px;
  margin:0;
  min-width:18px;
  padding:1px 5px;
  font-size:10px;
  background:rgba(8,47,73,.96);
  border:1px solid rgba(56,189,248,.45);
  z-index:2;
}
.unit-dock .unit-info-count.empty{ display:none; }

.unit-dock .unit-cost-badge{
  position:absolute;
  bottom:3px;
  left:50%;
  transform:translateX(-50%);
  padding:0 6px;
  font-size:10px;
  font-weight:800;
  letter-spacing:.02em;
  color:#fde68a;
  background:rgba(0,0,0,.35);
  border-radius:999px;
  white-space:nowrap;
}
.unit-dock .crystal-cost{ color:#c4b5fd; }

/* Tooltip — desktop hover / keyboard focus */
.unit-dock .unit-tooltip{
  position:absolute;
  left:calc(100% + 12px);
  top:50%;
  transform:translateY(-50%) translateX(-4px);
  width:196px;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(8,17,31,.97);
  border:1px solid rgba(148,163,184,.22);
  box-shadow:0 14px 30px rgba(0,0,0,.4);
  opacity:0;
  pointer-events:none;
  transition:opacity .14s ease, transform .14s ease;
  z-index:30;
  text-align:left;
}
.unit-dock .unit-info-card:hover .unit-tooltip,
.unit-dock .unit-info-card:focus-visible .unit-tooltip{
  opacity:1;
  transform:translateY(-50%) translateX(0);
}
.unit-dock .unit-tooltip .unit-info-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:4px;
}
.unit-dock .unit-tooltip .unit-bar-group{ margin:8px 0 6px; }
@media (hover:none){
  .unit-dock .unit-tooltip{ display:none; }
}

/* Mobile: horizontal dock pinned to the bottom */
@media (max-width:700px){
  .unit-info-panel.unit-dock{
    flex-direction:row;
    justify-content:center;
    top:auto;
    left:calc(12px + var(--safe-left));
    right:calc(12px + var(--safe-right));
    bottom:calc(12px + var(--safe-bottom));
    width:auto;
    padding:7px;
    gap:7px;
  }
  .unit-dock .unit-info-card{
    width:56px;
    height:56px;
    padding:4px 4px 15px;
  }
  .unit-dock .unit-sprite{ width:34px; height:31px; }
  .unit-dock .unit-glyph{ font-size:22px; line-height:31px; }
  .unit-dock .unit-key-hint{ display:none; }
}


/* =========================================================
   Hero — gilded treatment.
   Gradient-filled title, hairline ornaments, plate button,
   icon nav, and a restructured champion card.
   ========================================================= */

/* --- Ornamental rules framing the title --- */
.hero-crest-rule,
.hero-title-rule{
  display:flex;
  align-items:center;
  gap:14px;
  max-width:430px;
  margin:0 0 14px;
}
.hero-title-rule{ margin:14px 0 20px; }
.hero-crest-rule .rule,
.hero-title-rule .rule{
  flex:1;
  height:1px;
  background:linear-gradient(90deg, transparent, rgba(192,138,74,.55), transparent);
}
.hero-crest-rule .crown{
  font-size:13px;
  color:#e6bb7a;
  text-shadow:0 0 12px rgba(230,187,122,.5);
  line-height:1;
}
.hero-title-rule .diamond{
  font-size:8px;
  color:rgba(230,187,122,.7);
  line-height:1;
}

/* --- Gilded title --- */
.hero-title-gilded{
  margin:0;
  font-family:Cinzel, Georgia, serif;
  font-size:clamp(38px, 7.5vw, 76px);
  font-weight:700;
  line-height:1.02;
  letter-spacing:.015em;
  background:linear-gradient(178deg,
    #fdf3d8 4%,
    #f0cd8b 28%,
    #d8ab63 42%,
    #cf9c4e 54%,
    #a8752f 74%,
    #e8c489 96%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  -webkit-text-fill-color:transparent;
  filter:drop-shadow(0 3px 10px rgba(0,0,0,.7)) drop-shadow(0 0 26px rgba(214,158,74,.26));
}
/* Fallback if background-clip:text is unsupported. */
@supports not (-webkit-background-clip: text){
  .hero-title-gilded{ color:#e6bb7a; -webkit-text-fill-color:#e6bb7a; }
}

/* --- Plate button --- */
.hero-plate-btn{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:15px 40px;
  font-family:Cinzel, Georgia, serif;
  font-size:17px;
  font-weight:700;
  letter-spacing:.05em;
  color:#2a1a08;
  text-decoration:none;
  background:linear-gradient(180deg, #f6dda6 0%, #e2b872 38%, #c9973f 62%, #e8c68d 100%);
  border-radius:7px;
  /* Cut corners give it a forged-plate silhouette. */
  clip-path:polygon(14px 0, calc(100% - 14px) 0, 100% 22%, 100% 78%, calc(100% - 14px) 100%, 14px 100%, 0 78%, 0 22%);
  box-shadow:
    0 0 26px rgba(214,158,74,.34),
    0 12px 26px rgba(0,0,0,.42),
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -2px 6px rgba(120,74,18,.42);
  transition:transform .16s ease, box-shadow .2s ease, filter .2s ease;
}
.hero-plate-btn:hover{
  transform:translateY(-2px);
  filter:brightness(1.06);
  box-shadow:
    0 0 36px rgba(214,158,74,.46),
    0 16px 30px rgba(0,0,0,.46),
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 -2px 6px rgba(120,74,18,.42);
}
.hero-plate-btn:active{ transform:translateY(0); }
.hero-plate-btn:focus-visible{ outline:2px solid #e6bb7a; outline-offset:4px; }

/* --- Icon nav with separators --- */
.hero-nav-links{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}
.hero-nav-links a{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:5px 2px;
  font-family:Cinzel, Georgia, serif;
  font-size:13px;
  font-weight:600;
  letter-spacing:.04em;
  color:#e8dfd2;
  text-decoration:none;
  transition:color .18s ease;
}
.hero-nav-links a .ico{ font-size:14px; opacity:.85; }
.hero-nav-links a::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:0;
  height:2px;
  border-radius:2px;
  background:linear-gradient(90deg, transparent, #c08a4a, transparent);
  opacity:0;
  transform:scaleX(.5);
  transition:opacity .18s ease, transform .18s ease;
}
.hero-nav-links a:hover{ color:#f2d9a8; }
.hero-nav-links a:hover::after{ opacity:1; transform:scaleX(1); }
.hero-nav-links a:focus-visible{ outline:2px solid #c08a4a; outline-offset:3px; border-radius:4px; }
.hero-nav-links .sep{
  width:1px;
  height:15px;
  background:linear-gradient(180deg, transparent, rgba(192,138,74,.45), transparent);
}

/* --- Champion card --- */
.hero-champion-card{ padding-top:16px; }
.hero-champion-status{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:14px;
}
.hero-live-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#5ee08a;
  box-shadow:0 0 9px rgba(94,224,138,.85);
  flex:0 0 auto;
  animation:heroPulse 2.4s ease-in-out infinite;
}
@keyframes heroPulse{
  0%,100%{ opacity:1; }
  50%{ opacity:.45; }
}
.hero-champion-status .panel-kicker{ margin:0; color:#5ee08a; }
.hero-refresh-link{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 6px;
  background:none;
  border:none;
  border-radius:6px;
  font-family:Cinzel, Georgia, serif;
  font-size:11px;
  font-weight:700;
  letter-spacing:.13em;
  text-transform:uppercase;
  color:#c9b89c;
  cursor:pointer;
  transition:color .18s ease;
}
.hero-refresh-link:hover{ color:#f2d9a8; }
.hero-refresh-link:focus-visible{ outline:2px solid #c08a4a; outline-offset:2px; }
.hero-refresh-link .ico{ font-size:12px; }

.hero-champion-card .hero-leaderboard-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:12px;
}
.hero-champion-card .hero-leaderboard-head h3{
  margin:0;
  font-family:Cinzel, Georgia, serif;
  font-size:clamp(20px, 2.4vw, 28px);
  font-weight:700;
  line-height:1.12;
  letter-spacing:.01em;
  color:#f0e6d6;
}
.hero-laurel{
  font-size:38px;
  line-height:1;
  flex:0 0 auto;
  filter:drop-shadow(0 0 16px rgba(214,158,74,.4));
}
.hero-champion-card .hero-leaderboard-sub{
  padding-bottom:14px;
  border-bottom:1px solid rgba(192,138,74,.2);
  margin-bottom:4px;
}

@media (max-width:900px){
  .hero-crest-rule, .hero-title-rule{ max-width:100%; }
  .hero-laurel{ font-size:30px; }
}
@media (max-width:640px){
  .hero-nav-links{ gap:10px; }
  .hero-nav-links a{ font-size:12px; }
  .hero-nav-links .sep{ display:none; }
  .hero-plate-btn{ padding:13px 30px; font-size:15px; }
  .hero-champion-card .hero-leaderboard-head h3{ font-size:20px; }
}
@media (prefers-reduced-motion:reduce){
  .hero-live-dot{ animation:none; }
  .hero-plate-btn, .hero-nav-links a, .hero-nav-links a::after{ transition:none; }
}

/* --- Champion row: large avatar, crown badge, big score --- */
.hero-champion-card .leaderboard-row{
  grid-template-columns:auto 1fr auto;
  gap:14px;
  padding:14px 4px 4px;
  background:none;
  border:none;
}
/* The crown lives on the avatar instead of its own column. */
.hero-champion-card .leaderboard-rank{ display:none; }
.hero-champion-card .leaderboard-name{
  position:relative;
  display:flex;
  align-items:center;
  gap:13px;
  font-family:Cinzel, Georgia, serif;
  font-size:17px;
  font-weight:700;
  color:#f2e8d8;
}
.hero-champion-card .leaderboard-name .dd-crest{
  width:52px;
  height:52px;
  border-radius:50%;
  flex:0 0 auto;
  border:2px solid rgba(192,138,74,.5);
  box-shadow:0 0 18px rgba(214,158,74,.28);
}
/* Crown badge pinned to the avatar's lower-left. Anchored on the
   parent, since image crests fill ::after slots of their own. */
.hero-champion-card .leaderboard-name::after{
  content:"♛";
  position:absolute;
  left:34px;
  bottom:-2px;
  width:21px;
  height:21px;
  display:grid;
  place-items:center;
  font-size:11px;
  color:#2a1a08;
  background:linear-gradient(180deg, #f2d195, #c9973f);
  border-radius:50%;
  box-shadow:0 2px 7px rgba(0,0,0,.5);
  pointer-events:none;
}
.hero-champion-card .leaderboard-main{ gap:2px; }
.hero-champion-card .leaderboard-meta{
  padding-left:65px;
  margin-top:-2px;
  font-size:12.5px;
  color:#9d9488;
}
.hero-champion-card .leaderboard-score{
  font-family:Cinzel, Georgia, serif;
  font-size:clamp(26px, 3.4vw, 38px);
  font-weight:700;
  line-height:1;
  color:#e6bb7a;
  text-shadow:0 0 20px rgba(214,158,74,.35);
}
@media (max-width:640px){
  .hero-champion-card .leaderboard-name .dd-crest{ width:44px; height:44px; }
  .hero-champion-card .leaderboard-name::after{ left:28px; width:18px; height:18px; font-size:10px; }
  .hero-champion-card .leaderboard-meta{ padding-left:57px; }
  .hero-champion-card .leaderboard-score{ font-size:26px; }
}

/* Hero artwork on narrow screens: the fortress sits right of
   centre, so pan toward it and darken further for legibility. */
@media (max-width:900px){
  .hero-home-banner{
    background-position: center, center, 72% center;
  }
  .hero-home-banner::after{
    content:"";
    position:absolute;
    inset:0;
    pointer-events:none;
    z-index:-1;
    background:linear-gradient(180deg, rgba(6,7,10,.42), rgba(6,7,10,.72));
  }
}

/* =========================================================
   Hero — slim variant.
   Tighter vertical rhythm, quieter title, no ornaments.
   Appended last so it wins over the gilded block above.
   ========================================================= */
.hero-home-banner{
  padding:26px 30px 30px;
  align-items:center;
}

/* Ornaments removed — the artwork carries the mood now. */
.hero-crest-rule,
.hero-title-rule{ display:none; }

/* Title: engraved stone rather than polished gold. */
.hero-title-gilded{
  font-size:clamp(30px, 4.4vw, 50px);
  line-height:1.0;
  letter-spacing:.02em;
  background:linear-gradient(178deg, #f4ece0 6%, #e6dccc 46%, #c8bba6 96%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  -webkit-text-fill-color:transparent;
  filter:drop-shadow(0 2px 6px rgba(0,0,0,.7));
}
@supports not (-webkit-background-clip: text){
  .hero-title-gilded{ color:#efe7db; -webkit-text-fill-color:#efe7db; }
}

.hero-home-banner .hero-copy p{
  margin-top:10px;
  margin-bottom:0;
  font-size:15px;
  line-height:1.55;
  max-width:60ch;
}
.hero-home-banner .hero-cta-row{
  margin-top:14px;
  margin-bottom:2px;
  align-items:center;
  gap:22px;
}
.hero-plate-btn{
  padding:12px 32px;
  font-size:15px;
}

/* Compact rank-one card: it should sit beside the hero copy, not stretch to
   the full banner height like a three-row leaderboard. */
.hero-champion-card{
  height:auto;
  padding:11px 15px 13px;
}
.hero-champion-status{ margin-bottom:7px; }
.hero-champion-card .hero-leaderboard-head{
  margin-bottom:6px;
  padding:8px 11px;
  align-items:center;
}
.hero-champion-card .hero-leaderboard-head h3{
  font-size:clamp(17px, 1.65vw, 21px);
  white-space:nowrap;
}
.hero-laurel{ font-size:27px; }
.hero-champion-card .hero-leaderboard-sub{
  overflow:hidden;
  margin-bottom:0;
  padding-bottom:8px;
  font-size:11px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.hero-champion-card .leaderboard-row{
  gap:10px;
  padding:9px 2px 0;
}
.hero-champion-card .leaderboard-name{ font-size:15px; }
.hero-champion-card .leaderboard-name .dd-crest{ width:40px; height:40px; }
.hero-champion-card .leaderboard-name::after{ left:25px; width:17px; height:17px; font-size:9px; }
.hero-champion-card .leaderboard-meta{ padding-left:52px; font-size:11.5px; }
.hero-champion-card .leaderboard-score{ font-size:clamp(20px, 2.2vw, 26px); }

@media (max-width:760px){
  .hero-home-banner{ padding:22px 20px 24px; }
  .hero-home-banner .hero-cta-row{ gap:14px; }
}
/* =========================================================
   Shared page chrome - banner, panels, nav strip.
   Matches the game's tokens (Cinzel + Inter, gold on black)
   and the fortress artwork used on the home hero.
   ========================================================= */
.pg{ max-width:1120px; margin:0 auto; padding:22px 20px 60px; }

.pg-banner{
  position:relative;
  overflow:hidden;
  isolation:isolate;
  border-radius:22px;
  padding:26px 30px 28px;
  border:1px solid var(--panel-border);
  box-shadow:var(--shadow);
  background:
    linear-gradient(90deg,
      rgba(6,7,10,0.97) 0%,
      rgba(6,7,10,0.93) 30%,
      rgba(6,7,10,0.78) 50%,
      rgba(6,7,10,0.42) 72%,
      rgba(6,7,10,0.20) 100%),
    linear-gradient(135deg, rgba(129,78,40,0.16), rgba(255,255,255,0.02)),
    url("assets/ui/hero-fortress.webp");
  background-size:auto, auto, cover;
  background-position:center, center, center right;
  background-repeat:no-repeat;
}
.pg-banner::before{
  content:"";
  position:absolute; inset:0;
  pointer-events:none; z-index:-1;
  background:
    radial-gradient(circle at 82% 66%, rgba(234,120,42,0.15), transparent 26%),
    radial-gradient(circle at 78% 50%, transparent 30%, rgba(0,0,0,0.42) 100%);
}
.pg-banner-inner{ position:relative; z-index:1; max-width:640px; }
.pg-eyebrow{
  font-size:11px; letter-spacing:.28em; text-transform:uppercase;
  color:var(--accent); font-weight:700;
}
.pg-title{
  margin:9px 0 8px;
  font-family:Cinzel, Georgia, serif;
  font-size:clamp(28px, 4.2vw, 46px);
  font-weight:700; line-height:1.04; letter-spacing:.02em;
  background:linear-gradient(178deg, #f4ece0 6%, #e6dccc 46%, #c8bba6 96%);
  -webkit-background-clip:text; background-clip:text;
  color:transparent; -webkit-text-fill-color:transparent;
  filter:drop-shadow(0 2px 6px rgba(0,0,0,.7));
}
@supports not (-webkit-background-clip: text){
  .pg-title{ color:#efe7db; -webkit-text-fill-color:#efe7db; }
}
.pg-sub{ margin:0; color:var(--muted); font-size:15px; line-height:1.55; max-width:58ch; }
.pg-banner-actions{ display:flex; align-items:center; gap:20px; flex-wrap:wrap; margin-top:16px; }
.pg-plate{
  display:inline-flex; align-items:center; justify-content:center;
  padding:12px 30px;
  font-family:Cinzel, Georgia, serif;
  font-size:15px; font-weight:700; letter-spacing:.05em;
  color:#2a1a08; text-decoration:none;
  background:linear-gradient(180deg, #f6dda6 0%, #e2b872 38%, #c9973f 62%, #e8c68d 100%);
  border-radius:7px;
  clip-path:polygon(13px 0, calc(100% - 13px) 0, 100% 22%, 100% 78%, calc(100% - 13px) 100%, 13px 100%, 0 78%, 0 22%);
  box-shadow:0 0 24px rgba(214,158,74,.3), 0 10px 22px rgba(0,0,0,.4),
             inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 6px rgba(120,74,18,.42);
  transition:transform .16s ease, filter .2s ease;
}
.pg-plate:hover{ transform:translateY(-2px); filter:brightness(1.06); }
.pg-plate:focus-visible{ outline:2px solid #e6bb7a; outline-offset:4px; }
.pg-ghost{
  display:inline-flex; align-items:center; gap:7px;
  font-family:Cinzel, Georgia, serif;
  font-size:13px; font-weight:600; letter-spacing:.04em;
  color:#e8dfd2; text-decoration:none;
  transition:color .18s ease;
}
.pg-ghost:hover{ color:#f2d9a8; }
.pg-ghost:focus-visible{ outline:2px solid #c08a4a; outline-offset:3px; border-radius:4px; }

.pg-grid{ display:grid; grid-template-columns:repeat(12, 1fr); gap:15px; margin-top:16px; }
.pg-card{
  grid-column:span 12;
  padding:22px;
  border-radius:18px;
  border:1px solid var(--panel-border);
  background:linear-gradient(180deg, rgba(18,14,12,.9), rgba(7,7,10,.93));
  box-shadow:0 16px 36px rgba(0,0,0,.34);
}
.pg-card.half{ grid-column:span 6; }
.pg-card h2{
  margin:0 0 8px;
  font-family:Cinzel, Georgia, serif;
  font-size:20px; font-weight:700; letter-spacing:.02em;
}
.pg-card h3{
  margin:20px 0 8px;
  font-family:Cinzel, Georgia, serif;
  font-size:15px; font-weight:700; letter-spacing:.03em;
  color:#e8dfd2;
}
.pg-card h3:first-of-type{ margin-top:4px; }
.pg-card p{ font-size:13.5px; line-height:1.65; color:#c2b9ab; max-width:74ch; }
.pg-card p:last-child{ margin-bottom:0; }

.pg-list{ margin:0; padding:0; list-style:none; display:grid; gap:8px; }
.pg-list li{
  position:relative;
  padding:11px 14px 11px 32px;
  border-radius:11px;
  background:rgba(255,255,255,.024);
  border:1px solid rgba(255,255,255,.045);
  font-size:13.5px; line-height:1.6; color:#c2b9ab;
}
.pg-list li::before{
  content:"\25C6";
  position:absolute; left:13px; top:12px;
  font-size:8px; color:rgba(230,187,122,.7);
}
.pg-list li strong{ color:#e8dfd2; }
.pg-list li em{ color:#c4b5fd; font-style:normal; }

.pg-steps{ display:grid; gap:9px; margin:0; padding:0; list-style:none; counter-reset:pgstep; }
.pg-steps li{
  position:relative;
  padding:13px 15px 13px 48px;
  border-radius:12px;
  background:rgba(255,255,255,.026);
  border:1px solid rgba(255,255,255,.05);
  font-size:13.5px; line-height:1.6; color:#c2b9ab;
}
.pg-steps li::before{
  counter-increment:pgstep;
  content:counter(pgstep);
  position:absolute;
  left:14px; top:12px;
  width:22px; height:22px;
  display:grid; place-items:center;
  border-radius:50%;
  font-family:Cinzel, Georgia, serif;
  font-size:11px; font-weight:700;
  color:#2a1a08;
  background:linear-gradient(180deg, #f2d195, #c9973f);
}
.pg-steps li strong{ color:#e8dfd2; }

.pg-note{
  margin-top:16px;
  padding:13px 16px;
  border-radius:12px;
  border-left:3px solid rgba(192,138,74,.55);
  background:rgba(192,138,74,.08);
  font-size:13px; line-height:1.6; color:#cfc3b2;
}
.pg-note strong{ color:#f0e3ce; }

.pg-strip{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(190px, 1fr));
  gap:11px;
  margin-top:15px;
}
.pg-strip a{
  display:flex; align-items:center; gap:11px;
  padding:14px 15px; border-radius:13px;
  text-decoration:none; color:var(--text);
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.055);
  transition:transform .15s ease, border-color .2s ease, background .2s ease;
}
.pg-strip a:hover{
  transform:translateY(-2px);
  border-color:rgba(192,138,74,.4);
  background:rgba(192,138,74,.07);
}
.pg-strip a:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; }
.pg-strip .ico{ font-size:19px; flex:0 0 auto; }
.pg-strip b{
  display:block; font-size:13px; font-weight:700;
  font-family:Cinzel, Georgia, serif; letter-spacing:.02em;
}
.pg-strip .cap{ display:block; font-size:11px; color:var(--muted); margin-top:2px; }

@media (max-width:820px){
  .pg-card.half{ grid-column:span 12; }
}
@media (max-width:760px){
  .pg{ padding:14px 13px 44px; }
  .pg-banner{ padding:22px 20px 24px; background-position:center, center, 72% center; }
  .pg-card{ padding:16px 14px; }
}
@media (prefers-reduced-motion:reduce){
  .pg-plate, .pg-strip a{ transition:none; }
}

/* =========================================================
   Fullscreen overlays.
   In NATIVE fullscreen the screen overlays are moved inside
   #canvasWrap (see game.js) so the browser actually paints
   them. The wrapper is a centring grid, so overlays need to
   be pulled out of that flow and pinned to the viewport.
   The iPhone pseudo-fullscreen path does NOT relocate them —
   it only needs the z-index fix further below.
   ========================================================= */
.canvas-wrap:fullscreen .screen-overlay{
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  max-width:none;
  margin:0;
  z-index:60;
  /* Escape the wrapper's place-items:center. */
  grid-area:1 / 1 / -1 / -1;
  justify-self:stretch;
  align-self:stretch;
}
/* Hidden must stay hidden even after relocation. */
.canvas-wrap:fullscreen .screen-overlay.hidden{ display:none; }

/* Cards can grow taller than a landscape phone: let them scroll. */
.canvas-wrap:fullscreen .screen-overlay .overlay-card,
.canvas-wrap.pseudo-fullscreen .screen-overlay .overlay-card,
body.pseudo-fs-active .screen-overlay .overlay-card{
  max-height:calc(100vh - 40px);
  overflow-y:auto;
}
/* The map controls sit above the canvas but must stay under a modal. */
.canvas-wrap.fs-hosting-overlays .fullscreen-toggle,
.canvas-wrap.fs-hosting-overlays .speed-toggle,
.canvas-wrap.fs-hosting-overlays .hud-toggle,
.canvas-wrap.fs-hosting-overlays .settings-toggle{ z-index:16; }

/* Landscape phones are short: tighten the aura draft so all
   three cards and the confirm button fit without scrolling. */
@media (max-height:520px){
  .canvas-wrap:fullscreen .overlay-card,
  body.pseudo-fs-active .overlay-card{
    padding:18px 20px;
    border-radius:18px;
  }
  .canvas-wrap:fullscreen .overlay-card h1,
  body.pseudo-fs-active .overlay-card h1{
    font-size:22px;
    margin-bottom:6px;
  }
  .canvas-wrap:fullscreen .reward-grid,
  body.pseudo-fs-active .reward-grid{ gap:8px; }
}

/* On iPhone we fake fullscreen with a z-index:9999 wrapper. The
   overlays sit at z-index:30, so without this they would be buried
   under the map. They are NOT relocated on this path (no native
   fullscreen), so they must simply outrank the wrapper. */
body.pseudo-fs-active .screen-overlay:not(.hidden){
  z-index:10000;
}

/* Keyboard hint on the spell buttons, matching the 1-5 hints on
   the tower dock. Hidden on touch, where there is no keyboard. */
.spell-key{
  position:absolute;
  top:4px;
  left:6px;
  font-size:9px;
  font-weight:800;
  letter-spacing:.04em;
  line-height:1;
  color:rgba(226,232,240,.5);
  pointer-events:none;
}
.spell-btn:disabled .spell-key,
.spell-btn.on-cooldown .spell-key{ opacity:.35; }
@media (hover:none){
  .spell-key{ display:none; }
}
@media (max-width:700px){
  .spell-key{ display:none; }
}

/* =========================================================
   Spell buttons - fluid sizing.
   The desktop row is a fixed 3x78px grid with a 68px min-height,
   which stays too tall and cramped once the row is squeezed on a
   phone. Below 700px everything scales off the viewport instead,
   with clamp() keeping it readable at the small end and from
   growing past the desktop size at the large end.
   ========================================================= */
@media (max-width:700px){
  .map-spells{
    /* Slightly narrower cap so the row never crowds the HUD. */
    width:min(210px, calc(100% - 24px - var(--safe-left) - var(--safe-right)));
    gap:clamp(5px, 1.6vw, 8px);
  }
  .spell-btn{
    /* Height follows width, so the buttons stay squarish
       rather than tall-and-thin as the row narrows. */
    min-height:0;
    aspect-ratio:1 / 0.92;
    padding:clamp(4px, 1.4vw, 7px);
    border-radius:clamp(10px, 3vw, 14px);
    gap:clamp(1px, .5vw, 3px);
  }
  .spell-glyph{ font-size:clamp(15px, 4.6vw, 21px); }
  .spell-caption{
    font-size:clamp(7.5px, 2.1vw, 9.5px);
    letter-spacing:.06em;
    line-height:1.1;
  }
  .spell-timer{
    font-size:clamp(8px, 2.3vw, 10.5px);
    line-height:1.1;
  }
}

/* Very narrow phones: drop the caption and keep glyph + timer,
   which are the only two things you actually read mid-run. */
@media (max-width:380px){
  .map-spells{
    width:min(178px, calc(100% - 20px - var(--safe-left) - var(--safe-right)));
  }
  .spell-caption{ display:none; }
  .spell-btn{
    aspect-ratio:1 / 0.82;
    /* Never fall below a comfortable tap target, whatever the
       aspect ratio works out to. */
    min-height:46px;
  }
  .spell-glyph{ font-size:clamp(15px, 5.4vw, 19px); }
}

/* Landscape phones are short, not narrow: cap by height so the
   row does not eat the map. */
@media (max-width:900px) and (max-height:460px){
  .map-spells{
    width:min(186px, 34vw);
    gap:5px;
  }
  .spell-btn{ aspect-ratio:1 / 0.78; padding:4px; min-height:42px; }
  .spell-caption{ display:none; }
  .spell-glyph{ font-size:clamp(14px, 4.4vh, 18px); }
  .spell-timer{ font-size:clamp(8px, 2.6vh, 10px); }
}

/* =========================================================
   Hero System MVP
   ========================================================= */
.hero-hud{
  position:absolute;
  left:18px;
  bottom:18px;
  z-index:13;
  display:flex;
  align-items:stretch;
  gap:7px;
  width:min(300px, calc(100% - 160px));
  font-family:"Inter", Arial, Helvetica, sans-serif;
  transition:opacity .18s ease, transform .18s ease;
}

.hero-command-btn,
.hero-ability-btn{
  border:1px solid rgba(245,158,11,.34);
  background:
    radial-gradient(circle at 20% 18%, rgba(251,191,36,.16), transparent 38%),
    linear-gradient(180deg, rgba(30,25,20,.96), rgba(8,12,20,.96));
  color:#fef3c7;
  box-shadow:0 12px 28px rgba(0,0,0,.34), inset 0 0 0 1px rgba(255,255,255,.04);
}

.hero-command-btn{
  min-width:0;
  flex:1 1 188px;
  min-height:58px;
  padding:7px 9px;
  border-radius:16px;
  display:flex;
  align-items:center;
  gap:8px;
  text-align:left;
  cursor:pointer;
}

.hero-command-btn.active{
  border-color:rgba(253,230,138,.82);
  box-shadow:0 0 0 2px rgba(245,158,11,.20), 0 14px 30px rgba(0,0,0,.38);
}

.hero-command-btn.hero-down{
  filter:saturate(.45);
}

.hero-portrait{
  position:relative;
  flex:0 0 40px;
  width:40px;
  height:40px;
  overflow:hidden;
  border-radius:50%;
  background:#100d0c;
  border:2px solid rgba(253,230,138,.64);
  box-shadow:
    0 0 0 1px rgba(21,12,6,.9),
    0 0 17px rgba(245,158,11,.26),
    inset 0 0 13px rgba(0,0,0,.46);
}

.hero-portrait img{
  position:absolute;
  top:0;
  left:0;
  width:148%;
  height:148%;
  display:block;
  object-fit:cover;
  object-position:50% 50%;
  transform:translate(-16%,-1%);
  transition:filter .18s ease, transform .18s ease;
}

.hero-portrait::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:
    radial-gradient(circle at 36% 24%, rgba(255,222,159,.12), transparent 38%),
    linear-gradient(180deg, transparent 52%, rgba(7,4,3,.38));
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.06);
  pointer-events:none;
}

.hero-command-btn:hover .hero-portrait img,
.hero-command-btn.active .hero-portrait img{transform:translate(-16%,-1%) scale(1.04)}
.hero-command-btn.hero-down .hero-portrait img{filter:grayscale(.8) brightness(.62)}

.hero-hud-copy{
  min-width:0;
  flex:1;
  display:grid;
  gap:3px;
}

.hero-hud-copy strong{
  overflow:hidden;
  font-size:11px;
  line-height:1.1;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.hero-hud-copy > span:not(.hero-bar){
  color:#cbd5e1;
  font-size:9px;
  line-height:1;
}

.hero-bar{
  display:block;
  width:100%;
  height:4px;
  overflow:hidden;
  border-radius:999px;
  background:rgba(2,6,23,.88);
}

.hero-bar i{
  display:block;
  width:100%;
  height:100%;
  border-radius:inherit;
  transition:width .16s linear;
}

.hero-hp-bar i{ background:linear-gradient(90deg, #16a34a, #4ade80); }
.hero-xp-bar i{ background:linear-gradient(90deg, #7c3aed, #c4b5fd); }

.hero-ability-btn{
  position:relative;
  flex:0 0 92px;
  min-height:58px;
  padding:7px 8px 6px;
  border-radius:16px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  cursor:pointer;
}

.hero-ability-btn strong{
  font-size:9px;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.hero-ability-btn > span:last-child{
  color:#fde68a;
  font-size:10px;
  font-weight:800;
}

.hero-ability-btn:disabled{
  opacity:.58;
  cursor:not-allowed;
}

.hero-ability-btn.ready{
  border-color:rgba(253,230,138,.72);
  box-shadow:0 0 16px rgba(245,158,11,.20), inset 0 0 0 1px rgba(253,230,138,.10);
}

.hero-ability-key{
  position:absolute;
  top:3px;
  right:5px;
  color:rgba(226,232,240,.68);
  font-size:8px;
  font-weight:800;
}

.canvas-wrap.hud-hide-obstacles .hero-hud{
  opacity:0;
  pointer-events:none;
  transform:translateY(8px);
}

@media (max-width:700px){
  .hero-hud{
    left:calc(12px + var(--safe-left));
    bottom:calc(12px + var(--safe-bottom) + var(--mobile-bottom-stack));
    width:min(214px, calc(100% - 142px - var(--safe-left) - var(--safe-right)));
    gap:5px;
  }
  .hero-command-btn{
    min-height:50px;
    padding:5px 7px;
    border-radius:14px;
    gap:6px;
  }
  .hero-portrait{
    flex-basis:34px;
    width:34px;
    height:34px;
    font-size:18px;
  }
  .hero-hud-copy strong{ font-size:9px; }
  .hero-hud-copy > span:not(.hero-bar){ font-size:8px; }
  .hero-ability-btn{
    flex-basis:68px;
    min-height:50px;
    padding:5px 4px;
    border-radius:14px;
  }
  .hero-ability-btn strong{ font-size:7px; }
  .hero-ability-btn > span:last-child{ font-size:9px; }
  .hero-ability-key{ display:none; }
}

@media (max-width:380px){
  .hero-hud{
    width:min(180px, calc(100% - 124px - var(--safe-left) - var(--safe-right)));
  }
  .hero-ability-btn{ flex-basis:58px; }
  .hero-portrait{
    flex-basis:30px;
    width:30px;
    height:30px;
  }
}

/* ============================================================
   v0.9.1 — Inventory, Equipment and Hero Buildcraft
   ============================================================ */
.sr-only{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
}
.inventory-chip{
  display:inline-flex;
  margin-left:7px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(192,132,252,.32);
  background:rgba(192,132,252,.1);
  color:#e9d5ff;
  font-size:.76rem;
}
.btn-inventory.has-loot{
  border-color:rgba(251,191,36,.58);
  box-shadow:0 0 18px rgba(251,191,36,.12);
}
.inventory-overlay{
  align-items:flex-start;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:20px;
}
.inventory-card{
  width:min(1120px,100%);
  margin:auto;
  padding:26px;
  text-align:left;
  border-color:rgba(192,132,252,.26);
  background:
    radial-gradient(circle at 88% 6%,rgba(192,132,252,.12),transparent 30%),
    linear-gradient(180deg,rgba(15,23,42,.98),rgba(7,12,23,.98));
}
.inventory-card::before{border-radius:inherit}
.inventory-card h1,
.inventory-card h2,
.inventory-card h3,
.inventory-card p{margin-top:0;text-align:left}
.inventory-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:20px;
}
.inventory-header h1{
  margin-bottom:7px;
  font-size:clamp(26px,4vw,42px);
}
.inventory-header p{
  max-width:680px;
  margin-bottom:0;
  color:#aebbd0;
  line-height:1.55;
}
.inventory-close{
  flex:0 0 auto;
  width:42px;
  height:42px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,.18);
  background:rgba(8,17,31,.84);
  color:#e2e8f0;
  font-size:26px;
  cursor:pointer;
}
.inventory-close:hover{border-color:rgba(192,132,252,.55);color:#fff}
.inventory-summary{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:10px;
  margin:20px 0 16px;
}
.inventory-summary > div{
  padding:12px 14px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,.12);
  background:rgba(8,17,31,.66);
}
.inventory-summary span{
  display:block;
  color:#94a3b8;
  font-size:9px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.inventory-summary strong{
  display:block;
  margin-top:4px;
  color:#f8fafc;
  font-size:20px;
}
.inventory-crystal-cell{
  position:relative;
}
.inventory-crystal-cell strong{
  color:#a5f3fc;
}
.inventory-craft-btn{
  margin-top:8px;
  width:100%;
  min-height:28px;
  padding:5px 8px;
  border-radius:10px;
  font-size:9px;
  font-weight:800;
  letter-spacing:.06em;
  cursor:pointer;
  color:#67e8f9;
  background:color-mix(in srgb,#22d3ee 12%,rgba(8,17,31,.7));
  border:1px solid color-mix(in srgb,#22d3ee 34%,transparent);
  transition:background .15s ease,opacity .15s ease;
}
.inventory-craft-btn:hover:not(:disabled){
  background:color-mix(in srgb,#22d3ee 22%,rgba(8,17,31,.7));
}
.inventory-craft-btn:disabled{
  opacity:.5;
  cursor:default;
  color:#64748b;
  border-color:rgba(148,163,184,.18);
}
.loot-cache-panel,
.equipment-panel,
.inventory-bag-panel{
  border:1px solid rgba(148,163,184,.12);
  border-radius:20px;
  background:rgba(8,17,31,.52);
}
.loot-cache-panel{padding:15px;margin-bottom:14px}
.equipment-panel,.inventory-bag-panel{padding:16px}
.inventory-section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:12px;
}
.inventory-section-head h2{
  margin:2px 0 0;
  color:#f8fafc;
  font-size:18px;
}
.inventory-section-kicker{
  color:#a78bfa;
  font-size:9px;
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.inventory-claim-all{
  width:auto;
  min-width:120px;
  padding:9px 14px;
  border-radius:999px;
}
.inventory-claim-all:disabled{opacity:.46;cursor:not-allowed}
.loot-cache-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
}
.loot-cache-entry{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-width:0;
  padding:11px 12px;
  border:1px solid rgba(251,191,36,.18);
  border-radius:15px;
  background:linear-gradient(135deg,rgba(68,46,14,.32),rgba(15,23,42,.68));
}
.loot-cache-entry > div{min-width:0}
.loot-cache-entry span{
  display:block;
  color:#a99b83;
  font-size:9px;
  letter-spacing:.1em;
  text-transform:uppercase;
}
.loot-cache-entry strong{
  display:block;
  overflow:hidden;
  margin-top:3px;
  color:#fef3c7;
  font-size:12px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.loot-cache-entry .btn{
  flex:0 0 auto;
  width:auto;
  padding:7px 12px;
  border-radius:999px;
  font-size:11px;
}
.inventory-workspace{
  display:grid;
  grid-template-columns:minmax(280px,340px) minmax(0,1fr);
  gap:14px;
}
.equipment-slots{display:grid;gap:8px}
.equipment-slot{
  display:grid;
  grid-template-columns:38px minmax(0,1fr);
  align-items:center;
  gap:10px;
  min-height:66px;
  padding:10px;
  border:1px dashed rgba(148,163,184,.2);
  border-radius:15px;
  background:rgba(15,23,42,.55);
}
.equipment-slot.filled{
  grid-template-columns:38px minmax(0,1fr) auto;
  border-style:solid;
  border-color:color-mix(in srgb,var(--item-color,#94a3b8) 42%,transparent);
  background:linear-gradient(90deg,color-mix(in srgb,var(--item-color,#94a3b8) 9%,transparent),rgba(15,23,42,.6));
}
.equipment-slot-icon{
  display:grid;
  width:38px;
  height:38px;
  place-items:center;
  border-radius:12px;
  background:rgba(255,255,255,.045);
  font-size:20px;
}
.equipment-slot-copy{min-width:0}
.equipment-slot-copy span{
  display:block;
  color:#94a3b8;
  font-size:9px;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.equipment-slot-copy strong{
  display:block;
  overflow:hidden;
  margin:2px 0;
  color:var(--item-color,#dbeafe);
  font-size:13px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.equipment-slot-copy small{display:block;color:#aebbd0;font-size:10px}
.equipment-slot button{
  border:0;
  background:transparent;
  color:#c4b5fd;
  font:700 10px Inter,Arial,sans-serif;
  cursor:pointer;
}
.equipment-slot button:hover{color:#fff}
.inventory-bag-head{align-items:flex-end}
.inventory-controls{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.inventory-controls select{
  max-width:130px;
  min-height:36px;
  padding:7px 28px 7px 10px;
  border:1px solid rgba(148,163,184,.17);
  border-radius:11px;
  background:#0c1424;
  color:#dbeafe;
  font:700 11px Inter,Arial,sans-serif;
}
.inventory-items{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  max-height:530px;
  overflow-y:auto;
  padding-right:3px;
}
.inventory-item-card{
  min-width:0;
  padding:13px;
  border:1px solid color-mix(in srgb,var(--item-color,#94a3b8) 36%,transparent);
  border-radius:17px;
  background:
    radial-gradient(circle at 12% 5%,color-mix(in srgb,var(--item-color,#94a3b8) 12%,transparent),transparent 38%),
    rgba(13,21,37,.86);
}
.inventory-item-card.equipped{
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--item-color,#94a3b8) 25%,transparent);
}
.inventory-item-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.inventory-item-icon{
  display:grid;
  width:36px;
  height:36px;
  place-items:center;
  border-radius:12px;
  background:color-mix(in srgb,var(--item-color,#94a3b8) 13%,rgba(15,23,42,.8));
  font-size:19px;
}
.inventory-item-power{
  color:#f8fafc;
  font-size:17px;
  font-weight:800;
  text-align:right;
}
.inventory-item-power small{
  display:block;
  color:#7f8ca0;
  font-size:8px;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.inventory-item-rarity{
  margin-top:9px;
  color:var(--item-color,#94a3b8);
  font-size:9px;
  font-weight:800;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.inventory-item-card h3{
  overflow:hidden;
  margin:2px 0;
  color:#f8fafc;
  font-size:15px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.inventory-item-meta{color:#94a3b8;font-size:10px;text-transform:capitalize}
.inventory-item-stats{
  display:grid;
  gap:4px;
  min-height:39px;
  margin:9px 0 10px;
}
.inventory-item-stat{
  display:flex;
  justify-content:space-between;
  gap:8px;
  color:#aebbd0;
  font-size:10px;
}
.inventory-item-stat strong{color:#dbeafe}
.inventory-item-stat.core strong{color:var(--item-color,#dbeafe)}
.inventory-equip-btn{
  width:100%;
  min-height:34px;
  padding:7px 10px;
  border-radius:11px;
  font-size:10px;
}
.inventory-equip-btn:disabled{opacity:.62;cursor:default}
.inventory-item-actions{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.inventory-item-disposal{
  display:flex;
  gap:6px;
}
.inventory-salvage-btn,
.inventory-discard-btn{
  flex:1;
  min-height:28px;
  padding:5px 6px;
  border-radius:10px;
  font-size:9px;
  font-weight:700;
  letter-spacing:.04em;
  cursor:pointer;
  border:1px solid transparent;
  transition:background .15s ease,border-color .15s ease,color .15s ease;
}
.inventory-salvage-btn{
  color:#fcd34d;
  background:color-mix(in srgb,#fbbf24 12%,rgba(15,23,42,.7));
  border-color:color-mix(in srgb,#fbbf24 34%,transparent);
}
.inventory-salvage-btn:hover{
  background:color-mix(in srgb,#fbbf24 22%,rgba(15,23,42,.7));
}
.inventory-discard-btn{
  color:#fca5a5;
  background:rgba(15,23,42,.6);
  border-color:color-mix(in srgb,#ef4444 30%,transparent);
}
.inventory-discard-btn:hover{
  background:color-mix(in srgb,#ef4444 16%,rgba(15,23,42,.6));
  color:#fecaca;
}
.inventory-empty{
  grid-column:1/-1;
  display:grid;
  place-items:center;
  min-height:74px;
  padding:13px;
  color:#94a3b8;
  text-align:center;
}
.inventory-empty > span{color:#a78bfa;font-size:22px}
.inventory-empty strong{margin-top:3px;color:#cbd5e1;font-size:12px}
.inventory-empty small{margin-top:2px;color:#7f8ca0;font-size:10px}
.inventory-empty-bag{min-height:180px}
.inventory-feedback{
  margin-top:13px;
  padding:10px 12px;
  border:1px solid rgba(148,163,184,.12);
  border-radius:13px;
  background:rgba(8,17,31,.6);
  color:#aebbd0;
  font-size:11px;
}
.inventory-feedback[data-tone="success"]{border-color:rgba(74,222,128,.22);color:#bbf7d0}
.inventory-feedback[data-tone="warning"]{border-color:rgba(251,191,36,.28);color:#fde68a}

@media (max-width:880px){
  .inventory-summary{grid-template-columns:repeat(3,minmax(0,1fr))}
  .inventory-workspace{grid-template-columns:1fr}
  .equipment-slots{grid-template-columns:repeat(2,minmax(0,1fr))}
  .equipment-slot:last-child{grid-column:1/-1}
  .inventory-items{max-height:none}
}
@media (max-width:620px){
  .inventory-overlay{padding:10px}
  .inventory-card{padding:17px;border-radius:21px}
  .inventory-header{gap:10px}
  .inventory-header h1{font-size:25px}
  .inventory-header p{font-size:12px}
  .inventory-close{width:38px;height:38px}
  .inventory-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .inventory-summary > div{padding:10px}
  .inventory-summary strong{font-size:17px}
  .loot-cache-list{grid-template-columns:1fr}
  .inventory-section-head{align-items:flex-start}
  .inventory-bag-head{display:block}
  .inventory-controls{justify-content:flex-start;margin-top:9px}
  .inventory-controls label{flex:1}
  .inventory-controls select{width:100%;max-width:none}
  .equipment-slots{grid-template-columns:1fr}
  .equipment-slot:last-child{grid-column:auto}
  .inventory-items{grid-template-columns:1fr}
}

/* ============================================================
   v0.9.2 — Hero Skill Tree
   ============================================================ */
.skill-points-chip{
  display:inline-grid;
  min-width:24px;
  height:24px;
  margin-left:7px;
  padding:0 7px;
  place-items:center;
  border:1px solid rgba(251,191,36,.35);
  border-radius:999px;
  background:rgba(245,158,11,.12);
  color:#fbbf24;
  font-size:.76rem;
  font-weight:800;
}
.btn-skills.has-points{
  border-color:rgba(251,191,36,.62);
  box-shadow:0 0 18px rgba(251,191,36,.14);
}
.hero-skills-overlay{
  align-items:flex-start;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:20px;
}
.hero-skills-card{
  width:min(1080px,100%);
  margin:auto;
  padding:27px;
  text-align:left;
  border-color:rgba(245,158,11,.28);
  background:
    radial-gradient(circle at 12% 0%,rgba(245,158,11,.12),transparent 27%),
    radial-gradient(circle at 88% 0%,rgba(167,139,250,.11),transparent 30%),
    linear-gradient(180deg,rgba(15,23,42,.98),rgba(7,12,23,.98));
}
.hero-skills-card h1,
.hero-skills-card h2,
.hero-skills-card h3,
.hero-skills-card p{margin-top:0;text-align:left}
.hero-skills-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}
.hero-skills-identity{
  min-width:0;
  display:flex;
  align-items:center;
  gap:20px;
}
.hero-skills-portrait{
  position:relative;
  flex:0 0 104px;
  width:104px;
  height:120px;
  padding:2px;
  clip-path:polygon(50% 0,92% 14%,96% 72%,50% 100%,4% 72%,8% 14%);
  background:linear-gradient(145deg,#f8d18b 0%,#8d552a 36%,#2f1c17 68%,#9d75d4 100%);
  filter:drop-shadow(0 12px 19px rgba(0,0,0,.5)) drop-shadow(0 0 12px rgba(245,158,11,.18));
}
.hero-skills-portrait::after{
  content:"";
  position:absolute;
  inset:2px;
  clip-path:inherit;
  background:
    radial-gradient(circle at 32% 20%,rgba(255,221,154,.12),transparent 34%),
    linear-gradient(180deg,transparent 52%,rgba(5,4,7,.56));
  pointer-events:none;
}
.hero-skills-portrait img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  object-position:50% 28%;
  clip-path:inherit;
}
.hero-skills-intro{min-width:0}
.hero-skills-header h1{margin-bottom:7px;font-size:clamp(28px,4vw,44px)}
.hero-skills-header p{
  max-width:720px;
  margin-bottom:0;
  color:#aebbd0;
  line-height:1.55;
}
.hero-skills-close{
  flex:0 0 auto;
  width:42px;
  height:42px;
  border:1px solid rgba(148,163,184,.18);
  border-radius:14px;
  background:rgba(8,17,31,.84);
  color:#e2e8f0;
  font-size:26px;
  cursor:pointer;
}
.hero-skills-close:hover{border-color:rgba(245,158,11,.55);color:#fff}
.hero-skills-summary{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin:20px 0 16px;
}
.hero-skills-summary > div{
  padding:12px 14px;
  border:1px solid rgba(148,163,184,.12);
  border-radius:16px;
  background:rgba(8,17,31,.66);
}
.hero-skills-summary > div.available{border-color:rgba(251,191,36,.28)}
.hero-skills-summary span{
  display:block;
  color:#94a3b8;
  font-size:9px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.hero-skills-summary strong{
  display:block;
  margin-top:4px;
  color:#f8fafc;
  font-size:21px;
}
.hero-skills-summary .available strong{color:#fbbf24}
.hero-skill-branches{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.hero-skill-branch{
  min-width:0;
  padding:14px;
  border:1px solid color-mix(in srgb,var(--skill-branch-color) 28%,transparent);
  border-radius:20px;
  background:
    radial-gradient(circle at 14% 0%,color-mix(in srgb,var(--skill-branch-color) 10%,transparent),transparent 30%),
    rgba(8,17,31,.58);
}
.hero-skill-branch > header{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:56px;
  margin-bottom:11px;
}
.hero-skill-branch > header > span{
  display:grid;
  flex:0 0 42px;
  width:42px;
  height:42px;
  place-items:center;
  border-radius:14px;
  background:color-mix(in srgb,var(--skill-branch-color) 14%,rgba(15,23,42,.85));
  color:var(--skill-branch-color);
  font-size:22px;
}
.hero-skill-branch > header h2{
  margin:0;
  color:var(--skill-branch-color);
  font-size:17px;
}
.hero-skill-branch > header p{
  margin:2px 0 0;
  color:#94a3b8;
  font-size:10px;
  line-height:1.35;
}
.hero-skill-nodes{display:grid;gap:9px}
.hero-skill-node{
  position:relative;
  padding:12px;
  border:1px solid color-mix(in srgb,var(--skill-branch-color) 25%,transparent);
  border-radius:16px;
  background:rgba(13,21,37,.82);
}
.hero-skill-node.locked{opacity:.62;filter:saturate(.65)}
.hero-skill-node.maxed{
  border-color:color-mix(in srgb,var(--skill-branch-color) 65%,transparent);
  box-shadow:inset 0 0 20px color-mix(in srgb,var(--skill-branch-color) 8%,transparent);
}
.hero-skill-node-head{
  display:flex;
  align-items:center;
  gap:9px;
}
.hero-skill-node-icon{
  display:grid;
  flex:0 0 34px;
  width:34px;
  height:34px;
  place-items:center;
  border-radius:11px;
  background:color-mix(in srgb,var(--skill-branch-color) 12%,rgba(15,23,42,.88));
  color:var(--skill-branch-color);
  font-size:17px;
}
.hero-skill-node h3{margin:0;color:#f8fafc;font-size:13px}
.hero-skill-ranks{display:flex;align-items:center;gap:4px;margin-top:4px}
.hero-skill-ranks > span{
  width:8px;
  height:8px;
  border:1px solid rgba(148,163,184,.3);
  border-radius:99px;
  background:transparent;
}
.hero-skill-ranks > span.filled{
  border-color:var(--skill-branch-color);
  background:var(--skill-branch-color);
  box-shadow:0 0 6px color-mix(in srgb,var(--skill-branch-color) 70%,transparent);
}
.hero-skill-ranks small{margin-left:3px;color:#94a3b8;font-size:9px}
.hero-skill-node > p{
  min-height:30px;
  margin:9px 0 5px;
  color:#cbd5e1;
  font-size:10px;
  line-height:1.45;
}
.hero-skill-requirement{
  min-height:25px;
  color:#7f8ca0;
  font-size:9px;
  line-height:1.35;
}
.hero-skill-node .btn{
  width:100%;
  min-height:34px;
  margin-top:7px;
  padding:7px 9px;
  border-radius:11px;
  font-size:10px;
}
.hero-skill-node .btn:disabled{opacity:.65;cursor:not-allowed}
.hero-skills-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-top:14px;
  padding:12px 13px;
  border:1px solid rgba(148,163,184,.12);
  border-radius:15px;
  background:rgba(8,17,31,.62);
}
.hero-skill-feedback{color:#aebbd0;font-size:11px}
.hero-skill-feedback[data-tone="success"]{color:#bbf7d0}
.hero-skill-feedback[data-tone="warning"]{color:#fde68a}
.hero-skill-footer-actions{display:flex;gap:8px;flex:0 0 auto}
.hero-skill-footer-actions .btn{width:auto;min-width:100px;padding:9px 14px;border-radius:999px}
.hero-skill-respec.armed{border-color:rgba(248,113,113,.48);color:#fecaca}
.hero-skill-respec:disabled{opacity:.45;cursor:not-allowed}

@media (max-width:900px){
  .hero-skill-branches{grid-template-columns:1fr}
  .hero-skill-nodes{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:660px){
  .hero-skills-overlay{padding:10px}
  .hero-skills-card{padding:17px;border-radius:21px}
  .hero-skills-header{align-items:flex-start;gap:10px}
  .hero-skills-identity{align-items:flex-start;gap:11px}
  .hero-skills-portrait{
    flex-basis:70px;
    width:70px;
    height:82px;
  }
  .hero-skills-header h1{font-size:27px}
  .hero-skills-header p{font-size:12px}
  .hero-skills-close{width:38px;height:38px}
  .hero-skills-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .hero-skills-summary > div{padding:10px}
  .hero-skill-nodes{grid-template-columns:1fr}
  .hero-skill-node > p{min-height:0}
  .hero-skills-footer{display:block}
  .hero-skill-footer-actions{margin-top:10px}
  .hero-skill-footer-actions .btn{flex:1}
}
@media (max-width:430px){
  .hero-skills-portrait{
    flex-basis:58px;
    width:58px;
    height:68px;
  }
  .hero-skills-identity{gap:9px}
  .hero-skills-header h1{font-size:23px}
  .hero-skills-header p{font-size:11px;line-height:1.4}
}

/* =========================================================
   Inline War Council navigation.
   The home version sits beside Play Now; inner pages keep
   the same graphical controls inside their content banner.
   ========================================================= */
.site-nav-inline{
  min-width:0;
}
.site-nav-inline--hero{
  flex:1 1 500px;
  margin:0;
}
.site-nav-inline--page{
  width:100%;
  margin:15px 0 0;
  padding:7px;
  border:1px solid rgba(226,184,114,.17);
  border-radius:13px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent),
    rgba(4,5,8,.58);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}
main > .site-nav-inline--page{
  width:min(100%, 1120px);
  margin:0 auto 16px;
}
.site-nav-inline .site-nav-links{
  display:flex;
  grid-template-columns:none;
  align-items:stretch;
  gap:7px;
  width:100%;
}
.site-nav-inline .site-nav-link{
  flex:1 1 105px;
  min-width:0;
  min-height:58px;
  gap:9px;
  padding:7px 11px 7px 7px;
  border-color:rgba(226,184,114,.18);
  border-radius:7px;
  clip-path:polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
  background:
    linear-gradient(180deg, rgba(226,184,114,.07), transparent 48%),
    linear-gradient(145deg, rgba(31,24,21,.94), rgba(7,8,11,.96));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.045),
    inset 0 -1px 0 rgba(0,0,0,.75),
    0 5px 13px rgba(0,0,0,.22);
}
.site-nav-inline .site-nav-link:hover{
  transform:translateY(-1px);
  border-color:rgba(226,184,114,.48);
  background:
    linear-gradient(180deg, rgba(226,184,114,.14), transparent 50%),
    linear-gradient(145deg, rgba(47,33,23,.96), rgba(9,9,12,.98));
}
.site-nav-inline .site-nav-link.is-current{
  border-color:rgba(235,190,106,.66);
  background:
    linear-gradient(180deg, rgba(239,190,96,.22), transparent 52%),
    linear-gradient(145deg, rgba(67,44,24,.97), rgba(12,10,12,.98));
  box-shadow:
    0 0 16px rgba(204,145,61,.14),
    inset 0 1px 0 rgba(255,230,180,.12);
}
.site-nav-inline .site-nav-icon{
  position:relative;
  flex:0 0 42px;
  width:42px;
  height:42px;
  border:0;
  color:inherit;
  font-size:0;
  background:none;
  box-shadow:none;
  overflow:visible;
}
.site-nav-inline .site-nav-icon::after{
  content:"";
  position:absolute;
  inset:7px;
  z-index:-1;
  border-radius:50%;
  background:rgba(222,151,56,.13);
  box-shadow:0 0 16px rgba(222,151,56,.2);
}
.site-nav-inline .site-nav-icon img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  filter:
    drop-shadow(0 3px 3px rgba(0,0,0,.72))
    drop-shadow(0 0 5px rgba(206,139,48,.2));
  transition:transform .18s ease, filter .18s ease;
}
.site-nav-inline .site-nav-link:hover .site-nav-icon img,
.site-nav-inline .site-nav-link.is-current .site-nav-icon img{
  transform:scale(1.08);
  filter:
    drop-shadow(0 4px 4px rgba(0,0,0,.76))
    drop-shadow(0 0 8px rgba(229,164,70,.42));
}
.site-nav-inline .site-nav-copy strong{
  font-size:10.5px;
  line-height:1.15;
  text-shadow:0 1px 2px rgba(0,0,0,.78);
}
.site-nav-inline .site-nav-copy small{
  display:none;
}
.hero-home-banner .hero-cta-row{
  flex-wrap:wrap;
}

@media (max-width:760px){
  .site-nav-inline--hero{
    flex-basis:100%;
    width:100%;
  }
  .site-nav-inline .site-nav-links{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .site-nav-inline .site-nav-link{
    min-height:58px;
    justify-content:flex-start;
  }
}
@media (max-width:420px){
  .site-nav-inline .site-nav-link{
    padding-inline:8px;
  }
  .site-nav-inline .site-nav-copy strong{
    font-size:9px;
  }
}

/* ============================================================
   v11 War Council battlefield command bar
   ============================================================ */
.war-council-header{
  --war-gold:#d7a95f;
  --war-gold-soft:rgba(215,169,95,.2);
  display:grid;
  grid-template-columns:minmax(410px,auto) minmax(180px,1fr) auto;
  align-items:center;
  gap:16px;
  min-height:76px;
  padding:10px 12px;
  overflow:hidden;
  isolation:isolate;
  border-bottom:1px solid rgba(204,153,78,.22);
  background:
    radial-gradient(80% 150% at 0% 20%,rgba(88,61,31,.22),transparent 58%),
    radial-gradient(50% 140% at 100% 0%,rgba(76,44,29,.18),transparent 62%),
    linear-gradient(180deg,rgba(19,18,23,.985),rgba(10,11,16,.985));
  box-shadow:
    inset 0 1px 0 rgba(255,229,181,.055),
    inset 0 -16px 30px rgba(0,0,0,.14);
}
.war-council-header::before{
  content:"";
  position:absolute;
  z-index:0;
  top:0;
  left:18px;
  right:18px;
  height:1px;
  background:linear-gradient(90deg,transparent,rgba(222,173,96,.34) 18%,rgba(222,173,96,.1) 50%,rgba(222,173,96,.34) 82%,transparent);
}
.war-council-header::after{
  content:"";
  position:absolute;
  z-index:0;
  inset:0;
  pointer-events:none;
  opacity:.22;
  background:
    linear-gradient(115deg,transparent 0 18%,rgba(255,255,255,.018) 18.2% 18.5%,transparent 18.7% 100%),
    linear-gradient(65deg,transparent 0 82%,rgba(255,255,255,.014) 82.2% 82.5%,transparent 82.7% 100%);
}
.war-council-header > *{
  position:relative;
  z-index:1;
}

.war-council-header .panel-header-lead{
  display:flex;
  flex-flow:row nowrap;
  align-items:center;
  gap:8px;
  min-width:0;
  padding:0;
}
.panel-header-title{
  display:flex;
  align-items:center;
  gap:9px;
  min-width:126px;
  padding:2px 11px 2px 2px;
  border-right:1px solid rgba(203,155,87,.18);
}
.panel-header-title-sigil{
  position:relative;
  display:grid;
  place-items:center;
  flex:0 0 38px;
  width:38px;
  height:42px;
  color:#f0ca82;
  border:1px solid rgba(215,169,95,.4);
  border-radius:11px 11px 15px 15px;
  background:
    radial-gradient(circle at 50% 24%,rgba(226,177,92,.2),transparent 45%),
    linear-gradient(180deg,rgba(58,42,27,.92),rgba(19,19,24,.96));
  box-shadow:
    inset 0 1px 0 rgba(255,226,168,.12),
    inset 0 -8px 13px rgba(0,0,0,.28),
    0 7px 17px rgba(0,0,0,.26);
}
.panel-header-title-sigil::before{
  content:"\2694";
  font:600 20px/1 Georgia,serif;
  text-shadow:0 1px 2px #000,0 0 8px rgba(240,184,91,.26);
}
.panel-header-title-sigil::after{
  content:"";
  position:absolute;
  left:8px;
  right:8px;
  bottom:5px;
  height:1px;
  background:linear-gradient(90deg,transparent,#bf8342,transparent);
}
.panel-header-title-copy{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}
.war-council-header .panel-header-title .panel-kicker{
  flex-basis:auto;
  align-self:auto;
  margin:0;
  z-index:auto;
  color:#b98c50;
  font-size:8px;
  line-height:1;
  letter-spacing:.2em;
  white-space:nowrap;
}
.panel-header-title-copy strong{
  max-width:96px;
  overflow:hidden;
  color:#f0e1c6;
  font:700 13px/1.1 Cinzel,Georgia,serif;
  letter-spacing:.04em;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-shadow:0 1px 2px #000;
}

.war-council-header .worldmap-open-btn,
.war-council-header .daily-challenge-btn,
.war-council-header .endless-mode-btn{
  min-height:48px;
  padding:6px 10px;
  gap:8px;
  border-radius:12px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.055),
    0 7px 18px rgba(0,0,0,.22);
}
.war-council-header .worldmap-open-emoji,
.war-council-header .daily-challenge-emoji,
.war-council-header .endless-mode-emoji{
  width:30px;
  height:30px;
  border-radius:9px;
  font-size:16px;
}
.war-council-header .worldmap-open-kicker,
.war-council-header .daily-challenge-kicker,
.war-council-header .endless-mode-kicker{
  display:block;
  color:rgba(210,181,137,.68);
  font-size:7px;
  font-weight:800;
  line-height:1;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.war-council-header .worldmap-open-name,
.war-council-header .daily-challenge-name,
.war-council-header .endless-mode-name{
  max-width:112px;
  color:#f2e6d2;
  font:700 11.5px/1.1 Cinzel,Georgia,serif;
  letter-spacing:.02em;
}

.panel-header-run-status{
  --run-accent:#6ee7b7;
  position:relative;
  justify-self:center;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:188px;
  min-height:48px;
  padding:7px 13px;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--run-accent) 32%,rgba(255,255,255,.04));
  border-radius:14px;
  background:
    radial-gradient(100% 150% at 0% 0%,color-mix(in srgb,var(--run-accent) 11%,transparent),transparent 64%),
    linear-gradient(180deg,rgba(20,24,30,.94),rgba(9,12,18,.96));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 8px 22px rgba(0,0,0,.2);
}
.panel-header-run-status::after{
  content:"";
  position:absolute;
  left:14px;
  right:14px;
  bottom:0;
  height:1px;
  background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--run-accent) 55%,transparent),transparent);
}
.panel-header-run-status.is-battle{--run-accent:#fb923c}
.panel-header-run-status.is-paused{--run-accent:#facc15}
.panel-header-run-status.is-reward{--run-accent:#c084fc}
.panel-header-run-status.is-danger{--run-accent:#fb7185}
.panel-header-run-status.is-map{--run-accent:#67e8f9}
.run-status-medallion{
  position:relative;
  display:grid;
  place-items:center;
  flex:0 0 29px;
  width:29px;
  height:29px;
  border-radius:50%;
  border:1px solid color-mix(in srgb,var(--run-accent) 46%,transparent);
  background:color-mix(in srgb,var(--run-accent) 11%,rgba(8,12,18,.9));
  box-shadow:inset 0 0 10px rgba(0,0,0,.3),0 0 12px color-mix(in srgb,var(--run-accent) 12%,transparent);
}
.run-status-medallion::before,
.run-status-medallion::after{
  content:"";
  position:absolute;
  width:9px;
  height:9px;
  border:1px solid color-mix(in srgb,var(--run-accent) 72%,transparent);
  transform:rotate(45deg);
}
.run-status-medallion::after{
  width:3px;
  height:3px;
  border:0;
  background:var(--run-accent);
  box-shadow:0 0 7px var(--run-accent);
}
.panel-header-run-status.is-battle .run-status-medallion::after{
  animation:warCouncilPulse 1.25s ease-in-out infinite;
}
@keyframes warCouncilPulse{
  0%,100%{opacity:.5;transform:rotate(45deg) scale(.8)}
  50%{opacity:1;transform:rotate(45deg) scale(1.35)}
}
.run-status-copy{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}
.run-status-topline{
  display:flex;
  align-items:center;
  gap:5px;
  color:#8d98a8;
  font-size:8px;
  font-weight:800;
  letter-spacing:.15em;
  line-height:1;
  text-transform:uppercase;
}
.run-status-topline strong{
  color:var(--run-accent);
  font-size:9px;
}
.run-status-progress{
  overflow:hidden;
  color:#f1e5d2;
  font:700 12px/1.1 Cinzel,Georgia,serif;
  letter-spacing:.03em;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.war-council-header .panel-header-user-actions{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  min-width:0;
}
.war-council-header .panel-header-skills,
.war-council-header .panel-header-inventory,
.war-council-header .panel-header-ley{
  min-height:42px;
  padding:7px 10px 7px 8px;
  gap:6px;
  border-radius:12px;
  font-size:11.5px;
}
.war-council-header .phb-ico{
  width:23px;
  height:23px;
  font-size:12px;
}
.war-council-header .phb-count{
  min-width:20px;
  padding:2px 6px;
  font-size:10px;
}
.war-council-header .panel-header-user{
  min-height:42px;
  padding:5px 10px 5px 6px;
  gap:7px;
  border-radius:12px;
}
.war-council-header .panel-header-user-label{
  color:rgba(194,153,93,.76);
  font-size:8px;
  letter-spacing:.15em;
}
.war-council-header .panel-header-user-value{
  max-width:112px;
  overflow:hidden;
  font-size:12px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.panel-header-guest-mark{
  display:grid;
  place-items:center;
  width:28px;
  height:30px;
  color:#e3b562;
  font:700 13px/1 Cinzel,Georgia,serif;
  border:1px solid rgba(215,169,95,.4);
  border-radius:9px 9px 11px 11px;
  background:linear-gradient(180deg,rgba(71,50,27,.85),rgba(26,22,22,.94));
  box-shadow:inset 0 1px 0 rgba(255,226,168,.1);
}
.war-council-header .panel-header-user.is-guest{
  border-color:rgba(215,169,95,.28);
}
.war-council-header .panel-header-user.is-guest .panel-header-user-value{
  color:#f0ca82;
}
.war-council-header .panel-header-logout{
  min-height:42px;
  padding-inline:12px;
  border-radius:12px;
  font-size:11px;
}

@media (max-width:1180px){
  .war-council-header{
    grid-template-columns:minmax(0,1fr) auto;
    gap:9px 12px;
  }
  .panel-header-run-status{
    grid-column:1 / -1;
    grid-row:2;
    justify-self:stretch;
    justify-content:center;
    min-height:38px;
    padding-block:5px;
  }
}
@media (max-width:900px){
  .war-council-header{
    grid-template-columns:1fr;
    padding:10px;
  }
  .war-council-header .panel-header-lead{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    width:100%;
  }
  .panel-header-title{
    grid-column:1 / -1;
    width:100%;
    min-width:0;
    padding-right:0;
    padding-bottom:7px;
    border-right:0;
    border-bottom:1px solid rgba(203,155,87,.15);
  }
  .panel-header-title-copy strong{
    max-width:none;
  }
  .war-council-header .worldmap-open-btn,
  .war-council-header .daily-challenge-btn,
  .war-council-header .endless-mode-btn{
    width:100%;
    min-width:0;
  }
  .panel-header-run-status{
    grid-column:1;
    grid-row:auto;
  }
  .war-council-header .panel-header-user-actions{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    width:100%;
  }
  .war-council-header .panel-header-skills,
  .war-council-header .panel-header-inventory,
  .war-council-header .panel-header-ley,
  .war-council-header .panel-header-user{
    width:100%;
    justify-content:center;
    padding-inline:6px;
  }
  .war-council-header .phb-label,
  .war-council-header .panel-header-user-label{
    display:none;
  }
}
@media (max-width:460px){
  .war-council-header .panel-header-lead{
    grid-template-columns:1fr;
  }
  .war-council-header .panel-header-user-actions{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .war-council-header .panel-header-user-value{
    max-width:88px;
  }
}
@media (prefers-reduced-motion:reduce){
  .panel-header-run-status.is-battle .run-status-medallion::after{
    animation:none;
  }
}

/* =========================================================
   ACT II — cinematic story scenes and Exodus objective
   ========================================================= */
.story-overlay{
  z-index:46;
  overflow:hidden;
  background:
    radial-gradient(circle at 50% 115%, rgba(221,103,35,.22), transparent 42%),
    linear-gradient(180deg, rgba(3,4,8,.92), rgba(8,5,4,.96));
  backdrop-filter:blur(12px);
}
.story-overlay::before,
.story-overlay::after{
  content:"";
  position:absolute;
  pointer-events:none;
}
.story-overlay::before{
  inset:0;
  opacity:.28;
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(255,205,143,.04) 50%, transparent 56%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px);
}
.story-overlay::after{
  left:50%;
  bottom:-180px;
  width:760px;
  height:360px;
  transform:translateX(-50%);
  border-radius:50%;
  background:radial-gradient(circle, rgba(232,112,42,.26), rgba(92,27,10,.08) 46%, transparent 72%);
  filter:blur(10px);
}
.story-card{
  position:relative;
  z-index:1;
  width:min(100%,780px);
  min-height:390px;
  padding:34px 38px 30px;
  overflow:hidden;
  border:1px solid rgba(216,183,137,.25);
  border-radius:12px;
  background:
    linear-gradient(180deg, rgba(18,17,19,.97), rgba(8,9,13,.98)),
    #0b0c10;
  box-shadow:
    0 32px 90px rgba(0,0,0,.72),
    inset 0 0 0 1px rgba(255,240,216,.025);
  animation:storyCardEnter .34s ease-out;
}
.story-card::before{
  content:"";
  position:absolute;
  inset:9px;
  border:1px solid rgba(192,138,74,.09);
  pointer-events:none;
}
.story-ember{
  position:absolute;
  right:-90px;
  top:-120px;
  width:340px;
  height:340px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(219,111,45,.16), rgba(128,55,21,.04) 48%, transparent 70%);
  pointer-events:none;
}
.story-header{
  position:relative;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:24px;
}
.story-act{
  margin-bottom:7px;
  color:#c98a4a;
  font-size:11px;
  font-weight:900;
  letter-spacing:.2em;
  text-transform:uppercase;
}
.story-header h1{
  margin:0;
  color:#f1e7d8;
  font-family:"Cinzel", Georgia, serif;
  font-size:clamp(26px,4vw,42px);
  line-height:1.04;
  letter-spacing:.025em;
}
.story-location{
  max-width:230px;
  padding-top:4px;
  color:#8f887e;
  font-size:11px;
  font-weight:750;
  line-height:1.5;
  letter-spacing:.09em;
  text-align:right;
  text-transform:uppercase;
}
.story-rule{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:11px;
  margin:25px 0 27px;
  color:#a76e36;
  font-size:9px;
}
.story-rule i{
  height:1px;
  background:linear-gradient(90deg, transparent, rgba(192,138,74,.42));
}
.story-rule i:last-child{
  background:linear-gradient(90deg, rgba(192,138,74,.42), transparent);
}
.story-dialogue{
  position:relative;
  display:flex;
  min-height:150px;
  flex-direction:column;
  justify-content:center;
}
.story-speaker-wrap{
  margin-bottom:12px;
}
.story-speaker{
  display:inline-flex;
  padding:5px 11px;
  border:1px solid rgba(192,138,74,.25);
  border-radius:999px;
  color:#e6aa65;
  background:rgba(131,71,29,.11);
  font-size:11px;
  font-weight:900;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.story-text{
  margin:0;
  color:#f3ede4;
  font-family:"Cinzel", Georgia, serif;
  font-size:clamp(19px,2.5vw,29px);
  line-height:1.5;
  white-space:pre-line;
}
.story-card.is-narration .story-text{
  color:#c7bdb1;
  font-family:"Inter", Arial, sans-serif;
  font-size:clamp(16px,2vw,21px);
  font-style:italic;
  line-height:1.7;
}
.story-card.is-title .story-dialogue{
  align-items:center;
  text-align:center;
}
.story-card.is-title .story-text{
  color:#f2c47f;
  font-size:clamp(25px,4.5vw,46px);
  font-weight:800;
  letter-spacing:.09em;
  line-height:1.35;
  text-shadow:0 0 28px rgba(229,137,64,.18);
}
.story-footer{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:16px;
  margin-top:24px;
}
.story-skip{
  justify-self:start;
  padding:8px 0;
  border:0;
  color:#77726b;
  background:transparent;
  cursor:pointer;
  font-size:12px;
}
.story-skip:hover,
.story-skip:focus-visible{ color:#c7bdb1; }
.story-progress{
  color:#77726b;
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
}
.story-next{
  justify-self:end;
  min-width:124px;
}
@keyframes storyCardEnter{
  from{ opacity:0; transform:translateY(12px) scale(.985); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}

.campaign-objective{
  position:absolute;
  z-index:11;
  left:50%;
  top:58px;
  width:min(520px,calc(100% - 190px));
  transform:translateX(-50%);
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:11px;
  padding:9px 13px;
  border:1px solid rgba(245,158,11,.25);
  border-radius:14px;
  color:#eee7dc;
  background:linear-gradient(180deg, rgba(26,17,10,.91), rgba(11,10,11,.92));
  box-shadow:0 10px 24px rgba(0,0,0,.36), inset 0 0 16px rgba(235,117,30,.035);
  pointer-events:none;
}
/* The component's later display:grid declaration would otherwise win against
   the global .hidden rule. Act I stages have no objective and must stay clean. */
.campaign-objective.hidden{
  display:none;
}
.campaign-objective-icon{
  display:grid;
  width:34px;
  height:34px;
  place-items:center;
  border:1px solid rgba(245,158,11,.28);
  border-radius:50%;
  background:rgba(180,83,9,.12);
  filter:drop-shadow(0 0 7px rgba(245,158,11,.24));
}
.campaign-objective-copy{
  display:flex;
  min-width:0;
  flex-direction:column;
  gap:1px;
}
.campaign-objective-kicker{
  color:#c98542;
  font-size:8px;
  font-weight:900;
  letter-spacing:.16em;
  text-transform:uppercase;
}
.campaign-objective-copy strong{
  color:#f6ead9;
  font-family:"Cinzel", Georgia, serif;
  font-size:12px;
}
.campaign-objective-copy > span:last-child{
  overflow:hidden;
  color:#a9a198;
  font-size:9px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.campaign-objective-progress{
  display:flex;
  align-items:flex-end;
  flex-direction:column;
  gap:4px;
  color:#f5bd73;
  font-size:10px;
  font-weight:900;
}
.caravan-pips{
  display:flex;
  gap:4px;
}
.caravan-pips i{
  width:15px;
  height:4px;
  border-radius:999px;
  background:rgba(148,163,184,.22);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.035);
}
.caravan-pips i.complete{
  background:#f59e0b;
  box-shadow:0 0 8px rgba(245,158,11,.42);
}

.worldmap-hotspot.act-two{
  width:176px;
  height:110px;
}
.worldmap-hotspot.act-two .worldmap-hotspot-ring{
  width:148px;
  height:148px;
  opacity:.72;
  background:radial-gradient(circle, rgba(234,88,12,.24), rgba(180,83,9,.08) 48%, transparent 72%);
}
.worldmap-hotspot.act-two .worldmap-hotspot-label{
  bottom:7px;
  flex-direction:column;
  gap:1px;
  padding:7px 12px;
  border-color:rgba(234,138,67,.42);
  opacity:1;
  background:rgba(18,9,5,.94);
}
.worldmap-hotspot-name{
  color:#f4d1a2;
  font-family:"Cinzel", Georgia, serif;
  font-size:10px;
  font-weight:800;
  letter-spacing:.06em;
}

@media (max-width:700px){
  .story-overlay{ padding:12px; }
  .story-card{
    min-height:0;
    padding:24px 22px 20px;
  }
  .story-header{
    flex-direction:column;
    gap:8px;
  }
  .story-location{
    max-width:none;
    padding:0;
    text-align:left;
  }
  .story-rule{ margin:18px 0; }
  .story-dialogue{ min-height:128px; }
  .story-footer{ margin-top:16px; }
  .campaign-objective{
    top:50px;
    width:min(430px,calc(100% - 118px));
    padding:7px 9px;
  }
  .campaign-objective-copy > span:last-child{ display:none; }
}
@media (max-width:480px){
  .story-card{ padding:20px 18px 18px; }
  .story-footer{
    grid-template-columns:auto 1fr auto;
    gap:10px;
  }
  .story-next{
    min-width:98px;
    padding-inline:15px;
  }
  .campaign-objective{
    top:45px;
    width:calc(100% - 94px);
  }
  .campaign-objective-icon{ display:none; }
}
@media (max-height:520px){
  .story-card{
    min-height:0;
    max-height:calc(100vh - 20px);
    padding:18px 24px 16px;
  }
  .story-header h1{ font-size:24px; }
  .story-rule{ margin:10px 0 12px; }
  .story-dialogue{ min-height:82px; }
  .story-text{ font-size:18px; }
  .story-card.is-title .story-text{ font-size:26px; }
  .story-footer{ margin-top:10px; }
}
@media (prefers-reduced-motion:reduce){
  .story-card{ animation:none; }
}
