:root {
  --linen: #f4f7f4;
  --linen-2: #e9efe9;
  --wood: #1e3e2d;
  --wood-deep: #132b1e;
  --ink: #14221a;
  --ink-soft: #4d6356;
  --brown: #1c663e;
  --brown-deep: #12472b;
  --jade: #2a7b4f;
  --jade-deep: #1a5635;
  --gold: #b48018;
  --line: rgba(20, 50, 32, 0.13);
  --line-soft: rgba(20, 50, 32, 0.08);
  --surface: #ffffff;
  --surface-2: #f0f5f1;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 10px 30px rgba(16, 45, 28, 0.06), 0 2px 6px rgba(16, 45, 28, 0.03);
  --scroll-thumb: rgba(25, 75, 45, 0.25);
  --scroll-track: transparent;
  --serif: "RVY Serif", "Songti SC", "Songti TC", "STSong", "Source Han Serif SC",
    "Noto Serif CJK SC", "SimSun", "宋体", serif;
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", 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: #0e1913;
  --linen-2: #13231b;
  --ink: #eef6f1;
  --ink-soft: #9bb5a5;
  --brown: #4ade80;
  --brown-deep: #7ae6a4;
  --jade: #2ea063;
  --jade-deep: #227c4d;
  --gold: #facc15;
  --line: rgba(180, 225, 198, 0.13);
  --line-soft: rgba(180, 225, 198, 0.07);
  --surface: #15241c;
  --surface-2: #1b2d23;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  --scroll-thumb: rgba(74, 222, 128, 0.35);
  --scroll-track: rgba(10, 20, 14, 0.4);
  color-scheme: dark;
}

html { height: 100%; background-color: #164e32; }
@media (max-width: 1920px) {
  html,
  body {
    overflow: hidden;
    height: 100%;
  }
}

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

body {
  margin: 0;
  min-width: 320px;
  height: 100%;
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  background-color: #164e32;
  transition: color 0.25s;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #0c1a13;
}

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: #f0fdf4;
  background-color: #164e32;
  background-image: linear-gradient(165deg, #185536 0%, #124329 55%, #0d341f 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.16);
  box-shadow: 4px 0 20px rgba(6, 26, 15, 0.18);
}

:root[data-theme="dark"] .sidebar {
  color: #eef6f1;
  background-color: #0c1a13;
  background-image: linear-gradient(165deg, #0f2219 0%, #0c1a13 55%, #08120d 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
}

.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, 255, 255, 0.12);
}

/* App-icon tile: frame the mark so it reads as a proper logo, not a loose glyph. */
.sidebar .brand .brand__mark {
  width: 52px;
  height: 52px;
  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: #ffffff;
  text-decoration: none;
}

.sidebar .brand__name {
  display: block;
  color: #ffffff;
  font-size: 20px;
  line-height: 1.25;
  min-height: 28px;
  letter-spacing: 0.05em;
  text-align: center;
}

.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: 14px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.sidebar .brand__latin {
  color: rgba(220, 245, 230, 0.7);
}
.brand__text p {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.sidebar .brand__text p {
  color: rgba(220, 245, 230, 0.65);
}

.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(230, 245, 235, 0.78);
  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, 255, 255, 0.08); color: #ffffff; }
.nav__item.active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  color: #ffffff;
}
.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(230, 245, 235, 0.85);
}
html[lang="en"] .nav__item.active {
  font-weight: 600;
}

.sidebar__foot {
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 14px;
  color: rgba(220, 245, 230, 0.65);
  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, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(240, 253, 244, 0.92);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.12s, opacity 0.16s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { flex: 0 0 auto; width: 18px; height: 18px; }
.pol-icon-sun { display: none; }
:root[data-theme="dark"] .pol-icon-sun { display: block; }
:root[data-theme="dark"] .pol-icon-moon { display: none; }
.icon-btn:disabled { opacity: 0.42; cursor: not-allowed; }
.icon-btn:disabled:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); }

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

