/*
 * VoltToday Game — styles ("control room", dark)
 * ==============================================
 *
 * Mobile-first styles for game.html: a control-room look (dark by default,
 * light via html[data-theme="light"], same switch as the main site) with KPI tiles
 * (coins, income, output, weather), the clickable panel in a round well with
 * a 3-slot forecast, and a tabbed shop (Stations / Upgrades / Modernize).
 * All colours, radii, shadows and motion live in the custom properties right
 * below, so the look can be retuned by changing tokens, not rules.
 *
 * Related files:
 *   game.html — markup these rules target
 *   ui.js     — toggles .is-broken (body), .is-locked (cards), .is-pressed (panel),
 *               [hidden] on tab panels, aria-selected on tabs
 */

:root {
  color-scheme: dark;

  /* Colours */
  --color-bg: #0b0f12;
  --color-surface: #12181d;            /* boxes and tiles */
  --color-surface-strong: #1d272e;     /* selected tab, hover */
  --color-well: #0b0f12;               /* rows and slots inside boxes */
  --color-border: #22303a;
  --color-border-soft: #1d272e;
  --color-text: #e8eef2;
  --color-muted: #93a3ae;
  --color-accent: #2ed1c8;
  --color-accent-strong: #7fe6df;
  --color-accent-soft: #2ed1c826;
  --color-on-accent: #062a28;
  --color-gold: #f2b01e;
  --color-on-gold: #2b1d00;
  --color-danger: #ff8080;
  --color-on-danger: #2a0505;
  --color-up: #7fe6df;                 /* weather boost */
  --color-down: #ff9b9b;               /* weather penalty */
  --color-warning-bg: #3a2c0a;
  --color-warning-text: #ffd479;
  --color-frame: #3a4651;
  --color-crack: #c3ccd3;
  --color-ring-track: #1d272e;
  --color-backdrop: rgb(0 0 0 / 55%);
  --icon-solar: #f2b01e;
  --icon-wind: #7fb3ec;
  --icon-hydro: #7fe6df;
  --icon-gas: #ff9f68;
  --icon-nuclear: #c4a7ff;
  --icon-geothermal: #ff7a59;
  --icon-offshore: #5fb0ff;
  --icon-fusion: #f0a6ff;
  --icon-click: #f2b01e;

  /* Shape */
  --radius-small: 10px;
  --radius: 14px;
  --radius-large: 18px;
  --shadow-strong: 0 12px 40px rgb(0 0 0 / 45%);
  --well-ring: 0 0 0 2px var(--color-border), 0 0 0 10px #0f1418;
  --prestige-hover: #ffc94d;

  /* Type & spacing */
  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;   /* same as the main site */
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: 16px;
  --tap-size: 44px;
  --panel-size: min(64vw, 300px);
  --layout-width: 1200px;

  /* Motion */
  --press-duration: 120ms;
  --float-duration: 900ms;
  --reveal-duration: 400ms;
}

/* Light theme: the same tokens, re-coloured. Chosen by the theme button (saved
   under the main site's "theme" key) or, with no saved choice, by the system. */
