/* Chinese Checkers - single-screen, board-first. Brand-aligned with Game On
   Family. Chrome (header, pills, status, article, footer) follows
   apps/checkers/style.css; the settings sheet follows Timer's. */

:root {
  --gof-primary-dark: #157623;
  --gof-primary: #9bca3e;
  --gof-bg-light: #dde5ed;
  --gof-bg-mint: #defff0;
  --gof-accent: #ffb920;
  --gof-warm: #de6739;
  --text-primary: #2f2c28;
  --text-secondary: #5e5c5e;
  --card-bg: #ffffff;
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);

  /* Board */
  --star: #e9d7ab;
  --star-edge: #b99a5b;
  --hole: #b89a62;

  /* Marbles: base, highlight, edge */
  --m-red: #de6739;    --m-red-hi: #f4885c;    --m-red-lo: #a94a25;
  --m-blue: #2f6fd0;   --m-blue-hi: #6c9be6;   --m-blue-lo: #1d4a93;
  --m-yellow: #f2b705; --m-yellow-hi: #ffd85a; --m-yellow-lo: #b38600;
  --m-green: #2e9d47;  --m-green-hi: #64c97a;  --m-green-lo: #1d6a2f;
  --m-purple: #8a4fc6; --m-purple-hi: #b383e6; --m-purple-lo: #5d3091;
  --m-black: #34302b;  --m-black-hi: #6b655d;  --m-black-lo: #0f0d0b;

}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Arimo', sans-serif;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--gof-bg-light) 0%, var(--gof-bg-mint) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

[hidden] { display: none !important; }

/* ===== Shared header bar (per HEADER_SPECS) ===== */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 0.25rem;
  padding: 4px 0;
  gap: 12px;
  position: relative;
  z-index: 1100;
}

.header-left { flex: 1; min-width: 0; max-width: 85%; }
.header-right { flex-shrink: 0; min-width: 52px; }

.game-title-wrap { position: relative; display: inline-block; }

.game-title-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
}

.game-title-heading {
  margin: 0;
  font-family: 'League Spartan', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.game-title-chevron { font-size: 0.7rem; color: var(--text-secondary); }

.game-title-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 160px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.game-title-dropdown[aria-hidden="false"] { display: block; }

.game-nav-link {
  display: block;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid #e2e8f0;
}

.game-nav-link:last-child { border-bottom: none; }
.game-nav-link:hover { background: var(--gof-bg-mint); }

/* ===== Mode + difficulty pills ===== */
.mode-row,
.difficulty-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.difficulty-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.mode-btn,
.diff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 11px;
  min-height: 28px;
  font-family: 'Arimo', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  background: white;
  color: var(--text-secondary);
  border: 1.5px solid #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mode-btn:hover,
.diff-btn:hover {
  border-color: var(--gof-primary);
  background: var(--gof-bg-mint);
}

.mode-btn[aria-pressed="true"],
.diff-btn[aria-pressed="true"] {
  background: var(--gof-bg-mint);
  color: var(--gof-primary-dark);
  border-color: var(--gof-primary-dark);
  border-width: 2px;
  padding: 2px 10px;
}

/* ===== Tagline ===== */
.tagline {
  font-family: 'Trocchi', Georgia, serif;
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.35;
}

/* ===== Status area (fixed height: no layout shift) ===== */
.status-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
}

.turn-banner,
.win-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.turn-banner #turnText {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--gof-primary-dark);
}

.win-banner {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--gof-primary-dark);
}

.win-banner.is-loss { color: var(--text-primary); }
.win-banner.is-draw { color: var(--text-secondary); }

.turn-disc {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3), inset 0 2px 2px rgba(255, 255, 255, 0.25);
}

/* ===== Board ===== */
.board-wrap { display: flex; justify-content: center; width: 100%; }

