:root {
  --ink: #20263d;
  --muted: #70778d;
  --paper: #f6f1e7;
  --panel: #fffdf8;
  --board: #dca95f;
  --board-dark: #9b6530;
  --red: #ef654f;
  --red-dark: #b9362b;
  --blue: #4a56b8;
  --blue-dark: #26318f;
  --gold: #f4bb45;
  --hole-darkness: .46;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(239, 101, 79, .09), transparent 25%),
    radial-gradient(circle at 88% 82%, rgba(74, 86, 184, .11), transparent 28%),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.dragging-board-json::after {
  content: "Drop board JSON to load";
  position: fixed;
  z-index: 40;
  inset: 1rem;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(244, 187, 69, .95);
  border-radius: 14px;
  color: white;
  background: rgba(32, 38, 61, .72);
  font-size: clamp(1.1rem, 4vw, 2rem);
  font-weight: 850;
  pointer-events: none;
}

button, select { font: inherit; }

.game-shell {
  width: min(1180px, 94vw);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  padding: 3rem 0;
}

.intro { max-width: 390px; }
.eyebrow {
  margin: 0 0 .65rem;
  color: var(--red-dark);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .19em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.6rem, 7vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -.07em;
  line-height: .76;
}

h1 span { color: var(--red); font-style: italic; }
.lede { margin: 2rem 0; color: var(--muted); font-size: 1.02rem; line-height: 1.7; }

.controls { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.controls label,
.settings-content label { grid-column: 1 / -1; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.settings-panel {
  display: grid;
  grid-column: 1 / -1;
}
.settings-panel > summary {
  min-height: 48px;
  display: grid;
  align-items: center;
  padding: 0 1.2rem;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #ded7c9;
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}
.settings-panel > summary:hover { transform: translateY(-1px); }
.settings-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: .45rem;
  margin-top: .85rem;
}
.settings-search {
  display: grid;
  gap: .35rem;
  padding: .65rem;
  border: 1px solid rgba(217, 208, 191, .88);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
}
.settings-search span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.settings-search input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid #ded7c9;
  border-radius: 10px;
  padding: 0 .85rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}
.settings-search input:focus {
  outline: 3px solid rgba(241, 175, 48, .28);
  border-color: #c9891a;
}
.settings-filter-hidden {
  display: none !important;
}
.settings-group {
  display: grid;
  grid-column: 1 / -1;
  border: 1px solid #d9d0bf;
  border-radius: 8px;
  background: rgba(255, 255, 255, .66);
  overflow: hidden;
}
.settings-group[hidden] {
  display: none;
}
.settings-group[open] {
  grid-template-columns: 1fr;
  align-items: stretch;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 8px 20px rgba(40, 31, 17, .08);
}
.settings-group > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: 0 .85rem 0 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, .74);
  font-size: .82rem;
  font-weight: 850;
  cursor: pointer;
  border-left: 5px solid transparent;
  list-style-position: inside;
}
.settings-group[open] > summary {
  min-height: 42px;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
  border-left-color: var(--gold);
  border-right: 0;
  border-bottom: 1px solid #d9d0bf;
  background: #fff8e8;
  box-shadow: inset 0 -8px 14px rgba(102, 69, 24, .04);
}
.settings-group > summary:hover {
  background: rgba(255, 255, 255, .92);
}
.settings-group[open] > summary:hover {
  background: #fff8e8;
}
.settings-group[open] > :not(summary) {
  grid-column: 1;
  grid-row: auto;
}
.settings-group-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  padding: .75rem;
}
.settings-group-content > button,
.settings-group-content > select,
.settings-group-content .difficulty-row select {
  width: 100%;
}
.difficulty-row { grid-column: 1 / -1; display: grid; gap: .45rem; }
.difficulty-row[hidden] { display: none; }
.setting-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 40px;
  padding: .2rem .1rem;
  color: var(--ink) !important;
  font-size: .84rem !important;
  font-weight: 750 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  cursor: pointer;
}
.setting-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}
.free-placement-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  padding: .7rem;
  border: 1px solid #ded7c9;
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.free-placement-controls[hidden] { display: none; }
.free-placement-controls label {
  grid-column: 1 / -1;
}
.free-placement-controls select,
.free-placement-controls #start-custom-jumps {
  grid-column: 1 / -1;
}
.free-placement-controls button,
.free-placement-controls select {
  min-height: 42px;
}
.color-setting {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .6rem;
  min-height: 44px;
  padding: .35rem .75rem;
  border: 1px solid #ded7c9;
  border-radius: 999px;
  background: #fff;
}
.color-setting label {
  grid-column: auto;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}
