:root {
  color-scheme: dark;
  font: 15px/1.35 Roboto, "Segoe UI", Arial, sans-serif;
  --base: #2e2c29;
  --panel: #3b3936;
  --deep: #272522;
  --line: #504d48;
  --ink: #f5f3ef;
  --muted: #c3c0ba;
  --accent: #6c9b4e;
  --green: #a7cb83;
  --gold: #eebc45;
  background: var(--base);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: var(--green); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
button:disabled { cursor: default; opacity: .5; }
button, input, select, .card { -webkit-tap-highlight-color: transparent; }
.icon { width: 23px; height: 23px; flex: none; display: inline-block; vertical-align: middle; }
.icon path, .icon circle, .icon rect { vector-effect: non-scaling-stroke; }
.gold { color: var(--gold); }
.dim { color: var(--muted); }
.small { font-size: .83rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.loading { color: var(--muted); text-align: center; padding: 20vh 12px; }
.shell {
  display: grid; grid-template-columns: minmax(12px,1fr) minmax(0,484px) minmax(12px,1fr);
  column-gap: 0; padding-bottom: 36px;
}
.main { grid-column: 2; min-width: 0; }
.lobby-rail { grid-column: 3; grid-row: 1; min-width: 0; margin: 132px 16px 0 24px; max-width: 334px; }
.lobby-list { background: var(--deep); min-height: 420px; border: 1px solid #45423e; border-radius: 12px; overflow: hidden; }
.lobby-title { color: var(--muted); font-size: .9rem; font-weight: 700; margin: 0; padding: 14px 12px; }
.lobby-empty { color: var(--muted); padding: 12px; border-top: 1px solid var(--line); font-size: .8rem; }
.brandbar, .gamebar { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.brandbar { height: 48px; padding-inline: 6px; }
.logo {
  font: italic 700 27px/1.05 Georgia, serif; letter-spacing: -1.3px;
  color: var(--ink); white-space: nowrap;
}
.logo-button, .icon-button { border: 0; background: none; padding: 0; display: inline-grid; place-items: center; }
.icon-button { min-width: 40px; min-height: 40px; border-radius: 8px; }
.icon-button:hover { background: #ffffff0b; }
.badge {
  border: 1px solid #776331; background: #413826; color: #ffda71;
  border-radius: 10px; padding: 2px 8px; font-size: .77rem; font-weight: 700; text-align: center;
}
.brand-tools, .match-tools { display: flex; align-items: center; }
.tabs { display: flex; justify-content: space-between; border-bottom: 1px solid #494540; margin-bottom: 12px; }
.tab { flex: 1; border: 0; background: none; min-height: 71px; padding: 5px; font-weight: 600; font-size: .88rem; }
.tab .icon { display: block; margin: 0 auto 6px; }
.tab[aria-current="page"] { color: #a5ce86; }
.tab:hover { background: #ffffff06; }
.board-hero {
  position: relative; display: grid; place-items: center; height: 150px; width: 100%; overflow: hidden;
  border: 0; border-radius: 8px; padding: 0;
}
.board-hero::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 100%;
  background: linear-gradient(90deg,#18100b1c 0%,transparent 20%,#ffffff09 42%,#17100c24 81%),
      repeating-conic-gradient(var(--board-light) 0% 25%,var(--board-dark) 0% 50%) 50% 50% / 25% 120px;
}
.board-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--grain); opacity: .65; }
.hero-discs { display: flex; isolation: isolate; z-index: 1; width: 145px; }
.hero-discs .disc { flex: 0 0 96px; width: 96px; height: 96px; }
.hero-discs .disc + .disc { margin-left: -48px; }
.board-caption {
  position: absolute; right: 7px; bottom: 5px; display: grid; justify-items: end; gap: 3px;
  color: white; font-weight: 750; font-size: .79rem; z-index: 2; text-shadow: 0 1px 3px #342414;
}
.board-caption .icon { box-sizing: content-box; border-radius: 50%; background: var(--base); padding: 9px; }
.game-kind { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kind-label, .variant-label, .option, .preset, .button {
  border-radius: 8px; background: var(--panel); border: 1px solid transparent;
}
.kind-label, .variant-label { display: grid; place-items: center; min-height: 44px; font-weight: 700; }
.kind-label { background: #4a4844; }
.variant-label { color: var(--muted); }
.field-row { margin-top: 10px; display: grid; grid-template-columns: 1fr minmax(0,54%); align-items: center; gap: 7px; }
.field-row > span, .clock-label { color: var(--muted); font-weight: 600; font-size: 1.04rem; }
.option { display: flex; gap: 10px; align-items: center; min-height: 56px; padding: 9px 11px; text-align: left; border-color: #56524e; width: 100%; }
.option:hover, .preset:hover, .button:hover { filter: brightness(1.12); }
.option strong { display: block; font-weight: 750; }
.option small { display: block; color: var(--green); }
.option .chevron { margin-left: auto; width: 16px; color: var(--muted); }
.clock-label { display: block; margin: 11px 0 7px; }
.presets { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.preset { min-height: 62px; padding: 4px; border-color: #56524e; }
.preset strong, .preset small { display: block; }
.preset small { color: var(--muted); margin-top: 3px; }
.preset[aria-pressed="true"] { outline: 1px solid #97bf74; border-color: #97bf74; background: #45423d; }
.primary {
  margin: 16px 0 0; width: 100%; min-height: 58px; background: var(--accent);
  border: 0; border-radius: 8px; font-weight: 800; font-size: 1.8rem; color: #fff;
}
.primary:hover { background: #79a657; }
.note { min-height: 20px; color: var(--muted); font-size: .84rem; margin: 12px 0 0; }
.quick-links { margin-top: 18px; border-top: 1px solid #494540; }
.quick {
  width: 100%; background: none; border: 0; border-bottom: 1px solid #494540;
  min-height: 62px; text-align: left; padding: 8px; display: flex; align-items: center; gap: 14px; font-weight: 700;
}
.quick:hover { background: #ffffff06; }
.quick > :last-child { margin-left: auto; color: var(--muted); }
.heading { font-size: 1.35rem; margin: 18px 0 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin: 9px 0; padding: 11px; }
.card h3, .card p { margin: 0 0 6px; }
.card p { color: var(--muted); }
.row, .horizontal { display: flex; gap: 8px; align-items: center; }
.row { justify-content: space-between; }
.row > :first-child { min-width: 0; }
.row > :last-child { flex-shrink: 0; }
.button { min-height: 40px; border-color: #5c5851; padding: 7px 11px; font-weight: 650; }
.button.success { border-color: transparent; background: var(--accent); }
.button.danger { color: #ffb3a7; }
.challenge { display: flex; gap: 7px; align-items: center; min-height: 48px; padding: 8px; border-top: 1px solid #47433e; font-size: .83rem; }
.challenge > :nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.challenge .button { min-height: 34px; border: 0; background: transparent; color: var(--green); }
.input { min-height: 43px; width: 100%; padding: 8px; border: 1px solid #625c52; border-radius: 7px; background: var(--deep); color: var(--ink); }
.gamebar { padding: 0 10px; min-height: 56px; background: var(--panel); }
.gamebar .option { width: auto; min-height: 48px; padding: 3px 12px; justify-content: center; }
.match { --board-size: min(824px, calc(100dvh - 229px), calc(100vw - 314px)); width: var(--board-size); min-width: 0; margin: 0 auto; }
.play-grid { display: grid; grid-template-columns: var(--board-size) 150px; gap: 8px; align-items: stretch; }
.board-column { min-width: 0; }
.score-line { height: 8px; display: flex; background: #373532; margin: 2px 0; border-radius: 2px; overflow: hidden; }
.score-line span { display: block; background: #eee6da; transition: width .18s; }
.board {
  position: relative; width: var(--board-size); aspect-ratio: 1; display: grid;
  grid-template-columns: repeat(8,1fr); grid-template-rows: repeat(8,1fr);
  border: 1px solid #77573a; isolation: isolate; overflow: hidden;
}
.wood { --board-light: #c3a282; --board-dark: #9a7652; --grain: repeating-linear-gradient(90deg,#5f361010 0 1px,transparent 1px 8px,#f7e5d00a 8px 20px); }
.walnut { --board-light: #bd9e79; --board-dark: #744d36; --grain: repeating-linear-gradient(5deg,#2b170f14 0 1px,transparent 1px 5px,#fff4d711 5px 10px); }
.jade { --board-light: #dce5d4; --board-dark: #648b72; --grain: repeating-linear-gradient(130deg,transparent 0 16px,#edf9e81a 18px 19px,transparent 21px 40px); }
.slate { --board-light: #bdc6cd; --board-dark: #748497; --grain: linear-gradient(120deg,#ffffff13,transparent 65%,#242a3e33); }
.sand { --board-light: #ead6ad; --board-dark: #b18c5e; --grain: repeating-linear-gradient(0deg,#ffffff16 0 2px,transparent 2px 11px); }
.square { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background-color: var(--board-light); background-image: var(--grain),linear-gradient(122deg,#ffffff0c,transparent 48%,#23170a13); touch-action: manipulation; }
.square.is-dark { background-color: var(--board-dark); }
.square:nth-child(3n) { background-image: var(--grain),linear-gradient(30deg,#25170818 1%,transparent 56%,#fff5df18); }
.square.last::before, .square.selected::before, .square.suggested::before { content: ""; position: absolute; inset: 0; background: #a2ce5a64; }
.square.selected::before { box-shadow: inset 0 0 0 3px #dbe99f; }
.square.suggested::before { box-shadow: inset 0 0 0 3px #f1c75d; background: #ffcc506b; }
.square.target::after { content: ""; border-radius: 50%; width: 28%; aspect-ratio: 1; position: absolute; background: #395326ab; border: 2px solid #d1e78f99; }
.square:focus-visible { outline-offset: -3px; z-index: 3; }
.coord { position: absolute; color: #35210c; bottom: 2px; right: 3px; pointer-events: none; font-size: clamp(8px,1.2vw,11px); }
.disc {
  display: grid; place-items: center; position: relative; width: 77%; aspect-ratio: 1;
  border-radius: 50%; border: 1px solid var(--rim);
  background: radial-gradient(circle,var(--core) 0 28%,var(--middle) 29% 51%,var(--rim) 52% 54%,var(--middle) 55% 68%,var(--shine) 69% 75%,var(--rim) 80%);
  box-shadow: inset 0 2px 1px #ffffff75, inset 0 -5px 7px #170f1024, 0 3px 4px #1d110a50;
  color: var(--crown);
  pointer-events: none;
}
.disc.white { --core:#eee9df; --middle:#e1dbce; --rim:#b9a993; --shine:#fffdf7; --crown:#81694b; }
.disc.black { --core:#393531; --middle:#2f2c29; --rim:#171614; --shine:#5d5854; --crown:#e4bd60; }
.disc .icon { width: 48%; height: 48%; }
.disc.ghost { opacity: .34; }
.pieces-ivory .white { --core:#fff9ea; --middle:#f2e6c9; --rim:#bd9c64; --shine:#fff9e5; }
.pieces-ivory .black { --core:#6e4a36; --middle:#563725; --rim:#382416; --shine:#9c7459; }
.pieces-tournament .white { --core:#f7fafb; --middle:#dce2e8; --rim:#b9c4cd; --shine:white; }
.pieces-tournament .black { --core:#333b41; --middle:#1d242a; --rim:#14171c; --shine:#61707c; }
.pieces-glass .white { --core:#f0ffff; --middle:#a7e0df; --rim:#6eb9b2; --shine:#f6ffff; }
.pieces-glass .black { --core:#293d4e; --middle:#233346; --rim:#487683; --shine:#6fbccb; }
.pieces-pixel .disc { border-radius: 16%; border: 3px solid var(--rim); box-shadow: inset 4px 4px var(--shine),inset -4px -4px #0003; background: var(--middle); }
.pieces-cyber .white { --core:#d3fdf6; --middle:#418a76; --rim:#80e5ca; --shine:#90f5ff; --crown:#f4ffff; }
.pieces-cyber .black { --core:#4b2740; --middle:#271728; --rim:#f078b1; --shine:#bb548b; --crown:#ffb6d9; }
.pieces-holo .disc { background: conic-gradient(from 65deg,var(--core),var(--shine),var(--middle),var(--rim),var(--core)); }
.pieces-holo .white { --core:#d6eaf3; --middle:#b2b9e1; --rim:#e4bcd8; --shine:#fbf6ec; }
.pieces-holo .black { --core:#40516d; --middle:#3b4353; --rim:#89729a; --shine:#71a59e; }
.pieces-gold .white { --core:#ffe9a1; --middle:#e7bf63; --rim:#996b26; --shine:#ffedac; }
.pieces-gold .black { --core:#65482c; --middle:#38281f; --rim:#2b1b0b; --shine:#a57940; }
.pieces-marble .disc { background: var(--grain),radial-gradient(circle,var(--core),var(--middle) 68%,var(--rim) 70%,var(--shine) 75%); }
.pieces-marble .white { --core:#f8f8f4; --middle:#ddddd6; --rim:#afb2ad; --shine:#faf9f2; }
.pieces-marble .black { --core:#546059; --middle:#3b4742; --rim:#232924; --shine:#a0a79b; }
.pieces-matte .disc { background: var(--middle); border: 2px solid var(--rim); box-shadow: 0 3px 0 #29251a47; }
.pieces-ruby .white { --core:#fff5d6; --middle:#e5c5a7; --rim:#c99775; --shine:#fff1e2; }
.pieces-ruby .black { --core:#8b3644; --middle:#5d222e; --rim:#381b24; --shine:#bd5c66; }
.pieces-ocean .white { --core:#f4ffff; --middle:#b4dbe8; --rim:#7cafc3; --shine:#e9faff; }
.pieces-ocean .black { --core:#2f6079; --middle:#1b415a; --rim:#173447; --shine:#4889a3; }
.pieces-forest .white { --core:#eff0c9; --middle:#cccda6; --rim:#859374; --shine:#f9fae1; }
.pieces-forest .black { --core:#42644e; --middle:#294737; --rim:#192f25; --shine:#7ca18a; }
.people { display: flex; flex-direction: column; justify-content: space-between; padding-top: 12px; gap: 8px; min-width: 0; }
.person { padding: 9px 5px; display: grid; justify-items: center; gap: 6px; min-height: 146px; background: var(--panel); border: 2px solid transparent; border-radius: 8px; text-align: center; }
.person.active { border-color: #8b867d; }
.person strong { font-weight: 750; overflow-wrap: anywhere; }
.avatar { width: 50px; height: 50px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 1.35rem; }
.timer { font: 700 1.15rem/1.15 ui-monospace,Consolas,monospace; white-space: nowrap; }
.person.active .timer { color: #f5d17d; }
.analysis { background: var(--panel); margin-top: 3px; min-height: 105px; padding: 8px 10px; }
.analysis-head { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.analysis-note { font-size: .79rem; color: var(--muted); font-weight: 400; margin-left: auto; }
.move-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 83px; overflow: auto; margin-top: 6px; }
.move-list button { background: var(--base); border: 0; border-radius: 4px; padding: 3px 6px; min-height: 29px; }
.move-list button[aria-current="step"] { background: #526045; }
.match-controls { display: flex; justify-content: space-around; gap: 0; margin-top: 4px; background: var(--panel); }
.round-action { flex: 1; border: 0; background: none; min-height: 61px; padding: 3px 2px; display: grid; justify-items: center; align-content: center; gap: 4px; font-size: .71rem; }
.round-action:hover { background: #ffffff0a; }
.round-action .icon { width: 19px; height: 19px; }
.notice { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); padding: 8px; border-radius: 7px; background: var(--panel); margin: 8px 0 0; }
.notice p { margin: 0 4px 0 0; color: var(--muted); }
.message-list { min-height: 46px; max-height: 225px; overflow: auto; margin: 7px 0; overflow-wrap: anywhere; }
dialog { width: min(460px,calc(100% - 24px)); max-height: min(85dvh,720px); color: var(--ink); background: var(--base); border: 1px solid #615c55; border-radius: 12px; padding: 0; box-shadow: 0 10px 45px #0006; }
dialog::backdrop { background: #171613c9; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.15rem; margin: 0; }
.dialog-body { padding: 10px 12px; }
.tiles { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.theme-option { padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; min-height: 55px; font-size: .76rem; }
.theme-option[aria-pressed="true"] { border: 2px solid var(--green); }
.sample { display: flex; height: 33px; align-items: center; justify-content: center; gap: 4px; border-radius: 5px; margin-bottom: 4px; }
.sample.board-sample { background: repeating-conic-gradient(var(--board-light) 0% 25%,var(--board-dark) 0% 50%) 50% 50%/24px 24px; }
.sample .disc { width: 24px; }
.toast { position: fixed; z-index: 9; left: 50%; bottom: max(18px,env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 30px); border-radius: 8px; background: #1e1c19; color: var(--ink); box-shadow: 0 6px 18px #0005; }
.toast:not(:empty) { padding: 10px 13px; border: 1px solid #5b544a; }
@media (max-width: 1010px) {
  .shell { grid-template-columns: minmax(12px,1fr) minmax(0,484px) minmax(12px,1fr); }
  .lobby-rail { grid-column: 2; grid-row: 2; margin: 18px 0 0; max-width: none; }
  .lobby-list { min-height: 0; }
}
@media (max-width: 680px) {
  .match { width: min(100%,500px); --board-size: 100%; }
  .play-grid { display: flex; flex-direction: column; gap: 3px; }
  .people { order: -1; display: flex; flex-direction: row-reverse; padding: 0 5px; min-height: 32px; }
  .person { display: flex; flex: 1; justify-content: space-between; text-align: left; align-items: center; min-height: 31px; padding: 2px 5px; gap: 4px; font-size: .8rem; }
  .person .avatar, .person .rating { display: none; }
  .timer { font-size: .88rem; }
  .gamebar { min-height: 49px; gap: 2px; padding-right: 3px; }
  .gamebar .logo { font-size: clamp(15px,5vw,24px); }
  .gamebar .option { padding: 3px 5px; min-height: 37px; font-size: .75rem; gap: 2px; }
  .gamebar .icon-button { min-width: 32px; }
  .gamebar .icon { width: 18px; height: 18px; }
  .analysis { min-height: 115px; }
  .round-action { min-height: 54px; }
}
@media (max-width: 450px) {
  .brandbar { height: 45px; }
  .tab { min-height: 55px; font-size: .72rem; padding-inline: 2px; }
  .tab .icon { width: 19px; height: 19px; }
  .board-hero { height: clamp(104px,31vw,144px); }
  .hero-discs { transform: scale(.82); }
  .field-row { grid-template-columns: 1fr minmax(0,61%); }
  .option { min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
