/* ==========================================================================
   Idle Breakout — UI stylesheet
   The whole game is one self-contained, centred frame. Nothing lives outside
   it: the shop, settings and dialogs are all overlays drawn inside the frame.
   ========================================================================== */

:root {
  --bg-0: #070a14;
  --bg-1: #0b1020;
  --bg-2: #111834;
  --bg-3: #17203f;
  --line: rgba(148, 172, 255, 0.16);
  --line-soft: rgba(148, 172, 255, 0.09);

  --txt: #e8ecff;
  --txt-dim: #98a3c9;
  --txt-faint: #6b769b;

  --gold: #ffc542;
  --accent: #5aa9ff;
  --accent-2: #a78bfa;
  --good: #34d399;
  --bad: #fb7185;

  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 16px;

  --bar-h: 60px;
  --sub-h: 30px;
  --pad: 11px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

/* Components below set an explicit `display`, which would otherwise beat the
   user-agent's [hidden] rule and leave them stuck on screen. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg-0);
  color: var(--txt);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: grid;
  place-items: center;
}

button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1, h2, h3, h4, p { margin: 0; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 620px at 20% -12%, rgba(90, 169, 255, 0.15), transparent 60%),
    radial-gradient(760px 540px at 85% 6%, rgba(167, 139, 250, 0.13), transparent 62%),
    radial-gradient(700px 700px at 50% 118%, rgba(255, 159, 28, 0.07), transparent 60%);
  pointer-events: none;
}

/* ==========================================================================
   Boot screen
   ========================================================================== */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg-0);
  transition: opacity 0.4s ease;
}
.boot.hide { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; }
.boot h1 {
  font-size: 24px;
  letter-spacing: 0.22em;
  font-weight: 800;
  margin: 20px 0 6px;
  background: linear-gradient(92deg, var(--accent), var(--accent-2) 55%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.boot p { color: var(--txt-faint); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.boot-logo { position: relative; width: 140px; height: 74px; margin: 0 auto; }
.bl-brick { position: absolute; top: 6px; width: 38px; height: 15px; border-radius: 4px; animation: blPulse 1.6s ease-in-out infinite; }
.bl-brick.b1 { left: 2px;  background: #38bdf8; }
.bl-brick.b2 { left: 50px; background: #a78bfa; animation-delay: 0.18s; }
.bl-brick.b3 { left: 98px; background: #f472b6; animation-delay: 0.36s; }
.bl-ball {
  position: absolute; left: 66px; bottom: 4px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 18px rgba(255, 197, 66, 0.7);
  animation: blBounce 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite alternate;
}
@keyframes blPulse { 0%, 100% { opacity: 0.35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes blBounce { to { transform: translateY(-38px); } }

/* ==========================================================================
   The frame
   Width is capped by three things at once: a hard maximum, the viewport
   width, and the height left over once the two bars are accounted for — so
   the entire game always fits on screen without scrolling.
   ========================================================================== */
.game {
  position: relative;
  width: min(1040px, 100vw - 12px, (100vh - 26px - var(--bar-h) - var(--sub-h) - var(--pad) * 2) * 1.5 + var(--pad) * 2);
  max-height: calc(100vh - 12px);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19, 27, 56, 0.96), rgba(9, 13, 28, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.gbar {
  flex: 0 0 auto;
  min-height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- quick-buy chips --- */
.buy-strip { display: flex; gap: 4px; flex: 0 1 auto; min-width: 0; }
.bchip {
  width: 50px;
  padding: 4px 2px 3px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}
.bchip:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.bchip:active:not(:disabled) { transform: scale(0.94); }
.bchip .orb {
  width: 19px; height: 19px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,0.5), transparent 52%), var(--c);
  box-shadow: 0 0 9px -1px var(--c);
}
.bchip .price {
  font-size: 9.5px; font-weight: 800; color: var(--gold);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.bchip .own {
  position: absolute; top: 2px; right: 4px;
  font-size: 8.5px; font-weight: 800; color: var(--txt-faint);
}
.bchip { position: relative; }
.bchip.afford { border-color: rgba(255, 197, 66, 0.4); background: rgba(255, 197, 66, 0.08); }
.bchip:disabled { cursor: not-allowed; }
.bchip.locked .orb { background: #2a3452; box-shadow: none; }
.bchip.locked .price { color: var(--txt-faint); }
.bchip.full .price { color: var(--good); }

/* --- centre cluster --- */
.gbar-mid { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.readout {
  text-align: center; padding: 0 4px; line-height: 1.15;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.readout b { display: block; font-size: 14px; }
.readout span { font-size: 8.5px; letter-spacing: 0.1em; color: var(--txt-faint); }
.levelbox {
  text-align: center; padding: 3px 11px; line-height: 1.1;
  border-radius: var(--r-sm);
  background: rgba(90, 169, 255, 0.12);
  border: 1px solid rgba(90, 169, 255, 0.28);
  white-space: nowrap;
}
.levelbox span { display: block; font-size: 8px; letter-spacing: 0.16em; color: var(--txt-faint); }
.levelbox b { font-size: 16px; font-variant-numeric: tabular-nums; }

.gbtn {
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: var(--txt);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  transition: filter 0.14s, background 0.14s, transform 0.1s;
}
.gbtn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.gbtn:active:not(:disabled) { transform: scale(0.96); }
.gbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.gbtn.wide { width: 100%; }
.gbtn-main {
  background: linear-gradient(180deg, rgba(90, 169, 255, 0.32), rgba(90, 169, 255, 0.14));
  border-color: rgba(90, 169, 255, 0.45);
  color: #dbeeff;
}
.gbtn-main.pulse { box-shadow: 0 0 0 0 rgba(255, 197, 66, 0.55); animation: pulseRing 1.9s ease-out infinite; }
@keyframes pulseRing {
  70% { box-shadow: 0 0 0 9px rgba(255, 197, 66, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 197, 66, 0); }
}
.gbtn.ok { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.4); color: #b8f3dd; }
.gbtn.danger { background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.4); color: #ffc2cb; }

/* --- wallet + icons --- */
.gbar-right { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.wallet { text-align: right; line-height: 1.2; }
.wallet-row { display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.wallet-row b { font-size: 16px; color: var(--gold); font-variant-numeric: tabular-nums; }
.wallet-row .w-cur { font-size: 12px; color: var(--gold); opacity: 0.75; }
.wallet-row em { font-style: normal; font-size: 9px; color: var(--txt-faint); }
.wallet-row.w-alt b { font-size: 11px; color: var(--accent-2); }
.wallet-row.w-alt .w-cur { font-size: 9px; color: var(--accent-2); }
.wallet.bump b { animation: bump 0.28s ease; }
@keyframes bump { 50% { transform: scale(1.14); } }

.gbar-icons { display: flex; gap: 4px; }
.ibtn, .qbtn {
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  transition: background 0.14s, transform 0.1s;
}
.ibtn { width: 30px; font-size: 13px; }
.qbtn { padding: 0 8px; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; color: var(--txt-dim); }
.ibtn:hover, .qbtn:hover { background: rgba(255, 255, 255, 0.11); }
.ibtn:active, .qbtn:active { transform: scale(0.92); }
.ibtn.off { opacity: 0.4; }

/* ==========================================================================
   Level strip
   ========================================================================== */
.subbar {
  flex: 0 0 auto;
  min-height: var(--sub-h);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 2px;
}
.level-nav { display: flex; gap: 3px; }
.nav-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  color: var(--txt-dim);
  font-size: 16px; line-height: 1;
  transition: background 0.14s, color 0.14s;
}
.nav-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); color: #fff; }
.nav-btn:disabled { opacity: 0.25; cursor: default; }

.level-progress { flex: 1 1 auto; min-width: 40px; }
.lp-bar {
  height: 7px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.lp-fill {
  height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px rgba(90, 169, 255, 0.5);
  transition: width 0.2s ease-out;
}
.lp-text, .lp-eta {
  font-size: 10px; color: var(--txt-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip {
  padding: 5px 10px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--txt-faint);
  transition: all 0.16s;
}
.chip.chip-on {
  color: #06121f;
  background: linear-gradient(180deg, #7cc4ff, var(--accent));
  border-color: transparent;
}

/* ==========================================================================
   Playfield
   ========================================================================== */
.playfield {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #060911;
}
/* The board holds the canvas and its effect layers, so floating text always
   lines up with the canvas even when the playfield is taller than the board. */
.board {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 3 / 2;
}
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

/* Leftover space below the board (portrait phones). Collapsed on desktop,
   where the frame is sized so the board fills the playfield exactly. */
.pit { display: none; }
.pit-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
}
.pit-cell {
  padding: 7px 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  text-align: center;
}
.pit-cell u {
  display: block; text-decoration: none;
  font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--txt-faint);
}
.pit-cell b { font-size: 13px; font-variant-numeric: tabular-nums; }
.pit-hint {
  text-align: center;
  font-size: 10.5px;
  color: var(--txt-faint);
  padding: 0 10px;
}
.pit-hint b { color: var(--accent); }

.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fx-float {
  position: absolute;
  font-size: 12px; font-weight: 800;
  color: var(--gold);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  animation: floatUp 1.05s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  white-space: nowrap;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  18%  { opacity: 1; transform: translate(-50%, -8px) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(0.94); }
}

.level-banner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.level-banner span {
  font-size: clamp(19px, 4vw, 38px);
  font-weight: 900; letter-spacing: 0.16em;
  background: linear-gradient(92deg, var(--accent), var(--accent-2) 50%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 26px rgba(90, 169, 255, 0.45));
  animation: bannerPop 1.35s ease forwards;
}
@keyframes bannerPop {
  0%   { opacity: 0; transform: scale(0.75); }
  16%  { opacity: 1; transform: scale(1.05); }
  70%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04) translateY(-14px); }
}

/* ==========================================================================
   Overlays (upgrades / settings) — they cover the playfield, never the bars
   ========================================================================== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(10, 15, 32, 0.985), rgba(7, 10, 22, 0.99));
  /* The canvas underneath repaints every frame and gets its own compositor
     layer; without forcing this panel onto a layer of its own the playfield
     bleeds straight through an otherwise opaque background. A backdrop-filter
     here makes it worse, which is why there isn't one. */
  transform: translateZ(0);
  animation: ovIn 0.16s ease-out;
}
/* Opacity only — animating `transform` here would fight the translateZ(0)
   that keeps the panel on its own compositor layer, and the first frame can
   flash the playfield through. */
@keyframes ovIn { from { opacity: 0; } }
.overlay-dim { background: rgba(4, 7, 16, 0.72); display: grid; place-items: center; z-index: 30; }

.ov-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
}
.ov-head h2 {
  font-size: 12px; font-weight: 800; letter-spacing: 0.18em;
  color: var(--txt-dim);
}
.ov-tabs {
  display: flex;
  gap: 3px;
  margin-left: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ov-tabs::-webkit-scrollbar { display: none; }
.ov-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 6px 9px;
  font-size: 11px; font-weight: 700;
  border-radius: var(--r-sm);
  color: var(--txt-faint);
  transition: color 0.14s, background 0.14s;
}
.ov-tab:hover { color: var(--txt-dim); background: rgba(255, 255, 255, 0.05); }
.ov-tab-on, .ov-tab-on:hover {
  color: var(--txt);
  background: rgba(90, 169, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(90, 169, 255, 0.3);
}
.dot {
  position: absolute; top: 3px; right: 4px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 7px var(--gold);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot { 50% { opacity: 0.3; } }

.buy-modes { display: flex; gap: 3px; margin-left: auto; }
.buy-mode {
  padding: 5px 8px;
  font-size: 10px; font-weight: 800;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  color: var(--txt-faint);
  transition: all 0.14s;
}
.buy-mode:hover { background: rgba(255, 255, 255, 0.1); color: var(--txt); }
.buy-mode.buy-active {
  background: rgba(90, 169, 255, 0.2);
  border-color: rgba(90, 169, 255, 0.45);
  color: #cfe6ff;
}
.ov-close {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: 12px;
  color: var(--txt-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
}
.ov-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.ov-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 172, 255, 0.25) transparent;
  -webkit-overflow-scrolling: touch;
}
.ov-body::-webkit-scrollbar { width: 7px; }
.ov-body::-webkit-scrollbar-thumb { background: rgba(148, 172, 255, 0.22); border-radius: 99px; }

.ov-foot {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}
.ov-foot-split { display: flex; align-items: center; gap: 10px; }
.ov-foot-split .gbtn { flex: 1 1 auto; }
.saved-note, .version { font-size: 9.5px; color: var(--txt-faint); white-space: nowrap; }

.ov-page { display: none; }
.ov-page-on { display: block; }

/* ==========================================================================
   Upgrades page — one column per owned ball, as in the original
   ========================================================================== */
.ball-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  align-items: start;
  justify-content: center;
}

.ball-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 8px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-top: 2px solid var(--c);
}
.bc-head { text-align: center; line-height: 1.2; margin-bottom: 2px; }
.bc-count { display: block; font-size: 10px; color: var(--txt-faint); font-weight: 700; }
.bc-name {
  display: block;
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--txt);
}
.bc-orb {
  display: block;
  width: 20px; height: 20px;
  margin: 5px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,0.5), transparent 52%), var(--c);
  box-shadow: 0 0 10px -1px var(--c);
}

/* An upgrade button: label, "a >> b", then the price on its own line —
   the same shape the original uses. */
.ubtn {
  display: block;
  width: 100%;
  padding: 5px 6px 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  text-align: center;
  overflow: hidden;
  transition: background 0.13s, border-color 0.13s;
}
.ubtn:hover:not(:disabled) { background: rgba(90, 169, 255, 0.15); border-color: rgba(90, 169, 255, 0.32); }
.ubtn:active:not(:disabled) { transform: scale(0.97); }
.ubtn:disabled { opacity: 0.42; cursor: not-allowed; }
.ubtn u {
  display: block; text-decoration: none;
  font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--txt-faint);
}
.ubtn b {
  display: block;
  font-size: 11px; font-weight: 700; color: var(--txt);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The ">>" separator sits inside <b>; reset it so it does not inherit the
   price bar styling from .ubtn i below. */
.ubtn b i {
  display: inline;
  margin: 0;
  padding: 0 5px;
  background: none;
  font-style: normal;
  font-size: inherit;
  font-weight: 700;
  color: var(--txt-faint);
}
.ubtn > i {
  display: block;
  margin: 3px -6px 0;
  padding: 2px 0;
  font-style: normal;
  font-size: 10.5px; font-weight: 800;
  color: #0d2417;
  background: rgba(52, 211, 153, 0.55);
  font-variant-numeric: tabular-nums;
}
.ubtn.afford > i { background: var(--good); }
.ubtn:disabled > i { background: rgba(148, 172, 255, 0.18); color: var(--txt-faint); }

.global-row { margin: 12px auto 0; max-width: 180px; }
.panel-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 10.5px;
  color: var(--txt-faint);
}

/* ==========================================================================
   Power ups
   ========================================================================== */
.pu-counter {
  margin: 4px auto 6px;
  padding: 10px 18px;
  width: max-content;
  text-align: center;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.pu-counter b { display: block; font-size: 14px; font-weight: 800; letter-spacing: 0.06em; }
.pu-counter span { font-size: 11px; color: var(--txt-dim); letter-spacing: 0.06em; }
.pu-next {
  text-align: center;
  font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--txt-faint);
  margin-bottom: 12px;
}

.pu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}
.pu-card {
  padding: 9px 7px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  text-align: center;
  transition: background 0.14s, border-color 0.14s, opacity 0.14s;
}
.pu-card:hover:not(:disabled) { background: rgba(255, 197, 66, 0.12); border-color: rgba(255, 197, 66, 0.4); }
.pu-card:disabled { opacity: 0.42; cursor: not-allowed; }
.pu-card u {
  display: block; text-decoration: none;
  font-size: 10px; font-weight: 800; letter-spacing: 0.07em;
  color: var(--txt);
}
.pu-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  margin: 7px auto;
  border-radius: 50%;
  font-size: 16px;
  background: rgba(255, 197, 66, 0.14);
  border: 1px solid rgba(255, 197, 66, 0.3);
  color: var(--gold);
}
.pu-card em {
  display: block;
  font-style: normal;
  font-size: 9.5px; line-height: 1.35;
  color: var(--txt-faint);
  min-height: 26px;
}
.pu-dur {
  display: block;
  margin-top: 6px;
  font-size: 9px; letter-spacing: 0.05em;
  color: var(--txt-faint);
}
.pu-card.active {
  opacity: 1;
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.12);
}
.pu-card.active .pu-dur { color: var(--good); font-weight: 800; }

/* ==========================================================================
   Lab / prestige rows, stats, achievements
   ========================================================================== */
.row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
}
.row-ico {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-size: 14px;
  border-radius: 8px;
  background: rgba(90, 169, 255, 0.13);
  border: 1px solid rgba(90, 169, 255, 0.18);
}
.row-main { flex: 1 1 auto; min-width: 0; }
.row-main h4 { font-size: 11.5px; font-weight: 700; }
.row-main p { font-size: 9.5px; color: var(--txt-faint); }
.row-main .lvl { color: var(--accent); font-weight: 700; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 2px 8px;
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--txt-faint); font-weight: 800;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.hero-box {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(167, 139, 250, 0.16), rgba(90, 169, 255, 0.06));
  border: 1px solid rgba(167, 139, 250, 0.26);
  text-align: center;
}
.hero-box .big {
  font-size: 26px; font-weight: 900; color: var(--accent-2); line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(167, 139, 250, 0.5);
}
.hero-box .sub { font-size: 10px; color: var(--txt-dim); margin-top: 2px; }
.hero-box .note { font-size: 10px; color: var(--txt-faint); margin-top: 7px; line-height: 1.45; }
.hero-box .gbtn { margin-top: 9px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; margin-bottom: 10px; }
.stat-cell {
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
}
.stat-cell u {
  display: block; text-decoration: none;
  font-size: 8.5px; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--txt-faint);
}
.stat-cell b { font-size: 13px; font-variant-numeric: tabular-nums; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 5px; }
.ach {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  opacity: 0.5;
}
.ach.got { opacity: 1; border-color: rgba(255, 197, 66, 0.28); background: rgba(255, 197, 66, 0.07); }
.ach-ico { font-size: 15px; filter: grayscale(1); }
.ach.got .ach-ico { filter: none; }
.ach-txt h5 { margin: 0; font-size: 11px; font-weight: 700; }
.ach-txt p { font-size: 9.5px; color: var(--txt-faint); }
.ach-bonus { margin-left: auto; font-size: 9px; font-weight: 800; color: var(--gold); white-space: nowrap; }