html[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f3f6f8;
  --color-surface: #ffffff;
  --color-surface-strong: #e9eef1;
  --color-well: #f5f7f8;
  --color-border: #dde4e8;
  --color-border-soft: #e6ebee;
  --color-text: #12181d;
  --color-muted: #5f6b75;
  --color-accent: #0d8c8a;
  --color-accent-strong: #0a6f6d;
  --color-accent-soft: #0d8c8a1a;
  --color-on-accent: #ffffff;
  --color-gold: #b7791f;
  --color-on-gold: #ffffff;
  --color-danger: #c0392b;
  --color-on-danger: #ffffff;
  --color-up: #0a6f6d;
  --color-down: #c0392b;
  --color-warning-bg: #fff6e0;
  --color-warning-text: #7a5300;
  --color-frame: #c9d0d6;
  --color-crack: #4a5157;
  --color-ring-track: #e6ebee;
  --color-backdrop: rgb(18 24 29 / 35%);
  --shadow-strong: 0 10px 40px rgb(18 24 29 / 18%);
  --well-ring: 0 0 0 2px var(--color-border), 0 0 0 10px #eef2f4;
  --prestige-hover: #9a6618;
  --icon-solar: #b7791f;
  --icon-wind: #3d6fb4;
  --icon-hydro: #0a6f6d;
  --icon-gas: #c4561e;
  --icon-nuclear: #7b5cc4;
  --icon-geothermal: #c2410c;
  --icon-offshore: #2563a8;
  --icon-fusion: #a03fb5;
  --icon-click: #b7791f;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.muted { color: var(--color-muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------
 * Top bar
 * ------------------------------------------------------------------------- */

.save-warning {
  padding: 8px var(--gutter);
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  font-size: 13px;
  text-align: center;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px var(--gutter);
  border-bottom: 1px solid var(--color-border-soft);
}

/* Logo as on the main site: outline bolt + monospace name. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-decoration: none;
}

.brand svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--color-accent); }
.brand-sub { color: var(--color-muted); font-weight: 500; }
.topbar .icon-btn:first-of-type { margin-left: auto; }
.theme-icon-light { display: none; }
html[data-theme="light"] .theme-icon-light { display: block; }
html[data-theme="light"] .theme-icon-dark { display: none; }

/* ---------------------------------------------------------------------------
 * Layout: KPI tiles on top, panel box and shop box below
 * ------------------------------------------------------------------------- */

.layout {
  display: grid;
  gap: 12px;
  max-width: var(--layout-width);
  margin: 0 auto;
  padding: 12px var(--gutter) 24px;
}

.box {
  padding: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
}

/* Before the repair: only the broken panel on an empty screen. */
body.is-broken .kpis,
body.is-broken .shop { display: none; }
body.is-broken .stage { min-height: calc(100vh - 110px); justify-content: center; background: none; border: 0; }
body.is-broken .panel { box-shadow: none; background: none; }

.shop { animation: reveal var(--reveal-duration) ease-out; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* KPI tiles. Phone: coins across the top, then income and weather side by side. */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.kpi {
  min-width: 0;
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.kpi-coins { grid-column: 1 / -1; }
.kpi-forecast { grid-column: 1 / -1; }   /* phones: the forecast gets its own row */

.kpi-label {
  overflow: hidden;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--color-muted);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi-value small { margin-left: 4px; font-size: 12px; font-weight: 500; color: var(--color-muted); }
.kpi-coins .kpi-value { font-size: 32px; color: var(--color-accent); }
.kpi-note { font-size: 12px; }
.certs { color: var(--color-gold); font-weight: 600; }

.weather-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  margin-top: 2px;
  font-size: 13px;
}

.weather-now b { font-size: 15px; }
.weather-icon { display: inline-flex; color: var(--color-accent-strong); }
.weather-icon svg { width: 22px; height: 22px; }
.weather-effects { display: inline-flex; flex-wrap: wrap; gap: 0 8px; }
.effect-up { color: var(--color-up); }
.effect-down { color: var(--color-down); }

@media (min-width: 860px) {
  .topbar { padding-inline: 40px; }
  .layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 20px;
    padding: 20px 40px 32px;
  }
  .kpis { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px 16px; }
  .kpi-coins,
  .kpi-forecast { grid-column: auto; }
  .kpi-label { font-size: 12px; }
  .kpi-value { font-size: 30px; }
  .kpi-value small { font-size: 14px; }
  .weather-now b { font-size: 18px; }
  body.is-broken .layout { display: block; }

  /* Desktop: one screen, no page scroll; the shop's tab content scrolls inside its box. */
  body:not(.is-broken) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
  }
  body:not(.is-broken) > .save-warning,
  body:not(.is-broken) > .topbar { flex: none; }
  body:not(.is-broken) .layout {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }
  body:not(.is-broken) .stage,
  body:not(.is-broken) .shop { min-height: 0; }
  /* The bolt shrinks on short screens so the goals always fit: no scrollbar here. */
  /* What is left of the screen height after the bar, tiles, caption and three goals
     (measured: about 545px), capped at 240px. */
  body:not(.is-broken) { --panel-size: clamp(120px, calc(100vh - 545px), 240px); }
  body:not(.is-broken) .stage { overflow: hidden; justify-content: flex-start; }
  .shop { display: flex; flex-direction: column; }
  .shop .tab-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;          /* scrolls with the wheel / finger, no visible bar */
  }
  .shop .tab-panel::-webkit-scrollbar { display: none; }
}

