:root {
  --bg: #16181c;
  --bg-2: #1e2126;
  --bg-3: #262a31;
  --line: #343943;
  --ink: #e8eaee;
  --ink-dim: #9aa2af;
  --ink-faint: #6d7683;

  /* Frutiger Aero palette, sampled from the reference orb: deep blue rim,
     bright cyan core bleeding up from below, pale lavender gel on top. */
  --aero-deep: #0a0abe;
  --aero-rim: #0f1fe0;
  --aero-mid: #1c47f7;
  --aero-bright: #5a90ff;
  --aero-cyan: #00cfff;
  --aero-glow: #a9f0ff;
  --aero-pale: #e9ecff;

  --accent: #3d7bff;
  --accent-2: #57e0ff;
  --danger: #d9614c;
  /* Checker jump landings must stay legible on all six board themes, so the
     board marker keeps its own colour rather than following --accent. */
  --marker: #00cfff;

  --sq-light: #e8dcc3;
  --sq-dark: #7f9464;
  --sq-light-last: #ded08f;
  --sq-dark-last: #9aa055;

  /* Overridden at runtime from Settings. */
  --pc-w-fill: #f8f4ec;
  --pc-w-stroke: #23211d;
  --pc-b-fill: #2b2926;
  --pc-b-stroke: #ece6d9;

  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

/* Author `display` rules below would otherwise beat the UA stylesheet's
   [hidden] rule, leaving the modal, banner and chain bar permanently on. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 700px at 15% -10%, #22262e 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; }

/* The Checker piece rendered as an Aero orb: cyan core rising from the bottom,
   deep blue rim, pale gel cap, and the concentric rings sitting on top. */
.orb {
  position: relative;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 116%,
    #9df6ff 0%, var(--aero-cyan) 24%, #1636f2 62%, var(--aero-deep) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.3),
    inset 0 -7px 18px rgba(0, 220, 255, 0.55),
    0 0 18px rgba(0, 170, 255, 0.45);
}
.orb::before {
  content: "";
  position: absolute;
  left: 13%;
  right: 13%;
  top: 5%;
  height: 44%;
  border-radius: 50%;
  background: linear-gradient(180deg,
    rgba(240, 242, 255, 0.92) 0%,
    rgba(198, 206, 252, 0.3) 70%,
    rgba(198, 206, 252, 0) 100%);
  pointer-events: none;
}
.orb svg {
  position: relative;
  width: 100%;
  height: 100%;
  fill: rgba(255, 255, 255, 0.34);
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 4;
}

.logo { width: 30px; height: 30px; }

h1 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 .sup { font-size: 12px; vertical-align: super; color: var(--accent); font-weight: 700; }

.tag {
  color: var(--ink-faint);
  font-size: 12.5px;
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
}

.link {
  background: none;
  border: 0;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.link:hover { color: var(--ink); border-bottom-color: var(--ink-dim); }
.link.small { font-size: 12px; }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 22px;
  align-items: start;
}

.board-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }

.side-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 26px;
  padding: 0 2px;
}
.side-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-dim);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.tray { display: flex; flex-wrap: wrap; gap: 1px; min-height: 22px; align-items: center; }
.tray .pc.tiny { width: 22px; height: 22px; opacity: 0.9; }

/* ---------- board ---------- */

.board-frame {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 18px;
  gap: 4px;
  width: 100%;
  max-width: min(74vh, 660px);
}