/* ==========================================================================
   Settings page
   ========================================================================== */
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 7px;
  margin-bottom: 11px;
}
.setbtn {
  padding: 9px 10px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-soft);
  text-align: left;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}
.setbtn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line); }
.setbtn:active { transform: scale(0.98); }
.setbtn u {
  display: block; text-decoration: none;
  font-size: 8.5px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--txt-faint);
}
.setbtn b { font-size: 12px; font-weight: 800; letter-spacing: 0.03em; }
.setbtn.on b { color: var(--good); }
.setbtn.off b { color: var(--txt-faint); }
.setbtn .swatch {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 5px;
  vertical-align: -1px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.warn-box {
  padding: 10px 11px;
  margin-bottom: 9px;
  border-radius: var(--r-md);
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.07);
}
.warn-box p { font-size: 10.5px; color: var(--txt-dim); line-height: 1.5; }
.warn-box b { color: #ffc2cb; }
.warn-actions { display: flex; gap: 7px; margin-top: 8px; }
.warn-actions .gbtn { flex: 1 1 auto; }

/* ==========================================================================
   Dialog + toasts
   ========================================================================== */
.dialog {
  width: min(400px, 90%);
  max-height: 88%;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  background: var(--bg-1);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  animation: dlgIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
.dlg-head { padding: 12px 13px 6px; }
.dlg-head h3 { font-size: 14px; }
.dlg-body {
  padding: 2px 13px 11px;
  overflow-y: auto;
  font-size: 12px; color: var(--txt-dim); line-height: 1.55;
}
.dlg-body h4 { margin: 11px 0 3px; color: var(--txt); font-size: 11.5px; }
.dlg-foot { display: flex; gap: 7px; padding: 0 13px 13px; }
.dlg-foot .gbtn { flex: 1 1 auto; }
.dialog textarea {
  width: 100%; height: 96px;
  padding: 8px;
  border-radius: 8px;
  background: #060a15;
  border: 1px solid var(--line);
  color: var(--txt-dim);
  font-family: var(--mono); font-size: 10px;
  resize: none;
  user-select: text;
}

.toasts {
  position: absolute;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  pointer-events: none;
  width: max-content; max-width: 92%;
}
.toast {
  padding: 7px 13px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  background: rgba(17, 24, 52, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.26s cubic-bezier(0.2, 0.9, 0.3, 1), toastOut 0.35s ease forwards 2.5s;
}
.toast.gold { border-color: rgba(255, 197, 66, 0.42); color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.94); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* ==========================================================================
   Narrow frames — the bar wraps, cards go single column
   ========================================================================== */
@media (max-width: 780px) {
  :root { --bar-h: auto; }

  /* Fill the screen instead of floating a small box in the middle of a phone,
     and give the overlays the full remaining height to work with. */
  .game {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border-width: 0;
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }
  .pit { display: flex; flex-direction: column; justify-content: center; gap: 6px; flex: 1 1 auto; min-height: 0; }

  .gbar { flex-wrap: wrap; gap: 7px; }
  /* Keep the chips grouped at the left rather than stretched across the bar —
     with only two or three types owned, space-between leaves them stranded. */
  .buy-strip { order: 3; flex-basis: 100%; justify-content: flex-start; gap: 6px; }
  .gbar-mid { margin-left: 0; }
  .gbar-right { gap: 7px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  /* The close button floats over the header here, so the tab strip has to
     stop short of it — five tabs scroll sideways underneath otherwise. */
  .ov-head { flex-wrap: wrap; gap: 7px; padding-right: 34px; }
  .ov-head h2 { flex-basis: 100%; }
  /* Five tabs on a phone: tighten them until all five fit the strip, and
     fade the right edge so a stray sixth would still read as scrollable. */
  .ov-tabs {
    flex-basis: 100%;
    gap: 1px;
    -webkit-mask-image: linear-gradient(to right, #000 92%, transparent);
            mask-image: linear-gradient(to right, #000 92%, transparent);
  }
  .ov-tab { padding: 6px 5px; font-size: 9.5px; letter-spacing: 0.01em; }
  .buy-modes { margin-left: 0; }
  .ov-close { position: absolute; top: 8px; right: 9px; }
}

@media (max-width: 560px) {
  body { font-size: 12.5px; }
  :root { --pad: 8px; --sub-h: 28px; }
  .game { border-radius: var(--r-md); }
  .readout span { display: none; }
  .wallet-row em { display: none; }
  .wallet-row.w-alt { display: none; }
  .lp-eta { display: none; }
  .gbtn-main { padding: 7px 10px; letter-spacing: 0.05em; }
  .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ach-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 380px) {
  .bchip { max-width: none; padding: 3px 1px 2px; }
  .bchip .price { font-size: 8.5px; }
  .set-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Settings: how-to-play block ---------------------------------------- */
.help-box {
  margin-top: 11px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
}
.help-box h4 {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--txt-faint);
  margin-bottom: 6px;
}
.help-box ul { margin: 0; padding-left: 15px; }
.help-box li { font-size: 10.5px; color: var(--txt-dim); line-height: 1.6; }
.help-box b { color: var(--txt); }

/* --- Settings: live theme preview + custom-ball picker ------------------ */
.theme-preview {
  position: relative;
  height: 78px;
  margin-bottom: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
}
.tp-bricks { display: flex; gap: 4px; }
.tp-bricks i {
  display: block;
  width: 34px;
  height: 15px;
  border-radius: 3px;
  background: var(--tp-brick, #38bdf8);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28);
}
.tp-ball {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 9px;
  height: 9px;
  margin-left: -34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}
.tp-name {
  position: absolute;
  top: 6px;
  left: 9px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-ink, rgba(255, 255, 255, 0.5));
}

.pick-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pick {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-soft);
  text-align: left;
  transition: background 0.14s, border-color 0.14s;
}
.pick:hover:not(:disabled) { background: rgba(90, 169, 255, 0.14); border-color: rgba(90, 169, 255, 0.32); }
.pick:disabled { opacity: 0.42; cursor: not-allowed; }
.pick-orb {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,0.5), transparent 52%), var(--c);
  box-shadow: 0 0 10px -1px var(--c);
}
.pick-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.pick-txt b { font-size: 12px; color: var(--txt); }
.pick-txt em {
  font-style: normal; font-size: 10px; color: var(--txt-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-cost { font-size: 11.5px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

/* '+' slot in the buy strip */
.bchip-add .orb-add {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px dashed rgba(148, 172, 255, 0.4);
  box-shadow: none;
  color: var(--txt-dim);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.bchip-add.afford .orb-add { border-color: rgba(255, 197, 66, 0.6); color: var(--gold); }

/* First-purchase nudge: nothing moves until a ball is bought. */
.bchip.callout {
  border-color: rgba(255, 197, 66, 0.85);
  animation: chipCallout 1.5s ease-in-out infinite;
}
@keyframes chipCallout {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 197, 66, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 197, 66, 0); }
}

/* Panels sit inset inside the playfield, framed like the original's dialogs,
   rather than running edge to edge. */
.overlay:not(.overlay-dim) {
  inset: 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
}
.ov-head h2 { display: none; }
.ov-tabs { margin-left: 0; }
.ov-tab { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; }

/* ==========================================================================
   Prestige page — Gold bank and the permanent upgrade cards
   ========================================================================== */
.gold-next {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--txt-faint);
  margin-bottom: 8px;
}
.gold-bank {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  width: max-content;
  margin: 0 auto 10px;
  padding: 7px 20px;
  border-radius: var(--r-md);
  background: rgba(255, 197, 66, 0.1);
  border: 1px solid rgba(255, 197, 66, 0.42);
}
.gold-bank .gb-ico { color: var(--gold); font-size: 13px; }
.gold-bank b { font-size: 22px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.gold-bank em { font-style: normal; font-size: 9px; letter-spacing: 0.16em; color: var(--txt-faint); }

.claim-box {
  padding: 10px 12px;
  margin-bottom: 11px;
  border-radius: var(--r-md);
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  text-align: center;
  transition: background 0.18s, border-color 0.18s;
}
.claim-box h4 { font-size: 10px; letter-spacing: 0.16em; color: var(--accent-2); }
.claim-box .note { font-size: 10px; color: var(--txt-faint); line-height: 1.5; margin-top: 4px; }
.claim-box .gbtn { margin-top: 8px; }
/* Gold is waiting: the box goes gold and the button asks to be pressed. */
.claim-box.ready {
  background: rgba(255, 197, 66, 0.12);
  border-color: rgba(255, 197, 66, 0.45);
}
.claim-box.ready h4 { color: var(--gold); }
.claim-box.ready .claim-btn:not(:disabled) {
  background: var(--gold);
  border-color: var(--gold);
  color: #241800;
  animation: claimPulse 1.8s ease-in-out infinite;
}
@keyframes claimPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 197, 66, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 197, 66, 0); }
}

.reset-box {
  padding: 10px 12px;
  margin-bottom: 11px;
  border-radius: var(--r-md);
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  text-align: center;
}
.reset-box h4 { font-size: 10px; letter-spacing: 0.16em; color: var(--accent-2); }
.reset-box .note { font-size: 10px; color: var(--txt-faint); line-height: 1.5; margin-top: 4px; }
.reset-box .gbtn { margin-top: 8px; }

.gold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 7px;
}
.gold-card {
  display: flex;
  flex-direction: column;
  padding: 9px 8px 0;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  text-align: center;
  overflow: hidden;
  transition: background 0.14s, border-color 0.14s;
}
.gold-card:hover:not(:disabled) { background: rgba(255, 197, 66, 0.12); border-color: rgba(255, 197, 66, 0.4); }
.gold-card:disabled { opacity: 0.45; cursor: not-allowed; }
.gold-card u {
  display: block; text-decoration: none;
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  color: var(--txt); line-height: 1.25;
}
.gold-card em {
  display: block; font-style: normal;
  font-size: 9px; color: var(--txt-faint);
  margin: 4px 0 6px; min-height: 24px; line-height: 1.35;
}
.gold-card b {
  display: block; font-size: 11px; color: var(--txt-dim);
  font-variant-numeric: tabular-nums;
}
.gold-card b i {
  display: inline;
  margin: 0;
  padding: 0 5px;
  background: none;
  font-style: normal;
  font-size: inherit;
  color: var(--txt-faint);
}
.gold-card > i {
  display: block;
  margin: 7px -8px 0;
  padding: 3px 0;
  font-style: normal;
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(148, 172, 255, 0.14);
  color: var(--txt-faint);
}
.gold-card.afford > i { background: var(--gold); color: #241800; }

/* ==========================================================================
   Skills page — a point every 10 levels, each node bought once
   ========================================================================== */
.skill-bank {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  width: max-content;
  margin: 0 auto 10px;
  padding: 7px 20px;
  border-radius: var(--r-md);
  background: rgba(90, 169, 255, 0.1);
  border: 1px solid rgba(90, 169, 255, 0.42);
}
.skill-bank .sb-ico { color: var(--accent); font-size: 13px; }
.skill-bank b {
  font-size: 22px; font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.skill-bank em {
  font-style: normal;
  font-size: 9px; letter-spacing: 0.16em;
  color: var(--txt-faint);
}




/* BB sits beside Gold in the wallet. */
.w-bb { margin-left: 10px; }

/* ==========================================================================
   Skills tab
   Grid left, the node you picked right — the shape the original uses, and
   the reason the whole tab fits on one screen with nothing to scroll to.
   ========================================================================== */
.boss-box {
  display: flex; flex-direction: column; gap: 3px;
  padding: 6px 9px;
  margin-bottom: 7px;
  border-radius: var(--r-md);
  background: rgba(255, 197, 66, 0.07);
  border: 1px solid rgba(255, 197, 66, 0.28);
  text-align: center;
}
.boss-btn {
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: rgba(148, 172, 255, 0.14);
  border: 1px solid var(--line);
  color: var(--txt-faint);
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.boss-btn u {
  display: block; text-decoration: none;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em;
}
.boss-btn i {
  display: block; font-style: normal;
  font-size: 11px; font-weight: 900; margin-top: 1px;
}
.boss-btn.afford { background: var(--gold); border-color: var(--gold); color: #241800; }
.boss-hint { font-size: 9px; color: var(--txt-faint); }

.skill-layout {
  display: grid;
  grid-template-columns: auto 250px;
  gap: 12px;
  align-items: start;
  justify-content: center;
}
.skill-left { min-width: 0; width: 384px; max-width: 100%; }

/* Column labels — a coloured dot alone never says which ball it is. */
.skill-heads {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.skill-head {
  --c: var(--accent);
  text-align: center;
  font-size: 9px; font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}
.skill-cell {
  --sk-tint: var(--accent);
  position: relative;
  display: grid; place-items: center;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}
.skill-cell:hover { transform: translateY(-1px); }
.skill-cell .orb {
  width: 56%; max-width: 26px; aspect-ratio: 1 / 1; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,0.5), transparent 52%), var(--c);
  box-shadow: 0 0 8px -2px var(--c);
}
/* The cost, stamped on the node, so the four tiers read without clicking. */
.skill-cell .sk-n {
  position: absolute; right: 3px; bottom: 2px;
  font-style: normal;
  font-size: 9px; font-weight: 800;
  color: var(--txt-faint);
}
.skill-cell.afford {
  background: color-mix(in srgb, var(--sk-tint) 16%, transparent);
  border-color: color-mix(in srgb, var(--sk-tint) 50%, transparent);
}
.skill-cell.afford .sk-n { color: var(--txt); }
.skill-cell.owned {
  background: rgba(74, 222, 128, 0.16);
  border-color: rgba(74, 222, 128, 0.5);
}
.skill-cell.owned .orb { box-shadow: 0 0 10px 0 var(--c); }
.skill-cell.owned .sk-n { color: #a7f3c4; }
.skill-cell:not(.afford):not(.owned) .orb { opacity: 0.5; }
.skill-cell.picked { box-shadow: 0 0 0 2px var(--accent); }
.skill-gap { aspect-ratio: 1 / 1; }

.skill-right { display: flex; flex-direction: column; gap: 7px; }
.skill-right .skill-bank {
  width: auto; margin: 0;
  padding: 6px 10px;
  gap: 5px;
}
.skill-right .skill-bank b { font-size: 17px; }

.skill-detail {
  padding: 9px 10px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  text-align: center;
}
.skill-detail h4 { font-size: 11px; letter-spacing: 0.06em; color: var(--txt); }
.skill-detail .sk-ball {
  --c: var(--accent);
  font-size: 8.5px; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--c);
  margin-top: 1px;
}
.skill-detail .sk-desc {
  font-size: 10.5px; line-height: 1.45;
  color: var(--txt-faint);
  margin: 5px 0 6px;
}
.skill-detail .sk-price {
  font-size: 10.5px; font-weight: 800;
  color: var(--accent);
  margin-bottom: 7px;
}
.skill-lock { font-size: 9px; text-align: center; color: var(--txt-faint); }
.skill-lock.locked { color: var(--accent-2); }

/* Narrow frames: the detail panel drops under the grid, still without a
   scroll because everything above it is small. */
@media (max-width: 640px) {
  .skill-layout { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .skill-left { width: auto; }
  .skill-right { gap: 5px; }
  .boss-box { margin-bottom: 5px; }
  .skill-detail { padding: 7px 9px; }
  .skill-right { flex-direction: column; }
  .skill-head { font-size: 7px; }
  .skill-cell .sk-n { font-size: 7px; }
}