@media (min-width: 1201px) {
  :root {
    --pol-chrome-h: 58px;
  }
  .app {
    flex-direction: column;
  }
  .sidebar {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: calc(8px + env(safe-area-inset-top)) 18px 8px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 6px 18px rgba(6, 26, 15, 0.22);
  }
  :root[data-theme="dark"] .sidebar {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  }
  .sidebar__top {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    margin-right: auto;
  }
  .sidebar__top-spacer,
  .menu-toggle {
    display: none;
  }
  .sidebar .brand,
  .sidebar .brand--chrome {
    flex-direction: row;
    align-items: center;
    width: auto;
    max-width: none;
    padding: 0;
    margin: 0;
    gap: 10px;
    border-bottom: none;
  }
  .sidebar .brand .brand__mark {
    width: 40px;
    height: 40px;
  }
  .sidebar .brand__name {
    display: flex;
    font-size: 18px;
    line-height: 1.15;
    height: auto;
    min-height: 0;
    letter-spacing: 0.04em;
  }
  .sidebar__panel {
    display: flex;
    flex: 0 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-left: auto;
    position: static;
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
  :root[data-theme="dark"] .sidebar__panel {
    background: transparent;
  }
  .nav {
    flex-direction: row;
    flex: 0 1 auto;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav__item {
    flex: 0 0 auto;
    gap: 0;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }
  .nav__item svg {
    display: none;
  }
  .nav__item span {
    display: inline;
  }
  .sidebar__foot {
    flex: 0 0 auto;
    border-top: none;
    padding: 0;
    margin: 0;
  }
  .sidebar__tools {
    justify-content: flex-end;
  }
}

/* ===== Content area ===== */
.content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  overflow-x: hidden;
  background: linear-gradient(160deg, #f8faf8 0%, var(--linen) 50%, #edf3ed 100%);
}
:root[data-theme="dark"] .content {
  background: linear-gradient(160deg, #101e17 0%, var(--linen) 50%, #0c1711 100%);
}
.content-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: auto;
}
.content-main:has([data-pol-play]) {
  min-height: 100%;
}

/* Board layout: 3 columns — board | info | ad */
.play {
  display: grid;
  --panel-w: 336px;
  --panel-toggle-w: 30px;
  --play-mid-gap: 14px;
  --mid: calc(var(--panel-w) + var(--play-mid-gap) + var(--panel-toggle-w));
  grid-template-columns: minmax(0, 1fr) var(--mid) var(--ad-w);
  column-gap: 0;
  row-gap: 14px;
  align-items: start;
  padding: 12px;
}
@media (min-width: 1201px) {
  .content {
    min-height: 0;
    container-type: size;
  }
  .play {
    align-items: start;
    grid-template-rows: minmax(0, 1fr);
    height: 100cqh;
    min-height: 100cqh;
    max-height: 100cqh;
    overflow: visible;
    padding-block: var(--play-edge-inset);
    padding-inline: 12px;
  }
  .play .board {
    align-self: stretch;
    align-items: center;
    justify-content: flex-start;
    padding-left: var(--panel-toggle-w);
    box-sizing: border-box;
    --pol-stack-head: 0px;
    --pol-stack-hud: 134px;
    --pol-stack-foot: 52px;
    --pol-stack-gap: 20px;
    --pol-play-edge-y: calc(2 * var(--play-edge-inset));
    --pol-rail-w: 72px;
    --pol-rail-gap: 0px;
    --pol-board-chrome: calc(
      var(--pol-stack-head) + var(--pol-stack-hud) + var(--pol-stack-foot) +
      var(--pol-stack-gap) + var(--pol-play-edge-y)
    );
    --pol-sq-room: calc(100cqw - var(--pol-rail-w) - var(--pol-rail-gap));
    --sq: min(
      1280px,
      var(--pol-sq-room),
      calc((100cqh - var(--pol-board-chrome)) / var(--pol-board-ar))
    );
    padding-right: 0;
    overflow: visible;
  }
  .play .pol-wrap {
    flex: 0 0 auto;
    width: calc(var(--sq) + var(--pol-rail-w) + var(--pol-rail-gap));
    max-width: 100%;
    height: auto;
    margin-inline: auto;
    align-items: flex-start;
  }
  .play .play-head,
  .play .pol-top {
    width: var(--sq);
    max-width: 100%;
  }
  .play .pol-foot {
    width: 100%;
    max-width: 100%;
  }
  .play .board__stage {
    flex: 0 1 auto;
    min-height: 0;
    width: 100%;
    height: calc(var(--sq) * var(--pol-board-ar));
    max-height: 100%;
    container-type: normal;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: var(--pol-rail-gap);
  }
  .play .board__frame {
    flex: 0 0 var(--sq);
    align-self: stretch;
    width: var(--sq);
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }
  .play .pol-rail {
    flex: 0 0 var(--pol-rail-w);
    width: var(--pol-rail-w);
    height: var(--pol-felt-span);
    margin-top: 0;
    align-self: center;
  }
  .play .panel-toggle {
    right: calc(-1 * var(--panel-toggle-w));
  }
}
.play.play--ready {
  transition: grid-template-columns 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.play.play--ready .board,
.play.play--ready .pol-wrap {
  transition: none;
}
/* 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;
}
@media (min-width: 1201px) {
  .play.play--noad.play--collapsed {
    padding-block: var(--play-edge-inset);
    padding-inline: 12px;
  }
}
@media (max-width: 1200px) {
  .play--noad.play--collapsed {
    padding-left: 14px;
    padding-right: 14px;
  }
}
@media (min-width: 1201px) and (max-width: 1439px) {
  .play {
    --panel-w: 360px;
  }
}
@media (min-width: 1440px) and (max-width: 1679px) {
  .play {
    --panel-w: 400px;
  }
}
@media (min-width: 1680px) and (max-width: 1919px) {
  .play {
    --panel-w: 440px;
  }
}
@media (min-width: 1920px) {
  .play {
    --panel-w: 480px;
  }
}
@media (min-width: 1921px) {
  html,
  body,
  html[data-theme="dark"],
  html[data-theme="dark"] body {
    background-color: var(--linen);
  }
  .app {
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin-inline: 0;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    background-color: var(--linen);
  }
  .content {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    margin-inline: 0;
    min-height: 0;
    container-type: normal;
    overflow-y: visible;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .content-main {
    width: 100%;
    max-width: none;
    min-height: 0;
  }
  .content-main:has([data-pol-play]) {
    min-height: 0;
  }
  .content-main:has([data-pol-play]) > [data-pol-play] {
    flex: 0 0 auto;
    min-height: 0;
  }
  .play {
    width: 100%;
    max-width: 1920px;
    margin-inline: auto;
    box-sizing: border-box;
    height: auto;
    min-height: 0;
    max-height: none;
    align-items: start;
    grid-template-rows: auto;
    padding: 16px 24px 20px;
    --play-mid-gap: 36px;
    --mid: calc(var(--panel-w) + var(--play-mid-gap) + var(--panel-toggle-w));
  }
  .play .board {
    height: auto;
    min-height: 0;
    align-self: start;
    container-type: size;
    --pol-sq-room: calc(100cqw - var(--pol-rail-w) - var(--pol-rail-gap));
    --sq: min(
      1280px,
      var(--pol-sq-room),
      calc((100dvh - clamp(300px, 36vh, 420px)) / var(--pol-board-ar))
    );
  }
  .play .panel {
    height: auto;
    max-height: none;
    align-self: start;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .play .card-side {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .site-footer {
    width: 100%;
    max-width: none;
    margin-top: 0;
    box-sizing: border-box;
  }
  .site-footer__inner {
    width: 100%;
    max-width: 1920px;
    margin-inline: auto;
    padding-left: 32px;
    padding-right: 32px;
    box-sizing: border-box;
  }
  .site-footer__bar {
    width: 100%;
    max-width: 1920px;
    margin-inline: auto;
    padding-left: 32px;
    padding-right: 32px;
    box-sizing: border-box;
  }
  .sidebar {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 16px 20px;
    box-sizing: border-box;
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: 10px;
    padding-left: max(18px, calc((100vw - 1920px) / 2 + 18px));
    padding-right: max(18px, calc((100vw - 1920px) / 2 + 18px));
    border-right: none;
    border-bottom: 1px solid rgba(255, 235, 205, 0.14);
    box-shadow: none;
  }
  :root[data-theme="dark"] .sidebar {
    border-bottom-color: rgba(255, 235, 205, 0.1);
    box-shadow: none;
  }
  .sidebar__top {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    margin-right: 0;
  }
  .sidebar__top-spacer,
  .menu-toggle {
    display: none;
  }
  .sidebar .brand,
  .sidebar .brand--chrome {
    flex-direction: row;
    align-items: center;
    width: auto;
    margin: 0;
    padding: 0;
    border-bottom: none;
    gap: 10px;
  }
  .sidebar .brand .brand__mark {
    width: 36px;
    height: 36px;
  }
  .sidebar .brand__name {
    font-size: 18px;
    height: auto;
    line-height: 1.2;
  }
  .sidebar__panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-width: 0;
    min-height: 0;
    margin-left: 0;
    position: static;
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    padding: 0;
    background: none;
    box-shadow: none;
    border: none;
    overflow: visible;
    max-height: none;
  }
  .nav {
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 6px;
    min-width: 0;
    overflow-x: visible;
  }
  .nav__item {
    flex: 0 0 auto;
    height: 36px;
    padding: 6px 12px;
    gap: 0;
  }
  .nav__item svg {
    display: none;
  }
  .sidebar__foot {
    flex: 0 0 auto;
    padding: 0;
    border-top: none;
  }
  .sidebar__tools {
    justify-content: flex-end;
  }
  .below {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }
}

.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: 6px;
  padding-right: 0;
  overflow: visible;
  container-type: size;
  --pol-board-ar: 0.556277;
  --pol-rail-w: 72px;
  --pol-rail-gap: 0px;
  --pol-stack-head: 36px;
  --pol-stack-hud: 64px;
  --pol-stack-foot: 56px;
  --pol-stack-gap: 30px;
  --pol-board-chrome: calc(var(--pol-stack-head) + var(--pol-stack-hud) + var(--pol-stack-foot) + var(--pol-stack-gap));
  --pol-sq-room: calc(100cqw - var(--pol-rail-w) - var(--pol-rail-gap));
  --sq: min(
    1280px,
    calc((100cqh - var(--pol-board-chrome)) / var(--pol-board-ar)),
    var(--pol-sq-room)
  );
}
.pol-wrap {
  width: calc(var(--sq) + var(--pol-rail-w) + var(--pol-rail-gap));
  max-width: 100%;
  height: auto;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  container-type: inline-size;
}
.play--scoring:not(.play--spectating) .board {
  --sq: min(1280px, 100cqw, calc((100cqh - 200px) / var(--pol-board-ar)));
}
.play--scoring:not(.play--spectating) .toolbar--board {
  display: none;
}
.play--spectating .toolbar--board {
  display: none;
}
.play--spectating .board {
  --sq: min(1280px, 100cqw, calc((100cqh - 56px) / var(--pol-board-ar)));
}
[data-pol-spectate-leave] {
  display: none;
}
.play--spectating [data-pol-spectate-leave="panel"] {
  display: block;
  width: 100%;
}
.play-head [data-pol-spectate-leave="head"] {
  flex: 0 0 auto;
  white-space: nowrap;
}

.board__stage {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: calc(var(--sq) * var(--pol-board-ar));
  --pol-felt-inset-top: calc(100% * 54 / 514);
  --pol-felt-span: calc(100% * 406 / 514);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--pol-rail-gap);
  overflow: visible;
}
.board__stage .panel-toggle {
  top: 50%;
}
.panel-toggle {
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--panel-toggle-w));
  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(16, 45, 28, 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); }

.play-head {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  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: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.play-title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--brown-deep);
  line-height: 1.2;
}

.head-live {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
  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: 14px;
  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-pol-turn-text] {
  display: inline-block;
  min-width: 12ch;
  text-align: center;
  white-space: nowrap;
}
.head-live__cap {
  background: var(--surface);
  color: var(--ink-soft);
}
.head-live__cap b {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 2ch;
  text-align: center;
}
.head-live__sep { color: var(--line); margin: 0 1px; }
.head-live .status-chip { border: 1px solid transparent; }

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

/* 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: 14px;
  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: #f0fdf4;
  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: #f0fdf4;
  font-size: 14px;
  letter-spacing: 0.03em;
}
.match-center .match-rules {
  margin: 2px 0 0;
  color: var(--match-muted);
  font: 500 14px/1.3 var(--sans);
  white-space: nowrap;
}
.setup-ruleset-now {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.turn {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #f0fdf4;
  font-size: 14px;
}
.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; }

.play-head,
.pol-top,
.pol-foot {
  min-width: 0;
  width: var(--sq);
  max-width: 100%;
}
.board__frame {
  position: relative;
  flex: 0 0 var(--sq);
  align-self: stretch;
  width: var(--sq);
  height: 100%;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  box-sizing: border-box;
  filter: drop-shadow(0 16px 22px rgba(60, 48, 30, 0.28));
  --pol-wood-r-x: calc(100% * 18 / 924);
  --pol-wood-r-y: calc(100% * 18 / 514);
}
.pol-content-guide {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.board__frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--pol-wood-r-x) / var(--pol-wood-r-y);
  background: #22140c;
  pointer-events: none;
}
.pol-board-load {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: var(--pol-wood-r-x) / var(--pol-wood-r-y);
  background: color-mix(in srgb, var(--wood-deep) 38%, transparent);
  pointer-events: none;
}
.pol-board-load[hidden] {
  display: none;
}
.pol-board-load__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 22px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(158deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
  color: var(--ink);
}
.pol-board-load__ball {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff, #ebe7dc 62%, #b5afa0 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.pol-board-load__label {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--brown-deep);
}
.pol-board-load__track {
  width: 132px;
  max-width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.pol-board-load__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
  transition: width 0.16s ease-out;
}
@media (max-width: 900px) {
  .pol-board-load {
    padding: 10px;
  }
  .pol-board-load__card {
    gap: 8px;
    padding: 12px 14px 11px;
    max-width: min(220px, calc(100% - 16px));
  }
  .pol-board-load__ball {
    width: 26px;
    height: 26px;
  }
  .pol-board-load__track {
    width: min(108px, 100%);
  }
}
.board__frame:has(canvas[data-pol-live="1"])::before,
.board__frame:has(canvas[data-pol-live="1"]) .pol-board-load {
  opacity: 0;
  visibility: hidden;
  transition: none;
}
.board__frame:has(canvas[data-pol-live="1"]) .pol-board-load {
  display: none;
}
.board__frame:has(canvas[data-pol-live="1"]) canvas {
  visibility: visible;
}
.board__frame canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
  filter: none;
  cursor: crosshair;
  touch-action: none;
  background: transparent;
  visibility: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
:root[data-theme="dark"] .board__frame {
  overflow: visible;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.6));
}
:root[data-theme="dark"] .board__frame canvas {
  background: transparent;
  box-shadow: none;
  filter: none;
}
.pol-board-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: visible;
  border-radius: 0;
}
.pol-top {
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  display: block;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.pol-hud {
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px 16px;
  padding: 4px 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.pol-mid {
  display: contents;
}
.pol-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: center;
  justify-content: center;
  flex: 0 0 var(--pol-rail-w);
  width: var(--pol-rail-w);
  height: var(--pol-felt-span);
  margin-top: 0;
  min-height: 0;
  gap: 12px;
  padding: 12px 8px 14px;
  box-sizing: border-box;
  border-radius: 0 16px 16px 0;
  background: linear-gradient(180deg, rgba(30,33,40,.94), rgba(16,18,23,.96));
  box-shadow: 0 14px 32px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px rgba(255,255,255,.06);
}
.pol-kpis { display: flex; gap: 6px; }
.pol-kpi {
  min-width: 58px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,.32);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pol-kpi em {
  font-style: normal;
  font-size: 14px;
  letter-spacing: .6px;
  color: #7f8594;
  text-transform: uppercase;
}
.pol-kpi b {
  font-size: 17px;
  font-weight: 700;
  color: #f6f7fa;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.pol-kpi--grp {
  min-width: 58px;
}
.pol-kpi--grp em {
  letter-spacing: 0;
  text-transform: none;
}
.pol-kpi--grp b {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  color: #7f8594;
}
.pol-kpi--grp.is-assigned b,
.stat-item.pol-kpi--grp.is-assigned dd {
  font-weight: 600;
  color: #eab308;
}
.play[data-mode="vs-ai"] .pol-kpi--score,
.play[data-mode="vs-ai"] .pol-kpi--combo,
.play[data-mode="two-player"] .pol-kpi--score,
.play[data-mode="two-player"] .pol-kpi--combo,
.play[data-mode="online"] .pol-kpi--score,
.play[data-mode="online"] .pol-kpi--combo {
  display: none;
}
.play[data-mode="vs-ai"] .pol-kpi--grp,
.play[data-mode="two-player"] .pol-kpi--grp,
.play[data-mode="online"] .pol-kpi--grp {
  display: flex;
}
.play[data-mode="vs-ai"] .stat-item.pol-kpi--score,
.play[data-mode="vs-ai"] .stat-item.pol-kpi--combo,
.play[data-mode="two-player"] .stat-item.pol-kpi--score,
.play[data-mode="two-player"] .stat-item.pol-kpi--combo,
.play[data-mode="online"] .stat-item.pol-kpi--score,
.play[data-mode="online"] .stat-item.pol-kpi--combo {
  display: none;
}
.pol-kpi--match-you,
.pol-kpi--match-opp {
  display: none;
}
.play[data-mode="vs-ai"] .pol-kpi--match-you,
.play[data-mode="vs-ai"] .pol-kpi--match-opp,
.play[data-mode="two-player"] .pol-kpi--match-you,
.play[data-mode="two-player"] .pol-kpi--match-opp,
.play[data-mode="online"] .pol-kpi--match-you,
.play[data-mode="online"] .pol-kpi--match-opp {
  display: flex;
}
.play:has(.pol-hud--passive) .pol-rail {
  opacity: 0.42;
  pointer-events: none;
  filter: saturate(0.7);
}
.pol-hud__center {
  grid-column: 1 / -1;
  order: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 4px 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
@media (min-width: 821px) and (max-width: 1200px) {
  .pol-hud__center {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .pol-tray {
    justify-content: center;
  }
  .pol-subrow {
    align-items: center;
    text-align: center;
  }
  [data-pol-toast] {
    text-align: center;
  }
}
.pol-tray {
  --ball-size: calc(var(--sq) * 31 / 924);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}
@media (min-width: 1201px) {
  .pol-hud {
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
  }
  .pol-hud__center {
    grid-column: auto;
    order: 0;
    min-width: 0;
    padding-top: 0;
    border-top: none;
    flex-wrap: nowrap;
  }
  .pol-tray {
    flex-wrap: nowrap;
    justify-content: center;
  }
}
.pol-tray__lane {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 7px;
  border-radius: 12px;
}
.pol-tray__lane em {
  display: none;
  font-style: normal;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .2px;
  color: #8b91a0;
  white-space: nowrap;
  line-height: 1;
}
.pol-tray--eight .pol-tray__lane em { display: block; }
.pol-tray--eight .pol-tray__lane,
.pol-tray--eight .pol-tray__mid {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.pol-tray__mid {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 12px;
  flex: none;
}
.pol-tray__lane.is-you {
  background: rgba(234,179,8,.12);
  box-shadow: 0 0 0 1px rgba(234,179,8,.38);
}
.pol-tray__lane.is-you em { color: #eab308; }
.pol-tray__lane.is-opp {
  background: rgba(148,163,184,.08);
  box-shadow: 0 0 0 1px rgba(148,163,184,.22);
}
.pol-tray__balls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pol-tray__sep {
  width: 1px;
  height: 14px;
  background: rgba(255,255,255,.1);
  margin: 0 2px;
}
.pol-well {
  width: var(--ball-size);
  height: var(--ball-size);
  min-width: 0;
  min-height: 0;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.1), transparent 50%),
    radial-gradient(circle at 50% 68%, #2c3038 0%, #1c1e24 80%);
  box-shadow:
    inset 0 1px 1.5px rgba(0, 0, 0, 0.38),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.22);
}
.pol-bicon {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 50%;
  display: block;
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.4));
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.pol-well.off .pol-bicon {
  opacity: 0;
  transform: scale(0.28);
  pointer-events: none;
}
.pol-well.is-hovered:not(.off) {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  z-index: 1;
}
.pol-subrow {
  flex: 0 0 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 14px;
  color: #949aa9;
  white-space: normal;
}
[data-pol-toast] {
  display: block;
  width: 100%;
  height: 1.5em;
  flex: none;
  line-height: 1.5;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 700;
  color: #4ade80;
}
.pol-rail__k {
  font-style: normal;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .2px;
  color: #8b91a0;
  text-align: center;
  line-height: 1.2;
}
.pol-spinbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
}
.pol-charge {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  margin-top: 0;
  gap: 8px;
  padding: 0;
  background: none;
  box-shadow: none;
  box-sizing: border-box;
}
.pol-charge__head {
  width: 100%;
  flex: 0 0 auto;
}
.pol-charge__head b {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 28px;
  padding: 2px 0 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
}
.pol-pct {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  margin: 0 0 1px 1px;
}
.pol-charge.is-charged .pol-charge__head b {
  color: #ecfdf5;
  background: rgba(16, 185, 129, 0.16);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.28);
}
.pol-charge__track {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 96px;
  max-height: none;
  height: auto;
  padding: 5px;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 16%, transparent 84%, rgba(255, 255, 255, 0.08)),
    linear-gradient(180deg, #4a5366, #343b4c);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.38);
}
.pol-charge__fill {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 5px;
  height: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(to bottom, #22c55e 0%, #86efac 28%, #facc15 62%, #fb7185 100%);
  box-shadow:
    0 0 14px rgba(52, 211, 153, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}
.pol-charge.is-charged .pol-charge__fill {
  box-shadow:
    0 0 16px rgba(250, 204, 21, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}
.pol-charge__shine {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
}
.pol-charge__knob {
  position: absolute;
  top: auto;
  bottom: 3px;
  left: 50%;
  width: 18px;
  height: 7px;
  margin-left: -9px;
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(180deg, #fff8e7, #d6c7a3 55%, #8f7d58);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  opacity: 0;
}
.pol-charge.is-charged .pol-charge__knob {
  opacity: 1;
}
.pol-charge__ticks {
  position: absolute;
  inset: 10px 8px;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}
.pol-charge__ticks i {
  display: block;
  height: 1px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.32);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.pol-pbox {
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pol-phead {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #8b90a0;
  font-variant-numeric: tabular-nums;
}
.pol-phead b { color: #f4f5f8; font-size: 18px; }
.pol-charge__head.pol-phead {
  display: flex;
  justify-content: center;
  align-items: center;
}
.pol-charge__head b {
  width: 100%;
  text-align: center;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pol-power {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: rgba(0,0,0,.55);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.06);
  overflow: hidden;
}
[data-pol-power-fill] {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg,#34d399,#facc15 55%,#ef4444);
  border-radius: 5px;
}
.pol-pticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 24%, rgba(0,0,0,.45) 24% 25%);
  pointer-events: none;
}
[data-pol-spin], .pol-spin-picker__ball {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 59%, rgba(0,0,0,.15) 60% 62.5%, transparent 63.5%),
    radial-gradient(circle at 32% 28%, #fff, #ebe7dc 62%, #b5afa0 100%);
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 3px 8px rgba(0,0,0,.55), inset 0 0 0 1.5px rgba(0,0,0,.35);
}
[data-pol-spin]::before, [data-pol-spin]::after,
.pol-spin-picker__ball::before, .pol-spin-picker__ball::after { content: ''; position: absolute; background: rgba(0,0,0,.18); pointer-events: none; }
[data-pol-spin]::before, .pol-spin-picker__ball::before { left: 15%; right: 15%; top: 50%; height: 1px; }
[data-pol-spin]::after, .pol-spin-picker__ball::after { top: 15%; bottom: 15%; left: 50%; width: 1px; }
[data-pol-spin-dot], .pol-spin-picker__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px;
  border-radius: 50%;
  pointer-events: none;
  background: #e11d48;
  box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 1px 3px rgba(0,0,0,.6);
}
[data-pol-spin][aria-disabled="true"] { cursor: not-allowed; opacity: .55; }
[data-pol-spin]:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.pol-spin-picker-layer { position: fixed; inset: 0; z-index: 1100; touch-action: none; }
.pol-spin-picker-layer[hidden] { display: none; }
.pol-spin-picker-layer[data-mobile="true"] { background: color-mix(in srgb, var(--wood-deep) 24%, transparent); }
.pol-spin-picker {
  position: fixed;
  z-index: 1100;
  width: min(16.5rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  display: grid;
  gap: .875rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-family: var(--sans);
  touch-action: pan-y;
}
.pol-spin-picker[hidden] { display: none; }
.pol-spin-picker__head, .pol-spin-picker__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.pol-spin-picker__title { font-weight: 700; font-size: .9375rem; }
.pol-spin-picker__label { color: var(--brown); font-size: .75rem; font-weight: 600; }
.pol-spin-picker__ball {
  width: min(11.5rem, calc(100vw - 5rem));
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  margin: .25rem auto;
  cursor: crosshair;
}
.pol-spin-picker__ball:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
.pol-spin-picker__dot { width: 14px; height: 14px; margin: -7px; }
.pol-spin-picker__hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: .75rem;
  line-height: 1.6;
  text-align: center;
}
.pol-spin-picker__action {
  flex: 1;
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-size: .8125rem;
  font-weight: 600;
}
.pol-spin-picker__action:last-child { background: var(--brown-deep); color: var(--surface); }
:root[data-theme="dark"] .pol-spin-picker__action:last-child { color: var(--wood-deep); }
.pol-spin-picker__action:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (pointer: coarse) and (max-height: 480px), (hover: none) and (max-height: 480px) {
  .pol-spin-picker { gap: .5rem; padding: .75rem; }
  .pol-spin-picker__ball { width: min(8rem, calc(100dvh - 10rem)); }
}
.pol-smeta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  text-align: center;
}
.pol-smeta em { font-style: normal; font-size: 14px; color: #7f8594; letter-spacing: .4px; white-space: nowrap; }
[data-pol-spin-label] { font-size: 14px; font-weight: 400; color: #f0f1f5; white-space: nowrap; line-height: 1.2; text-align: center; }
.pol-foot {
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 13px;
  background: rgba(18,20,26,.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 1px rgba(255,255,255,.05);
  font-size: 14px;
  color: #8c92a2;
}
.pol-keys { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pol-keys span { display: inline-flex; align-items: center; gap: 5px; }
.pol-keys span.pol-keys--touch { display: none; }
@media (pointer: coarse), (hover: none) {
  .pol-keys span.pol-keys--pc { display: none; }
  .pol-keys span.pol-keys--touch { display: inline-flex; }
}
.pol-foot kbd {
  padding: 2px 6px;
  border-radius: 5px;
  font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #d9dce4;
  background: linear-gradient(180deg,#2a2e39,#1b1e26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 2px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.08);
}
.pol-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.pol-acts button {
  padding: 5px 10px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  font: 600 14px inherit;
  color: #dfe2ea;
  background: linear-gradient(180deg,#2b303c,#1e222b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.08);
}
.pol-acts button:hover { background: linear-gradient(180deg,#353b49,#252a35); color: #fff; }
[data-theme="light"] .board__frame {
  overflow: visible;
  background: transparent;
  box-shadow: none;
}
[data-theme="light"] .board__frame canvas {
  background: transparent;
  box-shadow: none;
  filter: none;
}
[data-theme="light"] .pol-rail {
  background: linear-gradient(180deg, #c5d2c9, #aebdb4);
  box-shadow: 0 10px 28px rgba(40, 55, 48, .16), inset 0 1px 0 rgba(255,255,255,.38), 0 0 0 1px rgba(50, 70, 58, .18);
}
[data-theme="light"] .pol-top,
[data-theme="light"] .pol-hud {
  background: none;
  box-shadow: none;
}
[data-theme="light"] .pol-rail__k { color: #4b5563; }
[data-theme="light"] .pol-charge {
  background: none;
  box-shadow: none;
}
[data-theme="light"] .pol-charge__head b {
  color: #1d2027;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .pol-charge.is-charged .pol-charge__head b {
  color: #14532d;
  background: rgba(22, 163, 74, 0.12);
  box-shadow: inset 0 0 0 1px rgba(22, 101, 52, 0.22);
}
[data-theme="light"] .pol-charge__track {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.55), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.28)),
    linear-gradient(180deg, #dfe6e1, #c5d0c8);
  box-shadow:
    inset 0 2px 4px rgba(40, 55, 48, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(50, 70, 58, 0.14);
}
[data-theme="light"] .pol-charge__fill {
  box-shadow:
    0 0 10px rgba(22, 163, 74, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
[data-theme="light"] .pol-charge__ticks i {
  background: rgba(20, 34, 26, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
[data-theme="light"] .pol-kpi { background: rgba(35,38,45,.05); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
[data-theme="light"] .pol-kpi em,
[data-theme="light"] .pol-smeta em,
[data-theme="light"] .pol-phead { color: #6b7080; }
[data-theme="light"] .pol-kpi b,
[data-theme="light"] .pol-phead b,
[data-theme="light"] [data-pol-spin-label] { color: #1d2027; }
[data-theme="light"] .pol-kpi--grp b,
[data-theme="light"] .stat-item.pol-kpi--grp dd { color: #6b7280; }
[data-theme="light"] .pol-kpi--grp.is-assigned b,
[data-theme="light"] .stat-item.pol-kpi--grp.is-assigned dd { color: #a16207; }
[data-theme="light"] .pol-tray--eight .pol-tray__lane,
[data-theme="light"] .pol-tray--eight .pol-tray__mid {
  background: rgba(174, 189, 180, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 0 0 1px rgba(50, 70, 58, 0.14);
}
[data-theme="light"] .pol-tray__sep { background: rgba(0,0,0,.12); }
[data-theme="light"] .pol-tray__lane em { color: #6b7080; }
[data-theme="light"] .pol-tray__lane.is-you { background: rgba(202,138,4,.1); box-shadow: 0 0 0 1px rgba(202,138,4,.35); }
[data-theme="light"] .pol-tray__lane.is-you em { color: #a16207; }
[data-theme="light"] .pol-tray__lane.is-opp { background: rgba(100,116,139,.08); box-shadow: 0 0 0 1px rgba(100,116,139,.2); }
[data-theme="light"] .pol-well {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.35), transparent 50%),
    radial-gradient(circle at 50% 68%, #9aa497 0%, #6d786f 82%);
  box-shadow:
    inset 0 1px 1.5px rgba(40, 55, 48, 0.28),
    inset 0 -1px 1px rgba(255, 255, 255, 0.4),
    0 0 0 1px rgba(50, 70, 58, 0.16);
}
[data-theme="light"] .pol-well.is-hovered:not(.off) {
  outline: 3px solid var(--brown-deep);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--surface);
}
[data-theme="light"] .pol-subrow { color: #5f6472; }
[data-theme="light"] [data-pol-toast] { color: #15803d; }
[data-theme="light"] .pol-power { background: rgba(35,38,45,.1); box-shadow: inset 0 1px 2px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.06); }
[data-theme="light"] .pol-pticks { background: repeating-linear-gradient(90deg, transparent 0 24%, rgba(255,255,255,.7) 24% 25%); }
[data-theme="light"] .pol-foot {
  background: rgba(255,255,255,.82);
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(0,0,0,.07);
  color: #5f6472;
}
[data-theme="light"] .pol-foot kbd {
  color: #2b2f38;
  background: linear-gradient(180deg,#fff,#eeece6);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.1);
}
[data-theme="light"] .pol-acts button {
  color: #2b2f38;
  background: linear-gradient(180deg,#fff,#f0eee8);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0,0,0,.1), 0 0 0 1px rgba(0,0,0,.1);
}
[data-theme="light"] .pol-acts button:hover { background: linear-gradient(180deg,#fff,#e8e5dd); color: #111; }
@media (max-width: 820px) {
  .pol-hud { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 8px 12px; }
  .pol-kpis { grid-column: 1 / -1; }
  .pol-kpi { flex: 1; }
  .pol-pbox { width: 100%; min-width: 140px; }
  .pol-hud__center { flex-wrap: wrap; gap: 6px 12px; }
}
@media (max-width: 520px) {
  .pol-kpi { min-width: 0; padding: 4px 7px; }
  .pol-kpi b { font-size: 14px; }
  .pol-tray { gap: 5px; width: 100%; justify-content: center; }
  .pol-tray__lane { padding: 2px 6px; gap: 6px; }
  .pol-tray__balls { gap: 5px; }
  .pol-subrow { font-size: 14px; white-space: normal; }
  [data-pol-spin] { width: 48px; height: 48px; }
  .pol-foot { padding: 6px 10px; }
  .pol-acts { width: 100%; justify-content: space-between; }
  .pol-acts button { flex: 1; padding: 7px 0; font-size: 14px; }
}
@media (max-height: 500px) {
  .pol-hud { padding: 5px 10px; gap: 4px 10px; border-radius: 11px; }
  .pol-kpi { padding: 2px 7px; flex-direction: row; align-items: baseline; gap: 5px; min-width: 0; }
  .pol-kpi b { font-size: 14px; }
  .pol-hud__center { padding-top: 4px; }
  [data-pol-spin] { width: 40px; height: 40px; }
  .pol-foot { padding: 3px 10px; border-radius: 9px; }
}
.board__status {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 3;
  margin: 0;
  max-width: calc(100% - 28px);
  padding: 7px 14px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: rgba(12, 34, 22, 0.9);
  color: #f0fdf4;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(6, 20, 12, 0.35);
}
.board__status[hidden] {
  display: none;
}

/* ===== Info column ===== */
.panel {
  min-width: 0;
  width: auto;
  height: 100%;
  margin-left: calc(var(--play-mid-gap) + var(--panel-toggle-w));
  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;
  min-height: 0;
  max-height: 100%;
  align-self: stretch;
}

/* ===== Live status card (top of info column) ===== */
.status-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(158deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}
.status-card__top {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.status-card__badges {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}
.status-card__badges .mode-pill,
.status-card__badges .status-chip {
  flex: 0 0 auto;
  width: max-content;
  padding: 5px 12px;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.status-card__badges .status-chip {
  gap: 6px;
}
.status-card__top .btn-sound {
  margin-left: auto;
  flex: 0 0 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(0, 0, 0, 0.25);
  border: 1px solid transparent;
}
.stone-dot.black {
  background: radial-gradient(circle at 35% 30%, #444444, #080808 75%);
  border-color: transparent;
}
.stone-dot.white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #ded4c2 80%);
  border-color: 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: 14px;
  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: 14px;
}
.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: 14px;
}
.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); font-variant-numeric: tabular-nums; }

.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: var(--surface);
  font-size: 14px;
  cursor: pointer;
}

.toolbar { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.toolbar.toolbar--panel {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}
.toolbar.toolbar--panel .btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  padding: 6px 4px;
  white-space: nowrap;
}
.toolbar .btn { border-radius: 12px; }
.toolbar .btn--primary { grid-column: 1 / -1; }

/* Toolbar mounted below the board: a content-aware flex row. */
.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[aria-busy="true"],
.toolbar--board .btn.is-replaying {
  cursor: wait;
  opacity: 0.85;
  animation: rvy-hint-pulse 1.1s ease-in-out infinite;
}
@keyframes rvy-hint-pulse {
  50% { opacity: 0.55; }
}

.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: 14px;
  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, #1e7044, #124d2d);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(18, 77, 45, 0.28);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #248250, #165b36);
  box-shadow: 0 6px 18px rgba(18, 77, 45, 0.36);
}
.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);
}
.pol-scoreboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 10px;
}
.pol-score-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 10px 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.pol-score-row--you {
  background: color-mix(in srgb, var(--gold) 12%, var(--surface-2));
  border-color: color-mix(in srgb, var(--gold) 35%, var(--line-soft));
}
.pol-score-row__who {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
.pol-score-row__grp {
  justify-self: end;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: right;
}
.pol-score-row.is-assigned .pol-score-row__grp {
  color: var(--ink-soft);
}
.pol-score-row--you.is-assigned .pol-score-row__grp {
  color: var(--gold);
}
.play[data-ruleset="nine-ball"] .pol-score-row__grp,
.play[data-ruleset="ten-ball"] .pol-score-row__grp {
  display: none;
}
.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: 14px; font-weight: 400; }
.stat-item dd { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.stat-item dd[data-pol-last] { font-size: 14px; font-weight: 400; }

.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: 14px;
  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; }

