/* Shogi Asia — Learn · Teach · Connect */
:root {
  --bg: #f7f3eb;
  --bg-card: #fffdf8;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #57534e;
  --line: #ded6c8;
  --vermillion: #b94726;
  --vermillion-soft: #fee2d5;
  --indigo: #173b5e;
  --indigo-soft: #dbeafe;
  --community: #0f766e;
  --community-soft: #ccfbf1;
  --wood: #c99867;
  --wood-dark: #6b4423;
  --success: #15803d;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(28, 25, 23, 0.08);
  --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Fraunces", "Georgia", serif;
  --max: 1100px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--vermillion); }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid #0b6bcb;
  outline-offset: 3px;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 0.6em;
}
p { margin: 0 0 1em; color: var(--ink-soft); }
ul, ol { color: var(--ink-soft); }
code, kbd {
  font-family: ui-monospace, Consolas, monospace;
  background: #efe8dc;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--indigo);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 243, 235, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #6b4423, #3f2917);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.1rem;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.2);
}
.logo-text {
  display: grid;
  line-height: 1.1;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.logo-text > span:first-child { color: var(--ink); font-weight: 700; }
.logo-text > span:last-child {
  display: block;
  margin-top: 0.22rem;
  font-weight: 500;
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--font);
  letter-spacing: 0.025em;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.contrast-toggle {
  min-height: 38px;
  padding: 0.42rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--ink);
  font: 600 0.78rem/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.contrast-toggle:hover { border-color: var(--indigo); color: var(--indigo); }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font: inherit;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
  align-items: center;
}
.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
}
.site-nav a:hover {
  background: var(--indigo-soft);
  color: var(--indigo);
}
.site-nav a[aria-current="page"] {
  background: var(--indigo);
  color: #fff;
}
.site-nav a[aria-current="page"]:hover {
  background: #152a46;
  color: #fff;
}
.nav-cluster {
  display: contents;
}
.nav-sep {
  width: 1px;
  height: 1.1rem;
  background: var(--line);
  margin: 0 0.15rem;
  align-self: center;
}
.util-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 1rem;
}
.util-bar .btn { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.status-ok { color: var(--success) !important; font-weight: 600; }
.status-bad { color: #b91c1c !important; font-weight: 600; }
.quick-start {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.quick-step {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.quick-step strong {
  display: block;
  color: var(--vermillion);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.lesson-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.lesson-panel[hidden] { display: none !important; }
.rubric {
  width: 100%;
  font-size: 0.92rem;
}
.rubric th:not(:first-child),
.rubric td:not(:first-child) {
  text-align: center;
}
.move-board.slider {
  max-width: 200px;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  aspect-ratio: 1;
}
.home-notice {
  font-size: 0.9rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: var(--ink-soft);
}
.footer-meta {
  display: grid;
  gap: 0.35rem;
}
.footer-meta a { color: var(--ink-soft); }
.path-home {
  background: linear-gradient(135deg, #15803d, #3f8f5a);
}
html.high-contrast {
  --bg: #fff;
  --bg-card: #fff;
  --ink: #000;
  --ink-soft: #111;
  --muted: #333;
  --line: #000;
  --vermillion: #9a0000;
  --vermillion-soft: #ffd6d6;
  --indigo: #000066;
  --indigo-soft: #d0d0ff;
  --community: #005c55;
  --community-soft: #d7fff8;
  --wood: #6b4423;
  --wood-dark: #3d2812;
  --success: #005500;
}
html.high-contrast body { line-height: 1.7; }
html.high-contrast .site-header {
  background: #fff;
  border-bottom: 2px solid #000;
}
html.high-contrast .site-nav a[aria-current="page"] {
  outline: 2px solid #000;
}
html.high-contrast .note { color: #222; }
html.high-contrast .path-card p { color: #fff; }
html.high-contrast .route-card,
html.high-contrast .community-filter,
html.high-contrast .community-card,
html.high-contrast .map-wrap { background: #fff; border-color: #000; }
html.high-contrast .all-eight-section,
html.high-contrast .movement-group,
html.high-contrast .overview-pieces a { background: #fff; }

/* Layout */
main { max-width: var(--max); margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
  padding: 1.5rem 0 2.5rem;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--vermillion);
  margin-bottom: 0.75rem;
}
.hero-kanji {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 0.85rem;
}
.hero-kanji-chars {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", "Songti SC", "Noto Serif JP", serif;
  font-size: clamp(2.4rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--indigo);
  background: linear-gradient(145deg, #fffdf8, #f3e6d0);
  border: 2px solid var(--wood-dark);
  border-radius: 14px;
  padding: 0.35rem 0.7rem 0.45rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.7);
}
.hero-kanji-reading {
  font-size: 0.98rem;
  color: var(--ink-soft);
  max-width: 22ch;
  line-height: 1.35;
}
.hero-kanji-reading strong {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", "Songti SC", "Noto Serif JP", serif;
  font-size: 1.15em;
  color: var(--ink);
  font-weight: 700;
}
.hero-kanji-romaji {
  color: var(--muted);
  font-style: italic;
}
html.high-contrast .hero-kanji-chars {
  background: #fff;
  border-color: #000;
  color: #000;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.75rem;
  color: var(--ink);
}
.hero h1 span { display: block; }
.hero-lead {
  font-size: 1.1rem;
  max-width: 38ch;
  margin-bottom: 1.5rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.hero-visual {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--vermillion);
  color: #fff;
}
.btn-primary:hover { background: #9a3412; color: #fff; }
.btn-secondary {
  background: var(--indigo);
  color: #fff;
}
.btn-secondary:hover { background: #152a46; color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--indigo); color: var(--indigo); }

.section { margin: 2.5rem 0; }
.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.section-header h2 { margin: 0; font-size: 1.75rem; }
.section-header p { margin: 0; max-width: 48ch; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 2px 10px rgba(28, 25, 23, 0.03);
}
.card h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--vermillion-soft);
  color: var(--vermillion);
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.card a.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: border-color 0.15s, transform 0.15s;
}
a.card-link:hover .card,
.card.card-hover:hover {
  border-color: var(--wood);
  transform: translateY(-2px);
}

.paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.routes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2.5rem;
}
.route-card {
  min-height: 260px;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-top: 6px solid var(--vermillion);
  border-radius: calc(var(--radius) + 2px);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.route-card.community-route { border-top-color: var(--community); }
.route-card .eyebrow { margin-bottom: 0.5rem; }
.route-card.community-route .eyebrow,
.eyebrow.community { color: var(--community); }
.route-card h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
.route-card p { max-width: 48ch; }
.route-card .route-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.btn-community { background: var(--community); color: #fff; }
.btn-community:hover { background: #0b5d57; color: #fff; }
.benefit-icon {
  width: 50px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 0.75rem;
  color: var(--ink);
  background: var(--wood);
  border: 0;
  /* Match the pointed crown, sloped shoulders and broad foot of the actual pieces. */
  clip-path: polygon(50% 0%, 94% 28%, 100% 100%, 0% 100%, 6% 28%);
  filter: drop-shadow(0 0 1px var(--wood-dark));
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}
.path-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
}
.path-card h3 { color: #fff; margin: 0 0 0.4rem; }
.path-card p { color: rgba(255,255,255,0.9); margin: 0; }
.path-teachers { background: linear-gradient(135deg, #1e3a5f, #3b6ea5); }
.path-students { background: linear-gradient(135deg, #9a3412, #c2410c); }
.path-card .path-cta {
  margin-top: 1rem;
  font-weight: 700;
  color: #fff;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-card); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  background: #f0e9dc;
  font-weight: 600;
  color: var(--ink);
}
tr:last-child td { border-bottom: 0; }

.prose { max-width: 70ch; }
.prose h2 { margin-top: 2rem; }
.prose li { margin-bottom: 0.35rem; }
.callout {
  border-left: 4px solid var(--vermillion);
  background: #fff7ed;
  padding: 1rem 1.15rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
}
.callout.info {
  border-left-color: var(--indigo);
  background: #eff6ff;
}
.callout.success {
  border-left-color: var(--success);
  background: #f0fdf4;
}
.note {
  font-size: 0.9rem;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 0.75rem;
}
.timeline-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}
.time-badge {
  font-weight: 700;
  color: var(--vermillion);
  font-size: 0.95rem;
}

/* Piece cards */
.piece-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}
.piece-grid-gold-promos {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.piece-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: grid;
  gap: 0.75rem;
  align-content: start;
}
.piece-card-promo {
  border-color: #f0c9a0;
  box-shadow: 0 0 0 1px rgba(194, 65, 12, 0.06);
}
.piece-card header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.piece-glyph {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
}
.piece-glyph-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.12));
}
.section-title-inline {
  font-size: 1.5rem;
  margin: 2rem 0 0.35rem;
}
.section-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.1rem;
  max-width: 70ch;
}
.subsection-title {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.75rem;
}
.card-link-line {
  margin: 0;
  font-size: 0.9rem;
}
.card-link-line a {
  font-weight: 600;
  text-decoration: none;
}
.card-link-line a:hover { text-decoration: underline; }

/* Learn page: legend + jump nav */
.move-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 1rem 0 1.25rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.legend-swatch {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 4px;
  border: 1px solid rgba(166, 124, 82, 0.45);
  display: inline-grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.legend-swatch.origin-swatch {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--wood-dark);
}
.legend-swatch.ok-swatch {
  background: rgba(21, 128, 61, 0.22);
  color: var(--success);
}
.legend-swatch.jump-swatch {
  background: rgba(30, 58, 95, 0.18);
  color: var(--indigo);
}
.legend-swatch.empty-swatch {
  background: #f3e6d0;
}
.piece-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.5rem;
}
.piece-jump a {
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--ink-soft);
}
.piece-jump a:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  background: var(--indigo-soft);
}
.all-eight-section {
  scroll-margin-top: 6rem;
  padding: 1.5rem;
  border: 2px solid var(--indigo);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #f8fbff, var(--bg-card));
}
.movement-groups {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.75fr;
  gap: 1rem;
  margin: 1.25rem 0;
}
.movement-group {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card);
}
.movement-group .eyebrow { margin-bottom: 0.75rem; }
.overview-pieces {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.overview-pieces a {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  gap: 0 0.55rem;
  align-items: center;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
}
.overview-pieces a:hover { border-color: var(--indigo); color: var(--indigo); }
.overview-pieces img {
  grid-row: 1 / 3;
  width: 40px;
  height: 44px;
  object-fit: contain;
}
.overview-pieces strong { font-size: 0.88rem; line-height: 1.2; }
.overview-pieces span { color: var(--muted); font-size: 0.74rem; line-height: 1.25; }
.first-game-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.first-game-callout .btn { margin-left: auto; }
.first-game-steps .quick-step { border-top: 4px solid var(--indigo); }
.media-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.25rem 0;
}
.media-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.media-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: top;
  background: #fff;
}
.media-card .media-body {
  padding: 1rem 1.1rem 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.media-card h3 { margin: 0; font-size: 1.05rem; }
.hero-visual img.hero-board {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.pack-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.pack-steps li {
  counter-increment: step;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1rem 1rem 3.2rem;
  position: relative;
}
.pack-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 0.95rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: var(--vermillion-soft);
  color: var(--vermillion);
  font-weight: 700;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
}
.promo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1rem 0;
}
.promo-strip .arrow { color: var(--vermillion); font-weight: 700; }
.promo-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.35rem 0.6rem;
}
.promo-pair img { width: 40px; height: 40px; object-fit: contain; }
.piece-card h3 { margin: 0; font-size: 1.1rem; }
.piece-card .jp { color: var(--muted); font-size: 0.85rem; }
.move-board {
  width: 100%;
  max-width: 168px;
  margin: 0.15rem auto 0.25rem;
  aspect-ratio: 1;
  background: #f3e6d0;
  border: 2px solid var(--wood-dark);
  border-radius: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.move-board .cell {
  border: 1px solid rgba(166, 124, 82, 0.35);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 0;
  min-height: 0;
  padding: 1px;
}
.move-board .cell .dot {
  line-height: 1;
  opacity: 0.95;
}
.move-board .cell.origin {
  background: #fffdf8;
  position: relative;
}
.move-board .cell.origin img {
  width: 78%;
  height: 78%;
  max-width: 42px;
  max-height: 42px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
  pointer-events: none;
  user-select: none;
}
.move-board.slider .cell.origin img,
.move-board.knight-board .cell.origin img {
  max-width: 34px;
  max-height: 34px;
}
.move-board .cell.ok { background: rgba(21, 128, 61, 0.22); color: var(--success); }
.move-board .cell.jump { background: rgba(30, 58, 95, 0.18); color: var(--indigo); }
.move-board.knight-board {
  max-width: 180px;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 5 / 3.2;
}
html.high-contrast .move-board {
  border-color: #000;
  background: #fff;
}
html.high-contrast .move-board .cell.ok {
  background: #c6f6d5;
  color: #004d00;
}
html.high-contrast .move-board .cell.jump {
  background: #c3dafe;
  color: #000066;
}
html.high-contrast .piece-card-promo {
  border-color: #000;
}

/* Puzzles */
.puzzle-primer { padding-top: 1rem; }
.puzzle-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}
.puzzle-picker-btn {
  min-height: 76px;
  padding: 0.75rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--ink);
  cursor: pointer;
}
.puzzle-picker-btn:hover { border-color: var(--indigo); }
.puzzle-picker-btn.current {
  border: 2px solid var(--indigo);
  background: var(--indigo-soft);
}
.puzzle-picker-btn.solved { box-shadow: inset 4px 0 0 var(--success); }
.puzzle-picker-btn strong,
.puzzle-picker-btn span { display: block; }
.puzzle-picker-btn strong { font-size: 0.82rem; color: var(--indigo); }
.puzzle-picker-btn span { margin-top: 0.15rem; font-size: 0.78rem; line-height: 1.25; }
.puzzle-hint-box {
  margin: 0.75rem 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.puzzle-hint-box summary { cursor: pointer; color: var(--indigo); font-weight: 700; }
.puzzle-hint-box p { margin: 0.55rem 0 0; }
html.high-contrast .puzzle-picker-btn.current { outline: 3px solid #000; }
.puzzle-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}
.puzzle-board-wrap {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
#puzzle-board {
  display: grid;
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 3px solid var(--wood-dark);
  background: #f3e6d0;
}
.puz-cell {
  border: 1px solid rgba(166, 124, 82, 0.4);
  display: grid;
  place-items: center;
  min-height: 0;
}
.puz-piece {
  width: 76%;
  max-width: 48px;
  aspect-ratio: 5 / 6;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: clamp(0.75rem, 2.5vw, 1.1rem);
  clip-path: polygon(50% 3%, 79% 20%, 94% 97%, 6% 97%, 21% 20%);
  background: #fffdf8;
  border: 1px solid #1c1917;
  color: #1c1917;
}
.puz-piece.gote {
  background: repeating-linear-gradient(45deg, #f5f0e6, #f5f0e6 2px, #e7e5e4 2px, #e7e5e4 4px);
  transform: rotate(180deg);
}
.puzzle-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--indigo-soft);
  color: var(--indigo);
}
.badge.star { background: var(--vermillion-soft); color: var(--vermillion); }
.choices { display: grid; gap: 0.5rem; margin-top: 1rem; }
.choice-btn {
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  cursor: pointer;
}
.choice-btn:hover { border-color: var(--indigo); }
.choice-btn.correct {
  border-color: var(--success);
  background: #f0fdf4;
}
.choice-btn.wrong {
  border-color: #b91c1c;
  background: #fef2f2;
}
.puzzle-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Download */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.print-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.75rem;
  min-height: 200px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.print-preview object,
.print-preview iframe {
  width: 100%;
  min-height: 320px;
  border: 0;
}
.print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Communities */
.community-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 1.25rem;
  align-items: stretch;
}
.community-summary {
  background: linear-gradient(145deg, var(--community), #0b514d);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
}
.community-summary h2,
.community-summary p { color: #fff; }
.community-summary p:last-child { margin-bottom: 0; }
.map-wrap {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0;
  overflow-x: auto;
}
.asia-map { min-width: 480px; }
.asia-map .land {
  fill: #e7ddce;
  stroke: #9f8b72;
  stroke-width: 2;
}
.asia-map .sea-label,
.asia-map .region-label {
  fill: var(--muted);
  font: 600 14px var(--font);
}
.asia-map .marker {
  fill: var(--community);
  stroke: #fff;
  stroke-width: 3;
}
.asia-map a:hover .marker,
.asia-map a:focus .marker { stroke: var(--ink); stroke-width: 5; }
.asia-map a:focus { outline: none; }
.map-caption { margin: 0.7rem 0 0; font-size: 0.86rem; color: var(--muted); }
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.legend-marker {
  width: 0.85rem;
  height: 0.85rem;
  display: inline-block;
  margin-right: 0.3rem;
  border-radius: 50%;
  vertical-align: -0.1rem;
}
.legend-marker.official { background: var(--community); }
.legend-marker.public { border: 3px solid var(--indigo); }
.legend-marker.needed { border: 2px dotted var(--wood-dark); }
.community-filter {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(220px, 1fr) auto;
  gap: 0.9rem;
  align-items: end;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.field { display: grid; gap: 0.35rem; }
.field label { color: var(--ink); font-size: 0.88rem; font-weight: 700; }
.field select,
.field input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.filter-status {
  min-width: 11rem;
  margin: 0;
  padding: 0.65rem 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.country-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 1rem;
}
.community-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem;
  background: var(--bg-card);
}
.community-card[hidden] { display: none; }
.community-card h3 {
  margin: 0;
  font-size: 1.15rem;
}
.community-card-title {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.local-name { color: var(--muted); font-size: 0.85rem; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-officially-listed { background: var(--community-soft); color: #075e58; border: 1px solid var(--community); }
.status-public-community { background: var(--indigo-soft); color: var(--indigo); border: 1px solid var(--indigo); }
.status-online-community { background: #eef2ff; color: #3730a3; border: 1px solid #6366f1; }
.status-information-needed { background: #f7ede1; color: #654321; border: 1px dotted var(--wood-dark); }
.community-meta {
  display: grid;
  gap: 0.25rem;
  margin: 0.75rem 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 0.86rem;
}
.community-meta strong { color: var(--ink); }
.community-group {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}
.community-group h4 { margin-bottom: 0.25rem; font-size: 0.98rem; }
.community-group p { margin-bottom: 0.55rem; font-size: 0.9rem; }
.community-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  font-size: 0.86rem;
}
.community-update {
  display: inline-block;
  margin-top: 0.8rem;
  font-size: 0.82rem;
}
.empty-state {
  grid-column: 1 / -1;
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.online-play-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.online-play-grid .card { border-top: 5px solid var(--indigo); }
.external-cue { font-size: 0.82rem; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: #efe8dc;
  padding: 2rem 1.25rem;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}
.footer-inner small { color: var(--muted); }
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}
.footer-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
}
.footer-nav a:hover { color: var(--vermillion); }

.page-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin-bottom: 0.4rem;
}
.page-lead {
  font-size: 1.08rem;
  max-width: 60ch;
  margin-bottom: 1.75rem;
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--vermillion); }

.checklist { list-style: none; padding: 0; }
.checklist li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}
.checklist input { margin-top: 0.3rem; }

/* Responsive */
@media (max-width: 900px) {
  .hero, .puzzle-layout, .paths, .routes, .grid-2, .media-row, .quick-start,
  .community-intro { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .timeline-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .nav-sep { display: none; }
  .movement-groups { grid-template-columns: 1fr; }
  .puzzle-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 0.75rem 1.25rem 1rem;
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; }
  .site-nav a { display: block; border-radius: 10px; }
  .header-actions { margin-left: auto; }
  .contrast-toggle { font-size: 0.72rem; padding-inline: 0.55rem; }
  .community-filter { grid-template-columns: 1fr; }
  .filter-status { min-width: 0; padding: 0; }
  .online-play-grid { grid-template-columns: 1fr; }
  .country-list { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .header-inner { position: relative; }
  .quick-start { grid-template-columns: 1fr; }
  .overview-pieces { grid-template-columns: 1fr 1fr; }
  .first-game-callout .btn { width: 100%; margin-left: 0; }
  .puzzle-picker { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .header-inner { gap: 0.45rem; padding-inline: 0.75rem; }
  .logo { gap: 0.45rem; }
  .logo-mark { width: 32px; height: 32px; }
  .logo-text > span:last-child { display: none; }
  .contrast-toggle { max-width: 6rem; white-space: normal; }
  .nav-toggle { padding-inline: 0.55rem; }
  .overview-pieces { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .nav-toggle, .no-print, .hero-actions, .print-actions { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card, .timeline-item { break-inside: avoid; box-shadow: none; }
  .lesson-panel[hidden] { display: block !important; }
  a { color: inherit; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
}
