@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;700;900&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --linen: #f5f0e1;
  --linen-2: #efe7d2;
  --wood: #deb887;
  --wood-deep: #c89b6a;
  --ink: #2b2118;
  --ink-soft: #5a4a38;
  --brown: #8b4513;
  --brown-deep: #6b340e;
  --jade: #3a6b4f;
  --jade-deep: #2c5440;
  --gold: #b8860b;
  --line: rgba(120, 80, 40, 0.22);
  --line-soft: rgba(120, 80, 40, 0.14);
  --surface: #fbf7ec;
  --surface-2: #f1e8d4;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 14px 36px rgba(90, 60, 25, 0.18);
  --scroll-thumb: rgba(120, 80, 40, 0.38);
  --scroll-track: transparent;
  --serif: "Noto Serif SC", "Kaiti SC", "STKaiti", "楷体", "PingFang SC", "Microsoft YaHei", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --sidebar-w: 200px;
  --ad-w: 160px;
  color-scheme: light;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

:root[data-theme="dark"] {
  --linen: #241d15;
  --linen-2: #2c2419;
  --ink: #f0e7d6;
  --ink-soft: #bfb098;
  --brown: #d08a4e;
  --brown-deep: #b3702f;
  --jade: #5a9b76;
  --jade-deep: #4a8564;
  --gold: #d8a838;
  --line: rgba(220, 190, 150, 0.18);
  --line-soft: rgba(220, 190, 150, 0.1);
  --surface: #2b2319;
  --surface-2: #342a1e;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
  --scroll-thumb: rgba(208, 138, 78, 0.48);
  --scroll-track: rgba(18, 12, 8, 0.42);
  color-scheme: dark;
}