.ranks, .files {
  display: grid;
  color: var(--ink-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  transition: opacity 140ms ease;
}
.ranks { grid-template-rows: repeat(10, 1fr); }
.ranks span { display: grid; place-items: center; }
.files { grid-template-columns: repeat(10, 1fr); grid-column: 2; }
.files span { display: grid; place-items: center; }
.corner { grid-row: 2; grid-column: 1; }

/* Board rotation. `spin` arms the transitions, `spin-go` (added a frame later,
   so the transition has a start value to animate from) drives the turn. The
   pieces counter-rotate by the same amount, so at the end of the spin the board
   already looks exactly like the flipped layout with upright pieces — which is
   what lets us swap to the real layout and drop both transforms in one frame
   without a visible jump. */
.board.spin,
.board.spin .pc {
  transition: transform var(--spin-ms, 400ms) cubic-bezier(0.45, 0.03, 0.25, 1);
}
.board.spin { will-change: transform; }
.board.spin-go { transform: rotate(180deg); }
.board.spin-go .pc { transform: rotate(-180deg); }

/* Coordinates live outside the board, so fade them across the turn rather than
   leaving them stubbornly upright while everything else rotates. */
.board-frame.coords-out .ranks,
.board-frame.coords-out .files { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .board.spin, .board.spin .pc, .ranks, .files { transition: none; }
}

.board {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.5);
  user-select: none;
  touch-action: manipulation;
}

.sq {
  position: relative;
  display: grid;
  place-items: center;
}
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }

.sq.last.light { background: var(--sq-light-last); }
.sq.last.dark { background: var(--sq-dark-last); }
.sq.last-via::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 2px dashed rgba(70, 55, 20, 0.45);
}

/* Cyan rather than --accent: the plain blue lost too much contrast against the
   Ocean and Slate boards, and "what is selected" has to be obvious. */
.sq.selected {
  box-shadow: inset 0 0 0 3px var(--marker), inset 0 0 12px rgba(0, 207, 255, 0.5);
  z-index: 2;
}

.sq.check::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(217, 60, 44, 0.85) 12%, rgba(217, 60, 44, 0) 72%);
}

.piece-layer {
  position: relative;
  width: 88%;
  height: 88%;
  z-index: 3;
  pointer-events: none;
}

/* A travelling piece has to clear the squares it passes over. */
.sq.moving { z-index: 6; }

/* Captured pieces are re-inserted here and faded out, under the arriving piece. */
.capture-ghost {
  position: absolute;
  left: 6%;
  top: 6%;
  width: 88%;
  height: 88%;
  z-index: 2;
  pointer-events: none;
}

.marker {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* move affordances */
.sq.move-target .marker::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 26%; height: 26%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(30, 40, 25, 0.32);
}
.sq.capture-target .marker::after {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 5px solid rgba(30, 40, 25, 0.32);
}
.sq.jump-target .marker::after {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 22%;
  border: 3px solid var(--marker);
  background: rgba(0, 207, 255, 0.26);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.3), 0 0 8px rgba(0, 207, 255, 0.5);
}
.sq.jump-target:hover .marker::after { background: rgba(0, 207, 255, 0.48); }

.sq.stop-here .marker::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.7);
}

.sq.doomed .piece-layer { opacity: 0.34; }
.sq.doomed::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(217, 97, 76, 0.5);
  z-index: 1;
}

.sq:hover { cursor: default; }
.sq.move-target:hover, .sq.capture-target:hover, .sq.jump-target:hover { cursor: pointer; }

/* ---------- pieces ---------- */

.pc {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--pc-fill);
  stroke: var(--pc-stroke);
  stroke-width: 3.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, 0.35));
}
.pc-w { --pc-fill: var(--pc-w-fill); --pc-stroke: var(--pc-w-stroke); }
.pc-b { --pc-fill: var(--pc-b-fill); --pc-stroke: var(--pc-b-stroke); }
.pc .ring, .pc .line { fill: none; stroke: var(--pc-stroke); }
.pc .eye { fill: var(--pc-stroke); stroke: none; }
.pc .mane { fill: var(--pc-stroke); stroke: var(--pc-stroke); }
/* Hair strands drawn back in the body colour, so the mane reads as locks
   rather than a solid slab. */
.pc .mane-lock { fill: none; stroke: var(--pc-fill); stroke-width: 1.7; }

/* ---------- chain bar ---------- */

.chain-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #1b2a44, #141d33);
  border: 1px solid #2c4a78;
  border-left: 3px solid var(--aero-cyan);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}
