/* Checkers - single-screen, board-first. Brand-aligned with Game On Family. */

: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 */
  --board-light: #f1e7c8;
  --board-dark: #43763e;
  --board-frame: #2b3b22;

  /* Pieces */
  --piece-red: #de6739;
  --piece-red-edge: #b04d27;
  --piece-black: #34302b;
  --piece-black-edge: #0f0d0b;

  --cell: clamp(34px, 10.8vw, 62px);
}

* { 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;
}

/* ===== 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 (per HEADER_SPECS) ===== */
.mode-row,
.difficulty-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

/* `display: flex` above would otherwise override the [hidden] attribute. */
.difficulty-row[hidden] { display: none; }

.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;
  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: turn / forced / win ===== */
.status-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.6rem;
  justify-content: center;
}

/* The `display: flex` rules below would otherwise override the [hidden]
   attribute's display:none, so restore it explicitly. */
.turn-banner[hidden],
.win-banner[hidden] { display: none; }

.turn-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

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

.turn-disc {
  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);
}

.turn-disc.is-red {
  background: radial-gradient(circle at 35% 30%, #f4885c, var(--piece-red) 60%, var(--piece-red-edge));
}

.turn-disc.is-black {
  background: radial-gradient(circle at 35% 30%, #6b655d, var(--piece-black) 60%, var(--piece-black-edge));
}

.forced-note {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gof-warm);
  background: #fff3e6;
  border: 1px solid #f3c89c;
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
}

.win-banner {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--gof-primary-dark);
  text-align: center;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* A draw is neutral, not a green "win". */
.win-banner.is-draw { color: var(--text-secondary); }

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

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(8, var(--cell));
  border: 8px solid var(--board-frame);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

.square {
  width: var(--cell);
  height: var(--cell);
  position: relative;
}

.square.light { background: var(--board-light); }
.square.dark { background: var(--board-dark); cursor: pointer; }

/* Legal-destination marker (a dot on an empty target square) */
.square.legal::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: rgba(255, 185, 32, 0.92);
  border: 2px solid rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
}

/* ===== Pieces ===== */
/* Each .piece is a cell-sized box, positioned by a translate() the UI sets.
   The visible disc is drawn with ::before so transforms on the box (used for
   sliding) stay independent of the disc's own pop-out animation. */
.piece {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--cell);
  height: var(--cell);
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.16s ease;
  z-index: 4;
}

.piece::before {
  content: "";
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.32), inset 0 3px 3px rgba(255, 255, 255, 0.22),
    0 2px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s ease, box-shadow 0.15s ease;
}

.piece.red::before {
  background: radial-gradient(circle at 35% 30%, #f4885c, var(--piece-red) 60%, var(--piece-red-edge));
}

.piece.black::before {
  background: radial-gradient(circle at 35% 30%, #6b655d, var(--piece-black) 62%, var(--piece-black-edge));
}

/* King crown */
.piece.king::after {
  content: "\265B";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.46);
  line-height: 1;
  color: var(--gof-accent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

/* Selected piece */
.piece.selected::before {
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.32), inset 0 3px 3px rgba(255, 255, 255, 0.22),
    0 0 0 4px var(--gof-accent), 0 0 10px 3px rgba(255, 185, 32, 0.7);
}

/* Pieces that have a mandatory capture available */
.piece.can-capture::before {
  animation: capture-pulse 1.1s ease-in-out infinite;
}

@keyframes capture-pulse {
  0%, 100% {
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.32), inset 0 3px 3px rgba(255, 255, 255, 0.22),
      0 0 0 0 rgba(222, 103, 57, 0);
  }
  50% {
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.32), inset 0 3px 3px rgba(255, 255, 255, 0.22),
      0 0 0 4px rgba(222, 103, 57, 0.95);
  }
}

/* Piece being jumped - pops out of existence */
.piece.captured { opacity: 0; }
.piece.captured::before { transform: scale(0); }

/* ===== Play actions ===== */
.play-actions {
  display: flex;
  gap: 0.625rem;
  width: 100%;
  max-width: 280px;
  justify-content: center;
}

.play-actions .secondary-btn { flex: 1; }

.secondary-btn {
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.7rem 1.25rem;
  min-height: 44px;
  background: white;
  color: var(--gof-primary-dark);
  border: 2px solid var(--gof-primary-dark);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.secondary-btn:hover { background: var(--gof-bg-mint); }
.secondary-btn:active { transform: scale(0.97); }

/* ===== Merged article ("how to play checkers") ===== */
.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;
  color: var(--text-primary);
  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;
  color: var(--text-primary);
}

.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 li { padding-left: 0.15rem; }
.article-body strong { color: var(--text-primary); }

.article-body a {
  color: var(--gof-primary-dark);
  font-weight: 600;
}

.glossary { display: flex; flex-direction: column; gap: 0.5rem; }
.glossary dt { font-weight: 700; color: var(--text-primary); }
.glossary dd { margin-left: 0; }

/* ===== 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) {
  :root { --cell: 36px; }
  .turn-banner #turnText { font-size: 1.15rem; }
  .win-banner { font-size: 1.3rem; }
}