.card-side {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 12px 12px;
}
.play .card-side .side-tabs { display: none; }
.play .side-pane[data-pol-side-pane="info"] { flex: 0 0 auto; }
.play .side-pane[data-pol-side-pane="info"].is-off {
  visibility: visible;
  pointer-events: auto;
  display: flex !important;
}
.play .side-pane[data-pol-side-pane="history"] {
  position: relative;
  inset: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
  gap: 8px;
}
.side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line-soft);
}
.side-tabs__btn {
  min-height: 30px;
  padding: 4px 2px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
}
.side-tabs__btn:hover { color: var(--brown-deep); }
.side-tabs__btn.active {
  color: var(--brown-deep);
  border-bottom-color: var(--brown-deep);
}
.side-stack {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.side-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.side-pane[hidden],
.side-pane.is-off { display: none !important; }
.side-pane[data-pol-side-pane="history"]:not([hidden]) {
  overflow: hidden;
  gap: 8px;
}
.move-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px 4px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.move-list-bar {
  position: relative;
  flex: 0 0 auto;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 2px 0 0;
  background: var(--surface);
}
.btn.move-list-copy,
.move-list-copy {
  min-height: 28px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: none;
}
.btn.move-list-copy:hover,
.move-list-copy:hover {
  transform: none;
}
.history-head .move-list-bar {
  padding: 0;
  background: transparent;
}
.card-side .move-list {
  flex: none;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
}
.move-list {
  margin: 0;
  padding: 0 2px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}
.pol-shot-empty {
  margin: 4px 4px 0;
  font-size: 14px;
  color: var(--ink-soft);
}
.pol-shot-empty[hidden] { display: none; }
.pol-shot {
  display: grid;
  grid-template-columns: 1.7em 2.4em minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 400;
}
.pol-shot__n {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.pol-shot__who { font-weight: 500; }
.pol-shot__play {
  min-width: 0;
  font-weight: 400;
  line-height: 1.25;
}
.pol-shot__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  white-space: nowrap;
}
.pol-shot__tag { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.pol-shot.is-gain { border-color: rgba(22, 163, 74, 0.38); }
.pol-shot.is-foul { border-color: rgba(190, 18, 60, 0.38); }
.move-list button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  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 .stone-dot {
  display: block;
  width: 14px;
  height: 14px;
}
.move-list button:hover { background: color-mix(in srgb, var(--jade) 12%, var(--surface-2)); color: var(--ink); }
.move-list button:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }
.move-list .active button { background: #1e7044; color: #ffffff; border-color: #1e7044; font-weight: 700; }

.ad-rail {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  justify-content: center;
  margin-left: 14px;
}
.ad-slot {
  width: var(--ad-w);
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
}
.ad-slot iframe {
  border: 0;
  display: block;
  flex-shrink: 0;
}
.ad-slot--mobile {
  display: none;
  width: var(--sq);
  height: 50px;
  flex: 0 0 50px;
  margin-top: 8px;
}
iframe[id^="container-"],
iframe[class^="container-"] {
  display: none !important;
}

/* ===== 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);
  box-shadow: var(--shadow);
}
.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);
  box-shadow: var(--shadow);
}
.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);
  text-align: center;
}
.tips-flow__step strong {
  font-size: 15px;
  line-height: 1.3;
}
.tips-flow__step span {
  color: var(--ink-soft);
  font-size: 14px;
  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(--jade);
  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 .pool-rules-shot,
.rules-case__shot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.rules-case__figure {
  margin: 0 0 18px;
}
.tips-diagram {
  margin: 24px 0 30px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.tips-diagram figcaption {
  text-align: left;
}
.tips-diagram h3 {
  margin: 0 0 10px;
}
.tips-diagram figcaption p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
}
.tips-diagram__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.tips-diagram__grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tips-diagram__grid[data-count="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tips-diagram__panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  position: relative;
}
.tips-diagram h4 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
.tips-diagram__shot {
  display: block;
  width: 100%;
  max-width: 540px;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
}
.tips-diagram__desc-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.tips-diagram .tips-diagram__caption {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.6;
}
.tips-diagram .tips-diagram__legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
  list-style: none;
  margin: 18px 0;
  padding: 0;
}
.tips-diagram__legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}
.tips-diagram .tips-diagram__legend[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tips-diagram__key {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 1px solid #746c5a;
  border-radius: 50%;
  background: #f5f3eb;
}
.tips-diagram__key--target {
  background: #e1bb77;
}
.tips-diagram__key--ghost {
  border-style: dashed;
  background: none;
}
.tips-diagram__key--zone {
  border-color: var(--brown-deep);
  border-style: dashed;
  border-radius: 3px;
  background: #aad4b9;
}
.tips-diagram__key--axis {
  height: 0;
  border: 0;
  border-top: 2px dashed var(--brown-deep);
  border-radius: 0;
  background: none;
}
.tips-diagram .tips-diagram__steps {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}
.tips-diagram__steps li + li {
  margin-top: 6px;
}
.tips-diagram__notes {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.tips-diagram .tips-diagram__notes p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}
.tips-diagram .tips-diagram__notes p + p {
  margin-top: 6px;
}
@media (max-width: 900px) {
  .tips-diagram__grid[data-count="2"],
  .tips-diagram__grid[data-count="3"] {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  .tips-diagram {
    padding: 14px;
  }
  .tips-diagram__panel {
    padding: 10px;
  }
  .tips-diagram .tips-diagram__legend {
    gap: 8px;
  }
}
.article-figure figcaption {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  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; }
.lesson-board-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0;
}
.lesson-board {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.lesson-board__grid {
  display: grid;
  grid-template-columns: 22px repeat(8, minmax(0, 1fr));
  grid-template-rows: 22px repeat(8, minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1;
}
.lesson-board__corner,
.lesson-board__file,
.lesson-board__rank {
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font: 700 14px/1 var(--font-sans);
}
.lesson-board__cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  border-right: 1px solid rgba(8, 55, 35, 0.32);
  border-bottom: 1px solid rgba(8, 55, 35, 0.32);
  background: #2f8a58;
}
.lesson-board__cell:nth-child(9n + 2) { border-left: 1px solid rgba(8, 55, 35, 0.32); }
.lesson-board__cell.is-focus { background: #49a66f; }
.lesson-board__cell.is-flipped::after {
  content: "";
  position: absolute;
  inset: 9%;
  border: 2px solid #f8c95c;
  border-radius: 50%;
}
.lesson-board__disc {
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.34);
}
.lesson-board__disc.black {
  background: radial-gradient(circle at 34% 28%, #505b54, #101713 62%, #050806);
}
.lesson-board__disc.white {
  border: 1px solid rgba(20, 45, 31, 0.18);
  background: radial-gradient(circle at 34% 28%, #fff, #e7eee9 64%, #c7d2cb);
}
.lesson-board__legal {
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.13);
}
.lesson-board figcaption {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}
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: 14px/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: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.select__trigger:hover { border-color: var(--jade); }
.select.open .select__trigger {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(42, 123, 79, 0.15);
}
.select__dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(42, 123, 79, 0.18);
}
.select__dot.lv2 { background: var(--gold); box-shadow: 0 0 0 3px rgba(180, 128, 24, 0.18); }
.select__dot.lv3 { background: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18); }
.select__dot.lv4 { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2); }
.select__dot.lv5 { background: #1f6b4a; box-shadow: 0 0 0 3px rgba(31, 107, 74, 0.2); }
.select__dot.lv-white {
  background: #fdf8ee;
  border: 1px solid rgba(140, 95, 45, 0.35);
  box-shadow: 0 0 0 3px rgba(140, 95, 45, 0.12);
}
.select__dot.lv-black {
  background: #1c1917;
  box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.22);
}
:root[data-theme="dark"] .select__dot.lv-white {
  background: #f4ece0;
  border-color: rgba(226, 168, 59, 0.45);
}
.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: 14px; 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(30, 112, 68, 0.1); }
.select__opt .select__title { color: var(--ink); }

/* ===== Online room view ===== */
.online { max-width: 860px; width: 100%; min-width: 0; 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;
  max-width: none;
  width: 100%;
  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; min-width: 0; }
.room-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.room-card p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.room-card .size-switch {
  justify-content: stretch;
  width: 100%;
}
.room-card .size-switch__btn {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}
.room-input {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0.02em;
  text-align: center;
}
.online__hint {
  margin: 0;
  min-height: 1.2em;
  font-size: 14px;
  color: var(--gold);
}
.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(42, 123, 79, 0.1);
  border: 1px solid rgba(42, 123, 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: var(--surface-2);
}
.state-tabs__label { flex: 0 0 100%; font-size: 14px; 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: 14px;
  cursor: pointer;
}
.state-tabs button.active { background: #1e7044; color: #ffffff; border-color: #1e7044; }

.conn {
  max-width: 560px;
  width: 100%;
  min-width: 0;
  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(30, 112, 68, 0.18);
  border-top-color: #1e7044;
  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(42, 123, 79, 0.12);
  color: var(--jade-deep);
}
.conn__ring.warn { background: rgba(180, 128, 24, 0.14); color: var(--gold); }
.conn__ring.err { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.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; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-soft); max-width: 100%; }
.seg--full { display: flex; width: 100%; min-width: 0; }
.seg--full .seg__btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }
.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, #1e7044, #124d2d);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(18, 77, 45, 0.22);
}
.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: 14px; 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: 14px; 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: var(--surface);
  font-size: 14px;
  color: var(--ink);
}
.invite-row .btn { flex: 0 0 auto; }
.copied { font-size: 14px; color: var(--jade-deep); }