.chain-text { color: #cfe9ff; }
.chain-actions { display: flex; gap: 8px; }

/* ---------- panel ---------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 20px;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
}
.card.grow { display: flex; flex-direction: column; min-height: 190px; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.card-head h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 0;
  font-weight: 650;
}

.seg {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  flex: 1;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  padding: 7px 6px;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.seg-btn.on {
  color: #f2fbff;
  background:
    radial-gradient(120% 95% at 50% 132%, rgba(0, 207, 255, 0.8) 0%, rgba(0, 207, 255, 0) 62%),
    linear-gradient(180deg, var(--aero-bright) 0%, var(--aero-mid) 50%, #0d1cc4 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 2px 8px rgba(12, 40, 230, 0.4);
  text-shadow: 0 1px 2px rgba(0, 20, 90, 0.55);
}
.seg.small .seg-btn { font-size: 12px; padding: 5px 4px; }

#single-opts { margin-top: 11px; }

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--ink-dim);
}
.field > span:first-child { white-space: nowrap; }
.field .seg { flex: 1; max-width: 178px; }

select {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  min-width: 120px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-top: 4px;
  cursor: pointer;
}
.check input { accent-color: var(--accent); }

.status-card { padding: 12px 13px; }
.status { font-size: 15px; font-weight: 600; }
.status.thinking { color: var(--accent); }
.status.over { color: var(--accent-2); }
.status-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }
.status-sub.alert { color: var(--danger); font-weight: 600; }

.moves {
  flex: 1;
  overflow-y: auto;
  max-height: 260px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  scrollbar-width: thin;
}
.mv-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 4px;
}
.mv-row:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.mv-n { color: var(--ink-faint); }
.mv { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.mv.cur { color: var(--accent); font-weight: 700; }
.mv-empty { color: var(--ink-faint); font-size: 12.5px; padding: 4px; }

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

/* ---------- glossy buttons ---------- */

/* Frutiger Aero gel buttons. Three stacked ingredients, same as the reference
   orb: a saturated blue body, a cyan bloom rising from the bottom edge, and a
   pale gel highlight sitting on the top half with an elliptical lower edge. */

.btn, .gloss {
  position: relative;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #eaf6ff;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  padding: 9px 14px;
  cursor: pointer;
  background:
    radial-gradient(120% 90% at 50% 128%, rgba(0, 207, 255, 0.85) 0%, rgba(0, 207, 255, 0) 60%),
    linear-gradient(180deg, #3f5fa8 0%, #27397a 46%, #16204d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    inset 0 -12px 20px -10px rgba(0, 207, 255, 0.45),
    0 3px 12px rgba(4, 10, 40, 0.5);
  text-shadow: 0 1px 2px rgba(0, 16, 60, 0.55);
  transition: filter 0.14s ease, transform 0.06s ease, box-shadow 0.14s ease;
}

/* The gel: top half, pale, with a rounded-off bottom edge. */
.btn::before, .gloss::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 44%;
  border-radius: inherit;
  border-bottom-left-radius: 50% 78%;
  border-bottom-right-radius: 50% 78%;
  background: linear-gradient(180deg,
    rgba(233, 236, 255, 0.60) 0%,
    rgba(200, 214, 255, 0.26) 58%,
    rgba(200, 214, 255, 0.02) 100%);
  pointer-events: none;
  z-index: -1;
}

.btn:hover, .gloss:hover { filter: brightness(1.16) saturate(1.12); }
.btn:active, .gloss:active {
  transform: translateY(1px);
  filter: brightness(0.94) saturate(1.05);
  box-shadow:
    inset 0 2px 6px rgba(0, 10, 45, 0.65),
    inset 0 -8px 16px -10px rgba(0, 207, 255, 0.35),
    0 1px 3px rgba(0, 0, 0, 0.35);
}
.btn:focus-visible, .gloss:focus-visible {
  outline: 2px solid var(--aero-cyan);
  outline-offset: 2px;
}

/* The headline orb: full saturation, strong cyan core, outer bloom. */
.btn.primary, .gloss.primary {
  color: #f4fcff;
  font-weight: 650;
  border-color: rgba(255, 255, 255, 0.45);
  background:
    radial-gradient(125% 105% at 50% 116%,
      var(--aero-cyan) 0%, rgba(0, 207, 255, 0.62) 30%, rgba(0, 207, 255, 0) 68%),
    linear-gradient(180deg, var(--aero-bright) 0%, var(--aero-mid) 42%, var(--aero-deep) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    inset 0 -18px 26px -12px rgba(0, 220, 255, 0.95),
    0 3px 14px rgba(12, 40, 230, 0.45),
    0 0 26px rgba(0, 176, 255, 0.32);
  text-shadow: 0 1px 2px rgba(0, 22, 96, 0.7);
}
.btn.primary::before, .gloss.primary::before {
  height: 43%;
  background: linear-gradient(180deg,
    rgba(238, 241, 255, 0.88) 0%,
    rgba(190, 205, 255, 0.42) 58%,
    rgba(190, 205, 255, 0.02) 100%);
}
.btn.primary:disabled, .gloss.primary:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* Quieter glass for secondary actions: same gel, drained of colour. */
.btn.ghost, .gloss.ghost {
  color: var(--ink-dim);
  border-color: rgba(255, 255, 255, 0.13);
  background:
    radial-gradient(120% 90% at 50% 130%, rgba(120, 190, 255, 0.22) 0%, rgba(120, 190, 255, 0) 62%),
    linear-gradient(180deg, #363c47 0%, #272c35 50%, #1c2027 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.34);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.btn.ghost::before, .gloss.ghost::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0));
}
.btn.ghost:hover, .gloss.ghost:hover { color: var(--ink); }

.btn.small { font-size: 12px; padding: 6px 12px; }

/* ---------- banner + modal ---------- */

.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding: 13px 18px;
  background: linear-gradient(180deg, #1a2740, #131b2e);
  border: 1px solid #33507d;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  color: #d5e9ff;
}

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 9, 11, 0.72); }
.modal-box {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.modal-box h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 0 0 12px;
  text-align: center;
  font-weight: 650;
}
.promo-choices { display: flex; gap: 8px; }
.promo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 76px;
  padding: 10px 6px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.promo-btn:hover { border-color: var(--accent); color: var(--ink); }
.promo-btn .pc { width: 44px; height: 44px; }

/* ---------- keyboard cursor ---------- */

.sq.cursor::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border: 3px solid #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  animation: cursor-pulse 1.5s ease-in-out infinite;
}
@keyframes cursor-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .sq.cursor::after { animation: none; }
}