html { height: 100%; background-color: #8b4513; }
html, body { height: 100%; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img, svg, canvas { display: block; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  background-color: #8b4513;
  transition: background-color 0.25s, color 0.25s;
}

:root[data-theme="dark"] html,
:root[data-theme="dark"] body {
  background-color: #3a2410;
}

button {
  appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  line-height: inherit;
}

button, select, input { font: inherit; color: inherit; }

a { color: var(--brown); text-decoration: none; }
a:hover { color: var(--gold); }

/* ===== App shell: sidebar + content ===== */
.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ===== Sidebar navigation ===== */
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: calc(18px + env(safe-area-inset-top)) 14px 14px;
  color: #fdf6e8;
  background: linear-gradient(165deg, #8b4513 0%, #7a3a0d 55%, #5d2c08 100%);
  border-right: 2px solid rgba(40, 18, 4, 0.4);
  box-shadow: 4px 0 20px rgba(80, 45, 15, 0.25);
}
:root[data-theme="dark"] .sidebar {
  background: linear-gradient(165deg, #3a2410 0%, #2c1a0a 55%, #1d1006 100%);
  border-right: 2px solid rgba(0, 0, 0, 0.5);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 18px;
}
.sidebar .brand {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  width: 100%;
  padding: 8px 8px 18px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 244, 224, 0.12);
}
/* App-icon tile: frame the mark so it reads as a proper logo, not a loose glyph. */
.sidebar .brand .brand__mark {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 11px;
  background: none;
  border: none;
  box-shadow: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.sidebar .brand,
.sidebar .brand:hover {
  color: #fff8ec;
  text-decoration: none;
}
.sidebar .brand__name {
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff8ec;
  font-size: 20px;
  line-height: 24px;
  height: 24px;
  letter-spacing: 0.05em;
  overflow: hidden;
}
.sidebar .brand__text { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sidebar__top-spacer { display: none; }
.brand .brand__mark { display: block; border-radius: 9px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35)); }
.brand__name {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.15;
  white-space: nowrap;
}
.brand__latin {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.sidebar .brand__latin {
  color: rgba(255, 236, 205, 0.66);
}
.brand__text p {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.sidebar .brand__text p {
  color: rgba(255, 248, 232, 0.62);
}

.nav { display: flex; flex-direction: column; justify-content: flex-start; gap: 4px; flex: 1 1 auto; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 42px;
  height: 42px;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 240, 220, 0.72);
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.nav__item:hover { background: rgba(255, 240, 220, 0.1); color: #fff3e0; }
.nav__item.active {
  background: linear-gradient(135deg, rgba(255, 240, 220, 0.22), rgba(255, 240, 220, 0.1));
  color: #fff8ec;
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav__item svg { flex: 0 0 auto; width: 20px; height: 20px; }

/* Latin nav labels: Noto Sans SC at 500 looks thin on the dark sidebar. */
html[lang="en"] .nav__item {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", var(--sans);
  font-weight: 600;
  color: rgba(255, 240, 220, 0.82);
}
html[lang="en"] .nav__item.active {
  font-weight: 600;
}

.sidebar__foot {
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 240, 220, 0.14);
  font-size: 12px;
  color: rgba(255, 240, 220, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar__tools { display: flex; gap: 10px; justify-content: center; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 240, 220, 0.18);
  border-radius: 12px;
  background: rgba(255, 240, 220, 0.08);
  color: rgba(255, 244, 228, 0.9);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.12s, opacity 0.16s;
}
.icon-btn:hover { background: rgba(255, 240, 220, 0.16); border-color: rgba(255, 240, 220, 0.32); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { flex: 0 0 auto; width: 18px; height: 18px; }
.goy-icon-sun { display: none; }
:root[data-theme="dark"] .goy-icon-sun { display: block; }
:root[data-theme="dark"] .goy-icon-moon { display: none; }
.icon-btn:disabled { opacity: 0.42; cursor: not-allowed; }
.icon-btn:disabled:hover { background: rgba(255, 240, 220, 0.08); border-color: rgba(255, 240, 220, 0.18); }

.sidebar__panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.menu-toggle,
.nav-scrim { display: none; }

/* ===== Content area ===== */
.content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(0deg, rgba(150, 110, 60, 0.05) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #f7f2e6 0%, var(--linen) 50%, #efe6d0 100%);
}
:root[data-theme="dark"] .content {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #1f1810 0%, var(--linen) 50%, #1b150e 100%);
}
.content-main {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Board layout: 3 columns — board | info | ad */
.play {
  display: grid;
  /* Middle track is panel width + the 14px seam. Collapse animates this
     track to 0 so the ad rail stays put and the board grows into the gap. */
  --panel-w: 336px;
  --mid: calc(var(--panel-w) + 14px);
  grid-template-columns: minmax(0, 1fr) var(--mid) var(--ad-w);
  column-gap: 0;
  row-gap: 14px;
  align-items: start;
  height: 100dvh;
  min-height: 100dvh;
  padding: 12px;
}
.play.play--ready {
  transition: grid-template-columns 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Online in-game: no ad rail, board + info only */
.play--noad { grid-template-columns: minmax(0, 1fr) var(--mid); }
.play--collapsed {
  --mid: 0px;
  grid-template-columns: minmax(0, 1fr) 0px var(--ad-w);
}
.play--noad.play--collapsed {
  grid-template-columns: minmax(0, 1fr) 0px;
  padding-right: 42px;
}

/* ===== Board column (fills the viewport height) =====
   The board is the largest square that fits the column in both axes,
   after reserving room for the H1 and toolbar. That same width (--sq)
   is shared by the H1 and toolbar so all three stay aligned. */
.board {
  position: relative;
  z-index: 2;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  overflow: visible;
  container-type: size;
  --sq: min(100cqw, calc(100cqh - 96px));
}
.play--scoring .board {
  --sq: min(100cqw, calc(100cqh - 200px));
}
.play--scoring .toolbar--board {
  display: none;
}

/* Stage holds the square board frame. Toggle is a ShogiGridBase-style tab
   glued to the wood's right edge (not the column gutter). */
.board__stage {
  position: relative;
  flex: 0 0 auto;
  width: var(--sq);
  height: var(--sq);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.panel-toggle {
  position: absolute;
  top: 50%;
  right: -30px;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 12px 12px 0;
  background: var(--surface);
  color: var(--brown-deep);
  box-shadow: 3px 0 8px rgba(60, 30, 10, 0.08);
  cursor: pointer;
  transition: background 0.2s;
}
.panel-toggle:hover { background: var(--surface-2); }
.panel-toggle svg { width: 16px; height: 16px; transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
/* Open: arrow points right (collapse). Collapsed: flip to point left (expand). */
.play--collapsed .panel-toggle svg { transform: rotate(180deg); }

/* Compact, real (visible) H1 above the board */
.play-head {
  flex: 0 0 auto;
  width: var(--sq);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.play-head__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-focus {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.btn-focus:hover { background: var(--surface-2); }
.btn-focus[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
  color: #f3fbf5;
  border-color: transparent;
}
.btn-focus svg { width: 16px; height: 16px; }
.play-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--brown-deep);
  line-height: 1.2;
}

/* Live status pulled onto the H1 row: the two things players glance at most
   (whose turn, capture counts) live here so the info panel can stay slim. */
.head-live {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.head-live__turn,
.head-live__cap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--line);
}
.head-live__turn {
  background: var(--surface);
  color: var(--ink);
}
.head-live__turn [data-goy-turn-text] {
  min-width: 12ch;
}
.head-live__cap {
  background: var(--surface);
  color: var(--ink-soft);
}
.head-live__cap b { color: var(--ink); font-weight: 700; }
.head-live__sep { color: var(--line); margin: 0 1px; }

.infobar {
  width: 100%;
  max-width: min(100%, calc(100dvh - 140px));
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* image-7.png remains the approved visual reference for the original top control banner:
   title chip at left, board-size pills and sound control at right. Its composition
   is intentionally carried by the live semantic controls below rather than used as text-in-image. */
/* Board size segmented control */
.size-switch {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
}
.size-switch__btn {
  padding: 5px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.size-switch__btn:hover { background: var(--surface-2); color: var(--ink); }
.size-switch__btn.active {
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
  color: #f3fbf5;
  border-color: transparent;
}
.mode-pill {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
  color: #f3fbf5;
  font-size: 13px;
  letter-spacing: 0.03em;
}
.turn {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #f7efe0;
  font-size: 13px;
}
.info-cap { flex: 1 1 auto; text-align: right; color: var(--ink-soft); font-size: 14px; }
.btn-sound {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s, opacity 0.16s;
}
.btn-sound svg { width: 18px; height: 18px; }
.btn-sound:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-sound[aria-pressed="false"] { opacity: 0.5; }

.board__frame {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  padding: clamp(3px, 0.6vw, 8px);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, #e8c79a, var(--wood) 55%, #cfa775);
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(255, 240, 210, 0.4), inset 0 0 30px rgba(120, 80, 40, 0.25);
}
.board__frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.goy-board-host {
  width: 100%;
  height: 100%;
  min-height: 0;
}
.board__status {
  width: 100%;
  margin: 0;
  min-height: 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}

/* ===== Info column ===== */
.panel {
  min-width: 0;
  width: auto;
  height: 100%;
  margin-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.play.play--ready .panel {
  transition:
    margin-left 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}
.play--collapsed .panel {
  margin-left: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.play.play--focus,
.play.play--noad.play--focus,
.play.play--collapsed.play--focus,
.play.play--noad.play--collapsed.play--focus {
  grid-template-columns: minmax(0, 1fr);
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-right: 12px;
}
.play.play--focus .panel,
.play.play--focus .ad-rail,
.play.play--focus .panel-toggle {
  display: none;
}
html.is-focus-play .sidebar,
html.is-focus-play .goy-chrome-header,
html.is-focus-play .below,
html.is-focus-play .site-footer,
html.is-focus-play .nav-scrim {
  display: none !important;
}
html.is-focus-play .app {
  height: 100dvh;
  overflow: hidden;
}
html.is-focus-play .content {
  overflow: hidden;
  height: 100%;
}
html.is-focus-play .content-main {
  height: 100%;
  min-height: 0;
}
html.is-focus-play [data-goy-shell] {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
html.is-focus-play [data-goy-play] {
  flex: 1 1 auto;
  min-height: 0;
}
html.is-focus-play [data-goy-online],
html.is-focus-play [data-online-view="playing"] {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* ===== Live status card (top of info column) ===== */
.status-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(158deg, var(--surface), var(--surface-2));
}
.status-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-card__top .btn-sound { margin-left: auto; }
.status-card__turn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brown-deep);
}
.stone-dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(60, 34, 12, 0.35);
}
.stone-dot.black { background: radial-gradient(circle at 35% 30%, #4a4238, #14100a 70%); box-shadow: none; }
.stone-dot.white { background: radial-gradient(circle at 35% 30%, #fffefb, #ddd2c0 78%); border: 1px solid var(--line); }
.status-card__hint {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
  min-height: calc(20px + 3em);
}
.status-card__size {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-card__label {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 13px;
}
.status-card__size .size-switch {
  flex: 1 1 auto;
  justify-content: stretch;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.status-card__size .size-switch__btn { flex: 1 1 0; text-align: center; }

.caps-row {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.caps-row__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.caps-row__item dt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
}
.caps-row__item .stone-dot { width: 14px; height: 14px; }
.caps-row__item dd { margin: 0 0 0 auto; font-size: 18px; font-weight: 700; color: var(--ink); }

.board__bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}
.board__bar label { flex-shrink: 0; color: var(--ink-soft); font-size: 14px; }
.board__bar select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf7;
  font-size: 14px;
  cursor: pointer;
}

.toolbar { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.toolbar .btn { border-radius: 12px; }
.toolbar .btn--primary { grid-column: 1 / -1; }

/* Toolbar mounted below the board: a content-aware flex row. All six controls
   stay on a single line whenever the board is wide enough to hold them; only
   when space actually runs out do they wrap, and any wrapped row stretches to
   fill the width so no empty gaps are left behind. */
.toolbar--board {
  display: flex;
  flex-wrap: wrap;
  flex: 0 0 auto;
  width: var(--sq);
}
.toolbar--board .btn {
  flex: 1 1 0;
  min-width: 92px;
  padding-inline: 12px;
  white-space: nowrap;
}
.toolbar--board .btn--primary { grid-column: auto; }

.score-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--sq);
  flex: 0 0 auto;
  margin-top: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.score-bar[hidden] { display: none !important; }
.score-bar__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.score-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.score-bar__actions .btn { flex: 1 1 0; min-width: 120px; }
.toolbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.toolbar .btn svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: 0.85; }
.toolbar .btn--primary svg { opacity: 1; }
.btn {
  min-height: 38px;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--surface-2); }
.btn:active { transform: translateY(0); }
.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #a35a1f, var(--brown-deep));
  color: #fdf3e3;
  box-shadow: 0 8px 20px rgba(107, 52, 14, 0.3);
}
.btn--primary:hover { background: linear-gradient(135deg, #b3661f, #7a3a0d); }
.btn--lg { min-height: 44px; padding: 10px 26px; font-size: 15px; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 15px;
}
.card h3 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--brown-deep);
}
.stat-grid { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.stat-item dt { color: var(--ink-soft); font-size: 13px; }
.stat-item dd { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }

.card-history { display: flex; flex-direction: column; min-height: 0; }
.card-history__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.card-history__toggle h3 { margin: 0; }
.card-history__meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.card-history__chevron {
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
  transition: transform 0.2s ease;
}
.card-history__toggle[aria-expanded="true"] .card-history__chevron { transform: rotate(180deg); }
.card-history__toggle + .move-list { margin-top: 12px; }
.move-list {
  margin: 0;
  padding: 0 2px 4px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.move-list button {
  width: 100%;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-soft);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.move-list button:hover { background: #e9ddc2; color: var(--ink); }
.move-list .active button { background: var(--brown); color: #fff5e6; border-color: var(--brown); font-weight: 700; }

/* ===== Ad column (160x600) ===== */
.ad-rail {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  margin-left: 14px;
}
.ad-slot {
  width: var(--ad-w);
  height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s;
}
.ad-slot:hover { background: rgba(255, 255, 255, 0.65); border-color: var(--brown); color: var(--brown-deep); }
.ad-slot__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
.ad-slot__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--brown-deep);
}
.ad-slot__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}
.ad-slot__cta {
  flex-shrink: 0;
  display: inline-block;
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a35a1f, var(--brown-deep));
  color: #fdf3e3;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

/* ===== Article (rules / tips) ===== */
.article {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 28px;
}
.article section + section { margin-top: 30px; }
.article h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: var(--brown-deep);
}
.article p { color: var(--ink-soft); }
.guide-list { padding-left: 22px; color: var(--ink-soft); }
.guide-list li { margin: 9px 0; }
.guide-list strong { color: var(--brown-deep); }
.article-body code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--brown-deep);
  font-size: 0.92em;
}
.article-toc {
  margin: 24px 0 30px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.article-toc strong { color: var(--brown-deep); }
.article-toc ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
  margin: 11px 0 0;
  padding-left: 24px;
}
.article-toc li { padding-left: 4px; }
.article-toc a { color: var(--jade-deep); text-decoration: none; }
.article-toc a:hover { color: var(--brown); text-decoration: underline; }
.score-table-wrap {
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.score-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  text-align: left;
  color: var(--ink-soft);
}
.score-table caption {
  padding: 14px 16px 8px;
  color: var(--brown-deep);
  font-weight: 700;
  text-align: left;
}
.score-table th,
.score-table td { padding: 11px 16px; border-top: 1px solid var(--line); }
.score-table thead th { color: var(--brown-deep); background: var(--surface-2); }
.score-table tbody th { color: var(--brown-deep); font-weight: 600; }
.practice-checklist {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.practice-checklist h3 {
  margin: 0 0 12px;
  color: var(--brown-deep);
  font-family: var(--serif);
  font-size: 21px;
}
.practice-checklist ol { margin: 0 0 16px; padding-left: 22px; color: var(--ink-soft); }
.practice-checklist li + li { margin-top: 10px; }
.practice-checklist a {
  color: var(--jade-deep);
  font-weight: 700;
}
.practice-checklist__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid color-mix(in srgb, var(--jade-deep) 35%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--jade) 12%, var(--surface));
  color: var(--jade-deep);
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.practice-checklist__cta:hover {
  background: color-mix(in srgb, var(--jade) 18%, var(--surface));
  color: var(--brown-deep);
}
.tips-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  color: var(--brown-deep);
}
.tips-flow__step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
}
.tips-flow__step strong {
  font-size: 15px;
  line-height: 1.3;
}
.tips-flow__step span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}
.tips-flow__step--last {
  background: color-mix(in srgb, var(--jade) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--jade-deep) 28%, var(--line));
}
.tips-flow__step:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  color: var(--brown);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}
.tips-eyes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.tips-eyes__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.tips-eyes__label {
  margin: 0;
  color: var(--brown-deep);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.tips-eyes__panel svg {
  display: block;
  width: min(100%, 180px);
  height: auto;
}
.article-figure {
  max-width: 720px;
  margin: 22px auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.article-figure svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--brown-deep);
}
.article-figure figcaption {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}
.article-figure--wide {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.article-figure--wide svg {
  width: auto;
  min-width: 100%;
  max-width: none;
}
.article-note {
  margin: 22px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--jade);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-2);
}
.article-note strong { color: var(--brown-deep); }
.article-note p { margin: 7px 0 0; }
details {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
summary { cursor: pointer; color: var(--brown-deep); font-weight: 700; }
details p { margin: 8px 0 0; }
.license-notice pre {
  overflow-x: auto;
  margin: 14px 0 0;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
}

/* ===== Custom select (difficulty) ===== */
.select { position: relative; width: 100%; }
.select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(150deg, #fffdf7, #f6efdd);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.select__trigger:hover { border-color: var(--brown); }
.select.open .select__trigger {
  border-color: var(--brown);
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.14);
}
.select__dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(58, 107, 79, 0.18);
}
.select__dot.lv2 { background: var(--gold); box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.18); }
.select__dot.lv3 { background: var(--brown); box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.18); }
.select__dot.lv4 { background: #1c1917; box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.22); }
.select__labels { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.select__title { font-size: 14px; font-weight: 500; }
.select__sub { font-size: 12px; color: var(--ink-soft); }
.select__chev { flex: 0 0 auto; color: var(--ink-soft); transition: transform 0.2s; }
.select.open .select__chev { transform: rotate(180deg); }

.select__menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.select__menu[hidden] { display: none; }
.select__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s;
}
.select__opt:hover { background: var(--surface-2); }
.select__opt.active { background: rgba(139, 69, 19, 0.1); }
.select__opt .select__title { color: var(--ink); }

/* ===== Online room view ===== */
.online { max-width: 860px; margin: 0 auto; padding: 32px 24px; }
.online__head { text-align: center; margin-bottom: 26px; }
.online__head h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 700;
  color: var(--brown-deep);
}
.online__lead {
  margin: 0 auto;
  max-width: 42ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.65;
}
.online__head h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 600;
  color: var(--ink-soft);
}
.online__head p { margin: 0; color: var(--ink-soft); }
.online__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.room-card { display: flex; flex-direction: column; gap: 12px; }
.room-card p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.room-input {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf7;
  font-size: 16px;
  letter-spacing: 0.14em;
  text-align: center;
}
.room-code {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  color: var(--brown-deep);
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
}
.online__note {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(58, 107, 79, 0.1);
  border: 1px solid rgba(58, 107, 79, 0.24);
  color: var(--jade-deep);
  font-size: 14px;
}

/* ===== Online state UIs ===== */
.state-tabs {
  max-width: 720px;
  margin: 18px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.35);
}
.state-tabs__label { flex: 0 0 100%; font-size: 12px; color: var(--ink-soft); margin-bottom: 2px; }
.state-tabs button {
  padding: 5px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}
.state-tabs button.active { background: var(--brown); color: #fff5e6; border-color: var(--brown); }

.conn {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 24px;
  text-align: center;
}
.conn__spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 4px solid rgba(139, 69, 19, 0.18);
  border-top-color: var(--brown);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.conn__ring {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(58, 107, 79, 0.12);
  color: var(--jade-deep);
}
.conn__ring.warn { background: rgba(184, 134, 11, 0.14); color: var(--gold); }
.conn__ring.err { background: rgba(150, 40, 20, 0.12); color: #9c3320; }
.conn h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--brown-deep);
}
.conn p { margin: 0 0 20px; color: var(--ink-soft); }
.conn__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Generic segmented control (room type, color pick) */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.seg--full { display: flex; }
.seg--full .seg__btn { flex: 1 1 0; }
.seg__btn {
  padding: 7px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
  white-space: nowrap;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.active {
  background: linear-gradient(135deg, #a35a1f, var(--brown-deep));
  color: #fdf3e3;
  box-shadow: 0 4px 12px rgba(107, 52, 14, 0.24);
}
.seg__btn.active.jade { background: linear-gradient(135deg, var(--jade), var(--jade-deep)); }
.opt-row { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.opt-row > span { font-size: 13px; color: var(--ink-soft); }

/* Invite (URL + code) rows */
.invite { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 20px; text-align: left; }
.invite__label { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.invite-row { display: flex; gap: 8px; }
.invite-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf7;
  font-size: 14px;
  color: var(--ink);
}
.invite-row .btn { flex: 0 0 auto; }
.copied { font-size: 12px; color: var(--jade-deep); }

/* Site footer */
.site-footer {
  margin-top: 8px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.site-footer__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 44px 32px 32px;
  display: grid;
  grid-template-columns: 1.6fr 1.2fr 1fr;
  gap: 32px;
}
.footer-col h2,
.footer-col h4,
.footer-heading {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--brown-deep);
  letter-spacing: 0.02em;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--brown); }
.footer-col--brand .brand { margin-bottom: 14px; }
.footer-col--brand .brand__name { font-size: 17px; }
.footer-about {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
  max-width: 34ch;
}
.lang { position: relative; display: inline-block; }
.lang__trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.lang__trigger:hover { border-color: var(--brown); }
.lang__trigger.open { border-color: var(--brown); box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.14); }
.lang__globe { color: var(--brown); }
.lang__caret { color: var(--ink-soft); transition: transform 0.18s; }
.lang__trigger.open .lang__caret { transform: rotate(180deg); }
.lang__menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  min-width: 190px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 20;
  transform-origin: bottom left;
  animation: langPop 0.16s ease;
}
@keyframes langPop {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.lang__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s;
}
.lang__opt:hover { background: var(--surface-2); }
.lang__opt.active { background: rgba(139, 69, 19, 0.1); color: var(--brown-deep); font-weight: 600; }
.lang__check { margin-left: auto; color: var(--brown); }
.lang__opt:not(.active) .lang__check { visibility: hidden; }
.site-footer__bar {
  border-top: 1px solid var(--line-soft);
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
@media (max-width: 900px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; gap: 28px; padding: 36px 24px 28px; }
  .footer-col--brand { grid-column: 1 / -1; }
  .site-footer__bar { padding: 16px 24px; }
}
@media (max-width: 560px) {
  .site-footer__inner { grid-template-columns: 1fr; }
}