/* Site footer */
.site-footer {
  margin-top: 8px;
  background: linear-gradient(180deg, #124329 0%, #0d341f 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.18);
  color: rgba(220, 245, 230, 0.72);
}
.pol-chrome-footer::after {
  content: "";
  display: block;
  height: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="dark"] .site-footer {
  background: linear-gradient(180deg, #0c1a13 0%, #08120d 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.5);
  color: rgba(180, 215, 195, 0.65);
}
.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: #f0fdf4;
  letter-spacing: 0.02em;
}
:root[data-theme="dark"] .footer-heading {
  color: #eef6f1;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col .footer-games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}
.footer-col a {
  color: rgba(220, 245, 230, 0.78);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}
.footer-col a:hover { color: #ffffff; }
:root[data-theme="dark"] .footer-col a {
  color: rgba(180, 215, 195, 0.75);
}
:root[data-theme="dark"] .footer-col a:hover {
  color: #ffffff;
}
.footer-col--brand .brand { margin-bottom: 14px; }
.footer-col--brand .brand__name { font-size: 17px; }
.footer-col--brand .brand__text p { color: rgba(240, 253, 244, 0.92); }
.footer-about {
  margin: 0 0 18px;
  color: rgba(220, 245, 230, 0.68);
  font-size: 14px;
  line-height: 1.7;
  max-width: 34ch;
}
:root[data-theme="dark"] .footer-about {
  color: rgba(180, 215, 195, 0.65);
}
.lang { position: relative; display: inline-block; }
.lang__trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #f0fdf4;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.lang__trigger:hover { border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.16); }
.lang__trigger.open { border-color: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2); }
.lang__globe { color: #4ade80; }
.lang__caret { color: rgba(220, 245, 230, 0.7); 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(30, 112, 68, 0.1); color: var(--brown-deep); font-weight: 600; }
:root[data-theme="dark"] .lang__opt.active { background: rgba(74, 222, 128, 0.14); color: #eef6f1; }
.lang__check { margin-left: auto; color: var(--brown); }
.lang__opt:not(.active) .lang__check { visibility: hidden; }
.site-footer__bar {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: rgba(220, 245, 230, 0.62);
}
:root[data-theme="dark"] .site-footer__bar {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(180, 215, 195, 0.55);
}

@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; width: 100%; min-width: 0; margin: 0 auto; }
.lobby__bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}
.lobby__bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lobby__bar h3 { margin: 0; font-family: var(--serif); font-size: 18px; color: var(--brown-deep); min-width: 0; }
.lobby__filter { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.lobby__filter button {
  padding: 5px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
}
.lobby__filter button.active { background: #1e7044; color: #ffffff; border-color: #1e7044; }
.room-list { display: flex; flex-direction: column; gap: 10px; }
.room-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(16, 45, 28, 0.05);
}
.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: #ffffff;
  background: linear-gradient(135deg, #1e7044, #124d2d);
}
.room-item__body { 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-item__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-self: end;
  min-width: 88px;
}
.room-item__actions .btn {
  width: 100%;
  white-space: nowrap;
}
.room-item__close {
  font-size: 14px;
}
.room-tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 14px;
  color: var(--ink-soft);
}
.room-tag.waiting { color: var(--gold); border-color: rgba(180, 128, 24, 0.28); background: rgba(180, 128, 24, 0.1); }
.lobby__empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.lobby-block { margin-top: 8px; }
.lobby-block + .lobby-block { margin-top: 28px; }
.lobby-block__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.lobby-block h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--brown-deep);
}
.lobby-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(42, 123, 79, 0.10);
  color: var(--jade-deep);
  border: 1px solid rgba(42, 123, 79, 0.18);
}
.lobby-block__note {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-soft);
}
.room-item--mine {
  border-color: rgba(42, 123, 79, 0.35);
  background: linear-gradient(158deg, var(--surface), rgba(42, 123, 79, 0.08));
}
.room-item--busy {
  box-shadow: none;
  background: var(--surface-2);
  opacity: 0.92;
}
.room-item--busy .status-chip { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 560px) {
  .room-item { grid-template-columns: auto minmax(0, 1fr); }
  .room-item__actions { grid-column: 1 / -1; width: 100%; }
  .room-item--busy .status-chip { grid-column: 1 / -1; justify-self: start; }
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  width: max-content;
  white-space: nowrap;
  box-sizing: border-box;
}
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.status-chip.online { background: rgba(42, 123, 79, 0.14); color: var(--jade-deep); }
.status-chip.online .dot { background: var(--jade); box-shadow: 0 0 0 2px rgba(42, 123, 79, 0.18); }
.status-chip.waiting { background: rgba(180, 128, 24, 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(77, 99, 86, 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;
  flex-wrap: wrap;
  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: 0;
  flex: 1 1 120px;
}
.player.you { box-shadow: 0 0 0 2px rgba(42, 123, 79, 0.3); border-color: var(--jade); }
.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%, #444444, #080808 75%); color: #fff; }
.avatar.white { background: radial-gradient(circle at 35% 30%, #ffffff, #ded4c2 80%); color: #14221a; }
.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: 14px; 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: #080808; }
.turn-flag .dot.white { background: #ffffff; 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.4), transparent 240px);
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}
:root[data-theme="dark"] .below {
  background: linear-gradient(180deg, rgba(21, 36, 28, 0.4), 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--en .below__lead > p,
.below--zh-tw .below__lead > p {
  font-size: 16px;
  color: var(--ink-soft);
}
.pool-position-figure {
  margin: 0;
  padding: 16px;
}
.pool-position-figure__title {
  margin: 0 0 12px;
  font-weight: 600;
}
.pool-position-figure .pool-position-diagram {
  display: block;
  width: 100%;
  height: auto;
}
.pool-position-figure .pool-position-shot {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 8px;
  background: var(--surface-2);
}
.pool-position-figure figcaption {
  margin-top: 12px;
  font-size: 14px;
  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); }
.corner-map {
  margin: 22px auto 0;
  width: 100%;
  max-width: 420px;
}
.corner-map__grid {
  display: grid;
  width: 100%;
  grid-template-columns: 1.15rem repeat(8, minmax(0, 1fr));
  gap: 2px;
}
.corner-map__axis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  font-size: 14px;
  color: var(--ink-soft);
}
.corner-map__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  aspect-ratio: 1;
  padding: 1px;
  border-radius: 3px;
  background: #1f7a4a;
  color: #fff;
  font-size: clamp(14px, 2.5vw, 16px);
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
}
.corner-map__cell--corner { background: #c99a2e; }
.corner-map__cell--x { background: #b4432f; }
.corner-map__cell--c { background: #d9813a; }
.corner-map figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}
.corner-map figcaption span { display: inline-flex; align-items: center; gap: 6px; }
.corner-map figcaption span:last-child { flex-basis: 100%; justify-content: center; }
.corner-map__key {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.corner-map__key--corner { background: #c99a2e; }
.corner-map__key--x { background: #b4432f; }
.corner-map__key--c { background: #d9813a; }

.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: 14px;
  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; }
.below__faq {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  margin: 56px auto 0;
}
.below__faq h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.35;
  color: var(--brown-deep);
}
.below__faq details {
  margin: 0;
  padding: 16px 0;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.below__faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  color: var(--brown-deep);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16.5px;
  line-height: 1.45;
  list-style: none;
}
.below__faq summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--brown);
  font-family: system-ui, sans-serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}
.below__faq details[open] summary::after { content: "−"; }
.below__faq summary::-webkit-details-marker { display: none; }
.below__faq details p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.8;
}

@media (max-width: 900px) {
  .online { padding: 24px 16px; }
  .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); }
}
@media (max-width: 640px) {
  .beginner-guide { padding: 18px 12px; }
}

/* ===== Overlay ===== */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 28, 18, 0.6);
  backdrop-filter: blur(6px);
  z-index: 50;
}
:root[data-theme="dark"] .overlay {
  background: rgba(4, 12, 8, 0.78);
  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: var(--line);
}
:root[data-theme="dark"] .overlay__icon .stone-dot.white {
  border-color: rgba(238, 246, 241, 0.3);
}
.overlay__title { margin: 8px 0 4px; font-family: var(--serif); font-size: 24px; font-weight: 800; color: var(--brown-deep); }
.overlay.is-win .overlay__title { color: #166534; }
.overlay.is-lose .overlay__title { color: #9f1239; }
:root[data-theme="dark"] .overlay.is-win .overlay__title { color: #86efac; }
:root[data-theme="dark"] .overlay.is-lose .overlay__title { color: #fda4af; }
.overlay.is-win .overlay__card,
.overlay.is-lose .overlay__card { width: min(100%, 420px); }
.pol-result__kicker {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.pol-result__kicker:empty { display: none; }
.overlay.is-win .overlay__title,
.overlay.is-lose .overlay__title { margin-top: 0; font-size: 30px; }
.overlay__detail { margin: 0 0 18px; color: var(--ink-soft); }
.pol-result {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 20px;
}
.pol-result[hidden] { display: none; }
.pol-result__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.pol-result__side.is-win {
  border-color: rgba(22, 163, 74, 0.5);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.2), rgba(22, 101, 52, 0.08));
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.22);
  transform: scale(1.04);
}
.pol-result__side.is-lose { opacity: 0.72; }
.pol-result__tag {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-soft);
}
.pol-result__side.is-win .pol-result__tag {
  background: #166534;
  color: #fff;
}
.pol-result__side.is-lose .pol-result__tag {
  background: #9f1239;
  color: #fff;
}
.pol-result__name {
  font-style: normal;
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
}
.pol-result__vs {
  align-self: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  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; }
.overlay__actions--stack {
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 0;
}
.overlay__actions--stack .btn { width: 100%; }
.overlay--online-confirm { z-index: 60; }
.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}
.btn--quiet:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .app { flex-direction: column; height: 100dvh; }
  .sidebar {
    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;
    background-image: none;
  }
  :root[data-theme="dark"] .sidebar {
    background-image: none;
    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.2;
    height: auto;
    white-space: nowrap;
    align-items: center;
    padding-top: 2px;
  }
  .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, #164e32 0%, #124329 55%, #0d341f 100%);
    border-top: 1px solid rgba(255, 255, 255, 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, #0f2219 0%, #0c1a13 55%, #08120d 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(10, 24, 16, 0.55);
    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; min-height: 0; overflow-y: auto; }
  .play {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    align-items: stretch;
    padding: 14px;
    gap: 12px;
    --panel-w: 300px;
  }
  .play .board,
  .play .panel {
    min-height: 0;
    max-height: none;
  }
  .panel-toggle { display: none; }
  .panel {
    margin-left: 0;
    height: auto;
  }
  .board {
    overflow: visible;
    height: auto;
    container-type: normal;
    --pol-stack-head: 36px;
    --pol-stack-hud: 64px;
    --pol-stack-foot: 56px;
    --pol-board-chrome: 220px;
    --sq: min(
      calc(100dvw - 28px - var(--pol-rail-w) - var(--pol-rail-gap)),
      calc((100dvh - var(--pol-board-chrome)) / var(--pol-board-ar))
    );
  }
  .ad-rail { display: none; }
  .ad-slot--mobile { display: flex; }
  .play--collapsed {
    grid-template-columns: 1fr;
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 900px) {
  .play {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    padding: 14px;
    gap: 12px;
  }
  .board {
    height: auto;
    padding-right: 0;
    container-type: normal;
    --pol-board-chrome: 278px;
    --sq: min(
      calc(100dvw - 28px - var(--pol-rail-w) - var(--pol-rail-gap)),
      calc((100dvh - var(--pol-board-chrome)) / var(--pol-board-ar))
    );
  }
  .play--scoring:not(.play--spectating) .board {
    --sq: min(100dvw - 28px, calc((100dvh - 326px) / var(--pol-board-ar)));
  }
  .play--spectating [data-pol-spectate-leave="head"] {
    display: inline-flex;
  }
  .play-head {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: var(--sq);
    text-align: center;
    flex-wrap: wrap;
  }
  .play-title { width: 100%; text-align: center; }
  .play-head__meta,
  .head-live {
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
  }
  .pol-wrap {
    width: calc(var(--sq) + var(--pol-rail-w) + var(--pol-rail-gap));
    max-width: 100%;
    height: auto;
  }
  .board__stage {
    width: 100%;
    height: calc(var(--sq) * var(--pol-board-ar));
    flex: 0 0 auto;
    overflow: visible;
  }
  .infobar { max-width: var(--sq); }
  .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;
  }
  .card-side,
  .side-stack,
  .side-pane {
    flex: 0 1 auto;
  }
  .move-list-scroll {
    max-height: min(360px, 50dvh);
    min-height: 112px;
  }
  .side-stack {
    min-height: 152px;
  }
  .play--collapsed .panel {
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
  }
}