.keyhint {
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.7;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.keyhint kbd {
  font: inherit;
  font-size: 10.5px;
  background: #14161a;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink-dim);
}
.keyhint .who { color: var(--ink-dim); font-weight: 600; }

/* ---------- start menu ---------- */

.menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 28px 20px;
}
.menu-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(0, 160, 255, 0.22), transparent 62%),
    radial-gradient(760px 520px at 14% 108%, rgba(0, 207, 255, 0.16), transparent 62%),
    linear-gradient(180deg, #0c1220 0%, #080a12 100%);
}
.menu-inner {
  position: relative;
  width: 100%;
  max-width: 430px;
  text-align: center;
}
.menu-inner:has(.screen.wide:not([hidden])) { max-width: 640px; }

.menu-head { margin-bottom: 26px; }
.menu-logo { width: 62px; height: 62px; margin: 0 auto 14px; }
.menu-logo.orb {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    inset 0 -12px 28px rgba(0, 220, 255, 0.6),
    0 0 40px rgba(0, 170, 255, 0.5);
}
/* Same top-to-bottom run as the orb: pale lavender, cyan core, deep blue base. */
.menu-title {
  margin: 0;
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(180deg,
    #f4f6ff 0%,
    #b3c6ff 20%,
    var(--aero-cyan) 46%,
    #1240f2 78%,
    #0a1cc0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 90, 220, 0.55));
}
.menu-title .sup {
  font-size: 24px;
  vertical-align: super;
  letter-spacing: 0;
}
.menu-tag {
  margin: 10px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
}

.screen-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  font-weight: 650;
  margin: 0 0 16px;
}