/* Room lobby */
.lobby { max-width: 720px; margin: 0 auto; }
.lobby__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.lobby__bar h3 { margin: 0; font-family: var(--serif); font-size: 18px; color: var(--brown-deep); flex: 1 1 auto; }
.lobby__filter { display: inline-flex; gap: 4px; }
.lobby__filter button {
  padding: 5px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}
.lobby__filter button.active { background: var(--brown); color: #fff5e6; border-color: var(--brown); }
.room-list { display: flex; flex-direction: column; gap: 10px; }
.room-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(90, 60, 25, 0.08);
  transition: transform 0.14s, box-shadow 0.14s;
}
.room-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.room-item__ava {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 18px;
  color: #fdf3e3;
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
}
.room-item__body { flex: 1 1 auto; min-width: 0; }
.room-item__name { font-weight: 600; color: var(--ink); }
.room-item__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.room-tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-soft);
}
.lobby__empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.35);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-chip.online { background: rgba(58, 107, 79, 0.14); color: var(--jade-deep); }
.status-chip.online .dot { background: var(--jade); box-shadow: 0 0 0 3px rgba(58, 107, 79, 0.18); }
.status-chip.waiting { background: rgba(184, 134, 11, 0.14); color: var(--gold); }
.status-chip.waiting .dot { background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.status-chip.offline { background: rgba(90, 74, 56, 0.12); color: var(--ink-soft); }
.status-chip.offline .dot { background: var(--ink-soft); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.players {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 8px 0 22px;
}
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 130px;
}
.player.you { box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.25); }
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  border: 2px solid var(--line);
}
.avatar.black { background: radial-gradient(circle at 35% 30%, #5a5148, #14100a); color: #fff; }
.avatar.white { background: radial-gradient(circle at 35% 30%, #fff, #d8ccb4); color: #2b2118; }
.avatar.ghost { background: var(--surface-2); color: var(--ink-soft); border-style: dashed; }
.player__name { font-weight: 600; font-size: 15px; color: var(--ink); }
.player__meta { font-size: 12px; color: var(--ink-soft); }
.vs { font-family: var(--serif); font-size: 20px; color: var(--brown-deep); font-weight: 700; }

/* Online in-game panel bits */
.turn-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 14px;
  color: var(--ink);
}
.turn-flag .dot { width: 12px; height: 12px; border-radius: 50%; }
.turn-flag .dot.black { background: #14100a; }
.turn-flag .dot.white { background: #f0e9dc; border: 1px solid var(--line); }

/* ===== Below-fold copy ===== */
.below {
  padding: 56px 32px 64px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 240px);
}
.below__inner { max-width: 1040px; margin: 0 auto; }
.below__lead { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.below__title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--brown-deep);
}
.below__intro { margin: 0; font-size: 16px; color: var(--ink-soft); }
.below__resource-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.below__resource-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--brown-deep);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s;
}
.below__resource-link:hover {
  background: var(--surface-2);
  border-color: var(--line-soft);
}
.below__resource-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.beginner-guide {
  max-width: 860px;
  margin: 0 auto 56px;
  padding: 30px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.beginner-guide__body h3 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(21px, 2.6vw, 27px);
  color: var(--brown-deep);
}
.beginner-guide__body p { margin: 0 0 10px; color: var(--ink-soft); }
.beginner-guide__link {
  display: inline-block;
  margin-top: 5px;
  color: var(--jade-deep);
  font-weight: 700;
}
.beginner-guide__link:hover { color: var(--brown); }

.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  align-items: center;
  margin-bottom: 56px;
}
.feature:last-of-type { margin-bottom: 0; }
.feature.reverse .feature__media { order: 2; }
.feature__media {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.feature__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.feature__body h3 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(20px, 2.6vw, 27px);
  font-weight: 700;
  color: var(--brown-deep);
}
.feature__body p { margin: 0 0 14px; color: var(--ink-soft); }
.feature__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.feature__tags span {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--brown-deep);
}

