/* EMBERWARD — the whole interface.
   Design language: chunky dark outlines, warm gold gradients, deep violet grounds, generous rounding and a
   little squash on every press. Nothing here uses an image file; icons are inline SVG and every surface is a
   gradient. Two vendored fonts do the typography. */

@font-face {
  font-family: 'Titan One';
  src: url('../assets/fonts/TitanOne-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: block;
}
@font-face {
  font-family: 'Nunito';
  src: url('../assets/fonts/Nunito-latin.woff2') format('woff2');
  font-weight: 400 900; font-style: normal; font-display: swap;
}

:root {
  --ink: #16101d;
  --ink-2: #241a30;
  --ink-3: #322544;
  --paper: #f6efe2;
  --gold: #ffc63c;
  --gold-hi: #ffe9a8;
  --gold-lo: #ff7a18;
  --gold-deep: #c4471a;
  --violet: #8b5cf6;
  --violet-lo: #5b21b6;
  --rose: #f472b6;
  --mint: #7cc46b;
  --frost: #67e8f9;
  --danger: #ff5566;

  --display: 'Titan One', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --outline: 3px solid var(--ink);
  --lift: 0 4px 0 rgba(0, 0, 0, 0.35), 0 10px 26px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0b0712;
  font-family: var(--body);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; }
#app canvas { display: block; width: 100%; height: 100%; outline: none; }
/* The UI layer never swallows a click by accident: the root and every full-screen container are transparent
   to the pointer, and only the actual controls opt back in. (An `#ui-root > *` rule here would out-specify
   `.ew-hud { pointer-events: none }` on ID weight and make the whole HUD a click shield over the board.) */
#ui-root { position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: hidden; }
.ew-menus { pointer-events: auto; }
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }

/* ------------------------------------------------------------------------------------ primitives */
.ew-ico { width: 1em; height: 1em; display: block; flex: none; }

.ew-btn {
  --btn-bg: linear-gradient(180deg, #4b3a5e, #2e2340);
  --btn-text: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--display); font-size: 15px; letter-spacing: 0.4px;
  color: var(--btn-text);
  background: var(--btn-bg);
  border: var(--outline); border-radius: var(--r-lg);
  padding: 11px 20px; cursor: pointer;
  box-shadow: var(--lift);
  transition: transform 90ms ease, filter 140ms ease, box-shadow 90ms ease;
  position: relative;
}
.ew-btn .ew-ico { font-size: 19px; }
.ew-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.ew-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.4); }
.ew-btn--gold {
  --btn-bg: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 38%, var(--gold-lo) 100%);
  --btn-text: #3a1f06;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.ew-btn--big { font-size: 21px; padding: 15px 34px; border-radius: var(--r-xl); }
.ew-btn--tiny { font-size: 12px; padding: 7px 12px; border-radius: var(--r-md); border-width: 2.5px; gap: 5px; }
.ew-btn--ghost { --btn-bg: rgba(255,255,255,0.06); --btn-text: #cfc4de; border-color: rgba(255,255,255,0.18); box-shadow: none; }
.ew-btn--ghost:active { transform: translateY(2px); }
.ew-btn.is-poor { filter: grayscale(0.75) brightness(0.72); cursor: not-allowed; }
.ew-badgecount {
  position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px;
  display: grid; place-items: center; font-style: normal; font-size: 12px;
  background: var(--rose); color: #fff; border: 2.5px solid var(--ink); border-radius: 999px;
}

.ew-icobtn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: rgba(22, 16, 29, 0.72); color: var(--paper);
  border: 2.5px solid rgba(255,255,255,0.16); border-radius: 12px;
  cursor: pointer; font-size: 18px; transition: transform 90ms, background 140ms;
}
.ew-icobtn:hover { background: rgba(60, 44, 80, 0.9); }
.ew-icobtn:active { transform: translateY(2px); }