.stack { display: flex; flex-direction: column; gap: 10px; }

.gloss.xl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 15px 18px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 12px;
}
.gloss.xl .b-main { font-size: 17px; font-weight: 600; }
.gloss.xl .b-sub {
  font-size: 11.5px;
  font-weight: 400;
  opacity: 0.72;
  text-shadow: none;
}
.gloss.row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  font-size: 14px;
  border-radius: 10px;
}
.ico { width: 19px; height: 19px; flex: none; }
.ico.gear { stroke: currentColor; fill: none; transition: transform 0.25s ease; }
.gloss.row:hover .ico.gear { transform: rotate(30deg); }

.opt { text-align: left; margin-bottom: 4px; }
.opt-label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 6px;
  font-weight: 600;
}

/* ---------- settings ---------- */

.screen.wide { text-align: left; }
.set-block {
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 12px;
}
.set-block h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  margin: 0 0 11px;
  font-weight: 650;
}

.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-btn {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: none;
  padding: 6px;
  cursor: pointer;
  color: var(--ink-dim);
  font: inherit;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}
.theme-btn:hover { border-color: #4a505c; color: var(--ink); }
.theme-btn.on {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--accent);
}
.theme-swatch {
  width: 100%;
  height: 30px;
  border-radius: 5px;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.wheels { display: flex; gap: 18px; flex-wrap: wrap; }
.wheel { flex: 1 1 170px; min-width: 150px; }
.wheel-label {
  font-size: 11.5px;
  color: var(--ink-dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.wheel-disc {
  position: relative;
  margin: 0 auto 10px;
  border-radius: 50%;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.wheel-disc canvas { display: block; border-radius: 50%; }
.wheel-marker {
  position: absolute;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.75), 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.wheel-val {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
}
.wheel-val::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f2f2f2, #b9b9b9);
  border: 1px solid #16181c;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.wheel-val::-moz-range-thumb {
  width: 14px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f2f2f2, #b9b9b9);
  border: 1px solid #16181c;
}
.wheel-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.wheel-swatch {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
}
.wheel-hex {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 5px 7px;
  text-transform: lowercase;
}

.preview-wrap { margin-top: 14px; }
.preview-label {
  display: block;
  font-size: 11px;
  color: var(--ink-faint);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.preview {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border-radius: 7px;
  overflow: hidden;
  max-width: 340px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}
.preview .pv {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.preview .pv.light { background: var(--sq-light); }
.preview .pv.dark { background: var(--sq-dark); }
.preview .pc { width: 86%; height: 86%; }

/* ---------- rules sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px 18px;
}
.sheet-backdrop { position: absolute; inset: 0; background: rgba(6, 7, 9, 0.8); }
.sheet-box {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.65);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sheet-head h2 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 650;
}
.sheet-body { padding: 18px; overflow-y: auto; font-size: 13.5px; color: var(--ink-dim); }
.sheet-body .rules-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 26px; }
.sheet-body h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 6px;
}
.sheet-body h3 + p + h3 { margin-top: 16px; }
.sheet-body p { margin: 0 0 4px; }
.sheet-body ul { margin: 0; padding-left: 18px; }
.sheet-body li { margin-bottom: 5px; }
.sheet-body b { color: var(--ink); font-weight: 600; }
.rules-foot {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 12.5px;
}

.top-actions { display: flex; gap: 8px; }
.banner-actions { display: flex; gap: 8px; }

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .board-frame { max-width: 100%; }
  .actions { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 760px) {
  .sheet-body .rules-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* Four action buttons in a row start wrapping their labels below this. */
@media (max-width: 560px) {
  .actions { grid-template-columns: 1fr 1fr; }
  .field { flex-wrap: wrap; }
  .field .seg { max-width: none; }
  .menu-title { font-size: 40px; }
  .menu-title .sup { font-size: 19px; }
  .themes { grid-template-columns: repeat(2, 1fr); }
  .wheels { gap: 12px; }
  .banner { flex-direction: column; gap: 10px; }
}