.below__stats {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.below__stat {
  margin: 0;
  text-align: center;
  padding: 22px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.below__stat strong {
  display: block;
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  color: var(--jade-deep);
}
.below__stat span { font-size: 14px; color: var(--ink-soft); font-weight: 400; }

@media (max-width: 900px) {
  .online__grid { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; gap: 20px; margin-bottom: 40px; }
  .feature.reverse .feature__media { order: 0; }
  .below { padding: 40px 18px 48px; }
  .beginner-guide { padding: 26px; }
  .below__stats { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Overlay ===== */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(32, 18, 6, 0.58);
  backdrop-filter: blur(5px);
  z-index: 50;
}
:root[data-theme="dark"] .overlay {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}
.overlay[hidden] { display: none; }
.overlay__card {
  width: min(100%, 360px);
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: center;
}
:root[data-theme="dark"] .overlay__card {
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.55);
}
.overlay__icon {
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.overlay__icon .stone-dot {
  width: 28px;
  height: 28px;
}
.overlay__icon .stone-dot.white {
  border-color: rgba(43, 33, 24, 0.42);
}
:root[data-theme="dark"] .overlay__icon .stone-dot.white {
  border-color: rgba(240, 231, 214, 0.55);
}
.overlay__title { margin: 8px 0 4px; font-family: var(--serif); font-size: 24px; font-weight: 800; color: var(--brown-deep); }
.overlay__detail { margin: 0 0 18px; color: var(--ink-soft); }
.overlay__actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0 0 12px; }
.overlay__actions[hidden] { display: none; }

/* ===== Responsive ===== */
@media (max-width: 1360px) {
  /* Drop the ad rail first when space is tight so the board keeps room */
  .play {
    --panel-w: 300px;
    grid-template-columns: minmax(0, 1fr) var(--mid);
  }
  .ad-rail { display: none; }
  .play--collapsed {
    grid-template-columns: minmax(0, 1fr) 0px;
    padding-right: 42px;
  }
}

@media (max-width: 900px) {
  .app { flex-direction: column; height: 100dvh; }
  .sidebar {
    /* Block, not flex: an absolutely positioned panel must not
       participate in flex sizing or the header grows and crushes .content. */
    display: block;
    position: relative;
    z-index: 40;
    flex: 0 0 auto;
    width: 100%;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    border-right: none;
  }
  :root[data-theme="dark"] .sidebar { border-right: none; }
  .sidebar__top {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    column-gap: 8px;
  }
  .sidebar__top-spacer {
    display: block;
    width: 42px;
    height: 42px;
  }
  .sidebar .brand,
  .sidebar .brand--chrome {
    grid-column: 2;
    justify-self: center;
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: auto;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border-bottom: none;
  }
  .sidebar .brand .brand__mark {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 9px;
    flex: 0 0 auto;
  }
  .sidebar .brand__name {
    font-size: 17px;
    letter-spacing: 0.06em;
    line-height: 1.1;
    white-space: nowrap;
  }
  .menu-toggle {
    display: inline-flex;
    grid-column: 3;
    justify-self: end;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 5px;
  }
  .menu-toggle__bar {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .sidebar.is-open .menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .sidebar.is-open .menu-toggle__bar:nth-child(2) { opacity: 0; }
  .sidebar.is-open .menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .sidebar__panel {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1;
    width: auto;
    flex: none;
    padding: 8px 14px 14px;
    background: linear-gradient(165deg, #8b4513 0%, #7a3a0d 55%, #5d2c08 100%);
    border-top: 1px solid rgba(255, 244, 224, 0.12);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.32);
    max-height: min(72dvh, calc(100dvh - 72px));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
    overscroll-behavior: contain;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
    transform-origin: top center;
    pointer-events: none;
    transition:
      opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0.28s;
  }
  :root[data-theme="dark"] .sidebar__panel {
    background: linear-gradient(165deg, #3a2410 0%, #2c1a0a 55%, #1d1006 100%);
  }
  .sidebar.is-open .sidebar__panel {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .nav { flex: 0 0 auto; }
  .sidebar__foot { display: flex; }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(28, 14, 4, 0.46);
    touch-action: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0.28s;
  }
  .nav-scrim.is-active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  @media (prefers-reduced-motion: reduce) {
    .sidebar__panel,
    .nav-scrim {
      transition: none;
      transform: none;
    }
  }

  .content { flex: 1 1 auto; }
  .play {
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px;
    gap: 12px;
  }
  .board {
    height: auto;
    container-type: normal;
    /* Let the board fill the full portrait width; only clamp by height so a
       short/landscape device never pushes the board past the viewport. */
    --sq: min(100%, calc(100dvh - 220px));
  }
  .play--scoring .board {
    --sq: min(100%, calc(100dvh - 268px));
  }
  .play-head {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: var(--sq);
    text-align: center;
  }
  .play-title { width: 100%; text-align: center; }
  .play-head__meta {
    justify-content: center;
    width: 100%;
  }
  .head-live {
    justify-content: center;
  }
  .board__stage { width: var(--sq); height: auto; }
  .board__frame { width: 100%; height: auto; }
  .infobar { max-width: var(--sq); }
  /* Stacked layout: collapsing would only hide info the user scrolls to. */
  .panel-toggle { display: none; }
  .play.play--ready,
  .play.play--ready .panel { transition: none; }
  .play--collapsed {
    grid-template-columns: 1fr;
    padding-right: 14px;
  }
  .panel {
    height: auto;
    overflow: visible;
    margin-left: 0;
  }
  .play--collapsed .panel {
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
  }
  html.is-focus-play .play,
  html.is-focus-play .play.play--focus {
    height: 100%;
    min-height: 0;
  }
  html.is-focus-play .board {
    height: 100%;
    min-height: 0;
    container-type: size;
    --sq: min(100cqw, calc(100cqh - 96px));
  }
  html.is-focus-play .play--scoring .board {
    --sq: min(100cqw, calc(100cqh - 200px));
  }
  html.is-focus-play .board__stage {
    width: var(--sq);
    height: var(--sq);
  }
  html.is-focus-play .board__frame {
    width: 100%;
    height: 100%;
  }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .brand__name { font-size: 17px; }
}

/* ===== Dark-mode contrast refinements ===== */
.turn {
  background: linear-gradient(135deg, var(--brown), var(--brown-deep));
  color: #fff9ef;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(73, 37, 10, 0.24);
}

:root[data-theme="dark"] .board__bar select,
:root[data-theme="dark"] .room-input,
:root[data-theme="dark"] .invite-row input {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
:root[data-theme="dark"] .select__trigger {
  background: linear-gradient(150deg, #403426, #30261c);
  color: var(--ink);
  border-color: rgba(235, 206, 165, 0.28);
}
:root[data-theme="dark"] input::placeholder { color: #c9b99f; opacity: 1; }
:root[data-theme="dark"] .ad-slot,
:root[data-theme="dark"] .state-tabs { background: rgba(54, 43, 31, 0.72); }
:root[data-theme="dark"] .move-list button:hover { background: #403426; }

:root[data-theme="dark"] .content::-webkit-scrollbar,
:root[data-theme="dark"] .panel::-webkit-scrollbar,
:root[data-theme="dark"] .move-list::-webkit-scrollbar,
:root[data-theme="dark"] .article-figure--wide::-webkit-scrollbar,
:root[data-theme="dark"] .sidebar__panel::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
:root[data-theme="dark"] .content::-webkit-scrollbar-track,
:root[data-theme="dark"] .panel::-webkit-scrollbar-track,
:root[data-theme="dark"] .move-list::-webkit-scrollbar-track,
:root[data-theme="dark"] .article-figure--wide::-webkit-scrollbar-track,
:root[data-theme="dark"] .sidebar__panel::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}
:root[data-theme="dark"] .content::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .panel::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .move-list::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .article-figure--wide::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .sidebar__panel::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
:root[data-theme="dark"] .content::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .panel::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .move-list::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .article-figure--wide::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .sidebar__panel::-webkit-scrollbar-thumb:hover {
  background: rgba(208, 138, 78, 0.72);
  background-clip: padding-box;
}
:root[data-theme="dark"] .content::-webkit-scrollbar-corner,
:root[data-theme="dark"] .panel::-webkit-scrollbar-corner,
:root[data-theme="dark"] .move-list::-webkit-scrollbar-corner,
:root[data-theme="dark"] .article-figure--wide::-webkit-scrollbar-corner,
:root[data-theme="dark"] .sidebar__panel::-webkit-scrollbar-corner {
  background: transparent;
}

/* ===== Article navigation ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: 13px;
}
.breadcrumb a {
  color: var(--jade-deep);
  font-weight: 700;
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--brown); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb span[aria-current="page"] { color: var(--ink-soft); }
.article__head {
  max-width: 700px;
  margin-bottom: 34px;
  padding: 24px 26px 26px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(110deg, var(--surface), color-mix(in srgb, var(--surface-2) 68%, transparent));
  box-shadow: 0 10px 24px rgba(70, 44, 18, 0.08);
}
.article__eyebrow {
  margin: 0 0 7px;
  color: var(--jade-deep) !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
}
.article__head h1,
.article > h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(30px, 4.3vw, 42px);
  font-weight: 900;
  line-height: 1.18;
  color: var(--brown-deep);
}
.notfound-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}
.article__head > p:last-child {
  margin: 10px 0 0;
  color: var(--ink-soft);
}
:root[data-theme="dark"] .article__head {
  background: linear-gradient(110deg, var(--surface), #352a1f);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

@media (max-width: 560px) {
  .article { padding: 24px 18px 36px; }
  .breadcrumb { margin-bottom: 18px; }
  .article__head { margin-bottom: 28px; padding: 20px 18px 21px; }
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.breadcrumb ol li + li::before {
  content: "/";
  margin-right: 9px;
  color: var(--ink-soft);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 36px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 28px 48px;
}
.article-layout .article {
  max-width: none;
  padding: 0;
}
.article-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.article-side section {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.article-side h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--brown-deep);
}
.article-side ul { margin: 0; padding-left: 18px; color: var(--ink-soft); }
.article-side li { margin: 6px 0; }
.article-side p { margin: 0; color: var(--ink-soft); font-size: 14px; }

.meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 13px;
}
.article-footer {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: 14px;
}
.author-bio {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.author-bio img { border-radius: 12px; }
.author-bio strong { display: block; color: var(--brown-deep); }
.author-bio span { display: block; font-size: 13px; color: var(--ink-soft); }
.author-bio p { margin: 6px 0 0; font-size: 14px; }

.article-layout--solo {
  grid-template-columns: minmax(0, 1fr);
  max-width: 900px;
}

@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
    padding: 24px 18px 40px;
  }
  .article-figure { margin-inline: 0; padding: 10px; }
  .article-toc ol { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .article-layout { padding: 18px 14px 32px; }
  .article section + section { margin-top: 26px; }
  .article h2 { font-size: clamp(20px, 5.5vw, 26px); line-height: 1.28; }
  .article p,
  .guide-list,
  .article-note p { font-size: 15px; line-height: 1.7; }
  .article .intro { font-size: 16px; line-height: 1.75; }
  .guide-list { padding-left: 18px; }
  .article-toc {
    margin: 20px 0 24px;
    padding: 14px 14px 16px;
  }
  .article-toc ol {
    gap: 8px;
    padding-left: 18px;
  }
  .article-toc a {
    display: inline-block;
    padding: 2px 0;
    line-height: 1.45;
  }
  .article-figure { padding: 10px 8px; }
  .article-figure--wide svg { min-width: 520px; }
  .article-note {
    margin: 18px 0;
    padding: 14px;
    border-left-width: 3px;
  }
  .practice-checklist {
    margin: 18px 0;
    padding: 16px 14px;
  }
  .practice-checklist h3 { font-size: 19px; }
  .practice-checklist ol {
    padding-left: 18px;
    font-size: 15px;
    line-height: 1.65;
  }
  .practice-checklist__cta {
    min-height: 48px;
    font-size: 15px;
  }
  .tips-flow {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .tips-flow__step {
    min-height: 0;
    padding: 14px 12px;
    text-align: left;
  }
  .tips-flow__step:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
  }
  .tips-eyes {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .tips-eyes__panel svg {
    width: min(100%, 220px);
  }
  .score-table-wrap {
    overflow-x: visible;
    margin: 18px 0;
  }
  .score-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }
  .score-table caption {
    padding: 12px 14px 10px;
    font-size: 15px;
  }
  .score-table thead { display: none; }
  .score-table tbody tr {
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
  }
  .score-table tbody th {
    display: block;
    padding: 10px 14px;
    border-top: 0;
    background: var(--surface-2);
    font-size: 14px;
  }
  .score-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px;
    border-top: 1px solid var(--line-soft);
    font-size: 14px;
  }
  .score-table tbody td::before {
    color: var(--brown-deep);
    font-weight: 600;
    white-space: nowrap;
  }
  .score-table tbody td:nth-child(2)::before { content: "黑棋"; }
  .score-table tbody td:nth-child(3)::before { content: "白棋"; }
  details {
    padding: 14px;
  }
  summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    line-height: 1.45;
    padding-right: 8px;
  }
  .article-tags {
    gap: 10px;
    font-size: 13px;
  }
  .article-tags a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
  }
  .author-bio {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 14px;
  }
  .author-bio p { font-size: 13px; line-height: 1.65; }
  .article-footer { margin-top: 28px; padding-top: 18px; }
}

@media (max-width: 560px) {
  .article { padding: 24px 18px 36px; }
  .breadcrumb { margin-bottom: 18px; }
  .article__head {
    margin-bottom: 24px;
    padding: 18px 14px 19px;
    border-left-width: 3px;
  }
  .article__head h1,
  .article > h1 {
    font-size: clamp(26px, 7vw, 34px);
  }
}