/* ---------------------------------------------------------------------------
 * Stage: the panel in a round well, caption, forecast
 * ------------------------------------------------------------------------- */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.panel {
  display: grid;
  place-items: center;
  flex: none;                 /* never squeezed by the column: the circle stays round */
  aspect-ratio: 1;
  width: var(--panel-size);
  height: var(--panel-size);
  margin: 12px 0 4px;         /* room for the 10px ring, which the stage would otherwise clip */
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-well);
  box-shadow: var(--well-ring);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.panel:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 12px; }
.panel svg { display: block; width: 84%; height: 84%; }
.panel.is-pressed svg { animation: press var(--press-duration) ease-out; }

@keyframes press {
  50% { transform: scale(0.96); }
}

.ring-track,
.ring-progress { fill: none; stroke-width: 6; }
.ring-track { stroke: var(--color-ring-track); }

.ring-progress {
  stroke: var(--color-accent);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transform: rotate(-90deg);
  transform-origin: 100px 100px;
  transition: stroke-dashoffset var(--press-duration) ease-out;
}

/* The bolt: filled with a soft accent and outlined like the logo; grey and
   cracked before the repair; glows while a demand-spike boost runs. */
.logo-bolt {
  fill: var(--color-accent-soft);
  stroke: var(--color-accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill var(--press-duration) ease-out;
}

.panel:hover .logo-bolt { fill: color-mix(in srgb, var(--color-accent) 30%, transparent); }
.logo-cracks polyline { fill: none; stroke: var(--color-crack); stroke-width: 0.6; stroke-linecap: round; stroke-linejoin: round; }

.logo-cracks,
body:not(.is-broken) .ring-track,
body:not(.is-broken) .ring-progress { display: none; }
body.is-broken .logo-cracks { display: inline; }
body.is-broken .logo-bolt { fill: none; stroke: var(--color-frame); }
body.is-boosted .logo-bolt { fill: var(--color-accent); }
body.is-boosted .panel { box-shadow: var(--well-ring), 0 0 40px var(--color-accent-soft); }

.panel-caption {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 14px;
  text-align: center;
}

.floating-gain {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  pointer-events: none;
  animation: float-up var(--float-duration) ease-out forwards;
}

@keyframes float-up {
  to { opacity: 0; transform: translate(-50%, -260%); }
}

/* Demand spike: a bolt button over the stage; the ring drains over --spike-ms. */
.spike {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-size);
  padding: 6px 14px 6px 8px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--color-gold);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-gold);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 0 0 var(--color-gold);
  animation: spike-pulse 1s ease-in-out infinite;
}

.spike svg { width: 26px; height: 26px; fill: var(--color-gold); stroke: var(--color-gold); }
.spike:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }

.spike::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 3px;
  height: 3px;
  border-radius: 99px;
  background: var(--color-gold);
  transform-origin: left;
  animation: spike-drain var(--spike-ms, 10s) linear forwards;
}

@keyframes spike-pulse {
  50% { transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 0 0 8px transparent; }
}

@keyframes spike-drain {
  to { transform: scaleX(0); }
}

.floating-reward { color: var(--color-gold); font-size: 18px; white-space: nowrap; }