@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: #f0fdf4;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 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: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
:root[data-theme="dark"] .select__trigger:hover {
  border-color: #4ade80;
}
:root[data-theme="dark"] .select.open .select__trigger {
  border-color: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}
:root[data-theme="dark"] input::placeholder { color: var(--ink-soft); opacity: 0.8; }
:root[data-theme="dark"] .state-tabs { background: var(--surface); }
:root[data-theme="dark"] .move-list button:hover { background: var(--surface); }

: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(74, 222, 128, 0.55);
  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: 14px;
}
.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: none;
  margin-bottom: 34px;
  padding: 0 0 24px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.article__head h1,
.article > h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(27px, 3.3vw, 34px);
  font-weight: 700;
  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: transparent;
  box-shadow: none;
}

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

.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);
  box-shadow: var(--shadow);
}
.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: 14px;
}
.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);
  box-shadow: var(--shadow);
}
.author-bio img { border-radius: 12px; }
.author-bio strong { display: block; color: var(--brown-deep); }
.author-bio span { display: block; font-size: 14px; 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; }
  .lesson-board-pair { grid-template-columns: 1fr; }
  .lesson-board { padding: 10px; }
  .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: 14px;
  }
  .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: 14px; line-height: 1.65; }
  .article-footer { margin-top: 28px; padding-top: 18px; }
}