.board {
  /* --bw / --bh: the board's size in board units, set per game by ui.js
     (13.5 x 15.36 for the full star; narrower with unused points removed).
     Width is capped by the screen width and by the height, so a narrow
     board grows its holes instead of running off the bottom. */
  --bw: 13.5;
  --bh: 15.36;
  --board-w: min(92vw, 500px, calc(72vh * var(--bw) / var(--bh)));
  position: relative;
  width: var(--board-w);
  aspect-ratio: var(--bw) / var(--bh);
  /* One board unit = the distance between neighboring holes. */
  --u: calc(var(--board-w) / var(--bw));
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.star {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Outlines underneath at double width, fills on top: the fill hides each
   outline's inner half and every seam, leaving a 0.08 edge outside. */
.star .star-edge polygon {
  fill: var(--star);
  stroke: var(--star-edge);
  stroke-width: 0.16;
  stroke-linejoin: round;
}

.star .star-fill polygon { fill: var(--star); }

.hole {
  position: absolute;
  width: calc(var(--u) * 0.94);
  height: calc(var(--u) * 0.94);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: pointer;
  /* The visible hole is drawn by ::before; the box is the tap target. */
}

.hole::before {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: var(--hole);
  box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.35);
}

/* Each seated point is tinted with its owner's color. */
.hole[data-tint]::before { inset: 22%; }
.hole[data-tint="red"]::before { background: color-mix(in srgb, var(--m-red) 45%, var(--hole)); }
.hole[data-tint="blue"]::before { background: color-mix(in srgb, var(--m-blue) 45%, var(--hole)); }
.hole[data-tint="yellow"]::before { background: color-mix(in srgb, var(--m-yellow) 55%, var(--hole)); }
.hole[data-tint="green"]::before { background: color-mix(in srgb, var(--m-green) 45%, var(--hole)); }
.hole[data-tint="purple"]::before { background: color-mix(in srgb, var(--m-purple) 45%, var(--hole)); }
.hole[data-tint="black"]::before { background: color-mix(in srgb, var(--m-black) 45%, var(--hole)); }

/* Where the player to move is headed: a ring in their color. */
.hole.target::after {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 2px dashed var(--ring, var(--gof-primary-dark));
  opacity: 0.85;
}
.board[data-turn="red"] { --ring: var(--m-red-lo); }
.board[data-turn="blue"] { --ring: var(--m-blue-lo); }
.board[data-turn="yellow"] { --ring: var(--m-yellow-lo); }
.board[data-turn="green"] { --ring: var(--m-green-lo); }
.board[data-turn="purple"] { --ring: var(--m-purple-lo); }
.board[data-turn="black"] { --ring: var(--m-black-lo); }

/* The path of the last move, so a CPU hop chain can be followed. */
.hole.trail::before {
  background: var(--gof-accent);
  box-shadow: 0 0 0 2px rgba(255, 185, 32, 0.45);
}

/* Legal destination marker */
.hole.legal::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: rgba(255, 185, 32, 0.95);
  border: 2px solid rgba(0, 0, 0, 0.3);
  z-index: 3;
  animation: legal-pop 0.15s ease-out;
}

/* Hints off: tapped a hole the marble can't reach. */
.hole.nope::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 3px solid var(--gof-warm);
  z-index: 3;
  animation: nope-shake 0.35s ease-in-out;
}

@keyframes nope-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes legal-pop {
  from { transform: scale(0.4); }
  to { transform: scale(1); }
}

/* ===== Marbles ===== */
.marble {
  position: absolute;
  width: calc(var(--u) * 0.8);
  height: calc(var(--u) * 0.8);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  transition: left 0.17s ease, top 0.17s ease, box-shadow 0.15s ease;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.3),
    0 2px 3px rgba(0, 0, 0, 0.35);
}

.marble.moving { z-index: 6; }

.marble.red, .turn-disc.red { background: radial-gradient(circle at 35% 30%, var(--m-red-hi), var(--m-red) 58%, var(--m-red-lo)); }
.marble.blue, .turn-disc.blue { background: radial-gradient(circle at 35% 30%, var(--m-blue-hi), var(--m-blue) 58%, var(--m-blue-lo)); }
.marble.yellow, .turn-disc.yellow { background: radial-gradient(circle at 35% 30%, var(--m-yellow-hi), var(--m-yellow) 58%, var(--m-yellow-lo)); }
.marble.green, .turn-disc.green { background: radial-gradient(circle at 35% 30%, var(--m-green-hi), var(--m-green) 58%, var(--m-green-lo)); }
.marble.purple, .turn-disc.purple { background: radial-gradient(circle at 35% 30%, var(--m-purple-hi), var(--m-purple) 58%, var(--m-purple-lo)); }
.marble.black, .turn-disc.black { background: radial-gradient(circle at 35% 30%, var(--m-black-hi), var(--m-black) 58%, var(--m-black-lo)); }

.marble.selected {
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.3),
    0 0 0 3px var(--gof-accent), 0 0 10px 3px rgba(255, 185, 32, 0.7);
  z-index: 5;
}

/* Before the first move: a soft pulse on the marbles that can move. */
.marble.movable { animation: movable-pulse 1.4s ease-in-out infinite; }

@keyframes movable-pulse {
  0%, 100% { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.3), 0 0 0 0 rgba(255, 185, 32, 0); }
  50% { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.3), 0 0 0 3px rgba(255, 185, 32, 0.8); }
}

/* ===== CTA slot ===== */
.play-actions {
  display: flex;
  width: 100%;
  max-width: 280px;
  justify-content: center;
  min-height: 48px;
}

.play-actions > button { flex: 1; }

