/* ============================================================================
   CRYPTO QUEST — modern UI (Inter + Noto Sans Thai)
   ========================================================================== */
:root {
  --bg: #0a0b0f;
  --surface: rgba(20, 22, 29, 0.72);
  --surface-solid: #121419;
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f4f5f7;
  --text-2: #c7ccd6;
  --muted: #8a93a4;
  --accent: #38bdf8;
  --cyan: #38bdf8;
  --cyan-2: #7dd3fc;
  --gold: #fbbf24;
  --amber: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --pink: #f472b6;
  --violet: #a78bfa;
  --radius: 16px;
  --font: 'Inter', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --head: var(--font);
  --mono: var(--font);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; touch-action: manipulation; overscroll-behavior: none; }
/* phones: rapid taps on the game must never zoom or select text */
#game { touch-action: none; }
#touch, .tbtn, .joy, .hud-quick, .hud-abil { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#rotate { display: none; position: fixed; inset: 0; z-index: 999; background: rgba(5, 6, 10, .96); color: var(--text); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; }
body.need-rotate #rotate { display: flex; }
#rotate b { font-size: 20px; }
#rotate span { color: var(--muted); font-size: 14px; }
.rot-phone { width: 46px; height: 80px; border: 4px solid var(--text); border-radius: 10px; animation: rotPhone 1.8s ease-in-out infinite; margin-bottom: 14px; }
@keyframes rotPhone { 0%, 20% { transform: rotate(0); } 50%, 80% { transform: rotate(90deg); } 100% { transform: rotate(90deg); } }
.tb-fs { display: none; }
body.touch .tb-fs { display: inline-flex; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  user-select: none;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--cyan-2); }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: -0.02em; }
.mono, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 1.05em; height: 1.05em; vertical-align: -0.16em; flex: none; }
::selection { background: rgba(56, 189, 248, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

/* ------------------------------------------------------------ buttons & chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface-2);
  cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, opacity .15s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.22); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: #facc15; color: #1a1400; border-color: transparent; font-weight: 600; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 18px rgba(250, 204, 21, 0.18); }
.btn-primary:hover:not(:disabled) { background: #fde047; border-color: transparent; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 8px 24px rgba(250, 204, 21, 0.28); }
.btn-primary:focus-visible { outline-color: #fde047; }
.btn-gold { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border-color: rgba(251, 191, 36, 0.28); }
.btn-gold:hover:not(:disabled) { background: rgba(251, 191, 36, 0.2); border-color: rgba(251, 191, 36, 0.45); }
.btn-green { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.3); }
.btn-danger { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.18); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line); }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; white-space: nowrap;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.coin svg { color: var(--gold); }
.chip.token svg { color: var(--cyan-2); }
.chip.warn { border-color: rgba(251, 191, 36, 0.4); color: #fcd34d; }
.chip.danger { border-color: rgba(248, 113, 113, 0.5); color: #fca5a5; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------ top bar */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 64px; z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 0 20px;
  background: linear-gradient(180deg, rgba(10, 11, 15, 0.92), rgba(10, 11, 15, 0.6) 65%, transparent);
}
#topbar .brand { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-right: auto; }
#topbar .brand .logo-mark { width: 34px; height: 34px; }
#topbar .brand span { font-weight: 700; letter-spacing: -0.02em; font-size: 15px; }
#topbar .brand span em { font-style: normal; color: var(--muted); font-weight: 500; }
#topbar .wallet-btn.connected { border-color: rgba(52, 211, 153, 0.35); }
#topbar .wallet-btn .dot { width: 7px; height: 7px; background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
body.playing #topbar { display: none; }

/* ------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; overflow-y: auto; padding: 84px 24px 40px; z-index: 10; display: none; }
.screen.active { display: block; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow);
}

/* title */
#screen-title { background: linear-gradient(90deg, rgba(10, 11, 15, 0.94) 0%, rgba(10, 11, 15, 0.75) 36%, rgba(10, 11, 15, 0) 62%); }
.title-wrap { max-width: 1240px; margin: 0 auto; min-height: calc(100vh - 140px); min-height: calc(100dvh - 140px); display: flex; flex-direction: column; justify-content: center; }
.title-col { max-width: 540px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; }
.kicker::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2); }
.logo { font-weight: 800; font-size: clamp(48px, 7.4vw, 92px); line-height: 0.92; letter-spacing: -0.055em; margin: 20px 0 8px; color: #fff;
  background: linear-gradient(180deg, #ffffff 30%, #9aa3b2 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo small { display: block; font-size: 0.18em; letter-spacing: 0.32em; font-weight: 600; margin-top: 14px; color: var(--muted); -webkit-text-fill-color: var(--muted); }
.title-sub { font-size: 16.5px; color: var(--text-2); margin: 16px 0 28px; max-width: 480px; line-height: 1.65; }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.title-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 540px; }
.stat-card { padding: 14px 16px; }
.stat-card .k { font-size: 12.5px; line-height: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .v { font-size: 24px; line-height: 32px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-card .v.small { font-size: 21px; }
.stat-card .v span { line-height: 1; }
.stat-card .v.warn { color: var(--amber); }
.stat-card .v.danger { color: var(--red); }
.feature-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* map screen */
#screen-map { background: rgba(10, 11, 15, 0.88); }
.map-wrap { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.map-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.map-head h2 { font-size: 24px; margin-right: 6px; }
.map-head .grow { flex: 1; min-width: 140px; }
.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: rgba(255, 255, 255, 0.1); color: var(--text); }

/* list view */
.tier { margin-bottom: 26px; }
.tier-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.tier-head h3 { font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.tier-head h3::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tier-head .range { font-size: 12.5px; color: var(--muted); }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.lv {
  position: relative; padding: 14px; min-height: 148px; cursor: pointer; overflow: hidden;
  background: var(--surface-solid); border: 1px solid var(--line); border-radius: 14px;
  transition: transform .15s, border-color .15s, background .15s; display: flex; flex-direction: column; gap: 3px;
}
.lv:hover { transform: translateY(-2px); border-color: var(--line-2); background: #171a21; }
.lv .num { font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -0.04em; color: var(--text); font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.lv .num::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--tc, var(--accent)); margin-left: 6px; vertical-align: 0.35em; }
.lv .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.lv .th { font-size: 12.5px; color: var(--muted); }
.lv .meta { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.lv .reward { color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; font-weight: 500; }
.lv .reward svg { color: var(--gold); }
.lv .stars { color: var(--gold); letter-spacing: 1px; font-size: 12px; }
.lv .badge { position: absolute; top: 12px; right: 12px; font-size: 11.5px; font-weight: 500; height: 22px; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.lv.cleared .badge { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.08); }
.lv.current { border-color: rgba(56, 189, 248, 0.6); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15); }
.lv.current .badge { color: #0a0b0f; background: #f8fafc; border-color: transparent; font-weight: 600; }
.lv.locked { cursor: not-allowed; }
.lv.locked > *:not(.lock-ic) { opacity: .42; }
.lv.locked:hover { transform: none; background: var(--surface-solid); border-color: var(--line); }
.lv.disabled { opacity: .3; cursor: not-allowed; }
.lv .lock-ic { position: absolute; right: 12px; bottom: 12px; color: var(--muted); }
.lv .boss-tag { color: var(--pink); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }

/* side panel */
.side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 12px; }
.side .panel { padding: 18px; }
.side h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.side .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.countdown { font-size: 38px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.countdown.warn { color: var(--amber); }
.countdown.danger { color: var(--red); }
.camp-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.camp-meta div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.camp-meta span { display: block; font-size: 11.5px; color: var(--muted); }
.camp-meta b { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.timeline { position: relative; margin-top: 14px; }
.sched-day { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding-bottom: 16px; }
.sched-day:last-child { padding-bottom: 0; }
.sched-day::before { content: ''; position: absolute; left: 16px; top: 34px; bottom: 2px; width: 2px; background: var(--line); border-radius: 2px; }
.sched-day:last-child::before { display: none; }
.sched-day .d { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; font-size: 15px; background: var(--surface-2); border: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.sched-day.done .d { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.4); color: #6ee7b7; }
.sched-day.now .d { background: #f8fafc; color: #0a0b0f; border-color: transparent; }
.sched-day .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.sched-day .row b { font-weight: 600; font-size: 13.5px; }
.sched-day .due { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.sched-day .lvls { display: flex; flex-wrap: wrap; gap: 4px; }
.sched-day .lvls span { min-width: 28px; height: 24px; padding: 0 6px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 500; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sched-day .lvls span.ok { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); color: #6ee7b7; }
.sched-day .lvls span.late { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.sched-day .lvls span.next { background: #f8fafc; color: #0a0b0f; border-color: transparent; font-weight: 600; }
.sched-day .bar-mini { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin-top: 8px; }
.sched-day .bar-mini i { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.rule-note { font-size: 12.5px; color: var(--text-2); padding: 10px 12px; border-radius: 10px; background: rgba(251, 191, 36, 0.07); border: 1px solid rgba(251, 191, 36, 0.2); margin-top: 16px; line-height: 1.6; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-actions .btn { height: auto; padding: 12px 6px; flex-direction: column; gap: 6px; font-size: 12.5px; white-space: normal; text-align: center; }
.quick-actions .btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------ world map */
.wm { position: relative; height: calc(100vh - 152px); height: calc(100dvh - 152px); min-height: 460px; border-radius: 18px; overflow: hidden;
  background: #0c0e13; border: 1px solid var(--line); touch-action: none; cursor: grab; box-shadow: var(--shadow); }
.wm.dragging { cursor: grabbing; }
.wm-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.wm-world.anim { transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.wm-bg { position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1.2px, transparent 1.2px);
  background-size: 28px 28px; }
.wm-band { position: absolute; border-radius: 48px; border: 1px solid color-mix(in srgb, var(--tc) 22%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 9%, transparent), color-mix(in srgb, var(--tc) 3%, transparent)); pointer-events: none; }
.wm-band .bl { position: absolute; left: 40px; top: 26px; display: flex; align-items: baseline; gap: 12px; }
.wm-band .bl b { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; color: var(--tc); }
.wm-band .bl span { font-size: 22px; color: var(--muted); font-weight: 500; }
.wm-path { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.wm-path .p-lock { stroke: rgba(255, 255, 255, 0.14); stroke-width: 6; fill: none; stroke-dasharray: 2 18; stroke-linecap: round; }
.wm-path .p-done { stroke: rgba(52, 211, 153, 0.85); stroke-width: 6; fill: none; stroke-linecap: round; }
.wm-path .p-next { stroke: #f8fafc; stroke-width: 6; fill: none; stroke-dasharray: 14 14; stroke-linecap: round; animation: dashMove 1.2s linear infinite; }
.wm-flag { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--surface-solid); border: 1px solid var(--line-2); font-weight: 600; font-size: 18px; pointer-events: none; }
.mt { position: absolute; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mt-frame { position: relative; border-radius: 18px; overflow: hidden; background: #07080b; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 0 0 6px rgba(10, 11, 15, 0.9), 0 24px 60px rgba(0, 0, 0, 0.55); transition: box-shadow .2s, transform .2s; }
.mt-frame:hover { box-shadow: 0 0 0 6px rgba(10, 11, 15, 0.9), 0 0 0 8px rgba(255, 255, 255, 0.2), 0 24px 60px rgba(0, 0, 0, 0.6); }
.mt-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; }
.mt-frame .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px;
  background: linear-gradient(110deg, #0e1016 30%, #171a22 50%, #0e1016 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.mt-num { position: absolute; top: 12px; left: 12px; height: 34px; min-width: 46px; padding: 0 12px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px;
  background: rgba(10, 11, 15, 0.82); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(8px); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; z-index: 2; }
.mt-num i { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); }
.mt-state { position: absolute; top: 12px; right: 12px; height: 30px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; z-index: 2;
  background: rgba(10, 11, 15, 0.82); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(8px); }
.mt.cleared .mt-state { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); }
.mt.current .mt-state { background: #f8fafc; color: #0a0b0f; border-color: transparent; }
.mt.current .mt-frame { box-shadow: 0 0 0 6px rgba(10, 11, 15, 0.9), 0 0 0 9px #f8fafc, 0 24px 60px rgba(0, 0, 0, 0.6); animation: ringPulse 2s ease-in-out infinite; }
.mt.locked .mt-frame img { filter: grayscale(0.55) brightness(0.72); }
.wm.far .mt-label span { display: none; }
.wm.far .mt-state, .wm.far .mt-lock { transform: scale(1.4); }
.wm.far .mt-lock { transform: translate(-50%, -50%) scale(1.6); }
.mt.locked .mt-frame::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 11, 15, 0) 40%, rgba(10, 11, 15, 0.7)); }
.mt.disabled { opacity: .35; }
.mt.sel .mt-frame { box-shadow: 0 0 0 6px rgba(10, 11, 15, 0.9), 0 0 0 9px var(--accent), 0 24px 60px rgba(0, 0, 0, 0.6); }
.mt-lock { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; z-index: 2;
  background: rgba(10, 11, 15, 0.75); border: 1px solid rgba(255, 255, 255, 0.16); color: var(--text-2); backdrop-filter: blur(6px); }
.mt-lock svg { width: 26px; height: 26px; }
.mt-marks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 1; }
.wm.marks .mt-marks { opacity: 1; }
.mt-label { display: flex; flex-direction: column; align-items: center; gap: 2px; transform: scale(var(--lk, 1)); transform-origin: 50% 0; transition: transform .2s; pointer-events: none; text-align: center; }
.mt-label b { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.mt-label span { font-size: 16px; color: var(--muted); white-space: nowrap; }
.mt-label .rw { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; color: var(--text-2); font-variant-numeric: tabular-nums; margin-top: 2px; }
.mt-label .rw svg { color: var(--gold); }
.mt-label .rw .st { color: var(--gold); letter-spacing: 2px; }
.mt-scale { position: absolute; bottom: 10px; right: 12px; z-index: 2; font-size: 12px; color: var(--text-2); padding: 3px 8px; border-radius: 6px; background: rgba(10, 11, 15, 0.7); font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .2s; }
.wm.near .mt-scale { opacity: 1; }

.wm-tools { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 14px; z-index: 5;
  background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(14px); box-shadow: var(--shadow); cursor: default; }
.wm-tools button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; font-size: 18px; font-weight: 500; }
.wm-tools button:hover { background: var(--surface-3); color: var(--text); }
.wm-tools button.on { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.wm-tools hr { border: 0; height: 1px; background: var(--line); margin: 2px 4px; }
.wm-zoom { position: absolute; left: 14px; top: 14px; z-index: 5; display: flex; gap: 8px; align-items: center; cursor: default; }
.wm-zoom .chip { background: var(--surface); }
.wm-legend { position: absolute; left: 14px; top: 56px; z-index: 5; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; font-size: 12px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(14px); cursor: default; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; pointer-events: none; }
.wm.marks .wm-legend { opacity: 1; transform: none; }
.wm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wm-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.wm-mini { position: absolute; right: 14px; bottom: 14px; z-index: 5; width: 128px; opacity: .92; border-radius: 12px; overflow: hidden; background: rgba(12, 14, 19, 0.9); border: 1px solid var(--line-2); cursor: pointer; box-shadow: var(--shadow); }
.wm-mini canvas { display: block; width: 100%; }
.wm-card { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6; width: min(560px, calc(100% - 220px)); padding: 14px; display: grid; grid-template-columns: 96px 1fr; gap: 14px; cursor: default; animation: popIn .22s ease; }
.wm-card .thumb { width: 96px; height: 72px; border-radius: 10px; overflow: hidden; background: #07080b; border: 1px solid var(--line); }
.wm-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wm-card h4 { font-size: 16px; }
.wm-card .sub { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.wm-card .acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wm-card .x { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.wm-card .x:hover { background: var(--surface-3); color: var(--text); }
.wm-progress { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 5; }
.wm-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 4; font-size: 12.5px; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); pointer-events: none; white-space: nowrap; }

/* ------------------------------------------------------------ modals */
#modals { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.modal-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 18px; pointer-events: auto;
  background: rgba(5, 6, 9, 0.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fadeIn .16s ease;
}
.modal {
  width: min(620px, 100%); max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); display: flex; flex-direction: column;
  background: var(--surface-solid); border: 1px solid var(--line-2); border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6); animation: popIn .2s cubic-bezier(.2, .9, .3, 1.1);
}
.modal.wide { width: min(940px, 100%); }
.modal.xwide { width: min(1180px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 20px 22px 10px; }
.modal-head svg.i { color: var(--muted); }
.modal-head h3 { font-size: 18px; flex: 1; }
.modal-head .x { background: none; border: 0; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.modal-head .x:hover { color: var(--text); background: var(--surface-3); }
.modal-body { padding: 6px 22px 18px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.modal-head, .modal-foot { flex: none; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.modal-foot:empty { display: none; }

/* how-to stepper */
.steps-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.steps-dots i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); transition: background .2s; }
.steps-dots i.on { background: #f8fafc; }
.step-card { display: grid; grid-template-columns: 104px 1fr; gap: 20px; align-items: start; min-height: 220px; }
.step-art { width: 104px; height: 104px; border-radius: 24px; display: grid; place-items: center; background: linear-gradient(160deg, rgba(56, 189, 248, 0.16), rgba(167, 139, 250, 0.1)); border: 1px solid var(--line-2); color: #e0f2fe; }
.step-art svg { width: 44px; height: 44px; }
.step-num { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.step-card h4 { font-size: 21px; margin: 4px 0 10px; }
.step-card p { color: var(--text-2); margin: 0 0 8px; }
.step-card ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); }
.step-card li { margin: 5px 0; }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 22px; max-width: 100%; overflow-wrap: anywhere; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--text); }
.controls-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.controls-grid div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* agreement */
.rules { counter-reset: r; list-style: none; padding: 0; margin: 0 0 14px; }
.rules li { counter-increment: r; position: relative; padding: 10px 0 10px 40px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.rules li::before { content: counter(r); position: absolute; left: 0; top: 10px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; margin-top: 10px; transition: border-color .15s, background .15s; }
.check input { width: 18px; height: 18px; accent-color: #f8fafc; margin-top: 2px; flex: none; }
.check:has(input:checked) { border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.06); }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.hint.err { color: #fca5a5; }

/* briefing */
.brief-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.brief-num { width: 68px; height: 68px; border-radius: 18px; display: grid; place-items: center; font-weight: 700; font-size: 28px; letter-spacing: -0.03em; color: #0a0b0f; background: var(--tc, #f8fafc); }
.brief-map { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #07080b; margin: 4px 0 12px; }
.brief-map img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.brief-map .cap { position: absolute; left: 10px; bottom: 10px; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: rgba(10, 11, 15, 0.75); color: var(--text-2); }
.brief-goal { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin: 10px 0; color: var(--text-2); }
.brief-goal b { color: var(--text); }
.brief-steps { counter-reset: s; list-style: none; padding: 0; margin: 10px 0; }
.brief-steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 6px 0; color: var(--text-2); }
.brief-steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); font-weight: 600; font-size: 12px; border: 1px solid var(--line-2); }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.kv > div { padding: 11px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.kv .k { font-size: 11.5px; color: var(--muted); }
.kv .v { font-size: 15px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* results */
.result-hero { text-align: center; padding: 6px 0 4px; }
.result-hero h2 { font-size: 28px; }
.result-hero .kicker { margin-bottom: 10px; }
.big-stars { font-size: 40px; letter-spacing: 8px; color: rgba(255, 255, 255, 0.12); margin: 6px 0; }
.big-stars b { color: var(--gold); display: inline-block; animation: starPop .5s backwards; }
.big-stars b:nth-child(2) { animation-delay: .15s; }
.big-stars b:nth-child(3) { animation-delay: .3s; }
.reward-lines { margin: 14px 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.reward-lines div { display: flex; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.reward-lines div:last-child { border-bottom: 0; background: var(--surface-2); font-weight: 600; color: var(--text); }
.reward-lines .amt { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 600; }
.reward-lines .amt.tok { color: var(--cyan-2); }

/* shop / wallet */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.card { padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.card h4 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.pkg { text-align: center; cursor: pointer; transition: border-color .15s, transform .15s, background .15s; position: relative; }
.pkg:hover { border-color: var(--line-2); background: var(--surface-3); transform: translateY(-2px); }
.pkg > svg { color: var(--cyan-2); width: 22px; height: 22px; }
.pkg .amt { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.pkg .bonus { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 600; color: #6ee7b7; }
.pkg .price { font-size: 14px; color: var(--text-2); margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.wallet-head { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; }
.wallet-head .addr { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.wallet-opts { display: grid; gap: 8px; margin-top: 8px; }
.wallet-opt { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; width: 100%; transition: border-color .15s, background .15s; }
.wallet-opt:hover:not(:disabled) { border-color: var(--line-2); background: var(--surface-3); }
.wallet-opt:disabled { opacity: .45; cursor: not-allowed; }
.wallet-opt .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text); flex: none; }
.tx-list { max-height: 220px; overflow: auto; font-size: 13px; }
.tx-list div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tx-list .hash { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.demo-banner { font-size: 12.5px; padding: 10px 12px; border-radius: 10px; background: rgba(251, 191, 36, 0.07); border: 1px solid rgba(251, 191, 36, 0.22); color: #fde68a; margin-bottom: 12px; }
.confirm-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.confirm-table td { padding: 10px 2px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.confirm-table td:last-child { text-align: right; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.1); border-top-color: #f8fafc; animation: spin 0.8s linear infinite; margin: 12px auto; }
.wd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.wd { display: flex; flex-direction: column; padding: 16px; min-width: 0; }
.wd .confirm-table td { padding: 8px 2px; }
.wd-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.wd-head h4 { margin: 0 0 2px; }
.wd-step { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: #f8fafc; color: #0a0b0f; font-weight: 700; font-size: 13px; }
.swap-box { padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.swap-box:focus-within { border-color: rgba(255, 255, 255, 0.28); }
.swap-lbl { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.swap-row { display: flex; align-items: center; gap: 10px; }
.swap-inp { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; padding: 0; }
.swap-inp::-webkit-inner-spin-button { -webkit-appearance: none; }
.swap-out { flex: 1; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.swap-row .unit { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px; background: var(--surface-3); font-size: 13px; font-weight: 600; white-space: nowrap; }
.swap-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); min-height: 18px; }
.swap-sub b { color: var(--text-2); font-weight: 600; }
.pcts { display: inline-flex; gap: 4px; }
.pcts button { height: 22px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-2); background: transparent; font-size: 11.5px; color: var(--text-2); cursor: pointer; }
.pcts button:hover { background: var(--surface-3); color: var(--text); }
.swap-arrow { align-self: center; width: 32px; height: 32px; margin: -6px 0; z-index: 1; border-radius: 10px; display: grid; place-items: center; background: var(--surface-solid); border: 1px solid var(--line-2); color: var(--text-2); transform: rotate(90deg); }
.wd-st { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 4px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.wd-st.completed, .wd-st.paid { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.wd-st.pending { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }
.wd-st.rejected { background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
.upg { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.pips { display: flex; gap: 4px; margin-top: 8px; }
.pips i { width: 18px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }
.pips i.on { background: #f8fafc; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: none; }
body.playing #hud { display: block; }
/* top HUD: left column (status + level bars) · centre (mission + boss) · right (balances + pause) */
.hud-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; align-items: flex-start; gap: 12px; }
.hud-left { width: 300px; flex: none; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hud-center { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hud-status { padding: 12px 14px; }
.hud-status .lvl { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; white-space: nowrap; }
.hud-status .lvl span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hud-status .lvl b { color: var(--text); font-weight: 600; letter-spacing: 0.02em; }
.meter { margin-top: 8px; }
.meter .row { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; margin-bottom: 4px; }
.meter .row span:first-child { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; letter-spacing: 0.04em; }
.meter .row b { font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.bar { position: relative; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; transition: width .15s linear; }
.bar > i.lag { background: rgba(255, 255, 255, 0.4); transition: width .6s ease .25s; }
.bar.hp > i.fill { background: linear-gradient(90deg, #ef4444, #fb7185); }
.bar.sh > i.fill { background: linear-gradient(90deg, #3b82f6, #7dd3fc); }
.bar.en > i.fill { background: linear-gradient(90deg, #f59e0b, #fde047); }
.bar.thin { height: 6px; }
.hud-status.low .bar.hp { animation: pulseRed .8s infinite; }
.hud-extra { display: flex; flex-direction: column; gap: 8px; }
.hud-extra:empty { display: none; }
.hud-extra .panel { padding: 10px 12px; }
.hud-mission { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 8px; text-align: center; max-width: 100%; }
.hud-mission .timer { display: inline-block; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(14px); font-variant-numeric: tabular-nums; }
.hud-mission .timer.warn { color: var(--red); border-color: rgba(248, 113, 113, 0.4); animation: pulse 1s infinite; }
.hud-mission .obj { padding: 9px 16px; display: inline-block; min-width: 0; max-width: 100%; }
.hud-mission .obj b { display: block; font-size: 15px; font-weight: 600; }
.hud-mission .obj span { font-size: 12.5px; color: var(--muted); }
.hud-boss { width: min(600px, 100%); text-align: center; }
.hud-boss .name { font-weight: 700; letter-spacing: 0.2em; font-size: 13px; color: #fecaca; margin-bottom: 6px; }
.hud-boss .name small { letter-spacing: 0.02em; color: var(--muted); font-weight: 500; margin-left: 8px; }
.hud-boss .bar { height: 10px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.12); }
.hud-boss .bar > i.fill { background: linear-gradient(90deg, #db2777, #f87171, #fb923c); }
.hud-boss.shielded .bar > i.fill { background: linear-gradient(90deg, #3b82f6, #7dd3fc); }
.hud-right { flex: none; display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.hud-quick { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; pointer-events: auto; }
.qbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; min-width: 116px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(14px); cursor: pointer; text-align: left; transition: border-color .15s, transform .1s, background .15s; }
.qbtn:hover { border-color: var(--line-2); background: rgba(30, 33, 42, 0.8); }
.qbtn:active { transform: scale(.97); }
.qbtn .t { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; }
.qbtn .p { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qbtn .p .c { color: #fcd34d; }
.qbtn .p .tk { color: var(--cyan-2); }
.qbtn.hp .t { color: #fda4af; }
.qbtn.en .t { color: #fde68a; }
.qbtn.sh .t { color: #bae6fd; }
.qbtn.flash { animation: flashBtn .6s 3; }
.hud-abil { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 8px; }
.abil { width: 76px; padding: 9px 6px; text-align: center; border-radius: 12px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.abil .ic { font-size: 17px; color: var(--text); font-weight: 600; }
.abil.ready { border-color: rgba(255, 255, 255, 0.3); color: var(--text); }
.abil.skill { position: relative; width: 78px; height: 78px; padding: 4px; display: grid; place-items: center; }
.abil.skill.empty { width: 78px; padding: 14px 6px; display: block; font-size: 12px; }
.abil.skill.empty .ic { font-size: 22px; }
.abil.skill .ab-icon { width: 100%; height: 100%; opacity: .55; filter: grayscale(.6); transition: opacity .15s, filter .15s; }
.abil.skill.ready .ab-icon { opacity: 1; filter: none; }
.abil.skill b { position: absolute; right: 4px; bottom: 3px; font-size: 13px; color: #fff; text-shadow: 0 1px 2px #000; }
.abil.skill .cd { position: absolute; inset: 4px; border-radius: 10px; display: grid; place-items: center; font-size: 21px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none;
  background: conic-gradient(rgba(0, 0, 0, .6) var(--p, 0deg), transparent 0); }
.ab-icon { display: block; }
img.ab-3d { width: 100%; height: 100%; object-fit: contain; }
.ab-icon.legendary { filter: drop-shadow(0 0 6px rgba(251, 191, 36, .55)); }
.ab-icon.epic { filter: drop-shadow(0 0 5px rgba(192, 132, 252, .45)); }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 19; opacity: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(239, 68, 68, 0.5) 100%); transition: opacity .25s; }
#vignette.low { animation: lowHp 1.1s infinite; }
#vignette.hit { opacity: .8; transition: none; }
#announce { position: fixed; left: 0; right: 0; top: 30%; text-align: center; z-index: 25; pointer-events: none; }
#announce .a { animation: announce 2.2s ease forwards; }
#announce .a b { display: block; font-weight: 800; font-size: clamp(30px, 5vw, 56px); letter-spacing: -0.04em; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7); }
#announce .a span { font-size: 12px; letter-spacing: 0.3em; font-weight: 600; color: #fff; opacity: .75; }
#floaters { position: fixed; inset: 0; z-index: 21; pointer-events: none; overflow: hidden; }
#floaters span { position: absolute; font-weight: 700; font-size: 15px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9); animation: floatUp .8s ease-out forwards; white-space: nowrap; transform: translate(-50%, -50%); font-variant-numeric: tabular-nums; }
#toasts { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(560px, 92vw); }
.toast { padding: 10px 16px; border-radius: 12px; background: rgba(18, 20, 25, 0.96); border: 1px solid var(--line-2); font-size: 13.5px; animation: toastIn .22s ease, toastOut .4s ease 3.4s forwards; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); text-align: center; color: var(--text-2); }
.toast.good { border-color: rgba(52, 211, 153, 0.4); }
.toast.bad { border-color: rgba(248, 113, 113, 0.45); }
.toast.gold { border-color: rgba(251, 191, 36, 0.45); }

/* touch controls */
#touch { position: fixed; inset: 0; z-index: 22; pointer-events: none; display: none; }
body.touch.playing #touch { display: block; }
body.touch .hud-abil { display: none; }
/* touch: quick-buy row sits above the joystick / action buttons */
body.touch .hud-quick { left: 50%; right: auto; bottom: 236px; transform: translateX(-50%); gap: 6px; }
body.touch .hud-quick .qbtn { min-width: 0; padding: 7px 12px; border-radius: 999px; }
body.touch .hud-quick .qbtn .p { display: none; }
body.touch .hud-quick .qbtn .kbd { display: none; }
body.touch.playing #toasts { bottom: auto; top: 42%; }
.joy { position: absolute; left: 22px; bottom: 26px; width: 148px; height: 148px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); pointer-events: auto; touch-action: none; backdrop-filter: blur(8px); }
.joy i { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.35); }
.tbtns { position: absolute; right: 18px; bottom: 22px; width: 210px; height: 200px; pointer-events: none; }
.tbtn { position: absolute; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; background: rgba(18, 20, 25, 0.7); border: 1px solid var(--line-2); pointer-events: auto; touch-action: none; color: var(--text); backdrop-filter: blur(8px); }
.tbtn.fire { width: 96px; height: 96px; right: 0; bottom: 0; border-color: rgba(248, 113, 113, 0.6); color: #fecaca; font-size: 14px; }
.tbtn.jump { width: 62px; height: 62px; right: 108px; bottom: 6px; }
.tbtn.dash { width: 62px; height: 62px; right: 104px; bottom: 82px; }
.tbtn.spec { width: 62px; height: 62px; right: 30px; bottom: 112px; }
.tbtn.spec2 { width: 56px; height: 56px; right: 36px; bottom: 182px; }
.tbtn.reload { width: 56px; height: 56px; right: 172px; bottom: 124px; display: flex; flex-direction: column; gap: 0; line-height: 1.1; }
.tbtn.reload b { font-size: 12px; color: var(--amber); white-space: nowrap; }
.tbtn.reload small { font-size: 9.5px; color: var(--muted); }
.tbtn.spec, .tbtn.spec2 { overflow: hidden; padding: 0; }
.tbtn .ab-icon { width: 100%; height: 100%; opacity: .55; filter: grayscale(.6); }
.tbtn.ready .ab-icon { opacity: 1; filter: none; }
.tbtn .cd { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; background: conic-gradient(rgba(0, 0, 0, .6) var(--p, 0deg), transparent 0); }
.tbtn.on { background: rgba(255, 255, 255, 0.2); }

/* ------------------------------------------------------------ admin */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.tabs button { background: none; border: 0; height: 32px; padding: 0 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13.5px; }
.tabs button.on { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.tbl-wrap { overflow: auto; max-height: 56vh; border: 1px solid var(--line); border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { position: sticky; top: 0; background: #171a21; text-align: left; font-weight: 500; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; font-size: 12px; }
table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: rgba(255, 255, 255, 0.02); }
.inp { width: 100%; min-width: 64px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.25); font-size: 13px; font-variant-numeric: tabular-nums; }
textarea.inp { height: auto; padding: 10px; }
.inp:focus { outline: none; border-color: rgba(255, 255, 255, 0.35); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
select.inp { padding-right: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.field .inp { color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.toggle { position: relative; display: inline-block; vertical-align: middle; width: 38px; height: 22px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.14); cursor: pointer; transition: .2s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(16px); }
.section-title { font-size: 13px; font-weight: 600; color: var(--text); margin: 20px 0 10px; letter-spacing: -0.01em; }
.section-title:first-child { margin-top: 0; }
.admin-note { font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 12px; line-height: 1.6; }
.hist { font-size: 13px; max-height: 260px; overflow: auto; }
.hist div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.hist div span:first-child { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pin-box { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 14px 0; }
.pin-box .inp { width: 180px; height: 48px; text-align: center; font-size: 22px; letter-spacing: 10px; }

/* ------------------------------------------------------------ animations */
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes pulseRed { 50% { box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.45); } }
@keyframes ringPulse { 50% { box-shadow: 0 0 0 6px rgba(10, 11, 15, 0.9), 0 0 0 14px rgba(248, 250, 252, 0.35), 0 24px 60px rgba(0, 0, 0, 0.6); } }
@keyframes lowHp { 0%, 100% { opacity: .25; } 50% { opacity: .65; } }
@keyframes announce { 0% { opacity: 0; transform: scale(1.15); filter: blur(6px); } 12% { opacity: 1; transform: scale(1); filter: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-16px); } }
@keyframes floatUp { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -46px; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes starPop { from { transform: scale(0) rotate(-30deg); opacity: 0; } 70% { transform: scale(1.25); } }
@keyframes flashBtn { 50% { border-color: var(--red); background: rgba(248, 113, 113, 0.18); } }
@keyframes dashMove { to { stroke-dashoffset: -28; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ responsive */
/* modals never grow wider than the screen; wide content (tables) scrolls inside */
.modal-backdrop { grid-template-columns: minmax(0, 1fr); }
.modal { min-width: 0; justify-self: center; }
.modal-body > * { max-width: 100%; }

/* large desktops: give the map and HUD a little more room */
.skill-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; }
.skill-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font: inherit; text-align: center; cursor: pointer; transition: border-color .15s, transform .15s; }
.skill-card:hover, .skill-card:focus-visible { border-color: var(--gold); transform: translateY(-2px); outline: none; }
.skill-card .sk-ic svg { width: 30px; height: 30px; color: var(--gold); }
.skill-card b { font-size: 15.5px; }
.skill-card .sk-tag { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: rgba(61, 220, 151, .14); color: var(--green); }
.skill-card .sk-tag.up { background: rgba(251, 191, 36, .14); color: var(--gold); }
.skill-card .sk-tag.down { background: rgba(255, 77, 109, .14); color: var(--red); }
.skill-card .muted { font-size: 12.5px; }

.sk-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sk-slot { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.sk-slot .ab-icon, .sk-slot .sk-empty { width: 56px; height: 56px; flex: none; }
.sk-slot .muted { font-size: 12px; }
.sk-empty { border-radius: 12px; border: 2px dashed var(--line-2); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.sk-gacha { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sk-pull { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; background: radial-gradient(circle at 30% 0%, rgba(251, 191, 36, .12), transparent 60%), var(--surface-2); border: 1px solid var(--line); }
.sk-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.sk-pity { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sk-pity b { color: var(--gold); }
.sk-rate { padding: 8px 10px; border-radius: 10px; border-left: 3px solid var(--rc); background: var(--surface-2); margin-top: 6px; }
.sk-rate .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--rc); }
.sk-mini { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.sk-mini .ab-icon { width: 32px; height: 32px; }
.sk-results, .sk-bag { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sk-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border-radius: 14px; text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 14%, transparent), var(--surface-2)); border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent); }
.sk-card .ab-icon { width: 64px; height: 64px; }
.sk-card b { font-size: 14px; }
.sk-card.locked { opacity: .38; filter: grayscale(.8); }
.sk-card.legendary { box-shadow: 0 0 18px rgba(251, 191, 36, .25); }
.sk-rar { font-size: 11px; color: var(--rc); font-weight: 600; letter-spacing: .04em; }
.sk-lv { color: var(--gold); font-size: 12px; }
.sk-new { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: rgba(61, 220, 151, .15); color: var(--green); }
.sk-shard { font-size: 12px; color: var(--cyan-2); }
.sk-desc { font-size: 12px; min-height: 2.6em; }
.sk-eq { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.sk-card .btn-sm { font-size: 11.5px; max-width: 100%; height: auto; min-height: 28px; padding: 4px 8px; white-space: normal; line-height: 1.3; }
.flip { animation: skFlip .55s cubic-bezier(.2, 1.3, .4, 1) both; transform-origin: 50% 50%; }
@keyframes skFlip { from { opacity: 0; transform: perspective(600px) rotateY(90deg) scale(.8); } to { opacity: 1; transform: none; } }
.sk-card.flip.legendary, .sk-card.flip.epic { animation-name: skFlip, skGlow; animation-duration: .55s, 1.6s; animation-iteration-count: 1, 2; }
@keyframes skGlow { 50% { box-shadow: 0 0 28px var(--rc); } }

/* gacha capsule reveal */
.gacha-stage { position: absolute; inset: 0; z-index: 5; border-radius: inherit; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--rc) 22%, #05060a) 0%, #05060a 70%); }
.gs-rays { position: absolute; width: 160%; aspect-ratio: 1; opacity: 0; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 35%, transparent) 0 8deg, transparent 8deg 20deg); animation: gsSpin 6s linear infinite; mask: radial-gradient(circle, #000 0, transparent 60%); }
.gacha-stage.open .gs-rays { opacity: 1; transition: opacity .3s; }
.gs-capsule { position: relative; width: 120px; height: 120px; animation: gsDrop .65s cubic-bezier(.3, 1.5, .5, 1) both; filter: drop-shadow(0 0 22px var(--rc)); }
.gs-capsule i { position: absolute; left: 0; width: 120px; height: 60px; transition: transform .45s cubic-bezier(.3, 1.4, .5, 1), opacity .45s; }
.gs-capsule .top { top: 0; border-radius: 60px 60px 0 0; background: radial-gradient(circle at 35% 30%, #fff 0, var(--rc) 35%, color-mix(in srgb, var(--rc) 45%, #000) 100%); }
.gs-capsule .bot { bottom: 0; border-radius: 0 0 60px 60px; background: radial-gradient(circle at 40% 0%, #f1f5f9 0, #94a3b8 60%, #334155 100%); }
.gs-capsule .band { top: 54px; height: 12px; border-radius: 6px; background: #0b0d12; box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 60%, #fff); }
.gacha-stage.shake .gs-capsule { animation: gsShake .12s linear infinite; }
.gacha-stage.open .gs-capsule { animation: none; }
.gacha-stage.open .gs-capsule .top { transform: translateY(-90px) rotate(-25deg); opacity: 0; }
.gacha-stage.open .gs-capsule .bot { transform: translateY(90px) rotate(15deg); opacity: 0; }
.gacha-stage.open .gs-capsule .band { opacity: 0; }
.gs-flash { position: absolute; inset: 0; background: radial-gradient(circle, #fff 0, var(--rc) 25%, transparent 60%); opacity: 0; pointer-events: none; }
.gacha-stage.open .gs-flash { animation: gsFlash .7s ease-out both; }
.gs-label { position: absolute; top: 58%; font: 800 34px/1 var(--head); letter-spacing: .08em; color: var(--rc); text-shadow: 0 0 24px var(--rc); opacity: 0; }
.gacha-stage.open .gs-label { animation: gsLabel .9s cubic-bezier(.2, 1.5, .4, 1) .15s both; }
.gacha-stage.legendary.open { animation: gsQuake .45s linear; }
.gs-skip { position: absolute; right: 14px; bottom: 14px; }
@keyframes gsDrop { from { transform: translateY(-420px) scale(.7); } to { transform: none; } }
@keyframes gsShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg) translateX(-4px); } 75% { transform: rotate(9deg) translateX(4px); } }
@keyframes gsFlash { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes gsLabel { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes gsSpin { to { transform: rotate(360deg); } }
@keyframes gsQuake { 0%, 100% { transform: none; } 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-4px, -2px); } 80% { transform: translate(3px, 4px); } }

/* difficulty picker */
.diff-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 12px 0; }
.diff-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; flex: 1; min-width: 260px; }
.diff { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font: inherit; cursor: pointer; }
.diff b { font-size: 14px; }
.diff span { font-size: 11.5px; color: var(--muted); }
.diff em { font-style: normal; color: var(--gold); }
.diff.on.easy { border-color: var(--green); background: rgba(61, 220, 151, .12); }
.diff.on.normal { border-color: var(--cyan); background: rgba(76, 201, 240, .12); }
.diff.on.hard { border-color: var(--red); background: rgba(255, 77, 109, .12); }

/* character screen */
.ch-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; }
.ch-stats { padding: 14px; }
.ch-stats h4 { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.ch-loadout { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ch-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
.ch-slot:hover, .ch-slot:focus-visible { border-color: var(--gold); transform: translateY(-2px); outline: none; }
.ch-slot .ab-icon, .ch-slot .sk-empty, .ch-slot .ch-armor { width: 72px; height: 72px; }
.ch-k { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.ch-sub { font-size: 13px; font-weight: 600; text-align: center; }
.ch-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ch-armor { position: relative; display: grid; place-items: center; border-radius: 12px; background: radial-gradient(circle at 50% 30%, #475569, #0f172a); border: 2px solid #64748b; }
.ch-armor svg { width: 60%; height: 60%; color: #cbd5e1; }
.ch-armor b { position: absolute; font-size: 15px; color: #0f172a; }
.ch-armor.t2 { border-color: #38bdf8; } .ch-armor.t2 svg { color: #7dd3fc; }
.ch-armor.t3 { border-color: #c084fc; } .ch-armor.t3 svg { color: #e9b8ff; }
.ch-armor.t4 { border-color: #fbbf24; box-shadow: 0 0 16px rgba(251, 191, 36, .4); } .ch-armor.t4 svg { color: #ffe08a; }
.ch-armor.t0 svg { color: #334155; } .ch-armor.t0 b { color: #94a3b8; }
.ch-armors { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ch-armor-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.ch-armor-card .ch-armor { width: 76px; height: 76px; }
.ch-armor-card.own { border-color: rgba(61, 220, 151, .4); }
@media (max-width: 760px) { .ch-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .sk-gacha { grid-template-columns: 1fr; } }

@media (min-width: 1800px) {
  .map-wrap { max-width: 1720px; grid-template-columns: minmax(0, 1fr) 380px; }
  .title-wrap { max-width: 1480px; }
}

/* small laptops / tablets */
@media (max-width: 1100px) {
  .map-wrap { grid-template-columns: 1fr; }
  .side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
  .levels { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .wm { height: 68vh; height: 68dvh; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* HUD: below ~1000px the mission/boss column moves under the status row */
@media (max-width: 999px) {
  .hud-top { flex-wrap: wrap; row-gap: 10px; }
  .hud-left { width: 270px; }
  .hud-right { margin-left: auto; }
  .hud-center { order: 3; flex-basis: 100%; }
}

/* phones (portrait) */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .screen { padding: 74px 14px 28px; }
  #topbar { padding: 0 12px; gap: 6px; }
  #topbar .brand span { display: none; }
  #topbar .hide-sm { display: none; }
  #topbar .wallet-btn .wl { display: none; }
  #topbar .chip { padding: 0 9px; }
  #topbar .wallet-btn { width: 36px; padding: 0; }
  .title-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title-cards .stat-card:nth-child(2) { grid-column: 1 / -1; order: 3; }
  .stat-card .v { font-size: 22px; }
  .stat-card .v.small { font-size: 18px; }
  .step-card { grid-template-columns: 1fr; }
  .step-art { width: 72px; height: 72px; border-radius: 18px; }
  .step-art svg { width: 32px; height: 32px; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wd-grid { grid-template-columns: 1fr; }
  .wm { height: 62vh; height: 62dvh; min-height: 380px; border-radius: 14px; }
  .wm-card { width: calc(100% - 24px); bottom: 12px; grid-template-columns: 72px 1fr; }
  .wm-card .thumb { width: 72px; height: 56px; }
  .wm-mini { display: none; }
  .wm-hint { display: none; }
  .modal-backdrop { padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
  .modal { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .modal-head { padding: 16px 16px 8px; }
  .modal-head h3 { font-size: 16.5px; }
  .modal-body { padding: 4px 16px 12px; }
  .modal-foot { padding: 12px 16px 14px; }
  .modal-foot .spacer { display: none; }
  .modal-foot .btn { flex: 1 1 auto; }
  .quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hud-right .chip:not(.ping) { display: none; }
}

/* compact HUD for phones in either orientation */
@media (max-width: 760px), (max-height: 520px) {
  .hud-top { top: 8px; left: 8px; right: 8px; gap: 8px; row-gap: 8px; }
  .hud-left { width: min(230px, calc(100vw - 70px)); gap: 6px; }
  .hud-status { padding: 8px 10px; }
  .hud-status .lvl { font-size: 11px; margin-bottom: 2px; }
  .meter { margin-top: 5px; }
  .meter .row { font-size: 10.5px; margin-bottom: 2px; }
  .meter .row b { font-size: 11px; }
  .bar { height: 6px; }
  .bar.thin { height: 5px; }
  .hud-extra .panel { padding: 7px 10px; }
  .hud-mission { gap: 6px; }
  .hud-mission .timer { font-size: 18px; padding: 7px 10px; border-radius: 10px; }
  .hud-mission .obj { padding: 6px 12px; }
  .hud-mission .obj b { font-size: 13.5px; }
  .hud-mission .obj span { font-size: 11.5px; }
  .hud-boss .name { font-size: 11.5px; margin-bottom: 4px; }
  .hud-boss .bar { height: 8px; }
  .hud-quick { left: 8px; bottom: 8px; }
  .qbtn { min-width: 0; padding: 7px 10px; }
  .hud-abil { right: 8px; bottom: 8px; }
  .abil { width: 64px; padding: 6px 4px; }
  #announce .a b { font-size: clamp(24px, 7vw, 40px); }
}

/* phones in landscape: keep everything in one top row, controls in the corners */
@media (max-height: 520px) {
  .screen { padding-top: 70px; }
  .hud-top { flex-wrap: nowrap; }
  .hud-left { width: 210px; }
  .hud-center { order: 0; flex-basis: 0; }
  .hud-right .chip:not(.ping) { display: none; }
  .title-wrap { min-height: 0; justify-content: flex-start; }
  .logo { font-size: 46px; margin: 12px 0 4px; }
  .logo small { margin-top: 8px; }
  .title-sub { font-size: 14px; margin: 8px 0 14px; }
  .title-actions { margin-bottom: 14px; }
  .title-actions .btn-lg { height: 42px; font-size: 14px; }
  .stat-card { padding: 10px 14px; }
  .feature-row { display: none; }
  .wm { height: calc(100dvh - 90px); min-height: 260px; }
  .wm-mini, .wm-hint { display: none; }
  body.touch .hud-quick { bottom: 12px; gap: 4px; }
  body.touch .hud-quick .qbtn { padding: 6px 9px; }
  .qbtn .t { font-size: 12px; }
  .joy { left: 14px; bottom: 14px; width: 120px; height: 120px; }
  .joy i { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .tbtns { right: 12px; bottom: 12px; transform: scale(.82); transform-origin: 100% 100%; }
  body.touch.playing #toasts { top: auto; bottom: 70px; }
  /* level bars as slim one-liners so the left column clears the joystick */
  .hud-extra { gap: 4px; }
  .hud-extra .panel { padding: 5px 10px; }
  .hud-extra .meter { margin-top: 0; }
  .hud-extra .bar { height: 4px; }
}

/* very short landscape screens (e.g. 568×320) */
@media (max-height: 380px) {
  .kicker, .title-sub { display: none; }
  .logo { font-size: 38px; margin-top: 4px; }
  .logo small { font-size: 0.24em; }
  .title-actions { margin-bottom: 10px; }
  .joy { width: 108px; height: 108px; }
  .joy i { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .tbtns { transform: scale(.74); }
  .hud-status .lvl { display: none; }
  .hud-status .meter:first-of-type { margin-top: 0; }
}

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

/* very small phones */
@media (max-width: 400px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .title-actions .btn-lg { padding: 0 16px; }
  .joy { left: 12px; bottom: 16px; width: 120px; height: 120px; }
  .joy i { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .tbtns { right: 10px; bottom: 14px; transform: scale(.8); transform-origin: 100% 100%; }
  body.touch .hud-quick { bottom: 196px; }
  .qbtn .t { font-size: 12.5px; }
}

/* landscape phones: bigger thumb buttons than the generic compact rules, clear of notches */
@media (orientation: landscape) and (max-height: 520px) {
  .joy { left: calc(16px + env(safe-area-inset-left)); bottom: 14px; width: 132px; height: 132px; }
  .joy i { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
  .tbtns { right: calc(12px + env(safe-area-inset-right)); bottom: 10px; transform: scale(.96); transform-origin: 100% 100%; }
  .hud-top { left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right)); }
}
@media (orientation: landscape) and (max-height: 380px) {
  .tbtns { transform: scale(.88); }
  .joy { width: 120px; height: 120px; }
}

/* ------------------------------------------------------------ frosted glass touch controls (style A) */
:root { --neon-a: #4cf2ff; --neon-b: #a855f7; --glass: rgba(255, 255, 255, .16); --glass-edge: rgba(255, 255, 255, .7); }
.tbtn, .joy {
  color: #fff;
  border: 1.5px solid var(--glass-edge);
  background: radial-gradient(120% 120% at 30% 18%, rgba(255, 255, 255, .28), rgba(255, 255, 255, .06) 55%), var(--glass);
  backdrop-filter: blur(8px) saturate(1.3);
  -webkit-backdrop-filter: blur(8px) saturate(1.3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .45);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .65);
  transition: transform .08s ease-out, background .12s, box-shadow .12s;
}
/* dark outline keeps white icons readable on bright sand/snow maps */
.tbtn .ic { width: 44%; height: 44%; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .7)) drop-shadow(0 0 1px rgba(0, 0, 0, .6)); }
.tbtn .lb { position: absolute; bottom: 6px; font-size: 8.5px; font-weight: 700; letter-spacing: .1em; opacity: .9; }
.tbtn.jump .ic, .tbtn.dash .ic { margin-top: -8px; }
.tbtn.on { transform: scale(.9); background: rgba(255, 255, 255, .34); box-shadow: 0 0 18px rgba(255, 255, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .5); }

.tbtn.fire { border: 2.5px solid rgba(255, 110, 90, .95); color: #ffd9d2; background: radial-gradient(circle at 34% 24%, rgba(255, 255, 255, .3), rgba(255, 90, 70, .22) 60%), rgba(255, 255, 255, .1); }
.tbtn.fire .ic { width: 48%; height: 48%; }
.tbtn.fire::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; background: conic-gradient(transparent 0 62%, rgba(255, 255, 255, .9) 82%, transparent 100%); -webkit-mask: radial-gradient(circle, transparent 64%, #000 66%); mask: radial-gradient(circle, transparent 64%, #000 66%); opacity: 0; pointer-events: none; }
.tbtn.fire.on::before { opacity: 1; animation: neonSpin .6s linear infinite; }
.tbtn.fire.on { background: radial-gradient(circle at 34% 24%, rgba(255, 255, 255, .4), rgba(255, 90, 70, .4) 60%), rgba(255, 255, 255, .14); box-shadow: 0 0 22px rgba(255, 110, 90, .6); }
@keyframes neonSpin { to { transform: rotate(360deg); } }

.tbtn.spec, .tbtn.spec2 { border-color: rgba(196, 160, 255, .95); overflow: visible; font-size: 16px; font-weight: 800; }
.tbtn.spec2 { border-color: rgba(110, 231, 160, .95); }
.tbtn.spec .ab-icon, .tbtn.spec2 .ab-icon { border-radius: 50%; clip-path: circle(46%); }
.tbtn.spec::after, .tbtn.spec2::after { content: attr(data-k); position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #1a1030; text-shadow: none; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.tbtn.spec.ready, .tbtn.spec2.ready { box-shadow: 0 0 14px rgba(255, 255, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .5); }

.tbtn.reload { border-color: rgba(255, 214, 80, .95); color: #ffe9a8; }
.tbtn.reload .ic { width: 40%; height: 40%; margin-top: -10px; }
.tbtn.reload b { position: absolute; bottom: 6px; font-size: 10.5px; color: #ffe9a8; }
.tbtn.reload.busy .ic { animation: spin .8s linear infinite; }

.joy::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, .45); }
.joy i { background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .55) 45%, rgba(220, 230, 245, .35)); border: 1.5px solid rgba(255, 255, 255, .85); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); transition: transform .05s; }
.joy .dir { position: absolute; inset: 0; border-radius: 50%; opacity: 0; pointer-events: none; background: conic-gradient(from -25deg, rgba(255, 255, 255, .6) 0 50deg, transparent 50deg); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.joy.on { background: radial-gradient(120% 120% at 30% 18%, rgba(255, 255, 255, .34), rgba(255, 255, 255, .1) 55%), var(--glass); }

body.touch .hud-quick .qbtn { background: rgba(10, 14, 24, .45); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(10px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15); }
body.touch .hud-quick .qbtn.hp { border-color: rgba(253, 164, 175, .55); box-shadow: 0 0 10px rgba(253, 164, 175, .25); }
body.touch .hud-quick .qbtn.en { border-color: rgba(253, 230, 138, .55); box-shadow: 0 0 10px rgba(253, 230, 138, .25); }
body.touch .hud-quick .qbtn.sh { border-color: rgba(186, 230, 253, .55); box-shadow: 0 0 10px rgba(186, 230, 253, .25); }
body.touch .hud-quick .qbtn:active { transform: scale(.92); }
body.touch #h-pause { border-radius: 50%; background: rgba(10, 14, 24, .45); border: 1px solid rgba(76, 242, 255, .5); box-shadow: 0 0 12px rgba(76, 242, 255, .3); backdrop-filter: blur(10px); }

/* ============================================================================
   SPACE THEME — neon type (style A) on a nebula backdrop (style C)
   ========================================================================== */
:root {
  --bg: #07051a;
  --surface: rgba(16, 12, 42, 0.62);
  --surface-solid: #0d0926;
  --surface-2: rgba(140, 120, 255, 0.07);
  --surface-3: rgba(140, 120, 255, 0.14);
  --line: rgba(150, 130, 255, 0.17);
  --line-2: rgba(120, 200, 255, 0.3);
  --text: #eef4ff;
  --text-2: #c9d2f0;
  --muted: #9298c8;
  --accent: #4cf2ff;
  --cyan: #4cf2ff;
  --cyan-2: #8ff7ff;
  --pink: #ff3df0;
  --violet: #a855f7;
  --head: 'Orbitron', 'Noto Sans Thai', system-ui, sans-serif;
  --neon-c: 0 0 14px rgba(76, 242, 255, .6);
  --neon-m: 0 0 14px rgba(255, 61, 240, .6);
  --nebula:
    radial-gradient(ellipse at 82% 12%, rgba(168, 85, 247, .38), transparent 46%),
    radial-gradient(ellipse at 12% 88%, rgba(56, 189, 248, .26), transparent 48%),
    radial-gradient(ellipse at 55% 55%, rgba(236, 72, 153, .12), transparent 55%);
}
body { background: var(--nebula), #07051a; }
::selection { background: rgba(76, 242, 255, .35); }

/* type */
.logo { font-family: var(--head); font-weight: 900; letter-spacing: .02em; line-height: .98; background: none; color: #e8fbff; -webkit-text-fill-color: currentColor; text-shadow: 0 0 22px rgba(76, 242, 255, .75), 0 0 2px #fff; }
.logo .q { color: #ff7af5; text-shadow: 0 0 22px rgba(255, 61, 240, .8), 0 0 2px #fff; }
.logo small { font-family: var(--head); color: #8ff7ff; -webkit-text-fill-color: #8ff7ff; text-shadow: var(--neon-c); letter-spacing: .38em; }
.kicker { border-color: rgba(76, 242, 255, .35); background: rgba(76, 242, 255, .06); color: #bff9ff; }
.kicker::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.modal-head h3, .section-title, .map-head h2, .ch-stats h4 { font-family: var(--head); letter-spacing: .05em; color: #e8fbff; text-shadow: var(--neon-c); }
.stat-card .v, .chip b, .hud-mission .timer, .countdown, .kv .v, .brief-num, .lv .num { font-family: var(--head); letter-spacing: .02em; }
.stat-card .k, .kv .k { color: #a9afe0; }

/* surfaces */
.panel {
  background: linear-gradient(160deg, rgba(34, 22, 78, .55), rgba(10, 10, 36, .6));
  border: 1px solid rgba(150, 130, 255, .24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(76, 242, 255, .04), 0 12px 40px rgba(16, 0, 50, .45);
}
.card { background: rgba(140, 120, 255, .06); border-color: rgba(150, 130, 255, .2); }
.modal-backdrop { background: rgba(6, 3, 20, .72); }
.modal {
  background: var(--nebula), #0c0824;
  border: 1px solid rgba(76, 242, 255, .32);
  box-shadow: 0 0 0 1px rgba(255, 61, 240, .1), 0 0 46px rgba(76, 242, 255, .14), 0 30px 90px rgba(0, 0, 0, .65);
}
.modal-head svg.i { color: var(--cyan); filter: drop-shadow(0 0 6px rgba(76, 242, 255, .8)); }
#topbar { background: linear-gradient(180deg, rgba(8, 5, 26, .94), rgba(8, 5, 26, .55) 65%, transparent); }
#topbar .brand span { font-family: var(--head); letter-spacing: .08em; font-weight: 800; text-shadow: var(--neon-c); }
#topbar .brand span em { color: #ff7af5; text-shadow: var(--neon-m); }
#screen-title { background: linear-gradient(90deg, rgba(8, 5, 26, .9) 0%, rgba(8, 5, 26, .55) 38%, rgba(8, 5, 26, 0) 64%); }
.chip { background: rgba(16, 12, 42, .62); border-color: rgba(150, 130, 255, .25); }
.tabs { background: rgba(16, 12, 42, .6); border-color: rgba(150, 130, 255, .22); }
.tabs button.on { background: rgba(76, 242, 255, .14); color: #e8fbff; box-shadow: inset 0 0 0 1px rgba(76, 242, 255, .5), 0 0 12px rgba(76, 242, 255, .2); }

/* buttons: cyan neon primary, magenta neon secondary */
.btn { border-color: rgba(120, 200, 255, .26); background: rgba(76, 242, 255, .05); }
.btn:hover:not(:disabled) { border-color: rgba(76, 242, 255, .65); background: rgba(76, 242, 255, .1); box-shadow: 0 0 14px rgba(76, 242, 255, .28); }
.btn-primary { background: linear-gradient(135deg, #5af4ff, #3b82f6); color: #031421; border-color: transparent; box-shadow: 0 0 20px rgba(76, 242, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #8ff7ff, #60a5fa); box-shadow: 0 0 28px rgba(76, 242, 255, .6), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn-gold { background: rgba(255, 61, 240, .1); color: #ffc2fa; border-color: rgba(255, 61, 240, .5); }
.btn-gold:hover:not(:disabled) { background: rgba(255, 61, 240, .18); border-color: #ff3df0; box-shadow: 0 0 16px rgba(255, 61, 240, .4); }
.btn-ghost { background: transparent; }

/* game HUD panels pick up the same glass */
.hud-status, .hud-mission .obj, .hud-mission .timer { background: linear-gradient(160deg, rgba(34, 22, 78, .6), rgba(10, 10, 36, .65)); border-color: rgba(150, 130, 255, .26); }
.hud-mission .timer { color: #e8fbff; text-shadow: var(--neon-c); }
.bar.hp .fill { background: linear-gradient(90deg, #ff3d8a, #ff7af5); box-shadow: 0 0 8px rgba(255, 61, 240, .6); }
.bar.sh .fill { background: linear-gradient(90deg, #38bdf8, #8ff7ff); box-shadow: 0 0 8px rgba(76, 242, 255, .6); }
.bar.en .fill { background: linear-gradient(90deg, #f59e0b, #fde047); box-shadow: 0 0 8px rgba(253, 224, 71, .5); }
.hud-boss .bar .fill { background: linear-gradient(90deg, #a855f7, #ff3df0); }

/* skill / item cards and character slots */
.sk-card, .ch-slot, .ch-armor-card, .skill-card, .sk-slot, .sk-pull, .diff { background-color: rgba(16, 12, 42, .55); }
.ch-slot:hover, .skill-card:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(76, 242, 255, .3); }
.ch-model { width: 100%; height: 260px; display: block; border-radius: 14px; background: radial-gradient(circle at 50% 70%, rgba(76, 242, 255, .18), transparent 60%), radial-gradient(circle at 50% 30%, rgba(168, 85, 247, .25), transparent 65%); border: 1px solid rgba(150, 130, 255, .22); margin-bottom: 10px; touch-action: pan-y; }

/* active buff chips under the status panel */
.hud-buffs { display: flex; flex-wrap: wrap; gap: 5px; }
.hud-buffs:empty { display: none; }
.buff { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 6px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: #fff; background: rgba(10, 8, 30, .7); border: 1px solid var(--bc); box-shadow: 0 0 10px color-mix(in srgb, var(--bc) 50%, transparent); }
.buff i { width: 8px; height: 8px; border-radius: 50%; background: var(--bc); box-shadow: 0 0 6px var(--bc); }
.buff b { font-family: var(--head); color: var(--bc); font-size: 11px; }

/* co-op lobby and HUD */
.coop-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.coop-pick .card { padding: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.coop-pick h4 { display: flex; gap: 6px; align-items: center; }
.coop-code-in { display: flex; gap: 8px; width: 100%; }
.coop-code-in input { flex: 1; min-width: 0; font: 600 22px var(--head); letter-spacing: .3em; text-transform: uppercase; text-align: center; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); }
.coop-code-in input:focus { outline: 2px solid var(--neon-a); outline-offset: 1px; }
.coop-room { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 10px 0 4px; }
.coop-code { font: 800 44px var(--head); letter-spacing: .28em; color: var(--neon-a); text-shadow: 0 0 18px rgba(76, 242, 255, .55); user-select: all; }
.coop-status { margin: 10px 0; padding: 9px 12px; border-radius: 12px; text-align: center; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-2); }
.coop-status.on { color: var(--green); border: 1px solid rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .08); }
.coop-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.coop-mode { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 14px; text-align: left; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-2); cursor: pointer; }
.coop-mode .i { width: 22px; height: 22px; color: var(--neon-a); }
.coop-mode span { font-size: 12px; color: var(--muted); }
.coop-mode.on { border-color: var(--neon-a); background: rgba(76, 242, 255, .1); box-shadow: 0 0 16px rgba(76, 242, 255, .2); }
.hud-mate { padding: 8px 12px; min-width: 170px; }
.hud-mate .row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #ffc48a; }
.hud-mate .row .i { width: 14px; height: 14px; vertical-align: -2px; }
.hud-mate .bar > i.fill { background: linear-gradient(90deg, #fb923c, #fbbf24); }
.hud-mate.down { border-color: rgba(248, 113, 113, .6); animation: pulse 1s infinite; }
.hud-mate.down .row { color: var(--red); }
.hud-down { margin-top: 8px; padding: 8px 14px; border-radius: 12px; font-weight: 600; color: #fff; background: rgba(120, 20, 40, .7); border: 1px solid rgba(248, 113, 113, .6); }
@media (max-width: 640px) { .coop-pick, .coop-modes { grid-template-columns: 1fr; } .coop-code { font-size: 36px; } }
.chip.ping { font-variant-numeric: tabular-nums; font-size: 12px; }
.chip.ping[data-q="good"] { color: var(--green); }
.chip.ping[data-q="mid"] { color: var(--amber); }
.chip.ping[data-q="bad"] { color: var(--red); }

/* title screen: one big play button, 2×2 mode cards, slim stats, small links */
.logo { margin-bottom: 4px; }
.title-play { width: 100%; max-width: 460px; height: 58px; justify-content: center; font-size: 18px; margin: 20px 0 12px; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 460px; }
.mode-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left;
  padding: 14px; border-radius: 16px; font: inherit; color: var(--text); cursor: pointer;
  border: 1.5px solid transparent;
  background:
    linear-gradient(rgba(14, 10, 38, .82), rgba(14, 10, 38, .82)) padding-box,
    linear-gradient(140deg, color-mix(in srgb, var(--c) 85%, #fff 0%), rgba(255, 255, 255, .06) 70%) border-box;
  backdrop-filter: blur(12px);
  transition: transform .15s ease, box-shadow .15s ease;
}
.mode-card:hover, .mode-card:focus-visible { transform: translateY(-2px); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 45%, transparent); outline: none; }
.mode-card:active { transform: translateY(0) scale(.98); }
.mc-ic { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent), 0 0 16px color-mix(in srgb, var(--c) 30%, transparent); }
.mc-ic .i { width: 24px; height: 24px; }
.mode-card b { font-size: 15.5px; font-weight: 700; }
.mode-card > span:last-child { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-stats { display: flex; max-width: 460px; margin-top: 12px; padding: 10px 4px; }
.title-stats > div { flex: 1; min-width: 0; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.title-stats > div + div { border-left: 1px solid var(--line-2); }
.title-stats .k { font-size: 11.5px; color: #a9afe0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-stats b { font-family: var(--head); font-size: 18px; letter-spacing: .02em; white-space: nowrap; }
.title-stats b small { font-size: 12px; color: var(--muted); }
.title-stats b.warn { color: var(--amber); }
.title-stats b.danger { color: var(--red); }
.title-links { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 10px; max-width: 460px; }
.title-links button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; font: inherit; font-size: 13px; color: var(--text-2); background: transparent; border: 1px solid transparent; cursor: pointer; }
.title-links button:hover, .title-links button:focus-visible { color: var(--neon-a); border-color: rgba(76, 242, 255, .35); background: rgba(76, 242, 255, .06); outline: none; }
.title-links .i { width: 15px; height: 15px; }
.char-spot {
  position: fixed; left: 0; top: 0; z-index: 11; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; font: 700 15px var(--head); letter-spacing: .04em; color: #fff; cursor: pointer;
  border: 2px solid transparent;
  background: linear-gradient(rgba(10, 14, 26, .78), rgba(10, 14, 26, .78)) padding-box, linear-gradient(140deg, var(--neon-a), var(--neon-b)) border-box;
  box-shadow: 0 0 18px rgba(76, 242, 255, .4);
  animation: spotPulse 2.4s ease-in-out infinite;
}
.char-spot .i { width: 18px; height: 18px; color: var(--neon-a); }
.char-spot:hover, .char-spot:focus-visible { box-shadow: 0 0 30px rgba(76, 242, 255, .7); outline: none; }
.char-spot.hidden { display: none; }
@keyframes spotPulse { 50% { box-shadow: 0 0 30px rgba(168, 85, 247, .55); } }
@media (prefers-reduced-motion: reduce) { .char-spot { animation: none; } }
@media (max-width: 640px), (max-height: 520px) {
  .title-play { height: 48px; font-size: 16px; margin: 12px 0 10px; }
  .mode-card { padding: 10px; column-gap: 10px; }
  .mc-ic { width: 36px; height: 36px; }
  .title-stats b { font-size: 15px; }
}
@media (min-width: 641px) and (max-height: 760px) {
  .logo { font-size: clamp(40px, 9.5vh, 72px); margin-top: 8px; }
  .title-play { margin: 12px 0 10px; }
}

/* big ammo counter above the action bar (desktop; phones show it on the reload button) */
.hud-ammo { position: absolute; right: 14px; bottom: 106px; min-width: 190px; padding: 10px 14px 9px; text-align: right; }
.hud-ammo .ha-name { font-size: 12px; color: #a9afe0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; margin-left: auto; }
.hud-ammo .ha-count { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; font-family: var(--head); font-variant-numeric: tabular-nums; line-height: 1; margin: 2px 0 7px; }
.hud-ammo .ha-count b { font-size: 46px; font-weight: 800; color: var(--amber); text-shadow: 0 0 16px rgba(251, 191, 36, .45); }
.hud-ammo .ha-count span { font-size: 21px; color: var(--text-2); }
.hud-ammo .bar > i.fill { background: linear-gradient(90deg, #f59e0b, #fde68a); transition: width .1s linear; }
.hud-ammo .ha-key { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.hud-ammo[data-st="low"] .ha-count b { color: var(--red); text-shadow: 0 0 16px rgba(248, 113, 113, .55); animation: pulse 1s infinite; }
.hud-ammo[data-st="reload"] .ha-count b { color: var(--muted); text-shadow: none; }
.hud-ammo[data-st="reload"] .bar > i.fill { background: linear-gradient(90deg, #38bdf8, #a5f3fc); }
@media (max-width: 900px), (max-height: 560px) {
  .hud-ammo { right: 8px; bottom: 88px; min-width: 150px; padding: 8px 10px; }
  .hud-ammo .ha-count b { font-size: 34px; }
  .abil.skill, .abil.skill.empty { width: 66px; height: 66px; }
}

/* top bar Deposit button + withdraw source picker */
#topbar .deposit-btn { gap: 5px; font-weight: 700; }
#topbar .deposit-btn .i { width: 15px; height: 15px; }
#topbar .withdraw-btn { color: var(--gold); border: 1px solid rgba(255, 210, 63, .55); background: rgba(255, 210, 63, .1); }
#topbar .withdraw-btn:hover { background: rgba(255, 210, 63, .2); }
@media (max-width: 760px) { #topbar .deposit-btn { width: 36px; padding: 0; } #topbar .deposit-btn .dl { display: none; } }
.wd-src { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.wd-src button { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 12px; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-2); cursor: pointer; }
.wd-src button .i { grid-row: 1 / 3; width: 22px; height: 22px; }
.wd-src button b { font-size: 14px; }
.wd-src button span { font-size: 11.5px; color: var(--muted); }
.wd-src button.on { border-color: var(--neon-a); background: rgba(76, 242, 255, .1); box-shadow: 0 0 14px rgba(76, 242, 255, .2); }
.wd-head .wd-step .i { width: 16px; height: 16px; }
@media (max-width: 560px) { .wd-src { grid-template-columns: 1fr; } }

/* phones: compact ammo counter top-right under the pause button (the bottom-right is all touch buttons) */
body.touch .hud-ammo { top: calc(62px + env(safe-area-inset-top)); bottom: auto; right: calc(10px + env(safe-area-inset-right)); min-width: 0; padding: 6px 12px 7px; pointer-events: none; }
body.touch .hud-ammo .ha-name { font-size: 10.5px; max-width: 150px; }
body.touch .hud-ammo .ha-count { margin: 1px 0 5px; }
body.touch .hud-ammo .ha-count b { font-size: 30px; }
body.touch .hud-ammo .ha-count span { font-size: 15px; }
body.touch .hud-ammo .ha-key { display: none; }

/* frameless 3D item pictures + live spinning hero view */
.sk-hero { display: flex; align-items: center; gap: 14px; margin: 6px 0 12px; padding: 10px 14px; border-radius: 16px;
  background: radial-gradient(120% 140% at 15% 50%, color-mix(in srgb, var(--rc) 22%, transparent), transparent 60%), rgba(10, 8, 30, .55);
  border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent); }
.sk-hero canvas { width: 190px; height: 190px; flex: none; cursor: grab; }
.sk-hero canvas:active { cursor: grabbing; }
.sk-hero > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sk-hero b { font-size: 20px; }
.sk-hero .sk-rar { color: var(--rc); font-weight: 700; letter-spacing: .04em; }
.sk-view { padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; width: 100%; }
.sk-view:focus-visible { outline: 2px solid var(--rc, var(--neon-a)); outline-offset: 2px; border-radius: 12px; }
.sk-card.viewing { box-shadow: 0 0 0 2px var(--rc), 0 0 18px color-mix(in srgb, var(--rc) 45%, transparent); }
@media (max-width: 640px), (max-height: 520px) { .sk-hero canvas { width: 130px; height: 130px; } .sk-hero b { font-size: 16px; } }

/* title: full-width mode buttons (solo / multiplayer / practice) + practice level picker */
.title-play small { font-size: 13px; font-weight: 600; opacity: .75; margin-left: 4px; }
.mode-grid.one { grid-template-columns: minmax(0, 1fr); }
/* title: gacha and shop as two bright tiles under the modes */
.title-shop { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 460px; margin-top: 10px; }
.shop-tile { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--c) 70%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 32%, transparent), color-mix(in srgb, var(--c) 8%, transparent) 70%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, .12); transition: transform .15s, box-shadow .15s; }
.shop-tile:hover, .shop-tile:focus-visible { transform: translateY(-2px); box-shadow: 0 0 28px color-mix(in srgb, var(--c) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18); outline: none; }
.shop-tile:active { transform: translateY(0) scale(.98); }
.shop-tile .st-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--c); background: color-mix(in srgb, var(--c) 22%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.shop-tile .st-ic .i { width: 22px; height: 22px; }
.shop-tile b { display: block; font-size: 16px; font-weight: 800; }
.shop-tile small { display: block; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-tile.gacha::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%); transform: translateX(-100%); animation: tile-shine 3.2s ease-in-out infinite; }
@keyframes tile-shine { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .shop-tile.gacha::after { animation: none; } }
.tr-list { display: flex; flex-direction: column; gap: 8px; }
.tr-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border-radius: 14px; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: rgba(140, 120, 255, .06); border: 1px solid rgba(150, 130, 255, .22); transition: border-color .15s, background .15s; }
.tr-row:hover:not(:disabled), .tr-row:focus-visible { border-color: rgba(76, 242, 255, .6); background: rgba(76, 242, 255, .07); outline: none; }
.tr-row:disabled { opacity: .5; cursor: not-allowed; }
.tr-row.done { border-color: rgba(74, 222, 128, .35); }
.tr-num { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font: 800 18px var(--head); color: #a78bfa; background: rgba(167, 139, 250, .14); }
.tr-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-txt > span { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-st { flex: none; color: var(--muted); }
.tr-st .i { width: 18px; height: 18px; }
.tr-stars { color: var(--gold); letter-spacing: .1em; }
.tr-go { color: var(--neon-a); font-weight: 700; }

/* ------------------------------------------------------------ Token League: Team War */
.tw-strip { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 460px; margin-top: 10px; padding: 9px 12px; border-radius: 14px; font: inherit; color: var(--text); cursor: pointer; text-align: left;
  border: 1.5px solid transparent; background: linear-gradient(rgba(20, 8, 30, .82), rgba(20, 8, 30, .82)) padding-box, linear-gradient(110deg, #ffc83d, #ff3d6e, #4cf2ff) border-box; backdrop-filter: blur(10px); }
.tw-strip:hover, .tw-strip:focus-visible { box-shadow: 0 0 22px rgba(255, 200, 61, .35); outline: none; }
.tw-strip.pick { animation: twPulse 1.8s ease-in-out infinite; }
.tw-s-tag { font: 800 11px var(--head); letter-spacing: .08em; color: #ffd23f; white-space: nowrap; }
.tw-s-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tw-s-go { margin-left: auto; color: #ffd23f; }
.tw-s-go .i { width: 16px; height: 16px; }
@keyframes twPulse { 50% { box-shadow: 0 0 24px rgba(255, 61, 110, .5); } }
.tw-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; background: var(--tc, #333); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc, #fff) 60%, transparent); }
.tw-logo.xs { width: 18px; height: 18px; box-shadow: none; }
.tw-logo.sm { width: 22px; height: 22px; }
.tw-logo.md { width: 40px; height: 40px; }
.tw-logo.lg { width: 56px; height: 56px; }
.tw-tier { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent); }
.tw-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.tw-week { font: 800 15px var(--head); letter-spacing: .03em; }
.tw-ends, .tw-next { font-size: 12.5px; color: var(--muted); }
.tw-ends b, .tw-next b { color: #ffd23f; font-variant-numeric: tabular-nums; }
.tw-next { margin-left: auto; }
.tw-banner { text-align: center; height: 0; opacity: 0; overflow: hidden; }
.tw-banner.on { animation: twBanner 2.6s ease forwards; height: auto; padding: 8px 12px; margin-bottom: 8px; border-radius: 12px; font: 800 16px var(--head); color: #fff;
  background: linear-gradient(90deg, rgba(255, 61, 110, 0), rgba(255, 61, 110, .55), rgba(255, 200, 61, .55), rgba(255, 200, 61, 0)); text-shadow: 0 0 12px rgba(255, 200, 61, .9); }
@keyframes twBanner { 0% { opacity: 0; transform: scale(.7); } 12% { opacity: 1; transform: scale(1.08); } 20% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.tw-me { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; border: 1px solid color-mix(in srgb, var(--tc, #888) 45%, transparent);
  background: radial-gradient(120% 160% at 0% 50%, color-mix(in srgb, var(--tc, #888) 18%, transparent), transparent 60%), rgba(10, 8, 30, .5); }
.tw-me-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tw-me-team { font-size: 17px; }
.tw-me-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.tw-pick-cta { justify-content: space-between; --tc: #ff3d6e; }
.tw-ok { color: var(--green); font-weight: 600; }
.tw-prog { position: relative; height: 18px; border-radius: 9px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.tw-prog i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--tc), #ffd23f); opacity: .55; transition: width .8s; }
.tw-prog span { position: relative; font-size: 11.5px; padding: 0 8px; line-height: 18px; }
.tw-champ { font-weight: 800; color: #ffd23f; text-shadow: 0 0 10px rgba(255, 210, 63, .6); white-space: nowrap; }
.tw-wear { font-size: 12px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.tw-wear.gold { color: #1a1400; background: linear-gradient(90deg, #ffe58a, #ffc83d); }
.tw-wear.silver { color: #111; background: linear-gradient(90deg, #f4f7fb, #c9d3de); }
.tw-wear.bronze { color: #1f0f02; background: linear-gradient(90deg, #f0b27a, #c97b3a); }
.tw-board { display: flex; flex-direction: column; gap: 6px; }
.tw-row { display: grid; grid-template-columns: 30px 34px minmax(70px, 150px) 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .06); transition: transform .6s cubic-bezier(.2, .9, .3, 1.2), background .3s; }
.tw-row.mine { border-color: color-mix(in srgb, var(--tc) 70%, transparent); background: color-mix(in srgb, var(--tc) 10%, rgba(255, 255, 255, .03)); }
.tw-row.first { background: linear-gradient(90deg, rgba(255, 200, 61, .16), rgba(255, 255, 255, .03)); border-color: rgba(255, 200, 61, .45); }
.tw-row.up { animation: twUp 1.4s ease; }
@keyframes twUp { 20% { box-shadow: 0 0 26px 2px rgba(61, 220, 151, .7); background: rgba(61, 220, 151, .18); } }
.tw-rank { font: 800 15px var(--head); text-align: center; color: var(--muted); }
.tw-crown { display: inline-block; font-size: 20px; animation: twCrown 1.6s ease-in-out infinite; }
@keyframes twCrown { 50% { transform: translateY(-4px) rotate(-8deg); } }
.tw-name { display: flex; flex-direction: column; min-width: 0; }
.tw-name small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-bar { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.tw-bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 55%, #000), var(--tc)); box-shadow: 0 0 12px color-mix(in srgb, var(--tc) 60%, transparent); transition: width .9s cubic-bezier(.2, .9, .3, 1); }
.tw-score { display: flex; flex-direction: column; align-items: flex-end; min-width: 86px; }
.tw-num { font: 800 16px var(--head); font-variant-numeric: tabular-nums; }
.tw-score small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tw-close { color: #ff6b6b; font-weight: 800; animation: twBlink .9s steps(2) infinite; }
@keyframes twBlink { 50% { opacity: .35; } }
.tw-feed { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto; }
.tw-feed-i { font-size: 12.5px; padding: 4px 8px; border-radius: 8px; background: rgba(255, 255, 255, .03); animation: twFeed .5s ease; }
@keyframes twFeed { from { opacity: 0; transform: translateX(-12px); } }
.tw-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tc); margin-right: 4px; box-shadow: 0 0 6px var(--tc); }
.tw-plus { color: var(--green); float: right; }
.tw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.tw-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--tc) 18%, transparent), transparent 60%), rgba(10, 8, 30, .6); border: 1px solid color-mix(in srgb, var(--tc) 35%, transparent); transition: transform .15s, box-shadow .15s; }
.tw-card:hover, .tw-card:focus-visible { transform: translateY(-2px); box-shadow: 0 0 20px color-mix(in srgb, var(--tc) 45%, transparent); outline: none; }
.tw-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tw-card-top > div { display: flex; flex-direction: column; min-width: 0; }
.tw-card-top small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-card-price { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; font-size: 13px; }
.tw-spark { width: 100%; height: 28px; }
.tw-card-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.tw-card-meta .i { width: 12px; height: 12px; }
.tw-confirm { display: flex; align-items: center; gap: 12px; }
.tw-buy { display: inline-block; margin-top: 4px; font-size: 13px; color: var(--neon-a); }
.hud-drone { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; background: rgba(10, 14, 24, .55); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(8px); }
.hud-drone.hidden { display: none; }
.hud-drone small { color: var(--muted); }
.tw-podiums { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 10px 0 14px; }
.tw-podium { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px 0; border-radius: 14px 14px 0 0; min-width: 96px; background: linear-gradient(color-mix(in srgb, var(--pc) 28%, transparent), transparent); border-top: 3px solid var(--pc); }
.tw-podium.p1 { order: 2; padding-bottom: 34px; }
.tw-podium.p2 { order: 1; padding-bottom: 18px; }
.tw-podium.p3 { order: 3; padding-bottom: 8px; }
.tw-podium i { font: 900 22px var(--head); font-style: normal; color: var(--pc); }
.tw-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tw-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: twFall 2.6s linear forwards; }
@keyframes twFall { to { transform: translateY(520px) rotate(720deg); opacity: 0; } }
@media (max-width: 640px) {
  .tw-row { grid-template-columns: 24px 28px minmax(56px, 1fr) 64px auto; gap: 6px; }
  .tw-row .tw-logo { width: 28px; height: 28px; }
  .tw-next { margin-left: 0; }
  .tw-me { flex-wrap: wrap; }
  .tw-me-side { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .tw-row, .tw-bar i { transition: none; } .tw-crown, .tw-close, .tw-strip.pick, .tw-confetti i { animation: none; } }
.tw-strip b { white-space: nowrap; }
ul.rules li { padding: 7px 0 7px 22px; }
ul.rules li::before { content: '•'; width: 14px; height: auto; top: 6px; background: none; color: var(--neon-a); font-size: 16px; }

/* ------------------------------------------------------------ survival race */
body.race #touch, body.race .hud-quick, body.race .hud-ammo, body.race .hud-abil, body.race .hud-drone { display: none !important; }
.rc-tbl tr.rc-me td { background: rgba(255, 210, 63, .1); }
.rc-mine { margin-top: 8px; font-size: 13px; }
.rc-prizes { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.rc-prize { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: rgba(255, 210, 63, .1); border: 1px solid rgba(255, 210, 63, .35); color: var(--text-2); }
.rc-prize b { color: var(--gold); }
.rc-shop-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; font-size: 13.5px; }
.rc-shop-top b { color: #ffd23f; font-variant-numeric: tabular-nums; }
.rc-buffs { display: flex; flex-direction: column; gap: 8px; }
.rc-buff { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); }
.rc-buff-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #ffd23f; background: rgba(255, 210, 63, .12); flex: none; }
.rc-buff-ic .i { width: 20px; height: 20px; }
.rc-buff-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-buff-txt span { font-size: 12px; }
.rc-buff-buy { display: flex; gap: 6px; flex: none; }
.rc-sum { margin-top: 10px; font-size: 12.5px; }
body.race #h-status .meter:has(#h-sh), body.race #h-status .meter:has(#h-en), body.race #h-ar-row { display: none; }

/* race: on-screen lane / jump buttons on phones (frosted like the other touch buttons) */
#race-pad { display: none; position: fixed; inset: auto 0 0 0; z-index: 22; pointer-events: none; }
body.touch.race.playing #race-pad { display: block; }
.tbtn.rc-btn { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); width: 76px; height: 76px; touch-action: none; }
.tbtn.rc-btn .i { width: 34px; height: 34px; }
.tbtn.rc-btn[data-rc="left"] { left: calc(18px + env(safe-area-inset-left)); }
.tbtn.rc-btn[data-rc="right"] { left: calc(108px + env(safe-area-inset-left)); }
.tbtn.rc-jump { right: calc(20px + env(safe-area-inset-right)); width: 96px; height: 96px; border-color: rgba(255, 214, 80, .95); color: #ffe9a8; }
.tbtn.rc-jump .lb { position: absolute; bottom: 9px; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.tbtn.rc-jump .i { margin-top: -10px; }
@media (max-height: 420px) { .tbtn.rc-btn { width: 64px; height: 64px; } .tbtn.rc-btn[data-rc="right"] { left: calc(92px + env(safe-area-inset-left)); } .tbtn.rc-jump { width: 82px; height: 82px; } }

/* race control layouts: split (◀ left, ▶ right, jump above ▶) · pad (◀ ▶ left, jump right) · swipe (no buttons) */
body.rc-ctl-swipe #race-pad { display: none !important; }
body.rc-ctl-split .tbtn.rc-btn[data-rc="right"] { left: auto; right: calc(18px + env(safe-area-inset-right)); }
body.rc-ctl-split .tbtn.rc-jump { right: calc(18px + env(safe-area-inset-right)); bottom: calc(112px + env(safe-area-inset-bottom)); width: 84px; height: 84px; }
@media (max-height: 420px) {
  body.rc-ctl-split .tbtn.rc-btn[data-rc="right"] { left: auto; }
  body.rc-ctl-split .tbtn.rc-jump { bottom: calc(96px + env(safe-area-inset-bottom)); width: 72px; height: 72px; }
}
.rc-layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rc-layout { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border-radius: 12px; font: inherit; color: var(--text); cursor: pointer; text-align: center;
  background: rgba(255, 255, 255, .04); border: 1.5px solid rgba(255, 255, 255, .1); }
.rc-layout.on { border-color: #ffd23f; background: rgba(255, 210, 63, .1); box-shadow: 0 0 14px rgba(255, 210, 63, .25); }
.rc-layout b { font-size: 13px; }
.rc-layout span { font-size: 11px; color: var(--muted); }
.rc-prev { display: block; flex: none; position: relative; width: 84px; height: 42px; border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .35); background: rgba(10, 10, 30, .6); }
.rc-prev i { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .85); bottom: 4px; }
.rc-prev i.j { width: 14px; height: 14px; background: #ffd23f; }
.rc-prev.pad .l { left: 5px; } .rc-prev.pad .r { left: 21px; } .rc-prev.pad .j { right: 5px; }
.rc-prev.split .l { left: 5px; } .rc-prev.split .r { right: 5px; } .rc-prev.split .j { right: 4px; bottom: 19px; }
.rc-prev.swipe i { display: none; }
.rc-prev.swipe::after { content: "👆 ปัด"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
@media (max-width: 520px) { .rc-layouts { grid-template-columns: minmax(0, 1fr); } .rc-layout { flex-direction: row; text-align: left; } }

/* online race rooms */
.rr-code-row { display: flex; gap: 8px; margin: 12px 0 4px; }
.rr-code-row .inp { max-width: 180px; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }
.rr-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.rr-room { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; font: inherit; color: var(--text); cursor: pointer; text-align: left;
  background: rgba(255, 255, 255, .04); border: 1.5px solid rgba(255, 255, 255, .1); }
.rr-room:hover { border-color: #4cf2ff; }
.rr-room b { font-size: 18px; letter-spacing: .15em; color: #4cf2ff; }
.rr-room span { font-size: 12px; color: var(--muted); }
.rr-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rr-bigcode { font-size: 40px; font-weight: 900; letter-spacing: .25em; color: var(--gold); line-height: 1.1; user-select: all; }
.rr-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin: 12px 0; }
.rr-player { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-player.me { background: rgba(255, 210, 63, .12); border: 1px solid rgba(255, 210, 63, .4); }
#rr-live { position: fixed; z-index: 30; right: calc(10px + env(safe-area-inset-right)); top: calc(78px + env(safe-area-inset-top)); width: 150px; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
#rr-live > div { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; padding: 3px 8px; border-radius: 8px; background: rgba(8, 6, 24, .55); backdrop-filter: blur(4px); }
#rr-live > div span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rr-live > div.me { background: rgba(255, 210, 63, .28); font-weight: 700; }
#rr-live > div.out { opacity: .45; }
@media (max-height: 420px) { #rr-live { top: calc(56px + env(safe-area-inset-top)); width: 130px; font-size: 11px; } }

/* race intro: online / solo mode cards (online stands out) */
.rc-modes { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; margin-bottom: 14px; }
.rc-mode { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: 16px; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: rgba(255, 255, 255, .04); border: 1.5px solid rgba(255, 255, 255, .12); transition: transform .12s, box-shadow .2s; }
.rc-mode:hover, .rc-mode:focus-visible { transform: translateY(-2px); outline: none; }
.rc-mode:active { transform: scale(.98); }
.rc-mode b { font-size: 18px; }
.rc-mode > span:not(.rc-live) { font-size: 13px; color: var(--text-2); }
.rc-mode em { margin-top: auto; padding-top: 6px; font-style: normal; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.rc-mode em svg { width: 14px; height: 14px; }
.rc-online { padding: 18px 18px 16px; border: 2px solid transparent;
  background: linear-gradient(135deg, rgba(76, 242, 255, .2), rgba(255, 61, 240, .18)) padding-box, linear-gradient(#150f36, #150f36) padding-box,
    linear-gradient(120deg, #4cf2ff, #ff3df0, #ffd23f, #4cf2ff) border-box;
  background-size: 100% 100%, 100% 100%, 300% 300%; animation: rcBorder 4s linear infinite, rcGlow 2.2s ease-in-out infinite; }
.rc-online b { font-size: 22px; background: linear-gradient(90deg, #fff, #9ff3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rc-online em { color: #ffd23f; font-size: 14px; }
.rc-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: #3ddc97; padding: 2px 8px; border-radius: 999px; background: rgba(61, 220, 151, .12); border: 1px solid rgba(61, 220, 151, .4); }
.rc-live i { width: 7px; height: 7px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 8px #3ddc97; animation: rcBlink 1.2s ease-in-out infinite; }
@keyframes rcBorder { to { background-position: 0 0, 0 0, 300% 0; } }
@keyframes rcGlow { 0%, 100% { box-shadow: 0 0 14px rgba(76, 242, 255, .25); } 50% { box-shadow: 0 0 28px rgba(255, 61, 240, .45); } }
@keyframes rcBlink { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rc-online, .rc-live i { animation: none; } }
@media (max-width: 560px) { .rc-modes { grid-template-columns: minmax(0, 1fr); } }

/* online race prizes (as the admin set them now) */
.rr-prizes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 210, 63, .14), rgba(255, 210, 63, .04)); border: 1px solid rgba(255, 210, 63, .4); }
.rr-prizes-t { font-size: 13px; font-weight: 700; color: var(--text-2); margin-right: 4px; }
.rr-prize { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .25); }
.rr-prize i { font-style: normal; font-size: 16px; align-self: center; }
.rr-prize b { font-size: 18px; color: var(--gold); font-variant-numeric: tabular-nums; }
.rr-prize small { font-size: 11px; color: var(--muted); }
.rr-prizes.none { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); }
.rr-prizes.small { margin: 6px 0 0; padding: 6px 8px; gap: 6px; }
.rr-prizes.small .rr-prizes-t { display: none; }
.rr-prizes.small.none .rr-prizes-t { display: inline; font-size: 12px; font-weight: 500; }
.rr-prizes.small .rr-prize b { font-size: 15px; }
#rr-live { width: 176px; }
#rr-live > div.rr-live-prize { display: block; text-align: center; font-weight: 700; color: var(--gold); background: rgba(40, 28, 0, .65); border: 1px solid rgba(255, 210, 63, .45); white-space: nowrap; }
#rr-live em { font-style: normal; font-size: 10px; font-weight: 700; color: #1a1200; background: var(--gold); border-radius: 6px; padding: 0 4px; margin-left: 2px; }
@media (max-height: 420px) { #rr-live { width: 160px; } }