/* PWA install guide (iOS Share → Add to Home Screen) */
.pol-pwa-guide {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.pol-pwa-guide[hidden] { display: none !important; }
.pol-pwa-guide__backdrop {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(8, 24, 16, 0.42);
  cursor: pointer;
}
.pol-pwa-guide__card {
  position: relative;
  z-index: 1;
  width: min(20.5rem, calc(100vw - 1.5rem));
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(16, 45, 28, 0.28);
}
.pol-pwa-guide__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 16px 12px;
  background: linear-gradient(165deg, #e7f3ea 0%, var(--surface) 55%);
  border-bottom: 1px solid var(--line-soft);
}
:root[data-theme="dark"] .pol-pwa-guide__head {
  background: linear-gradient(165deg, #1b2d23 0%, var(--surface) 55%);
}
.pol-pwa-guide__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(16, 45, 28, 0.14);
}
.pol-pwa-guide__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.pol-pwa-guide__host {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--ink-soft);
  line-height: 1.3;
}
.pol-pwa-guide__kicker {
  margin: 12px 16px 0;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--jade-deep);
}
.pol-pwa-guide__steps {
  list-style: none;
  margin: 10px 16px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pol-pwa-guide__steps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink);
}
.pol-pwa-guide__n {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  background: var(--jade);
  margin-top: 1px;
}
.pol-pwa-guide__share {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin: 0 2px;
  vertical-align: -2px;
  color: var(--jade-deep);
}
.pol-pwa-guide__actions {
  display: flex;
  gap: 8px;
  padding: 14px 16px 16px;
}
.pol-pwa-guide__primary,
.pol-pwa-guide__ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 5.75rem;
  min-height: 42px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pol-pwa-guide__primary {
  border: none;
  background: var(--jade);
  color: #fff;
  padding: 0 14px;
}
.pol-pwa-guide__primary:hover { filter: brightness(1.06); }
.pol-pwa-guide__ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 0 12px;
}
.pol-pwa-guide__ghost:hover {
  border-color: var(--jade);
  color: var(--jade-deep);
}

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

.players--split {
  margin: 0;
  justify-content: space-between;
}
.player--grow {
  min-width: 0;
  flex: 1;
}
.online__note--type {
  margin: 14px 0 4px;
}
.online__note--flush {
  margin-top: 0;
}
.status-chip--lead {
  margin-bottom: 16px;
}
.status-chip--matched {
  margin-bottom: 18px;
}
.opt-row--color {
  max-width: min(360px, 100%);
  margin: 0 auto 8px;
  align-items: center;
}
.seg.seg--rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  border-radius: 14px;
}
.seg.seg--rules .seg__btn {
  flex: none;
  min-width: 0;
}
.room-input--centered {
  display: block;
  max-width: 300px;
  margin: 0 auto 12px;
}
.btn--block {
  width: 100%;
}

.engine-card {
  margin-top: 12px;
  padding: 0;
  background: transparent;
  border: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.engine-card__header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 28px;
}

.engine-card__title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 0 1 auto;
}

.engine-live-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #27ae60;
  box-shadow: 0 0 5px rgba(39, 174, 96, 0.6);
  animation: rvy-engine-pulse 2s infinite ease-in-out;
}

.engine-live-dot[hidden] {
  display: none;
}

@keyframes rvy-engine-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.engine-card__title,
.engine-card__sublabel {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
}

.engine-card__title {
  flex: 0 0 auto;
  white-space: nowrap;
}

.engine-card__note {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.3;
  opacity: 0.75;
}

.engine-card__note:empty {
  display: none;
}

.engine-card__score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: auto;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 10px;
  border-radius: 999px;
  line-height: 1.35;
  white-space: nowrap;
  background: #e6d6c2;
  color: #61462d;
}

.engine-card__score.score-black {
  background: #3c2f24;
  color: #fdfaf5;
}

.engine-card__score.score-white {
  background: #f6efe4;
  color: #3c2f24;
  border: 1px solid #b8a48a;
}

.engine-card__score.score-even {
  background: #e6d6c2;
  color: #61462d;
}

.engine-card__stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  background: rgba(139, 69, 19, 0.04);
  border: 1px solid rgba(198, 166, 122, 0.22);
  border-radius: 7px;
  padding: 6px 2px;
}

.engine-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.engine-stat dt {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  opacity: 0.7;
}

.engine-stat dd {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.engine-card__pv-head {
  margin-bottom: 4px;
}

.engine-card__pv {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-height: 24px;
}

.engine-card__empty {
  font-family: var(--sans);
  font-size: 14px;
  opacity: 0.6;
  line-height: 24px;
}

.engine-card__ply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(198, 166, 122, 0.45);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-soft);
  white-space: nowrap;
}

.engine-card__ply--first {
  border-color: rgba(139, 69, 19, 0.55);
  color: var(--brown);
}

:root[data-theme="dark"] .engine-card__ply {
  background: #1c1612;
  color: #f3eadf;
}

:root[data-theme="dark"] .engine-card__score.score-white {
  background: #2a241e;
  color: #f3eadf;
  border-color: #6b5a48;
}

.select__menu--scroll {
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.card.setup-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
}

.setup-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setup-row > h3 {
  margin: 0;
  flex: 0 0 7.6em;
  font-size: 15px;
  white-space: nowrap;
}

.setup-row .select {
  flex: 1 1 auto;
  min-width: 0;
}

.setup-row .select__trigger {
  padding: 4px 10px;
  min-height: 34px;
}