.ew-seg { display: inline-flex; border: 2.5px solid var(--ink); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,0.3); }
.ew-seg button {
  font-family: var(--body); font-weight: 800; font-size: 12px; letter-spacing: 0.2px;
  padding: 7px 11px; border: 0; background: transparent; color: #b8abc8; cursor: pointer;
}
.ew-seg button + button { border-left: 2px solid rgba(0,0,0,0.4); }
.ew-seg button.is-on { background: linear-gradient(180deg, var(--gold), var(--gold-lo)); color: #3a1f06; }

.ew-star { color: #4a3f5c; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.45)); font-size: 26px; }
.ew-star.is-filled { color: var(--gold); }
.ew-maxed { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 13px; color: var(--mint); }

/* ------------------------------------------------------------------------------------ damage numbers */
.ew-dmg {
  position: absolute; left: 0; top: 0; will-change: transform, opacity;
  font-family: var(--display); font-size: 17px; line-height: 1;
  color: #fff6e0; text-shadow: 0 0 3px #000, 1.5px 1.5px 0 #1a1420, -1.5px 1.5px 0 #1a1420, 1.5px -1.5px 0 #1a1420, -1.5px -1.5px 0 #1a1420;
  pointer-events: none; white-space: nowrap;
}
.ew-dmg--crit { font-size: 25px; color: var(--gold-hi); }
.ew-dmg--magic { color: #d8b4fe; }
.ew-dmg--true { color: #a5f3fc; }
.ew-dmg--gold { color: var(--gold); font-size: 16px; }

/* ------------------------------------------------------------------------------------ HUD */
.ew-hud { position: absolute; inset: 0; pointer-events: none; }
.ew-hud > * { pointer-events: auto; }

.ew-hud__top {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; align-items: center; gap: 10px;
  /* #ui-root clips overflow, so anything pushed past the right edge is gone for good — on a 360px phone
     that was the Settings gear. Let the row wrap and let the pills give up space before the controls do. */
  flex-wrap: wrap; row-gap: 8px;
}
.ew-hud__top > * { flex-shrink: 0; }
.ew-hud__spacer { flex: 1; }

.ew-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-size: 17px; color: #fff3d8;
  background: linear-gradient(180deg, rgba(58,42,74,0.95), rgba(28,20,40,0.95));
  border: var(--outline); border-radius: 999px; padding: 7px 17px 7px 9px;
  box-shadow: var(--lift);
  transition: transform 120ms ease;
}
.ew-pill__ico { font-size: 24px; display: grid; place-items: center; }
.ew-pill--gold .ew-pill__ico { color: var(--gold); }
.ew-pill--life .ew-pill__ico { color: var(--rose); }
.ew-pill--life.is-low { animation: ew-lowpulse 1.1s ease-in-out infinite; }
.ew-pill.is-pop { animation: ew-pop 260ms ease; }
.ew-pill.is-hurt { animation: ew-shakepill 380ms ease; }
@keyframes ew-pop { 0% { transform: scale(1); } 35% { transform: scale(1.11); } 100% { transform: scale(1); } }
@keyframes ew-shakepill { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
@keyframes ew-lowpulse { 0%,100% { box-shadow: var(--lift); } 50% { box-shadow: var(--lift), 0 0 20px var(--danger); } }

.ew-hud__level { text-align: center; padding: 0 6px; }
.ew-hud__level-name { font-family: var(--display); font-size: 16px; color: #fff3d8; text-shadow: 0 2px 0 rgba(0,0,0,0.5); }
.ew-hud__level-sub { font-size: 12px; font-weight: 800; color: #b9a9cc; }

.ew-hud__speed { display: flex; gap: 5px; align-items: center; }
.ew-speedbtn {
  min-width: 38px; height: 38px; font-family: var(--display); font-size: 13px;
  background: rgba(22,16,29,0.72); color: #b8abc8;
  border: 2.5px solid rgba(255,255,255,0.16); border-radius: 12px; cursor: pointer;
}
.ew-speedbtn.is-on { background: linear-gradient(180deg, var(--gold), var(--gold-lo)); color: #3a1f06; border-color: var(--ink); }

.ew-hud__waves { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); pointer-events: none !important; }
.ew-waves__track { display: flex; gap: 4px; }
.ew-wpip { width: 12px; height: 7px; border-radius: 3px; background: rgba(255,255,255,0.16); border: 1.5px solid rgba(0,0,0,0.5); }
.ew-wpip.is-done { background: var(--mint); }
.ew-wpip.is-now { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.ew-wpip.is-boss { width: 18px; background: rgba(244,114,182,0.35); }
.ew-wpip.is-boss.is-done { background: var(--rose); }
.ew-wpip.is-boss.is-now { background: var(--rose); box-shadow: 0 0 12px var(--rose); }

/* --- next wave ---------------------------------------------------------------------------- */
.ew-nextwave {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 214px; padding: 13px;
  background: linear-gradient(180deg, rgba(48,34,64,0.95), rgba(26,18,38,0.95));
  border: var(--outline); border-radius: var(--r-lg); box-shadow: var(--lift);
  transition: opacity 240ms ease, transform 240ms ease;
}
.ew-nextwave.is-hidden { opacity: 0; transform: translateY(-50%) translateX(24px); pointer-events: none; }
.ew-nextwave.is-boss { border-color: var(--rose); box-shadow: var(--lift), 0 0 30px rgba(244,114,182,0.4); }
.ew-nextwave__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.ew-nextwave__label { font-family: var(--display); font-size: 13px; color: #fff3d8; }
.ew-nextwave.is-boss .ew-nextwave__label { color: var(--rose); }
.ew-nextwave__timer { font-family: var(--display); font-size: 16px; color: var(--gold); }
.ew-nextwave__units { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }
.ew-unit { display: inline-flex; align-items: center; gap: 3px; font-size: 21px; }
.ew-unit b { font-family: var(--body); font-size: 12px; font-weight: 900; color: #e5dced; }
.ew-btn--call { width: 100%; font-size: 14px; padding: 10px 12px; }
.ew-btn--call em { font-style: normal; font-size: 12px; color: #6b3a05; background: rgba(255,255,255,0.4); padding: 1px 6px; border-radius: 8px; }

/* --- spells ----------------------------------------------------------------------------- */
.ew-spells { position: absolute; left: 14px; bottom: 132px; display: flex; flex-direction: column; gap: 10px; }
.ew-spell {
  --cd: 0; position: relative; width: 62px; height: 62px;
  background: linear-gradient(180deg, rgba(58,42,74,0.95), rgba(28,20,40,0.95));
  border: var(--outline); border-radius: 18px; cursor: pointer; box-shadow: var(--lift);
  display: grid; place-items: center; overflow: hidden;
  transition: transform 100ms ease, filter 140ms ease;
}
.ew-spell__ico { font-size: 30px; display: grid; place-items: center; z-index: 1; }
.ew-spell__key {
  position: absolute; right: 5px; bottom: 3px; z-index: 2;
  font-family: var(--display); font-size: 10px; color: #cbb9df;
}
.ew-spell__ring {
  position: absolute; inset: 0; z-index: 1;
  background: rgba(8, 5, 14, 0.78);
  clip-path: inset(calc((1 - var(--cd)) * 100%) 0 0 0);
  transition: clip-path 120ms linear;
}
.ew-spell.is-ready { filter: none; }
.ew-spell.is-ready .ew-spell__ring { clip-path: inset(100% 0 0 0); }
.ew-spell.is-ready::after {
  content: ''; position: absolute; inset: -3px; border-radius: 20px;
  border: 2px solid rgba(255, 214, 120, 0.7); animation: ew-ready 1.7s ease-in-out infinite;
}
.ew-spell.is-active { transform: scale(1.07); border-color: var(--gold); }
.ew-spell:active { transform: translateY(2px); }
@keyframes ew-ready { 0%,100% { opacity: 0.25; } 50% { opacity: 0.95; } }

/* --- tower palette ----------------------------------------------------------------------- */
.ew-palette {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 9px;
}
.ew-tcard {
  position: relative; width: 94px; padding: 9px 7px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: linear-gradient(180deg, rgba(58,42,74,0.96), rgba(26,18,38,0.96));
  border: var(--outline); border-radius: var(--r-md); cursor: pointer; box-shadow: var(--lift);
  transition: transform 110ms ease, filter 160ms ease, border-color 160ms ease;
}
.ew-tcard__key {
  position: absolute; left: 5px; top: 4px;
  font-family: var(--display); font-size: 10px; color: #8e7fa4;
}
.ew-tcard__ico { font-size: 34px; display: grid; place-items: center; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.4)); }
.ew-tcard__name { font-family: var(--display); font-size: 10.5px; color: #f3e9dd; text-align: center; line-height: 1.15; }
.ew-tcard__cost {
  display: inline-flex; align-items: center; gap: 3px;
  font-weight: 900; font-size: 12px; color: var(--gold);
}
.ew-tcard__cost .ew-ico { font-size: 13px; color: var(--gold); }
.ew-tcard:hover { transform: translateY(-3px); }
.ew-tcard.is-active { border-color: var(--gold); box-shadow: var(--lift), 0 0 24px rgba(255,198,60,0.5); transform: translateY(-4px); }
.ew-tcard.is-poor { filter: grayscale(0.8) brightness(0.62); }

/* --- tower panel -------------------------------------------------------------------------- */
.ew-panel {
  position: absolute; left: 14px; top: 68px; width: 282px;
  background: linear-gradient(180deg, rgba(48,34,64,0.97), rgba(24,17,35,0.97));
  border: var(--outline); border-radius: var(--r-lg); box-shadow: var(--lift);
  overflow: hidden;
  animation: ew-slidein 180ms ease;
}
@keyframes ew-slidein { from { opacity: 0; transform: translateX(-14px); } }
.ew-panel__head {
  display: flex; align-items: center; gap: 10px; padding: 11px 11px 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 34%, transparent), transparent);
  border-bottom: 2.5px solid rgba(0,0,0,0.4);
}
.ew-panel__ico { font-size: 32px; color: var(--acc); display: grid; place-items: center; }
.ew-panel__id { flex: 1; min-width: 0; }
.ew-panel__name { font-family: var(--display); font-size: 14px; color: #fff3d8; }
.ew-panel__role { font-size: 11px; font-weight: 800; color: #b9a9cc; }
.ew-panel__close { width: 28px; height: 28px; font-size: 13px; }
.ew-panel__stats { padding: 9px 12px; display: grid; gap: 3px; }
.ew-stat { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.ew-stat span { color: #a798ba; font-weight: 700; flex: 1; }
.ew-stat b { font-family: var(--display); font-size: 13px; color: #fff3d8; }
.ew-tag { font-style: normal; font-size: 9.5px; font-weight: 900; padding: 1px 5px; border-radius: 6px; background: rgba(255,255,255,0.12); color: #cbb9df; text-transform: uppercase; }
.ew-tag--magic { background: rgba(216,180,254,0.2); color: #d8b4fe; }
.ew-tag--physical { background: rgba(255,198,60,0.18); color: var(--gold); }
.ew-tag--true { background: rgba(165,243,252,0.18); color: #a5f3fc; }
.ew-tag--buffed { background: rgba(124,196,107,0.22); color: var(--mint); }

.ew-panel__targeting { padding: 4px 12px 10px; }
.ew-panel__tlabel { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; color: #a798ba; margin-bottom: 5px; }
.ew-panel__tlabel .ew-ico { font-size: 13px; }

.ew-panel__ups { padding: 0 10px 10px; display: grid; gap: 7px; }
.ew-up {
  --acc: var(--gold);
  display: grid; gap: 2px; text-align: left; padding: 9px 11px; cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.16));
  border: 2.5px solid rgba(255,255,255,0.14); border-radius: var(--r-md);
  transition: transform 100ms ease, border-color 140ms ease, background 140ms ease;
}
.ew-up:hover { border-color: var(--acc); background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 20%, transparent), rgba(0,0,0,0.2)); }
.ew-up:active { transform: translateY(2px); }
.ew-up__lvl { font-family: var(--display); font-size: 12.5px; color: var(--acc); display: flex; align-items: center; gap: 5px; }
.ew-up__lvl .ew-ico { font-size: 14px; }
.ew-up__delta { font-size: 11px; font-weight: 700; color: #b9a9cc; line-height: 1.3; }
.ew-up__cost { display: inline-flex; align-items: center; gap: 3px; font-weight: 900; font-size: 12.5px; color: var(--gold); }
.ew-up__cost .ew-ico { font-size: 13px; }
.ew-up.is-poor { filter: grayscale(0.7) brightness(0.68); }
.ew-up--branch { border-color: color-mix(in srgb, var(--acc) 45%, transparent); }
.ew-branchhead { font-size: 10.5px; font-weight: 900; color: #a798ba; text-transform: uppercase; letter-spacing: 0.4px; padding: 2px 2px 0; }

.ew-panel__foot { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-top: 2.5px solid rgba(0,0,0,0.4); background: rgba(0,0,0,0.2); }
.ew-panel__kills { flex: 1; display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; color: #a798ba; }
.ew-panel__kills .ew-ico { font-size: 14px; }
.ew-btn--sell { font-size: 12px; padding: 7px 12px; border-radius: var(--r-md); border-width: 2.5px; --btn-bg: linear-gradient(180deg, #7a3a4a, #4e2130); }
.ew-btn--sell .ew-ico { font-size: 14px; }

/* --- tips, banners, toasts ------------------------------------------------------------------ */
.ew-tip {
  position: fixed; z-index: 30; width: 250px; padding: 11px 13px;
  background: linear-gradient(180deg, rgba(42,30,58,0.98), rgba(20,14,30,0.98));
  border: var(--outline); border-radius: var(--r-md); box-shadow: var(--lift);
  pointer-events: none !important;
}
.ew-tip__head { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ew-tip__head span { font-size: 24px; color: var(--acc); display: grid; place-items: center; }
.ew-tip__head b { font-family: var(--display); font-size: 13px; color: #fff3d8; flex: 1; }
.ew-tip__head em { font-style: normal; font-weight: 900; font-size: 12px; color: var(--gold); display: inline-flex; align-items: center; gap: 2px; }
.ew-tip p { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; line-height: 1.4; color: #cfc2dd; }
.ew-tip__rows { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 10.5px; font-weight: 800; color: #9b8cb0; }
.ew-tip__rows span { display: inline-flex; align-items: center; gap: 3px; }
.ew-tip__rows .ew-ico { font-size: 12px; }

.ew-banner {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, -12px);
  text-align: center; pointer-events: none !important; opacity: 0;
  transition: opacity 300ms ease, transform 300ms cubic-bezier(.2,1.6,.4,1);
}
.ew-banner.is-in { opacity: 1; transform: translate(-50%, 0); }
.ew-banner__t {
  font-family: var(--display); font-size: 58px; line-height: 1; letter-spacing: 1px;
  color: var(--gold);
  text-shadow: 0 0 26px rgba(255,160,40,0.55), 4px 4px 0 var(--ink), -4px 4px 0 var(--ink), 4px -4px 0 var(--ink), -4px -4px 0 var(--ink), 0 8px 0 rgba(0,0,0,0.4);
}
.ew-banner__s { margin-top: 5px; font-family: var(--display); font-size: 15px; color: #e8dcf0; text-shadow: 0 2px 0 var(--ink); }
.ew-banner--boss .ew-banner__t { color: var(--rose); text-shadow: 0 0 30px rgba(244,114,182,0.7), 4px 4px 0 var(--ink), -4px 4px 0 var(--ink), 4px -4px 0 var(--ink), -4px -4px 0 var(--ink); }

.ew-toasts { position: absolute; left: 50%; bottom: 122px; transform: translateX(-50%); display: grid; gap: 5px; justify-items: center; pointer-events: none !important; }
.ew-toast {
  font-family: var(--display); font-size: 13px; padding: 6px 14px; border-radius: 999px;
  background: rgba(20,14,30,0.92); border: 2.5px solid rgba(255,255,255,0.18); color: #e8dcf0;
  opacity: 0; transform: translateY(8px); transition: opacity 240ms, transform 240ms;
}
.ew-toast.is-in { opacity: 1; transform: translateY(0); }
.ew-toast--gold { color: var(--gold); border-color: rgba(255,198,60,0.45); }
.ew-toast--bad { color: #ffa8b4; border-color: rgba(255,85,102,0.5); }

/* ------------------------------------------------------------------------------------ menus */
.ew-menus {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 24px; overflow: auto;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(120, 60, 30, 0.5), transparent 70%),
    radial-gradient(ellipse 100% 80% at 50% 110%, rgba(90, 40, 120, 0.4), transparent 70%),
    linear-gradient(180deg, rgba(10,6,18,0.94), rgba(14,8,20,0.97));
  backdrop-filter: blur(3px);
}

.ew-sheet {
  width: min(560px, 100%); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(48,34,64,0.97), rgba(22,15,32,0.98));
  border: var(--outline); border-radius: var(--r-xl); box-shadow: var(--lift);
  animation: ew-sheetin 260ms cubic-bezier(.2,1.3,.4,1);
}
.ew-sheet--wide { width: min(940px, 100%); }
@keyframes ew-sheetin { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
.ew-sheet__head {
  display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; gap: 10px;
  padding: 13px 15px; border-bottom: 2.5px solid rgba(0,0,0,0.42);
}
.ew-sheet__head h2 { margin: 0; text-align: center; font-family: var(--display); font-size: 21px; color: #fff3d8; text-shadow: 0 2px 0 rgba(0,0,0,0.5); }
.ew-sheet__body { padding: 16px; overflow: auto; }

/* --- title ------------------------------------------------------------------------------- */
.ew-title { display: grid; justify-items: center; gap: 16px; text-align: center; }
.ew-title__logo { width: min(520px, 84vw); }
.ew-logo { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 0 rgba(0,0,0,0.4)); }
.ew-title__tag { margin: -6px 0 0; font-family: var(--display); font-size: 15px; color: #e0d2ee; letter-spacing: 0.4px; }
.ew-title__stats { display: flex; gap: 18px; font-weight: 900; font-size: 13px; color: #b9a9cc; }
.ew-title__stats span { display: inline-flex; align-items: center; gap: 5px; }
.ew-title__stats b { color: var(--gold); font-size: 15px; }
.ew-title__stats .ew-ico { font-size: 16px; color: var(--gold); }
.ew-title__buttons { display: grid; gap: 10px; width: min(300px, 80vw); }
.ew-title__buttons .ew-btn { width: 100%; }
.ew-title__foot { font-size: 11px; font-weight: 700; color: #6e6184; }

/* --- level select --------------------------------------------------------------------------- */
.ew-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 11px; }
.ew-level {
  position: relative; display: grid; grid-template-columns: 30px 84px 1fr auto; align-items: center; gap: 9px;
  padding: 10px; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(0,0,0,0.18));
  border: 2.5px solid rgba(255,255,255,0.14); border-radius: var(--r-md);
  color: inherit; font-family: inherit;
  transition: transform 110ms ease, border-color 160ms ease;
}
.ew-level:hover { transform: translateY(-2px); border-color: var(--gold); }
.ew-level.is-cleared { border-color: rgba(124,196,107,0.4); }
.ew-level.is-locked { filter: grayscale(0.85) brightness(0.55); cursor: not-allowed; }
.ew-level__no { font-family: var(--display); font-size: 22px; color: #6e6184; text-align: center; }
.ew-level__map { width: 78px; height: 52px; display: grid; place-items: center; }
.ew-mini { width: 100%; height: 100%; }
.ew-mini--lg { width: 100%; max-height: 190px; }
.ew-level__name { font-family: var(--display); font-size: 13px; color: #fff3d8; line-height: 1.2; }
.ew-level__sub { font-size: 11px; font-weight: 700; color: #a798ba; margin-bottom: 3px; }
.ew-level__meta { display: flex; flex-wrap: wrap; gap: 3px 9px; font-size: 10px; font-weight: 800; color: #8b7ca1; }
.ew-level__meta span { display: inline-flex; align-items: center; gap: 3px; }
.ew-level__meta .ew-ico { font-size: 11px; }
.ew-level__stars { display: flex; gap: 1px; }
.ew-level__stars .ew-star { font-size: 15px; }
.ew-level__lock {
  position: absolute; inset: -1px; display: grid; place-items: center; gap: 5px; align-content: center;
  background: rgba(12, 8, 20, 0.93); backdrop-filter: blur(3px);
  border-radius: var(--r-md); font-size: 11px; font-weight: 800; color: #9a8bb0; text-align: center;
}
.ew-level__lock .ew-ico { font-size: 22px; }

/* --- difficulty ------------------------------------------------------------------------------ */
.ew-difficulty { display: grid; gap: 14px; }
.ew-diff__map { display: grid; place-items: center; padding: 8px; background: rgba(0,0,0,0.25); border-radius: var(--r-md); }
.ew-diff__intro { text-align: center; }
.ew-diff__name { font-family: var(--display); font-size: 19px; color: var(--gold); }
.ew-diff__intro p { margin: 4px 0 0; font-size: 12.5px; font-weight: 700; line-height: 1.5; color: #c4b6d4; }
.ew-diff__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.ew-diffcard {
  --acc: var(--gold);
  display: grid; gap: 5px; padding: 12px; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 16%, transparent), rgba(0,0,0,0.2));
  border: 2.5px solid color-mix(in srgb, var(--acc) 45%, transparent); border-radius: var(--r-md);
  color: inherit; font-family: inherit;
  transition: transform 110ms ease, border-color 160ms;
}
.ew-diffcard:hover { transform: translateY(-2px); border-color: var(--acc); }
.ew-diffcard__name { font-family: var(--display); font-size: 16px; color: var(--acc); }
.ew-diffcard p { margin: 0; font-size: 11.5px; font-weight: 700; line-height: 1.4; color: #c4b6d4; }
.ew-diffcard__nums { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 10.5px; font-weight: 900; color: #9b8cb0; }
.ew-diffcard__nums span { display: inline-flex; align-items: center; gap: 3px; }
.ew-diffcard__nums .ew-ico { font-size: 12px; }
.ew-diffcard__best { font-size: 10.5px; font-weight: 900; color: var(--mint); display: inline-flex; align-items: center; gap: 4px; }
.ew-diffcard__best .ew-ico { font-size: 12px; }

/* --- talents ---------------------------------------------------------------------------------- */
.ew-talents { display: grid; gap: 14px; }
.ew-talents__bank { display: flex; align-items: center; gap: 14px; justify-content: center; }
.ew-talents__free { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 16px; color: var(--gold); }
.ew-talents__free .ew-ico { font-size: 20px; }
.ew-talents__tot { font-size: 11.5px; font-weight: 800; color: #8b7ca1; }
.ew-talents__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.ew-talent {
  display: grid; gap: 6px; padding: 13px; justify-items: center; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(0,0,0,0.18));
  border: 2.5px solid rgba(255,255,255,0.14); border-radius: var(--r-md);
}
.ew-talent.is-max { border-color: rgba(124,196,107,0.45); }
.ew-talent__ico { font-size: 32px; color: var(--gold); }
.ew-talent__name { font-family: var(--display); font-size: 13.5px; color: #fff3d8; }
.ew-talent p { margin: 0; font-size: 11px; font-weight: 700; color: #a798ba; line-height: 1.4; }
.ew-talent__pips { display: flex; gap: 4px; }
.ew-talent__pips span { width: 20px; height: 7px; border-radius: 3px; background: rgba(255,255,255,0.14); border: 1.5px solid rgba(0,0,0,0.45); }
.ew-talent__pips span.is-on { background: var(--gold); }
.ew-talent__now { font-size: 11px; font-weight: 900; color: var(--mint); min-height: 15px; }

/* --- codex ------------------------------------------------------------------------------------ */
.ew-codex h3 { font-family: var(--display); font-size: 16px; color: var(--gold); margin: 6px 0 9px; }
.ew-codex__grid { display: grid; gap: 8px; margin-bottom: 16px; }
.ew-codex__row {
  display: grid; grid-template-columns: 44px 1fr; gap: 11px; padding: 10px 12px; align-items: start;
  background: linear-gradient(90deg, color-mix(in srgb, var(--acc) 13%, transparent), rgba(0,0,0,0.18));
  border-left: 3.5px solid var(--acc); border-radius: var(--r-sm);
}
.ew-codex__ico { font-size: 34px; color: var(--acc); display: grid; place-items: center; }
.ew-codex__row b { font-family: var(--display); font-size: 13px; color: #fff3d8; }
.ew-codex__row em { font-style: normal; font-size: 10.5px; font-weight: 900; color: #9b8cb0; }
.ew-codex__row p { margin: 3px 0 0; font-size: 11.5px; font-weight: 700; color: #c4b6d4; line-height: 1.45; }
.ew-codex__branches { display: grid; gap: 3px; margin-top: 6px; }
.ew-codex__branches span { font-size: 10.5px; font-weight: 700; color: #a798ba; padding-left: 9px; border-left: 2px solid var(--acc); }
.ew-codex__branches b { font-size: 11px; color: var(--acc); font-family: var(--body); font-weight: 900; }
.ew-codex__note { font-size: 12px; font-weight: 700; color: #c4b6d4; line-height: 1.55; }
.ew-codex__note b { color: var(--gold); }

/* --- settings / pause --------------------------------------------------------------------------- */
.ew-settings { display: grid; gap: 16px; }
.ew-set__group h4 { margin: 0 0 8px; font-family: var(--display); font-size: 13px; color: var(--gold); }
.ew-set__row { display: flex; align-items: center; gap: 11px; padding: 7px 0; font-size: 12.5px; font-weight: 800; color: #d6cae2; }
.ew-set__row > span { flex: 1; }
.ew-set__row b { min-width: 42px; text-align: right; font-family: var(--display); font-size: 12px; color: var(--gold); }
.ew-set__row input[type=range] { width: 150px; accent-color: var(--gold); }
.ew-set__row input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--gold); }
.ew-keys { display: grid; gap: 5px; font-size: 11.5px; font-weight: 700; color: #a798ba; }
kbd {
  display: inline-block; min-width: 19px; padding: 1px 5px; margin: 0 1px; text-align: center;
  font-family: var(--body); font-size: 10.5px; font-weight: 900; color: #fff3d8;
  background: rgba(255,255,255,0.1); border: 2px solid rgba(0,0,0,0.5); border-radius: 6px;
}
.ew-pause { display: grid; gap: 16px; }
.ew-pause__stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: 12px; font-weight: 800; color: #a798ba; }
.ew-pause__stats span { display: inline-flex; align-items: center; gap: 5px; }
.ew-pause__stats b { font-family: var(--display); font-size: 14px; color: #fff3d8; }
.ew-pause__stats .ew-ico { font-size: 15px; color: var(--gold); }
.ew-pause__buttons { display: grid; gap: 9px; }

/* ------------------------------------------------------------------------------------ results */
.ew-results {
  position: absolute; inset: 0; display: grid;
  grid-template-rows: auto auto 1fr auto; justify-items: center; align-content: space-between;
  padding: 3.5vh 24px 4vh; pointer-events: none;
}
.ew-results > * { pointer-events: auto; }

.ew-results__top { text-align: center; opacity: 0; transform: translateY(-22px); transition: opacity 420ms ease, transform 480ms cubic-bezier(.2,1.5,.4,1); }
.ew-results__top.is-in { opacity: 1; transform: none; }
.ew-results__eyebrow {
  font-family: var(--display); font-size: 15px; letter-spacing: 3px; color: #f2e3c8;
  text-shadow: 0 2px 0 var(--ink), 0 0 18px rgba(255,180,60,0.5);
}
.ew-results__title {
  font-family: var(--display); font-size: clamp(34px, 6.4vw, 74px); line-height: 1.02; letter-spacing: 1px;
  color: var(--gold);
  text-shadow:
    0 0 40px rgba(255,170,50,0.6),
    5px 5px 0 var(--ink), -5px 5px 0 var(--ink), 5px -5px 0 var(--ink), -5px -5px 0 var(--ink),
    0 5px 0 var(--ink), 0 -5px 0 var(--ink), 5px 0 0 var(--ink), -5px 0 0 var(--ink),
    0 11px 0 rgba(0,0,0,0.45);
}
.ew-results[data-tier='silver'] .ew-results__title { color: #e8f0ff; text-shadow: 0 0 40px rgba(170,200,255,0.6), 5px 5px 0 var(--ink), -5px 5px 0 var(--ink), 5px -5px 0 var(--ink), -5px -5px 0 var(--ink), 0 5px 0 var(--ink), 0 -5px 0 var(--ink), 5px 0 0 var(--ink), -5px 0 0 var(--ink), 0 11px 0 rgba(0,0,0,0.45); }
.ew-results[data-tier='radiant'] .ew-results__title { color: #8ff7e6; text-shadow: 0 0 44px rgba(78,240,216,0.7), 5px 5px 0 var(--ink), -5px 5px 0 var(--ink), 5px -5px 0 var(--ink), -5px -5px 0 var(--ink), 0 5px 0 var(--ink), 0 -5px 0 var(--ink), 5px 0 0 var(--ink), -5px 0 0 var(--ink), 0 11px 0 rgba(0,0,0,0.45); }
.ew-results.is-loss .ew-results__title { color: #cbb9df; text-shadow: 0 0 30px rgba(139,92,246,0.45), 5px 5px 0 var(--ink), -5px 5px 0 var(--ink), 5px -5px 0 var(--ink), -5px -5px 0 var(--ink), 0 5px 0 var(--ink), 0 -5px 0 var(--ink), 5px 0 0 var(--ink), -5px 0 0 var(--ink), 0 11px 0 rgba(0,0,0,0.45); }
.ew-results__sub { margin-top: 5px; font-family: var(--display); font-size: 14px; color: #e0d2ee; text-shadow: 0 2px 0 var(--ink); }

.ew-results__stars { display: flex; gap: 12px; margin-top: 4px; opacity: 0; transition: opacity 300ms ease; }
.ew-results__stars.is-in { opacity: 1; }
.ew-results__stars .ew-star { font-size: 46px; transform: scale(0.45); opacity: 0.35; transition: none; }
.ew-results__stars .ew-star.is-filled { opacity: 1; }
.ew-results__stars .ew-star.is-pop { animation: ew-starpop 560ms cubic-bezier(.2,1.7,.4,1) forwards; }
@keyframes ew-starpop {
  0% { transform: scale(2.4) rotate(-22deg); opacity: 0; filter: brightness(2.4); }
  55% { transform: scale(0.88) rotate(6deg); opacity: 1; filter: brightness(1.5) drop-shadow(0 0 22px var(--gold)); }
  100% { transform: scale(1) rotate(0); opacity: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.45)); }
}

.ew-results__cards { display: flex; flex-wrap: wrap; gap: 11px; justify-content: center; align-self: end; margin-bottom: 2vh; }
.ew-card {
  --acc: var(--gold);
  position: relative; width: 116px; padding: 13px 9px 11px;
  display: grid; justify-items: center; gap: 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 30%, #2a1d3c), #1b1228);
  border: var(--outline); border-radius: var(--r-lg);
  box-shadow: var(--lift), inset 0 2px 0 rgba(255,255,255,0.22);
  opacity: 0; transform: translateY(30px) scale(0.74);
  transition: opacity 300ms ease, transform 460ms cubic-bezier(.2,1.7,.4,1);
}
.ew-card.is-in { opacity: 1; transform: none; }
.ew-card--gold { --acc: var(--gold); }
.ew-card--violet { --acc: var(--violet); }
.ew-card--mint { --acc: var(--mint); }
.ew-card--rose { --acc: var(--rose); }
.ew-card--grey { --acc: #7b6f8e; }
.ew-card__icon { font-size: 32px; color: var(--acc); filter: drop-shadow(0 2px 0 rgba(0,0,0,0.5)); }
.ew-card__value { font-family: var(--display); font-size: 21px; color: #fff6e0; text-shadow: 0 2px 0 rgba(0,0,0,0.55); line-height: 1.1; }
.ew-card__label { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.5px; color: #c4b6d4; text-align: center; }
.ew-card__tag {
  position: absolute; top: -10px; right: -8px; padding: 2px 8px; border-radius: 999px;
  font-family: var(--display); font-size: 9.5px; letter-spacing: 0.5px;
  background: linear-gradient(180deg, #ff9ecf, var(--rose)); color: #4a0f2c;
  border: 2.5px solid var(--ink); transform: rotate(9deg);
}

.ew-results__actions { display: flex; gap: 12px; align-items: center; opacity: 0; transform: translateY(26px); transition: opacity 340ms ease, transform 460ms cubic-bezier(.2,1.5,.4,1); }
.ew-results__actions.is-in { opacity: 1; transform: none; }

/* ------------------------------------------------------------------------------------ loading */
.ew-loading {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; gap: 16px; align-content: center;
  background: radial-gradient(ellipse at 50% 45%, #2a1430, #0b0712 70%);
  transition: opacity 500ms ease;
}
.ew-loading__flame { font-size: 68px; color: var(--gold); animation: ew-flicker 1.5s ease-in-out infinite; filter: drop-shadow(0 0 26px rgba(255,160,40,0.75)); }
@keyframes ew-flicker { 0%,100% { transform: scale(1) rotate(-1.5deg); } 50% { transform: scale(1.1) rotate(1.5deg); } }
.ew-loading__text { font-family: var(--display); font-size: 15px; color: #e0d2ee; letter-spacing: 1.5px; }
.ew-loading.is-out { opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------------------------------ build hint */
.ew-buildhint {
  position: absolute; left: 50%; bottom: 108px; transform: translateX(-50%);
  font-family: var(--display); font-size: 12.5px; color: #e8dcf0;
  background: rgba(16,10,26,0.86); border: 2.5px solid rgba(255,255,255,0.18);
  padding: 6px 15px; border-radius: 999px; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
}
.ew-buildhint em { font-style: normal; color: var(--gold); }

/* ------------------------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .ew-nextwave { width: 178px; right: 10px; padding: 10px; }
  .ew-panel { width: 250px; }
  .ew-tcard { width: 78px; }
  .ew-tcard__ico { font-size: 28px; }
  .ew-banner__t { font-size: 40px; }
  .ew-card { width: 98px; }
}
@media (max-width: 620px) {
  .ew-hud__level { display: none; }
  .ew-hud__top { gap: 6px; top: 10px; left: 10px; right: 10px; }
  .ew-pill { font-size: 15px; gap: 5px; }
  .ew-speedbtn { min-width: 26px; padding: 0 4px; font-size: 11px; }
  .ew-icobtn { width: 30px; height: 30px; }
  .ew-hud__spacer { flex-basis: 100%; height: 0; }
  .ew-spells { bottom: 118px; }
  .ew-spell { width: 50px; height: 50px; }
  .ew-palette { gap: 6px; }
  .ew-tcard { width: 64px; padding: 7px 4px 6px; }
  .ew-tcard__name { font-size: 9px; }
  .ew-panel { width: calc(100vw - 24px); left: 12px; top: 60px; }
  .ew-card { width: 86px; padding: 10px 6px 9px; }
  .ew-card__value { font-size: 17px; }
  .ew-card__icon { font-size: 25px; }
  .ew-results__stars .ew-star { font-size: 34px; }
}