.primary-btn,
.secondary-btn {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0.7rem 1.25rem;
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.primary-btn {
  background: var(--gof-primary-dark);
  color: white;
  border: 2px solid var(--gof-primary-dark);
  box-shadow: 0 3px 0 #0d4a16, 0 4px 12px rgba(21, 118, 35, 0.25);
}
.primary-btn:hover { background: #1a8d2a; }
.primary-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0d4a16; }

.secondary-btn {
  background: white;
  color: var(--text-secondary);
  border: 2px solid #cdd5dd;
}
.secondary-btn:hover { background: #f5f7fa; }

/* ===== Players card (Timer Game's players-card pattern) ===== */
.players-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 600px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 14px;
  min-height: 15rem;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.card-title {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
}

.gear-btn {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.gear-btn:active { transform: scale(0.92); }

.count-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.count-row--sheet { justify-content: flex-start; }

.count-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  min-width: 80px;
  text-align: center;
}

.step-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gof-primary-dark);
  background: white;
  color: var(--gof-primary-dark);
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.step-btn:hover:not([disabled]) { background: var(--gof-bg-mint); }
.step-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.customize-names-link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Arimo', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gof-primary-dark);
  text-decoration: underline;
  padding: 2px 10px;
}

.active-settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.settings-chip {
  appearance: none;
  background: none;
  border: 1.5px solid #c9cdd4;
  border-radius: 999px;
  padding: 5px 12px;
  font-family: 'Arimo', sans-serif;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.settings-chip:hover { border-color: var(--gof-primary-dark); color: var(--gof-primary-dark); }

.seat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.seat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  min-height: 32px;
  font-family: 'Arimo', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f5f7fa;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.seat-chip .turn-disc { width: 18px; height: 18px; }
.seat-chip:disabled { cursor: default; opacity: 0.8; }
.seat-chip:not(:disabled):hover { border-color: #cdd5dd; }

/* Who is up: the same green as the turn banner. */
.seat-chip.is-up {
  color: var(--gof-primary-dark);
  background: var(--gof-bg-mint);
  border-color: var(--gof-primary-dark);
}

.seat-chip.is-winner {
  color: var(--text-primary);
  background: #fff5d6;
  border-color: var(--gof-accent);
}

/* ===== Guest save nudge (line always reserved) ===== */
.save-nudge {
  min-height: 28px;
  margin-top: -0.4rem;
  text-align: center;
  visibility: hidden;
}

.save-nudge.is-shown { visibility: visible; }

.link-btn {
  background: none;
  border: none;
  font-family: 'Arimo', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gof-primary-dark);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

/* ===== Article ===== */
.article {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.quick-start {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 0.9rem 1rem;
}

.quick-start h2 {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.quick-start p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.quick-start strong { color: var(--text-primary); }

.article-section {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.article-section__head {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
}

.article-section__head::-webkit-details-marker { display: none; }

.article-section__head h2 {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.article-chevron {
  font-size: 0.7rem;
  color: var(--text-secondary);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.article-section[open] .article-chevron { transform: rotate(180deg); }

.article-body {
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.article-body h3 {
  font-family: 'League Spartan', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.9rem 0 0.35rem;
}

.article-body h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.7rem 0 0.2rem;
}

.article-body p { margin-bottom: 0.5rem; }

.article-body ul,
.article-body ol {
  padding-left: 1.2rem;
  margin-bottom: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.article-body strong { color: var(--text-primary); }

/* ===== Settings / help sheet (Timer's sheet) ===== */
.settings-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(47, 44, 40, 0.55);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.settings-sheet {
  background: white;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-sheet-title {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
}

.setup-section { display: flex; flex-direction: column; gap: 8px; }

.setup-label {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sheet-name-fields { display: flex; flex-direction: column; gap: 8px; }

.rule-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-secondary);
  cursor: pointer;
}

.rule-row input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--gof-primary-dark);
}

.rule-row strong { color: var(--text-primary); }

.setup-hint { font-size: 0.78rem; color: var(--text-secondary); }

.cc-sheet-row { display: flex; align-items: center; gap: 10px; }

.cc-sheet-row input {
  flex: 1;
  font-family: 'Arimo', sans-serif;
  font-size: 1rem;
  padding: 8px 10px;
  border: 1.5px solid #cdd5dd;
  border-radius: 8px;
}

.cc-sheet-row input:focus { outline: none; border-color: var(--gof-primary-dark); }

.settings-sheet-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.account-save-btn {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--gof-accent);
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
}

.cc-help-list {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--gof-primary-dark);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover { text-decoration: underline; }

/* ===== Mobile ===== */
@media (max-width: 360px) {
  .turn-banner #turnText { font-size: 1.15rem; }
  .win-banner { font-size: 1.3rem; }
}