/* Goals under the bolt */
.goals { width: 100%; }
.goals h2 { margin-bottom: 6px; }
.goals .list { gap: 6px; }
/* Compact rows: three goals must fit under the bolt on a laptop screen. */
.goals .card { padding: 6px 10px; gap: 10px; }
.goals .card-icon svg { width: 20px; height: 20px; }
.goals .card-title { font-size: 14px; line-height: 1.3; }
.goals .card-detail { font-size: 12px; line-height: 1.3; }
.goals .card-progress { margin-top: 4px; }
.goals .btn-buy { min-width: 72px; min-height: 36px; padding: 4px 10px; }
.goals .btn-buy .btn-price:empty { display: none; }
.card.is-done { border-color: var(--color-gold); }
.card.is-done .card-detail { color: var(--color-gold); }
.card-progress { height: 4px; margin-top: 6px; border-radius: 99px; background: var(--color-surface-strong); overflow: hidden; }
.card-progress span { display: block; height: 100%; border-radius: inherit; background: var(--color-accent); }
.card.is-done .card-progress span { background: var(--color-gold); }

/* Buffs under the weather: a running demand-spike boost, the certificate bonus. */
.buffs { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; font-size: 12px; }
.buffs:not(:has(.buff:not([hidden]))) { display: none; }
.buff { font-weight: 600; }
.boost-badge { color: var(--color-gold); }

/* Forecast tile: one line per coming hour, with what that weather does. */
.forecast { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; font-size: 13px; }
.slot { display: grid; grid-template-columns: 40px auto 1fr; align-items: center; gap: 8px; color: var(--color-muted); }
.slot-when { font-family: var(--font-mono); }
.slot-name { display: flex; align-items: center; gap: 6px; color: var(--color-text); font-weight: 600; }
.slot-name svg { width: 16px; height: 16px; color: var(--color-muted); flex: none; }
.slot-effects { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }

/* ---------------------------------------------------------------------------
 * Shop: tabs and lists
 * ------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--color-well);
  border-radius: var(--radius);
}

.tab {
  flex: 1;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover { color: var(--color-text); }
.tab[aria-selected="true"] { background: var(--color-surface-strong); color: var(--color-text); }
.tab:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 1px; }

.tab-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 12px;
  line-height: 18px;
}

@media (min-width: 860px) {
  .tabs { align-self: flex-start; }
  .tab { flex: none; padding: 0 16px; }
}

.list { display: flex; flex-direction: column; gap: 8px; }
.empty { margin: 4px 2px; font-size: 14px; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--color-well);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  animation: reveal var(--reveal-duration) ease-out;
}

.card.is-locked { border-style: dashed; background: transparent; }
.card.is-locked .card-title { color: var(--color-muted); }

.card-icon { flex: none; display: inline-flex; width: 28px; justify-content: center; color: var(--color-muted); }
.card-icon svg { width: 24px; height: 24px; }
.card-icon.icon-solar { color: var(--icon-solar); }
.card-icon.icon-wind { color: var(--icon-wind); }
.card-icon.icon-hydro { color: var(--icon-hydro); }
.card-icon.icon-gas { color: var(--icon-gas); }
.card-icon.icon-nuclear { color: var(--icon-nuclear); }
.card-icon.icon-geothermal { color: var(--icon-geothermal); }
.card-icon.icon-offshore { color: var(--icon-offshore); }
.card-icon.icon-fusion { color: var(--icon-fusion); }
.card-icon.icon-click { color: var(--icon-click); }
.card-info { flex: 1; min-width: 0; }
.card-title { font-weight: 600; }
.card-detail { color: var(--color-muted); font-size: 13px; overflow-wrap: anywhere; }

.count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.count:empty { display: none; }

/* Guide tab: plain reading text (also what search engines index). */
.guide article { max-width: 68ch; padding: 2px 4px 8px; font-size: 15px; }
.guide h1 { margin: 0 0 8px; font-size: 22px; line-height: 1.2; }
.guide h2 { margin: 20px 0 8px; color: var(--color-text); font-size: 16px; text-transform: none; letter-spacing: 0; }
.guide p { margin: 0 0 10px; color: var(--color-muted); }
.guide ol, .guide ul { margin: 0; padding-left: 20px; color: var(--color-muted); }
.guide li { margin-bottom: 6px; }
.guide li b { color: var(--color-text); }
.guide details { border-top: 1px solid var(--color-border); }
.guide details:last-of-type { border-bottom: 1px solid var(--color-border); }
.guide summary { min-height: var(--tap-size); display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.guide details p { margin: 0 0 12px; }
.guide .site-link { margin-top: 16px; }

/* Four tabs must fit a phone: tighter tabs below 420px. */
@media (max-width: 420px) {
  .tab { padding: 0 6px; font-size: 14px; }
}

/* ---------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------- */

.btn {
  min-height: var(--tap-size);
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:hover:not(:disabled) { background: var(--color-surface-strong); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:disabled { cursor: default; opacity: 0.5; }

.btn-buy {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  padding: 6px 12px;
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 700;
  line-height: 1.2;
}

.btn-buy:hover:not(:disabled) { background: var(--color-accent-strong); }
.btn-buy .btn-price { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.btn-buy:disabled { border-color: var(--color-border); background: var(--color-surface); color: var(--color-muted); opacity: 1; }

.btn-primary { border-color: var(--color-accent); background: var(--color-accent); color: var(--color-on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-strong); }

.btn-prestige {
  width: 100%;
  border-color: var(--color-gold);
  background: var(--color-gold);
  color: var(--color-on-gold);
}

.btn-prestige:hover:not(:disabled) { background: var(--prestige-hover); }
.btn-danger { border-color: var(--color-danger); background: transparent; color: var(--color-danger); }
.btn-danger-solid { border-color: var(--color-danger); background: var(--color-danger); color: var(--color-on-danger); }
.btn-danger-solid:hover:not(:disabled) { background: var(--color-danger); filter: brightness(1.1); } /* keep red: the generic .btn:hover would turn it dark */

/* ---------------------------------------------------------------------------
 * Modernize tab, dialogs
 * ------------------------------------------------------------------------- */

.prestige h2 { color: var(--color-text); font-size: 16px; text-transform: none; letter-spacing: 0; }
.prestige p { margin: 0 0 12px; }
.prestige .small { margin-top: 10px; }

.menu-body { display: flex; flex-direction: column; gap: 8px; }
.menu-body p { margin: 0; min-height: 1em; }

textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-well);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

.site-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.site-link:hover { text-decoration: underline; }

/* Square icon button in the top bar (settings) and dialogs (close). */
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tap-size);
  height: var(--tap-size);
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-muted);
  font: inherit;
  cursor: pointer;
}

.icon-btn:hover { color: var(--color-text); background: var(--color-surface-strong); }
.icon-btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.icon-btn svg { width: 20px; height: 20px; }

.settings,
.welcome,
.confirm {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-strong);
}

.settings { width: min(92vw, 420px); padding: 18px; }
.settings::backdrop,
.welcome::backdrop,
.confirm::backdrop { background: var(--color-backdrop); }

/* The game's confirmation dialog (prestige, import, reset). */
.confirm { width: min(92vw, 400px); padding: 22px; }
.confirm form { margin: 0; }
.confirm h2 { margin: 0 0 8px; color: var(--color-text); font-size: 19px; text-transform: none; letter-spacing: 0; }
.confirm p { margin: 0 0 20px; color: var(--color-muted); font-size: 15px; }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.confirm-actions .btn { min-width: 110px; }
.confirm[open] { animation: dialog-in var(--press-duration) ease-out; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
}
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.settings-head h2 { margin: 0; color: var(--color-text); font-size: 18px; text-transform: none; letter-spacing: 0; }
.settings-head form { margin: 0; }

.welcome { width: min(92vw, 380px); padding: 22px; text-align: center; }
.welcome h2 { margin-top: 0; color: var(--color-text); font-size: 20px; text-transform: none; letter-spacing: 0; }
.welcome form { margin: 0; }

.noscript { padding: var(--gutter); text-align: center; }

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