.color-setting input {
  width: 34px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.range-setting {
  grid-column: 1 / -1;
  display: grid;
  gap: .45rem;
  min-height: 54px;
  padding: .55rem .75rem;
  border: 1px solid #ded7c9;
  border-radius: 8px;
  background: #fff;
}
.range-setting label {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}
.range-setting input {
  width: 100%;
  accent-color: var(--ink);
  cursor: pointer;
}
.save-setting {
  grid-column: 1 / -1;
  display: grid;
  gap: .55rem;
  padding: .75rem;
}
.save-subsection > summary {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 .65rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, .78);
  border-left: 4px solid transparent;
}
.save-subsection {
  display: grid;
  gap: .55rem;
  min-width: 0;
  padding: .5rem;
  border: 1px solid rgba(222, 215, 201, .86);
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
  overflow: hidden;
}
.save-subsection[open] > summary {
  border-left-color: var(--ink);
  background: #fff;
}
.save-subsection[open] {
  padding-bottom: .65rem;
}
.save-subsection button,
.save-subsection select,
.save-subsection input[type="number"],
.save-subsection textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.save-subsection textarea {
  resize: vertical;
  min-height: 142px;
  border: 1px solid #ded7c9;
  border-radius: 8px;
  padding: .75rem;
  color: var(--ink);
  background: #fff;
  font: 700 .82rem/1.4 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
  text-transform: none;
}
.save-subsection textarea:focus {
  outline: 3px solid rgba(241, 175, 48, .28);
  border-color: #c9891a;
}
.save-subsection select {
  display: block;
  min-height: 46px;
  padding-right: 2.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.save-subsection small {
  display: block;
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.json-export-option {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 34px;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.json-export-option input {
  width: 17px;
  height: 17px;
  accent-color: var(--ink);
}
.json-move-limit {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.json-move-limit input {
  min-height: 42px;
  border: 1px solid #ded7c9;
  border-radius: 999px;
  padding: 0 .9rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
}
.json-move-limit input:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.animation-setting {
  grid-column: 1 / -1;
  display: grid;
}
.animation-setting[hidden] { display: none; }
.animation-setting span {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
}
.animation-setting small {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}
.animation-setting button {
  width: 100%;
}
.animation-option {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 32px;
}
.animation-delay-setting,
.animation-progress-setting {
  display: grid;
  gap: .35rem;
}
.animation-delay-setting span,
.animation-progress-setting span {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}
.animation-delay-setting b,
.animation-progress-setting b {
  color: var(--muted);
  font-size: .76rem;
}
.animation-delay-setting input:disabled,
.animation-progress-setting input:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.move-export-setting label {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.move-export-setting .move-export-filter {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 34px;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.move-export-filter input {
  width: 17px;
  height: 17px;
  accent-color: var(--ink);
}
.move-export-setting input {
  min-height: 42px;
  border: 1px solid #ded7c9;
  border-radius: 999px;
  padding: 0 .9rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
}
.online-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  padding: .7rem;
  border: 1px solid #ded7c9;
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.online-controls span {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
}
.online-controls input {
  min-height: 42px;
  border: 1px solid #ded7c9;
  border-radius: 999px;
  padding: 0 .9rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
}
.online-controls #google-login,
.online-controls #google-logout,
.online-controls #play-online-now,
.online-controls #leave-online-room {
  grid-column: 1 / -1;
}
.schedule-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  padding: .7rem;
  border: 1px solid #ded7c9;
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.schedule-controls span,
.schedule-controls button {
  grid-column: 1 / -1;
}
.schedule-controls span {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
}
.schedule-controls input {
  min-height: 42px;
  border: 1px solid #ded7c9;
  border-radius: 999px;
  padding: 0 .9rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
}
select,
button {
  min-height: 48px;
  height: auto;
  padding: .72rem 1.15rem;
  font-weight: 750;
  line-height: 1.15;
}
button {
  position: relative;
  border: 1px solid rgba(32, 38, 61, .18);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  letter-spacing: .01em;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
button:disabled {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
  box-shadow: none;
}
select {
  color: var(--ink);
  background: #fff;
  border: 1px solid #ded7c9;
  border-radius: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.primary {
  color: white;
  background: linear-gradient(180deg, #2d344f 0%, #171d32 100%);
  border-color: #0f1426;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.16),
    0 4px 0 #0d1222,
    0 10px 18px rgba(32, 38, 61, .18);
}
.secondary {
  color: var(--ink);
  background: linear-gradient(180deg, #ffd36d 0%, #f1af30 100%);
  border-color: #c9891a;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.42),
    0 4px 0 #bd7c12,
    0 9px 16px rgba(122, 81, 22, .18);
}
button:not(:disabled):hover {
  transform: translateY(-2px);
  filter: saturate(1.04);
}
button:not(:disabled):active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.2),
    0 1px 0 rgba(32, 38, 61, .25),
    0 4px 10px rgba(32, 38, 61, .12);
}

.color-choices { display: grid; gap: .55rem; margin-top: 1.25rem; }
.color-choice { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 1.15fr); align-items: center; gap: .75rem; }
.color-choice label { color: var(--muted); font-size: .82rem; font-weight: 750; }
.color-choice select { min-height: 40px; padding: 0 .8rem; }

.legend { display: flex; flex-wrap: wrap; gap: .7rem 1.25rem; margin-top: 1.5rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.legend span { display: flex; align-items: center; gap: .45rem; }
.legend i { width: 11px; height: 11px; border-radius: 50%; }

.board-panel {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  padding-bottom: 4.75rem;
}
.status-card {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .75rem;
  width: min(440px, 100%);
  min-width: 0;
  /* Reserve a stable HUD area so status changes never reposition the board. */
  height: 11rem;
  margin-bottom: 2rem;
  padding: .75rem 1rem;
  border: 1px solid rgba(32, 38, 61, .08);
  border-radius: 15px;
  background: rgba(255, 253, 248, .88);
  box-shadow: 0 10px 35px rgba(54, 44, 24, .1);
  backdrop-filter: blur(8px);
}
.status-card > div {
  flex: 1;
  min-width: 0;
  max-height: 100%;
  overflow: auto;
  overflow-wrap: anywhere;
}
.status-card > .turn-dot { flex-shrink: 0; }
.status-card small { display: block; margin-bottom: .12rem; color: var(--muted); }
.status-card strong { font-size: .9rem; }
.turn-count {
  display: block;
  margin-top: .2rem;
  color: var(--ink);
  font-size: .76rem;
  font-weight: 800;
}
.race-progress {
  display: block;
  margin-top: .18rem;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 750;
}
.thinking-progress {
  display: grid;
  gap: .28rem;
  margin-top: .42rem;
  min-width: 170px;
}
.thinking-progress[hidden] {
  display: none;
}
.thinking-progress-label {
  color: var(--ink);
  font-size: .72rem;
  font-weight: 850;
}
.thinking-progress-track {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 38, 61, .12);
  box-shadow: inset 0 0 0 1px rgba(32, 38, 61, .08);
}
.thinking-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #ef654f);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}
.turn-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 5px rgba(0,0,0,.05); }
.turn-dot.red { background: var(--red); }
.turn-dot.blue { background: var(--blue); }

.board {
  position: relative;
  width: min(680px, 90vw);
  aspect-ratio: 1 / 1.04;
  filter: drop-shadow(0 26px 30px rgba(76, 50, 20, .22));
  --star-shape: polygon(50% .8%, 64.6% 24.4%, 99.7% 24.4%, 82.7% 49.5%, 99.7% 74.6%, 64.6% 74.6%, 50% 99.2%, 35.4% 74.6%, .3% 74.6%, 17.3% 49.5%, .3% 24.4%, 35.4% 24.4%);
}
.finish-jump-board {
  position: absolute;
  left: 50%;
  bottom: 1.15rem;
  z-index: 6;
  min-width: 180px;
  margin: 0;
  transform: translateX(-50%);
  box-shadow: 0 9px 22px rgba(122, 81, 22, .22);
}
.finish-jump-board:not(:disabled):hover {
  transform: translateX(-50%) translateY(-2px);
}
.finish-jump-board:not(:disabled):active {
  transform: translateX(-50%) translateY(2px);
}
.import-info-bar {
  width: min(620px, 96vw);
  min-height: 36px;
  margin-top: .85rem;
  padding: .55rem .85rem;
  border: 1px solid rgba(32, 38, 61, .12);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 253, 248, .9);
  box-shadow: 0 8px 22px rgba(54, 44, 24, .08);
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
}
.import-info-bar[hidden] { display: none; }
.board::before {
  content: "";
  position: absolute;
  inset: -3.8% -4.8%;
  background:
    linear-gradient(rgba(246, 214, 151, .18), rgba(148, 88, 34, .12)),
    var(--board-texture-url, url("chineseCheckers.jpg")) center / cover;
  clip-path: var(--star-shape);
}
.board::after {
  content: "";
  position: absolute;
  inset: -3.8% -4.8%;
  clip-path: var(--star-shape);
  border: 1px solid rgba(91, 55, 18, .18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), inset 0 -18px 26px rgba(89, 55, 20, .08);
  pointer-events: none;
}

.hole {
  position: absolute;
  z-index: 2;
  width: clamp(19px, 3.85vw, 31px);
  aspect-ratio: 1;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 38% 30%, rgba(188, 132, 64, .5) 0 24%, rgba(111, 69, 28, .58) 72%, rgba(66, 39, 15, .78) 100%),
    linear-gradient(rgba(80, 47, 18, var(--hole-darkness)), rgba(80, 47, 18, var(--hole-darkness))),
    var(--board-texture-url, url("chineseCheckers.jpg")) center / 280%;
  box-shadow:
    inset 0 4px 7px rgba(67, 37, 10, .52),
    inset 0 -2px 3px rgba(255, 226, 166, .18),
    0 1px 0 rgba(255,255,255,.45);
  transition: transform .14s ease, box-shadow .14s ease;
}
button.hole:disabled {
  opacity: 1;
  transform: translate(-50%, -50%);
  box-shadow:
    inset 0 4px 7px rgba(67, 37, 10, .52),
    inset 0 -2px 3px rgba(255, 226, 166, .18),
    0 1px 0 rgba(255,255,255,.45);
}
button.hole:not(:disabled):hover,
.hole:hover {
  transform: translate(-50%, -50%) scale(1.08);
  filter: none;
}
button.hole:not(:disabled):active {
  transform: translate(-50%, -50%) scale(1.02);
}
.hole.piece {
  width: clamp(21px, 4.25vw, 34px);
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,.9) 0 7%, transparent 8%),
    radial-gradient(circle at 38% 30%, var(--piece-light) 0 18%, var(--piece-color) 46%, var(--piece-dark) 100%);
  box-shadow:
    inset 0 4px 5px rgba(255,255,255,.26),
    inset 0 -7px 10px rgba(0,0,0,.28),
    0 0 0 1px rgba(32,38,61,.2),
    0 7px 10px rgba(48, 31, 12, .28);
}
.hole.piece-red { background: radial-gradient(circle at 36% 29%, #ffb0a0 0 8%, var(--red) 35%, var(--red-dark) 100%); }
.hole.piece-blue { background: radial-gradient(circle at 36% 29%, #a8b0ff 0 8%, var(--blue) 35%, var(--blue-dark) 100%); }
.hole.piece-red,
.hole.piece-blue {
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,.88) 0 7%, transparent 8%),
    radial-gradient(circle at 38% 30%, var(--piece-light) 0 18%, var(--piece-color) 46%, var(--piece-dark) 100%);
}
.hole.piece-in-motion {
  width: clamp(19px, 3.85vw, 31px);
  background:
    radial-gradient(circle at 38% 30%, rgba(188, 132, 64, .5) 0 24%, rgba(111, 69, 28, .58) 72%, rgba(66, 39, 15, .78) 100%),
    linear-gradient(rgba(80, 47, 18, var(--hole-darkness)), rgba(80, 47, 18, var(--hole-darkness))),
    var(--board-texture-url, url("chineseCheckers.jpg")) center / 280%;
  box-shadow: inset 0 4px 7px rgba(67, 37, 10, .52), 0 1px 0 rgba(255,255,255,.45);
}
.placement-ghost {
  position: fixed;
  z-index: 30;
  width: clamp(24px, 4vw, 36px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  opacity: .9;
  transform: translate(12px, 12px);
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,.9) 0 7%, transparent 8%),
    radial-gradient(circle at 38% 30%, var(--piece-light) 0 18%, var(--piece-color) 46%, var(--piece-dark) 100%);
  box-shadow:
    inset 0 4px 5px rgba(255,255,255,.26),
    inset 0 -7px 10px rgba(0,0,0,.28),
    0 0 0 1px rgba(32,38,61,.18),
    0 8px 14px rgba(48, 31, 12, .24);
}
.placement-ghost[hidden] { display: none; }
.hole.selected { z-index: 3; transform: translate(-50%, -50%) scale(1.17); outline: 4px solid rgba(255,255,255,.85); }
.replay-animation .hole { transition: none; }
.hole.piece.chain-raised {
  z-index: 4;
  transform: translate(-50%, calc(-50% - 8px));
  box-shadow: inset 0 4px 5px rgba(255,255,255,.26), inset 0 -7px 10px rgba(0,0,0,.28), 0 10px 14px rgba(48,43,94,.34);
}
.hole.legal {
  box-shadow:
    0 0 0 6px rgba(255,255,255,.95),
    0 0 0 12px rgba(255,255,255,.22),
    inset 0 4px 7px rgba(67, 37, 10, .52),
    inset 0 -2px 3px rgba(255, 226, 166, .18);
  animation: legal-ring-pulse 1.15s ease-in-out infinite;
}
@keyframes legal-ring-pulse {
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow:
      0 0 0 8px rgba(255,255,255,1),
      0 0 0 16px rgba(255,255,255,.14),
      inset 0 4px 7px rgba(67, 37, 10, .52),
      inset 0 -2px 3px rgba(255, 226, 166, .18);
  }
}

.moving-piece {
  position: absolute;
  z-index: 10;
  width: clamp(21px, 4.25vw, 34px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.moving-marble {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,.9) 0 7%, transparent 8%),
    radial-gradient(circle at 38% 30%, var(--piece-light, #a8b0ff) 0 18%, var(--piece-color, var(--blue)) 46%, var(--piece-dark, var(--blue-dark)) 100%);
  box-shadow: inset 0 4px 5px rgba(255,255,255,.26), inset 0 -7px 10px rgba(0,0,0,.28), 0 10px 14px rgba(48, 43, 94, .34);
}

.hint { margin: -.4rem 0 0; color: var(--muted); font-size: .8rem; }
.modal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 1.5rem; background: rgba(32,38,61,.48); backdrop-filter: blur(8px); }
.modal[hidden] { display: none; }
.modal-card { width: min(410px, 100%); padding: 3rem; text-align: center; border-radius: 28px; background: var(--panel); box-shadow: 0 25px 80px rgba(0,0,0,.25); }
.modal-card h2 { margin: .5rem 0; font: 500 2.5rem Georgia, serif; }
.modal-card p:not(.eyebrow) { margin: 0 0 1.5rem; color: var(--muted); }
.matchmaking-card h2 { font-size: 2.15rem; }
.matchmaking-card #matchmaking-elapsed {
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 850;
}

@media (max-width: 850px) {
  .game-shell { grid-template-columns: 1fr; gap: 1rem; padding: 2rem 0; }
  .intro { max-width: none; text-align: center; }
  h1 { font-size: clamp(3.5rem, 15vw, 5.8rem); }
  .lede { max-width: 560px; margin: 1.5rem auto; }
  .controls { max-width: 460px; margin: auto; }
  .legend { justify-content: center; }
  .board { width: min(680px, 96vw); }
  .status-card { width: min(440px, 96vw); }
}

.animation-transport {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
  gap: .4rem;
}
.animation-transport > button { min-width: 0; padding-inline: .3rem; }
#animation-previous-move, #animation-next-step { font-size: 1.4rem; }

.race-lead { display: block; margin-top: .3rem; color: var(--ink); font-size: .95rem; font-weight: 850; }
.race-lead[hidden] { display: none; }

.board-draw-stage { position: relative; }
.starter-draw { position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem; }
.starter-draw[hidden] { display: none; }
.starter-coin-scene { --coin-lift: -100px; position: relative; perspective: 900px; width: 180px; height: 260px; max-width: 45%; isolation: isolate; }
.starter-coin-scene::before { content: ''; position: absolute; left: 5%; bottom: 20px; width: 90%; height: 30px; border-radius: 50%; background: #241700; opacity: .38; filter: blur(5px); transform: scale(.9); }
.starter-coin-scene:has(.flipping)::before { animation: starter-coin-shadow 2.4s linear forwards; }
.starter-coin { position: absolute; bottom: 25px; width: 100%; aspect-ratio: 1; transform-style: preserve-3d; }
.starter-coin-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1.2rem; border-radius: 50%; border: 8px double #9c6617; background: radial-gradient(circle at 30% 25%, #fff1ae, #f9c54e 55%, #c58b26); color: #47300e; box-shadow: inset 0 0 0 3px #ffe6a0, inset 0 -8px 12px #80510d66, 0 3px 0 #85550f; font-size: 1.15rem; font-weight: 850; text-align: center; backface-visibility: hidden; transform: translateZ(3px); text-shadow: 0 1px #fff4bf; }
.starter-coin-back { transform: rotateY(180deg) translateZ(3px); }
.starter-coin.flipping { animation: starter-coin-flip 2.4s linear forwards; }
.starter-coin.flipping .starter-coin-face { animation: starter-coin-glint 2.4s linear forwards; }
.starter-draw p { margin: 0; padding: .7rem 1.2rem; border-radius: 12px; background: #fff8e9; color: #332710; font-weight: 800; text-align: center; }
@keyframes starter-coin-flip {
  0% { transform: translate3d(0, 34px, 0) rotateX(65deg) rotateY(0deg) rotateZ(-12deg) scale(.85); animation-timing-function: cubic-bezier(.16,.65,.35,1); }
  42% { transform: translate3d(-12px, var(--coin-lift), 110px) rotateX(-15deg) rotateY(720deg) rotateZ(12deg) scale(1.06); animation-timing-function: cubic-bezier(.55,0,.85,.4); }
  76% { transform: translate3d(0, 34px, 0) rotateX(65deg) rotateY(var(--coin-end)) rotateZ(0deg) scale(.85); animation-timing-function: ease-out; }
  85% { transform: translate3d(0, -4px, 20px) rotateX(15deg) rotateY(var(--coin-end)) rotateZ(-5deg) scale(.96); animation-timing-function: ease-in; }
  93% { transform: translate3d(0, 12px, 0) rotateX(-8deg) rotateY(var(--coin-end)) rotateZ(2deg); }
  100% { transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(var(--coin-end)) rotateZ(0deg); }
}
@keyframes starter-coin-shadow {
  0%, 76% { transform: scale(.9); opacity: .42; filter: blur(4px); }
  42% { transform: translateX(12px) scale(1.5); opacity: .12; filter: blur(14px); }
  85% { transform: scale(1.15); opacity: .23; filter: blur(9px); }
  100% { transform: scale(1); opacity: .32; filter: blur(6px); }
}
@keyframes starter-coin-glint {
  0%, 76%, 100% { filter: brightness(1) blur(0); }
  16%, 58% { filter: brightness(1.18) blur(.65px); }
  42% { filter: brightness(1.08) blur(0); }
}
@media (max-width: 480px) { .starter-coin-scene { --coin-lift: -55px; width: 150px; height: 220px; } .starter-coin-face { font-size: 1rem; padding: .8rem; } }
@media (prefers-reduced-motion: reduce) {
  .starter-coin.flipping { animation: none; transform: rotateY(var(--coin-end)); }
  .starter-coin-scene:has(.flipping)::before, .starter-coin.flipping .starter-coin-face { animation: none; }
}

.learn-link {
  display: block;
  padding: .85rem 1rem;
  border: 1px solid #c9891a;
  border-radius: 10px;
  font: inherit;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: transform .14s ease, filter .14s ease;
}
.learn-link:hover { transform: translateY(-2px); filter: saturate(1.04); }
.learn-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.learn-link:active { transform: translateY(2px); }
.game-history-controls { display: grid; gap: 8px; min-width: 0; padding-top: 12px; border-top: 1px solid #d9d3c8; }
.game-history-controls[hidden] { display: none; }
.game-history-controls output { font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.history-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.history-buttons button { min-width: 0; min-height: 42px; padding: 6px; font-size: 22px; }

/* Header menus float independently of board/document layout. */
.game-shell > .intro { display: none; }
.app-header { position: sticky; top: 0; z-index: 30; background: #ffffff; border-bottom: 1px solid #d9dce1; }
.modal { z-index: 50; }
.header-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; max-width: 1440px; margin: auto; padding: 24px 24px 12px; }
.app-brand { display: flex; align-items: center; gap: 22px; font: 500 60px/.98 Georgia, 'Times New Roman', serif; letter-spacing: 0; min-width: 0; max-width: 100%; margin: 0; color: #20263d; }
.app-brand .brand-star { display: block; flex: 0 0 88px; width: 88px; height: 102px; }
.app-brand .brand-wordmark { min-width: 0; font-style: normal; color: inherit; }
.app-brand .brand-line { display: block; font-style: normal; color: inherit; }
.app-brand .brand-checkers { display: block; padding-bottom: 5px; font-style: italic; color: #ef654f; }
.menu-icon { display: inline-flex; flex: 0 0 18px; width: 18px; height: 18px; color: #526d70; }
.menu-icon svg { display: block; width: 100%; height: 100%; stroke-width: 1.8; }
.header-menu > summary { display: flex; align-items: center; gap: 7px; font-family: 'Segoe UI', sans-serif; white-space: nowrap; }
.header-menu[open] > summary .menu-icon { color: #bc4137; }
.header-menus { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; max-width: 1440px; margin: auto; padding: 4px 16px 8px; }
.header-menus .header-menu,
.header-menus .header-menu[open] { display: block; flex: 0 0 auto; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.header-menus .header-menu[hidden] { display: none; }
.header-menu > summary,
.header-menu[open] > summary { min-height: 38px; padding: 8px 10px; border: 0; border-radius: 4px; font-size: 14px; font-weight: 650; background: transparent; box-shadow: none; list-style: none; }
.header-menu > summary::-webkit-details-marker { display: none; }
.header-menu > summary::after { content: '\25BE'; margin-left: 5px; font-size: 11px; color: #747981; }
.header-menu > summary:hover,
.header-menu[open] > summary { background: #eef1f3; color: #161c24; transform: none; }
.header-menu > summary:focus-visible { outline: 2px solid #276b71; outline-offset: 1px; }
.header-menu-panel { position: fixed; z-index: 16; width: min(380px, calc(100vw - 16px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 8px; background: white; border: 1px solid #cdd2d7; border-radius: 6px; box-shadow: 0 12px 30px #20283026; text-align: left; }
.header-menu:not([open]) > .header-menu-panel { display: none; }
.header-menu-panel > div { min-width: 0; }
.header-menu-panel :is(.settings-group-content,.save-setting,.online-controls,.schedule-controls) { padding: 4px; gap: 10px; }
.header-menu-panel .save-subsection { display: block; border: 0; border-bottom: 1px solid #e5e8ea; border-radius: 0; padding: 4px 0; background: none; }
.header-menu-panel .save-subsection > summary { border: 0; padding: 8px; min-height: 40px; border-radius: 3px; background: none; font-weight: 650; }
.header-menu-panel .save-subsection > summary::after { content: '\25BE'; margin-left: auto; }
.header-menu-panel .save-subsection[open] > summary { background: #f1f4f5; margin-bottom: 8px; }
.header-menu-panel .save-subsection > :not(summary) { margin-block: 4px; }
.header-menu-panel :is(button,.learn-link) { display: block; width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid #d9dfe2; border-radius: 4px; background: #f6f8f9; color: #202830; box-shadow: none; text-align: left; font-size: 14px; font-weight: 600; line-height: 1.35; letter-spacing: 0; text-decoration: none; }
.header-menu-panel :is(button,.learn-link):hover { background: #eaf1f2; transform: none; filter: none; box-shadow: none; }
.header-menu-panel button:active { transform: none; box-shadow: none; }
.header-menu-panel [hidden] { display: none !important; }
.header-menu-panel :is(select,input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),textarea) { max-width: 100%; min-width: 0; width: 100%; border: 1px solid #cdd4d9; border-radius: 4px; padding: 8px; min-height: 38px; font: inherit; font-size: 14px; }
.header-menu-panel label { font-size: 13px; font-weight: 550; letter-spacing: 0; text-transform: none; }
.header-menu-panel :is(.color-setting,.range-setting) { border-radius: 4px; }
.header-menu-panel .color-choices { margin-top: 0; }
.header-menu-panel .legend { margin-top: 0; }
.header-menu-panel .animation-transport > button { text-align: center; }
.header-search { position: relative; width: min(260px, 45%); min-width: 0; }
.header-search .settings-search { display: block; margin: 0; padding: 0; border: 0; background: none; }
.header-search .settings-search > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.header-search input { width: 100%; min-height: 34px; border-radius: 4px; padding: 6px 10px; font-size: 13px; }
.header-search-results { position: absolute; z-index: 18; top: 100%; right: 0; width: min(380px, calc(100vw - 24px)); max-height: 60vh; overflow: auto; padding: 8px; background: white; border: 1px solid #cdd4d9; border-radius: 4px; box-shadow: 0 8px 24px #20283026; }
.header-search-results[hidden] { display: none; }
.header-search-results button { display: block; width: 100%; border: 0; border-radius: 3px; padding: 10px; min-height: 40px; font-size: 13px; text-align: left; background: white; box-shadow: none; transform: none; }
.header-search-results button:hover { background: #eef3f4; transform: none; }
.game-shell { width: 100%; min-height: 0; display: block; padding: 18px 12px 0; margin: 0; }
.game-shell .board-panel { padding-bottom: 28px; }
.game-shell .status-card { width: min(620px, 94vw); height: 132px; margin-bottom: 36px; padding: 10px 16px; border-radius: 6px; box-shadow: none; }
.game-shell .status-card :is(small,span,strong) { line-height: 1.3; }
.game-shell .board { width: min(760px, 86vw, max(300px, calc(100dvh - 400px))); }
.game-shell .import-info-bar { max-width: min(680px,94vw); margin-top: 8px; }
.game-shell .finish-jump-board { bottom: 12px; }
.game-footer { padding: 8px 16px 20px; }
.game-footer .game-history-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; padding-top: 8px; border: 0; }
.game-footer .game-history-controls[hidden] { display: none; }
.game-footer .history-buttons { grid-template-columns: repeat(5,42px); gap: 6px; }
.game-footer button { min-height: 40px; border-radius: 4px; background: #fff; color: #202830; border: 1px solid #cdd4d9; box-shadow: none; letter-spacing: 0; transform: none; }
.game-footer button:hover { background: #edf3f3; transform: none; }
.game-footer #history-continue { font-size: 13px; padding: 8px 12px; }
.game-footer .history-progress { order: 1; flex: 0 0 100%; width: 100%; min-width: 0; height: 24px; margin: 0; padding: 0; accent-color: #c33f35; cursor: pointer; }
.game-footer .game-history-controls { max-width: 560px; margin-inline: auto; }
.game-footer .history-progress:disabled { cursor: default; }
.hole-coordinate { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; pointer-events: none; white-space: nowrap; font: 600 10px/1 monospace; letter-spacing: 0; color: #fff; text-shadow: 0 1px 2px #000, 0 -1px 2px #000, 1px 0 2px #000, -1px 0 2px #000; z-index: 2; }
.show-hole-coordinates .hole-coordinate { display: flex; }
@media (max-width: 600px) { .hole-coordinate { font-size: 7px; } }
@media (max-width: 600px) {
  .header-top { padding: 18px 12px 8px; gap: 12px; }
  .app-brand { font-size: 38px; width: 100%; gap: 12px; line-height: 1.04; }
  .app-brand .brand-star { flex-basis: 48px; width: 48px; height: 56px; }
  .menu-icon { width: 16px; height: 16px; flex-basis: 16px; }
  .header-menus { padding: 4px 6px 6px; gap: 0; }
  .header-menu > summary, .header-menu[open] > summary { font-size: 12px; min-height: 38px; padding: 7px 8px; gap: 5px; }
  .game-shell { padding-top: 12px; }
  .game-shell .board { width: min(86vw, 600px); }
  .game-shell .status-card { height: 142px; }
  .game-footer .game-history-controls { gap: 8px; }
}