.setup-row .select__trigger .select__labels {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

.setup-row .select__trigger .select__sub {
  display: none;
}

.setup-row .select__title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* English rules and controls need the full panel width. */
html[lang="en"] .setup-row {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
html[lang="en"] .setup-row > h3 {
  flex-basis: auto;
}
html[lang="en"] .setup-row .select__menu {
  left: auto;
  right: 0;
  width: min(400px, calc(100vw - 32px));
}
html[lang="en"] .setup-row .select__sub {
  font-size: 13px;
  line-height: 1.35;
}
html[lang="en"] .pol-keys span {
  max-width: 100%;
}

html[lang="zh-TW"] .setup-row {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
html[lang="zh-TW"] .setup-row > h3 {
  flex-basis: auto;
}
html[lang="zh-TW"] .setup-row .select__menu {
  left: auto;
  right: 0;
  width: min(400px, calc(100vw - 32px));
}
html[lang="zh-TW"] .setup-row .select__sub {
  font-size: 13px;
  line-height: 1.35;
}
html[lang="zh-TW"] .pol-keys span {
  max-width: 100%;
}

@media (orientation: portrait) and (max-width: 1200px),
       (orientation: portrait) and (pointer: coarse) {
  .play {
    padding-left: 12px;
    padding-right: 12px;
  }
  .board {
    container-type: inline-size;
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
    --pol-rail-w: 2.75rem;
    --pol-tray-w: 2.75rem;
    --pol-rail-gap: 0px;
    --pol-port-chrome: calc(220px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
    --pol-port-h: calc(100dvh - var(--pol-port-chrome));
    --pol-port-w: calc(100cqw - var(--pol-rail-w) - var(--pol-tray-w));
    --pol-table-h: min(var(--pol-port-h), calc(var(--pol-port-w) * 924 / 514));
    --pol-pocket-span: calc(var(--pol-table-h) * 816 / 924);
    padding-right: 0;
  }
  .pol-wrap {
    display: grid;
    grid-template-columns: var(--pol-tray-w) auto;
    grid-template-areas:
      "match match"
      "tray stage"
      "foot foot";
    justify-content: center;
    justify-items: stretch;
    align-items: stretch;
    width: 100%;
    height: auto;
    max-width: 100%;
    column-gap: 0;
    row-gap: 8px;
  }
  .play-head {
    grid-area: head;
    width: 100%;
    max-width: 100%;
  }
  .pol-top {
    grid-area: tray;
    width: var(--pol-tray-w);
    max-width: none;
    height: var(--pol-pocket-span);
    align-self: center;
    display: flex;
    box-sizing: border-box;
    padding: 6px 4px 8px;
    border-radius: 16px 0 0 16px;
    background: linear-gradient(180deg, rgba(30, 33, 40, 0.96), rgba(16, 18, 23, 0.98));
    box-shadow:
      0 14px 32px rgba(0, 0, 0, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 0 1px rgba(255, 255, 255, 0.06);
  }
  [data-theme="light"] .pol-top {
    background: linear-gradient(180deg, #c5d2c9, #aebdb4);
    box-shadow:
      0 10px 28px rgba(40, 55, 48, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.38),
      0 0 0 1px rgba(50, 70, 58, 0.18);
  }
  .pol-hud {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    gap: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  [data-theme="light"] .pol-hud {
    background: none;
    box-shadow: none;
  }
  .pol-kpis { display: none; }
  .pol-hud__center {
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: stretch;
    align-items: stretch;
    overflow: visible;
    min-height: 0;
    width: 100%;
    height: 100%;
    padding: 0;
  }
  .pol-tray {
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    min-height: 0;
    gap: 3px;
    --ball-size: min(16px, calc((var(--pol-pocket-span) - 56px) / 16));
  }
  .pol-well .pol-bicon {
    width: 96%;
    height: 96%;
  }
  .pol-tray--eight .pol-tray__lane em { display: none; }
  .pol-tray__lane,
  .pol-tray--eight .pol-tray__lane,
  .pol-tray--eight .pol-tray__mid {
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    margin: 0;
    padding: 3px 3px;
    gap: 2px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.28);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  }
  [data-theme="light"] .pol-tray--eight .pol-tray__lane,
  [data-theme="light"] .pol-tray--eight .pol-tray__mid {
    background: rgba(35, 38, 45, 0.08);
    box-shadow: inset 0 1px 2px rgba(40, 55, 48, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  }
  .pol-tray__lane {
    flex: 1 1 auto;
    min-height: 0;
  }
  .pol-tray__balls {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    min-height: 0;
    gap: 2px;
  }
  .pol-tray__sep {
    width: 14px;
    height: 1px;
    margin: 0 auto;
    flex: none;
    background: rgba(255, 255, 255, 0.14);
  }
  [data-theme="light"] .pol-tray__sep {
    background: rgba(20, 34, 26, 0.18);
  }
  .pol-tray__mid {
    flex: none;
    padding: 4px 3px;
    background:
      radial-gradient(circle at 50% 42%, rgba(234, 179, 8, 0.22), transparent 62%),
      rgba(0, 0, 0, 0.32);
    box-shadow:
      inset 0 0 0 1px rgba(234, 179, 8, 0.28),
      inset 0 1px 2px rgba(0, 0, 0, 0.35);
  }
  .pol-tray__mid .pol-well {
    width: calc(var(--ball-size) * 1.12);
    height: calc(var(--ball-size) * 1.12);
  }
  [data-theme="light"] .pol-tray--eight .pol-tray__mid {
    background:
      radial-gradient(circle at 50% 42%, rgba(202, 138, 4, 0.2), transparent 62%),
      rgba(35, 38, 45, 0.08);
    box-shadow:
      inset 0 0 0 1px rgba(202, 138, 4, 0.32),
      inset 0 1px 2px rgba(40, 55, 48, 0.16);
  }
  .board__stage {
    grid-area: stage;
    flex: 0 0 auto;
    width: auto;
    height: var(--pol-table-h);
    min-width: 0;
    min-height: 180px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: var(--pol-rail-gap);
  }
  .board__frame {
    flex: 0 0 auto;
    width: min(var(--pol-port-w), calc(var(--pol-port-h) * 514 / 924));
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
    container-type: size;
  }
  .board__frame::before {
    inset: auto;
    top: 50%;
    left: 50%;
    width: 100cqh;
    height: 100cqw;
    transform: translate(-50%, -50%) rotate(-90deg);
    box-shadow: none;
  }
  .pol-rail {
    flex: 0 0 var(--pol-rail-w);
    width: var(--pol-rail-w);
    height: var(--pol-pocket-span);
    min-height: 0;
    align-self: center;
    padding: 8px 6px 10px;
    gap: 8px;
  }
  [data-pol-spin] { width: 36px; height: 36px; }
  .pol-rail__k { font-size: 14px; }
  .pol-charge__head b { font-size: 14px; letter-spacing: -0.06em; }
  .pol-pct { font-size: 14px; }
  .pol-charge {
    padding: 0;
    gap: 6px;
  }
  .pol-charge__track {
    min-height: 72px;
    padding: 4px;
  }
  .pol-foot {
    grid-area: foot;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    background: none;
    box-shadow: none;
  }
  .pol-keys {
    display: flex;
    flex: 1 0 100%;
    justify-content: center;
    gap: 0;
    font-size: 12px;
    line-height: 1.4;
  }
  .pol-acts {
    width: auto;
    justify-content: center;
    gap: 6px;
  }
  .pol-acts button {
    flex: none;
    padding: 6px 10px;
  }
}
html.portrait .play {
  padding-left: 12px;
  padding-right: 12px;
}
html.portrait .board {
  container-type: inline-size;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  --pol-rail-w: 2.75rem;
  --pol-tray-w: 2.75rem;
  --pol-rail-gap: 0px;
  --pol-port-chrome: calc(220px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
  --pol-port-h: calc(100dvh - var(--pol-port-chrome));
  --pol-port-w: calc(100cqw - var(--pol-rail-w) - var(--pol-tray-w));
  --pol-table-h: min(var(--pol-port-h), calc(var(--pol-port-w) * 924 / 514));
  --pol-pocket-span: calc(var(--pol-table-h) * 816 / 924);
  padding-right: 0;
}
html.portrait .pol-wrap {
  display: grid;
  grid-template-columns: var(--pol-tray-w) auto;
  grid-template-areas:
    "head head"
    "tray stage"
    "foot foot";
  justify-content: center;
  justify-items: stretch;
  align-items: stretch;
  width: 100%;
  height: auto;
  max-width: 100%;
  column-gap: 0;
  row-gap: 8px;
}
html.portrait .play-head {
  grid-area: head;
  width: 100%;
  max-width: 100%;
}
html.portrait .pol-top {
  grid-area: tray;
  width: var(--pol-tray-w);
  max-width: none;
  height: var(--pol-pocket-span);
  align-self: center;
  display: flex;
  box-sizing: border-box;
  padding: 6px 4px 8px;
  border-radius: 16px 0 0 16px;
  background: linear-gradient(180deg, rgba(30, 33, 40, 0.96), rgba(16, 18, 23, 0.98));
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}
html.portrait[data-theme="light"] .pol-top {
  background: linear-gradient(180deg, #c5d2c9, #aebdb4);
  box-shadow:
    0 10px 28px rgba(40, 55, 48, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 0 0 1px rgba(50, 70, 58, 0.18);
}
html.portrait .pol-hud {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  gap: 0;
  background: none;
  box-shadow: none;
}
html.portrait .pol-hud__center {
  flex: 1 1 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: stretch;
  align-items: stretch;
  overflow: visible;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0;
}
html.portrait .pol-tray {
  flex: 1 1 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  min-height: 0;
  gap: 3px;
  --ball-size: min(16px, calc((var(--pol-pocket-span) - 56px) / 16));
}
html.portrait .pol-well .pol-bicon {
  width: 96%;
  height: 96%;
}
html.portrait .pol-tray--eight .pol-tray__lane em { display: none; }
html.portrait .pol-tray__lane,
html.portrait .pol-tray--eight .pol-tray__lane,
html.portrait .pol-tray--eight .pol-tray__mid {
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  margin: 0;
  padding: 3px 3px;
  gap: 2px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
html.portrait[data-theme="light"] .pol-tray--eight .pol-tray__lane,
html.portrait[data-theme="light"] .pol-tray--eight .pol-tray__mid {
  background: rgba(35, 38, 45, 0.08);
  box-shadow: inset 0 1px 2px rgba(40, 55, 48, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
html.portrait .pol-tray__lane {
  flex: 1 1 auto;
  min-height: 0;
}
html.portrait .pol-tray__balls {
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  min-height: 0;
  gap: 2px;
}
html.portrait .pol-tray__sep {
  width: 18px;
  height: 1px;
  margin: 0 auto;
  flex: none;
  background: rgba(255, 255, 255, 0.14);
}
html.portrait .pol-tray__mid {
  flex: none;
  padding: 4px 3px;
  background:
    radial-gradient(circle at 50% 42%, rgba(234, 179, 8, 0.22), transparent 62%),
    rgba(0, 0, 0, 0.32);
  box-shadow:
    inset 0 0 0 1px rgba(234, 179, 8, 0.28),
    inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
html.portrait .pol-tray__mid .pol-well {
  width: calc(var(--ball-size) * 1.12);
  height: calc(var(--ball-size) * 1.12);
}
html.portrait[data-theme="light"] .pol-tray--eight .pol-tray__mid {
  background:
    radial-gradient(circle at 50% 42%, rgba(202, 138, 4, 0.2), transparent 62%),
    rgba(35, 38, 45, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(202, 138, 4, 0.32),
    inset 0 1px 2px rgba(40, 55, 48, 0.16);
}
html.portrait .board__stage {
  grid-area: stage;
  flex: 0 0 auto;
  width: auto;
  height: var(--pol-table-h);
  min-width: 0;
  min-height: 180px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--pol-rail-gap);
}
html.portrait .board__frame {
  flex: 0 0 auto;
  width: min(var(--pol-port-w), calc(var(--pol-port-h) * 514 / 924));
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  container-type: size;
}
html.portrait .board__frame::before {
  inset: auto;
  top: 50%;
  left: 50%;
  width: 100cqh;
  height: 100cqw;
  transform: translate(-50%, -50%) rotate(-90deg);
  box-shadow: none;
}
html.portrait .pol-rail {
  flex: 0 0 var(--pol-rail-w);
  width: var(--pol-rail-w);
  height: var(--pol-pocket-span);
  min-height: 0;
  align-self: center;
  padding: 8px 6px 10px;
}
html.portrait .pol-foot {
  grid-area: foot;
  width: 100%;
  max-width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  background: none;
  box-shadow: none;
  padding: 0;
}
html.portrait .pol-keys {
  display: flex;
  flex: 1 0 100%;
  justify-content: center;
  gap: 0;
  font-size: 12px;
  line-height: 1.4;
}
html.portrait .pol-acts {
  width: auto;
  justify-content: center;
}
html.portrait.tablet .board {
  --pol-tray-w: 3.75rem;
  --pol-side-h: min(
    var(--pol-pocket-span),
    calc(var(--pol-table-h) * 512 / 924 + 72px)
  );
}
html.portrait.tablet .pol-top,
html.portrait.tablet .pol-rail {
  height: var(--pol-side-h);
}
html.portrait.tablet .pol-tray {
  --ball-size: calc(var(--pol-table-h) * 31 / 924);
  justify-content: center;
}
html.portrait.tablet .pol-tray__lane,
html.portrait.tablet .pol-tray__balls {
  flex: none;
  justify-content: center;
}

:root {
  --play-edge-inset: 16px;
}
@media (max-width: 1200px) {
  .play .board {
    --pol-stack-head: 0px;
    --pol-stack-hud: 104px;
  }
}

.play .play-head { display: none; }

@media (min-width: 1201px) {
  .play.play--noad.play--collapsed {
    padding-block: var(--play-edge-inset);
  }
  .play.play--collapsed .board {
    --pol-play-edge-y: 0px;
  }
  .play.play--collapsed .pol-scoreboard { margin-top: 0; }
}

.pol-wrap > .pol-scoreboard {
  --match-center-ink: var(--ink);
  --match-base: var(--surface-2);
  --match-panel: var(--surface);
  --match-muted: color-mix(in srgb, var(--match-center-ink) 66%, var(--match-base));
  --match-line: color-mix(in srgb, var(--match-center-ink) 12%, transparent);
  --match-accent: var(--jade);
  grid-area: match;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px minmax(0, 1fr);
  width: var(--sq);
  max-width: 100%;
  min-width: 0;
  min-height: 134px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--match-line);
  border-radius: 8px;
  background: var(--match-base);
  box-shadow: none;
  color: var(--match-center-ink);
}

.pol-scoreboard .pol-score-row {
  --seat-accent: var(--match-accent);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  gap: 2px 11px;
  min-width: 0;
  min-height: 68px;
  padding: 8px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: start;
  transition: background .25s ease;
}
.pol-scoreboard .pol-score-row--opp {
  --seat-accent: var(--gold);
  grid-template-columns: minmax(0, 1fr) 40px;
  text-align: end;
}
.pol-scoreboard .pol-score-row::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 6px 0 6px 6px;
  background: color-mix(in srgb, var(--match-panel) 50%, var(--match-base));
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);
  transition: background .25s ease;
}
.pol-scoreboard .pol-score-row--opp::before {
  inset: 6px 6px 6px 0;
  clip-path: polygon(15px 0, 100% 0, 100% 100%, 15px 100%, 0 50%);
}
.pol-scoreboard .pol-score-row.match-active::before {
  background: color-mix(in srgb, var(--seat-accent) 14%, var(--match-base));
}
.pol-scoreboard .pol-score-row::after {
  content: "";
  position: absolute;
  inset: auto 22px 0;
  height: 2px;
  background: transparent;
}
.pol-scoreboard .match-active::after {
  background: var(--seat-accent);
  animation: match-turn-enter .35s ease-out both;
  transform-origin: left;
}
.pol-scoreboard .pol-score-row--opp.match-active::after { transform-origin: right; }
@keyframes match-turn-enter { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .pol-scoreboard .match-active::after { animation: none; }
  .pol-scoreboard .pol-score-row::before { transition: none; }
}

.match-avatar {
  grid-column: 1;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  color: var(--match-muted);
  background: color-mix(in srgb, var(--match-center-ink) 6%, transparent);
  clip-path: polygon(17% 0, 83% 0, 100% 15%, 100% 74%, 50% 100%, 0 74%, 0 15%);
}
.pol-score-row--opp .match-avatar { grid-column: 2; }
.match-avatar svg { width: 22px; height: 22px; margin-bottom: 3px; }
.match-active .match-avatar {
  color: var(--seat-accent);
  background: color-mix(in srgb, var(--seat-accent) 15%, transparent);
}
.pol-scoreboard .pol-score-row__who {
  grid-column: 2;
  grid-row: 1;
  color: var(--match-center-ink);
  font: 700 20px/1.2 var(--sans);
  letter-spacing: .02em;
}
.pol-scoreboard .pol-score-row--opp .pol-score-row__who { grid-column: 1; }
.pol-scoreboard .match-status {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.pol-scoreboard .pol-score-row--opp .match-status { grid-column: 1; justify-self: end; }
.pol-scoreboard .pol-score-row__grp,
.pol-scoreboard .pol-score-row.is-assigned .pol-score-row__grp {
  padding: 0;
  border: 0;
  background: none;
  color: var(--match-muted);
  font: 400 14px/1.5 var(--sans);
  letter-spacing: .04em;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pol-scoreboard .pol-score-row__grp:empty::after { content: attr(data-empty); }

.match-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
  padding: 2px 0 4px;
  color: var(--match-center-ink);
  background: var(--match-base);
}
.match-vs {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 32px;
  margin: 2px 10px 4px;
  color: var(--surface);
  font: italic 900 19px/1 system-ui, sans-serif;
  letter-spacing: -.02em;
  z-index: 1;
}
.match-vs::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: skewX(-14deg);
  z-index: -1;
}
.match-vs::after {
  content: "";
  position: absolute;
  left: -7px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold);
  transform: skewX(-14deg);
  z-index: -1;
}
.match-center .head-live,
.match-center .head-live__turn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--match-center-ink);
  font: 500 14px/1.4 var(--sans);
  white-space: nowrap;
}
.match-center .head-live__turn::before { display: none; }
.match-center .head-live__turn [data-pol-turn-text] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.match-center .head-live { min-width: 0; max-width: 100%; }
.match-center .head-live__turn { max-width: 100%; flex-wrap: wrap; }

.pol-scoreboard > .pol-top {
  grid-column: 1 / -1;
  width: 100%;
  padding: 4px 18px 5px;
  border-top: 1px solid var(--match-line);
  background: color-mix(in srgb, var(--match-panel) 35%, var(--match-base));
}
.pol-scoreboard > .pol-top .pol-hud { padding: 0; }
.pol-scoreboard > .pol-top .pol-tray {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 12px;
}
.pol-scoreboard > .pol-top .pol-tray__lane {
  flex: 1 1 0;
  min-width: 0;
  justify-content: space-between;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.pol-scoreboard > .pol-top .pol-tray__lane em { display: none; }
.pol-scoreboard > .pol-top .pol-tray__balls { flex: 1; justify-content: space-evenly; }
.pol-scoreboard > .pol-top .pol-tray__mid {
  padding: 2px 8px;
  border: 0;
  border-inline: 1px solid var(--match-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.match-eight-ball > .pol-top .pol-tray__lane[data-pol-tray-lane="stripe"] { order: 2; }
.match-eight-ball > .pol-top .pol-tray__lane.is-you { order: 0; }
.match-eight-ball > .pol-top .pol-tray__mid { order: 1; }
.match-eight-ball > .pol-top .pol-tray__lane.is-opp { order: 2; }
.match-eight-ball > .pol-top .pol-tray__sep { display: none; }
.pol-scoreboard > .pol-top .pol-well {
  background: var(--match-base);
  box-shadow: none;
}
.pol-well,
[data-theme="light"] .pol-well {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
:root[data-theme="light"] .play .pol-top .pol-well {
  background: color-mix(in srgb, var(--ink) 12%, var(--surface-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 24%, transparent);
}

.play .pol-top .pol-tray {
  --ball-size: calc(var(--sq) * var(--pol-ball-stamp-span, 30.333333) / 924);
}
html.portrait .play .pol-top .pol-tray {
  --ball-size: calc(var(--pol-table-h) * var(--pol-ball-stamp-span, 30.333333) / 924);
}
.play .pol-top .pol-tray .pol-well {
  width: var(--ball-size);
  height: var(--ball-size);
}
.play .pol-top .pol-well .pol-bicon {
  width: 100%;
  height: 100%;
}
:root[data-theme="light"] .play .pol-top .pol-well.is-hovered:not(.off) {
  outline: 2px solid var(--brown-deep);
  outline-offset: 2px;
  box-shadow: none;
}

:root[data-theme="dark"] .pol-wrap > .pol-scoreboard {
  --match-base: var(--linen);
  --match-panel: var(--surface);
  --match-center-ink: var(--ink);
  --match-accent: color-mix(in srgb, var(--jade) 60%, var(--match-center-ink));
}

:root[data-theme="dark"] .pol-tray__lane,
:root[data-theme="dark"] .pol-tray__mid {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: none;
}
:root[data-theme="dark"] .pol-scoreboard > .pol-top .pol-tray__lane {
  border: 0;
  background: none;
}
:root[data-theme="dark"] .pol-scoreboard > .pol-top .pol-tray__mid {
  border-block: 0;
  border-inline: 1px solid var(--match-line);
  background: none;
}

:root[data-theme="dark"] .pol-well {
  background: var(--linen);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.pol-rail,
[data-theme="light"] .pol-rail,
html.portrait .pol-top,
html.portrait[data-theme="light"] .pol-top {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.pol-charge__head b,
[data-theme="light"] .pol-charge__head b {
  min-height: 26px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: none;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}
.play .pol-rail__k,
.play .pol-pct,
.play [data-pol-spin-label] { font-size: 14px; }
.pol-charge__track,
[data-theme="light"] .pol-charge__track {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--ink) 6%, var(--surface-2)));
  box-shadow: inset 0 2px 5px rgba(15, 35, 24, 0.08);
}
[data-pol-spin] {
  box-shadow: 0 4px 10px rgba(15, 35, 24, 0.18), inset 0 0 0 1px rgba(15, 35, 24, 0.22);
}
.play .pol-wrap .pol-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 2px;
  padding: 8px 4px 0;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
}
.pol-foot .status-card__hint {
  grid-column: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.pol-foot .pol-keys {
  grid-column: 1;
  font-size: 12px;
  color: var(--ink-soft);
}
.pol-foot .pol-acts {
  grid-column: 2;
  grid-row: 1 / 3;
  gap: 4px;
}
.pol-foot .pol-acts .btn-sound {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  opacity: 1;
}
.pol-foot .btn-sound svg {
  flex: none;
  width: 18px;
  height: 18px;
}
.pol-foot .btn-sound[aria-pressed="true"] {
  color: var(--brown-deep);
  background: transparent;
  border-color: transparent;
}
.pol-acts button,
[data-theme="light"] .pol-acts button {
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}
.pol-foot .pol-acts button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  height: 32px;
}
.pol-acts button:hover,
[data-theme="light"] .pol-acts button:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--jade) 6%, transparent);
  color: var(--brown-deep);
}
.pol-foot .pol-acts button:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}
.pol-foot kbd,
[data-theme="light"] .pol-foot kbd {
  padding: 1px 3px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  font-size: 12px;
}

.play .status-card { display: none; }
.play .panel { justify-content: flex-start; }

.pol-foot .control-icon {
  display: block;
  flex: none;
  width: 15px;
  height: 15px;
}

.pol-foot__aux {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
}
.play .pol-foot__aux .pol-keys { flex: 0 1 auto; min-width: 0; }
.online-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 5px;
  margin-inline-start: auto;
  color: var(--jade);
  font: 500 14px/1.6 var(--sans);
  white-space: nowrap;
}
.online-link::after { content: ""; position: absolute; inset: -5px -2px; }
.online-link svg { flex: none; width: 13px; height: 13px; }
.online-link__people { color: var(--ink-soft); }
.online-link__short { display: none; }
.online-link:hover { color: var(--brown-deep); }
.online-link:hover .online-link__full,
.online-link:hover .online-link__short { text-decoration: underline; text-underline-offset: 3px; }
.online-link:focus-visible,
.online-next__link:focus-visible { outline: 2px solid var(--jade); outline-offset: 4px; }
@media (min-width: 1101px), (min-width: 721px) and (pointer: fine) {
  .play .pol-wrap .pol-foot {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .pol-foot__aux { display: contents; }
  .play .pol-foot .pol-keys {
    grid-column: 1;
    grid-row: 1;
    flex-wrap: nowrap;
    min-width: 0;
  }
  .play .pol-foot .pol-keys span {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .play .pol-foot .online-link {
    grid-column: 2;
    grid-row: 1 / 3;
    justify-content: center;
    min-height: 38px;
    margin: 0;
    padding: 0 14px;
    gap: 8px;
    border-radius: 9px;
    background: var(--jade);
    color: white;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
  }
  .play .pol-foot .online-link svg { width: 17px; height: 17px; }
  .play .pol-foot .online-link__people { color: inherit; }
  .play .pol-foot .online-link:hover { background: var(--jade-deep); }
  .play .pol-foot .online-link:hover .online-link__full { text-decoration: none; }
  .play .pol-foot .pol-acts { grid-column: 3; }
}
.online-next {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}
.online-next__hint { color: var(--ink-soft); font-size: 12px; }
.online-next__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  text-decoration: none;
}
.online-next__link svg { width: 16px; height: 16px; }
.overlay:has(.online-next:not([hidden])) [data-pol-overlay-rematch] {
  border-color: var(--line);
  background: var(--surface-2);
  box-shadow: none;
  color: var(--ink);
}

@media (max-width: 720px), (pointer: coarse) and (max-width: 1100px) {
  .pol-foot__aux { gap: 2px 8px; }
  .online-link { min-height: 24px; white-space: normal; flex: 1 1 160px; justify-content: flex-end; }
  .online-link__full { display: inline; }
  .online-link__short { display: none; }
  .play .pol-wrap .pol-foot {
    grid-template-columns: 1fr;
    justify-content: stretch;
    padding: 8px 4px 0;
    text-align: start;
    row-gap: 2px;
    border: 0;
    border-top: 1px solid var(--line-soft);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .pol-foot .status-card__hint {
    font-size: 14px;
    line-height: 1.5;
  }
  .pol-foot .status-card__hint::before {
    content: none;
  }
  .play .pol-foot .pol-keys {
    justify-content: flex-start;
    font-size: 12px;
    line-height: 1.5;
  }
  .pol-foot .pol-keys .pol-keys--pc { display: none; }
  .pol-foot .pol-keys .pol-keys--touch { display: inline-flex; }
  .play .pol-foot .pol-acts {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px;
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    margin-top: 2px;
    padding-top: 0;
    border-top: 0;
  }
  .play .pol-foot .pol-acts button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    border-radius: 7px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .play .pol-foot .pol-acts button:focus-visible {
    outline: 2px solid var(--jade);
    outline-offset: 2px;
  }
  .play .pol-foot .pol-acts .btn-sound {
    width: 44px;
    padding: 0;
  }
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
}
.history-head h3 {
  margin: 0;
  font-size: 15px;
}
.stat-grid { margin-bottom: 10px; }
.stat-item {
  padding: 10px 12px;
}
.stat-item dt { font-size: 14px; }
.stat-item dd {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

@container (max-width: 720px) {
  .pol-scoreboard .pol-score-row { padding: 8px 14px; gap: 2px 9px; }
  .pol-scoreboard .pol-score-row__who { font-size: 19px; }
}
html.portrait .pol-wrap {
  grid-template-areas: "match match" "tray stage" "foot foot";
}
html.portrait .pol-wrap > .pol-scoreboard { width: 100%; }

@media (max-width: 600px) {
  .pol-wrap > .pol-scoreboard { grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr); }
  .pol-scoreboard .pol-score-row {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 60px;
    padding: 7px 12px;
    gap: 2px 7px;
  }
  .pol-scoreboard .pol-score-row--opp { grid-template-columns: minmax(0, 1fr) 30px; }
  .match-avatar { width: 30px; height: 34px; }
  .match-avatar svg { width: 17px; height: 17px; }
  .pol-scoreboard .pol-score-row__who { font-size: 16px; }
  .pol-scoreboard .pol-score-row__grp,
  .pol-scoreboard .pol-score-row.is-assigned .pol-score-row__grp {
    font-size: 13px;
    letter-spacing: 0;
  }
  html[lang="en"] .pol-scoreboard .pol-score-row__grp,
  html[lang="en"] .pol-scoreboard .pol-score-row.is-assigned .pol-score-row__grp {
    font-size: 12px;
  }
  .pol-scoreboard .pol-score-row::after { inset-inline: 12px; }
  .match-center { padding: 2px 0 4px; }
  .match-vs { width: 46px; height: 36px; margin: 2px 6px 4px; font-size: 16px; }
}
@media (max-width: 359px) {
  .pol-scoreboard .pol-score-row {
    grid-template-columns: 26px minmax(0, 1fr);
    padding: 6px 10px;
    column-gap: 6px;
  }
  .pol-scoreboard .pol-score-row--opp { grid-template-columns: minmax(0, 1fr) 26px; }
  .pol-scoreboard .match-avatar { grid-row: 1; width: 26px; height: 28px; }
  .pol-scoreboard .pol-score-row .match-status { grid-column: 1 / -1; }
}
