
[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --ink: #070a12;
  --slate: #151925;
  --slate-2: #1c2233;
  --slate-3: #262e44;
  --line: #2b3550;
  --cloud: #f7f7f3;
  --muted: #9aa6bf;
  --cobalt: #173bff;
  --cobalt-lift: #6e8bff;
  --gold: #ffd37a;
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --safe-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  font: 15px/1.5 "Mona Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--cloud);
  background: var(--ink);
}
@font-face { font-family: "Hubot Sans"; font-weight: 200 900; font-display: swap; src: url("../vendor/fonts/hubot-sans.woff2") format("woff2"); }
@font-face { font-family: "Mona Sans"; font-weight: 200 900; font-display: swap; src: url("../vendor/fonts/mona-sans.woff2") format("woff2"); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--ink); overflow-x: hidden; }
button, input { font: inherit; color: inherit; }
button {
  min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--slate-2); cursor: pointer; touch-action: manipulation;
}
button:hover { background: var(--slate-3); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cobalt-lift); outline-offset: 2px; }
button.primary { background: var(--cobalt); border-color: var(--cobalt); font-weight: 650; }
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: calc(10px + var(--safe-top)) calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0b0f1c, var(--ink));
}
.brand { font: 800 21px/1 "Hubot Sans", ui-sans-serif, system-ui, sans-serif; letter-spacing: -.02em; text-decoration: none; color: var(--cloud); min-height: 44px; display: inline-flex; align-items: center; }
.brand .v { color: var(--cobalt-lift); }
.brand .o { color: #ff6b35; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: transparent; border-color: transparent; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--cloud); border-color: var(--line); background: var(--slate); }
main { max-width: 720px; margin: 0 auto; padding: 18px calc(16px + var(--safe-right)) calc(40px + var(--safe-bottom)) calc(16px + var(--safe-left)); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font: 800 26px/1.15 "Hubot Sans", ui-sans-serif, system-ui, sans-serif; margin: 0; }
.how { color: var(--muted); margin: 6px 0 12px; }
.status { min-height: 1.5em; margin: 0 0 12px; font-weight: 600; }
.c4-drops, .c4-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; width: min(100%, 490px); }
.c4-drops { margin-bottom: 6px; }
.c4-drops button { padding: 0; min-height: 44px; font-size: 18px; }
.c4-board { padding: 8px; border-radius: 14px; background: var(--slate); border: 1px solid var(--line); }
.c4-cell { aspect-ratio: 1; border-radius: 50%; background: #0b0f1a; border: 1px solid var(--line); }
.c4-cell.p1 { background: var(--cobalt-lift); border-color: var(--cobalt-lift); }
.c4-cell.p2 { background: var(--gold); border-color: var(--gold); }
.ck-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(100%, 520px); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ck-sq { aspect-ratio: 1; min-height: 36px; padding: 0; border: 0; border-radius: 0; display: grid; place-items: center; }
.ck-sq.light { background: #2a3146; cursor: default; }
.ck-sq.dark { background: #11162a; }
.ck-sq.dest { box-shadow: inset 0 0 0 3px var(--cobalt-lift); }
.ck-sq.sel { box-shadow: inset 0 0 0 3px var(--cloud); }
.ck-piece { width: 72%; height: 72%; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 800; color: var(--ink); }
.ck-piece.p1 { background: var(--cobalt-lift); }
.ck-piece.p2 { background: var(--gold); }
.pz-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: min(100%, 380px); }
.pz-tile { aspect-ratio: 1; font: 800 24px/1 "Hubot Sans", ui-sans-serif, system-ui, sans-serif; background: var(--slate-2); }
.pz-tile.gap { visibility: hidden; }
.pz-tile.home { border-color: var(--cobalt-lift); }
.wz-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.wz-form input { flex: 1 1 220px; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); }
.how kbd { font: inherit; font-size: 0.9em; padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; }
main:has(#panel-chess:not([hidden])) { max-width: 1080px; }
select {
  font: inherit; color: inherit; min-height: 44px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--ink);
}
.chess-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
@media (min-width: 900px) { .chess-layout { grid-template-columns: minmax(0, 620px) minmax(260px, 1fr); align-items: start; } }
.chess-main { min-width: 0; }
.chess-side { display: grid; gap: 12px; min-width: 0; }
.chess-card { background: var(--slate); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.chess-card h2 { font: 750 16px/1.2 "Hubot Sans", ui-sans-serif, system-ui, sans-serif; margin: 0; }
.chess-card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.chess-card .field { display: grid; grid-template-columns: 1fr 1.4fr; align-items: center; gap: 10px; color: var(--muted); }
.chess-card .note { color: var(--muted); margin: 0; font-size: 13px; }
.chess-player { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 4px 2px; }
.chess-player .who { font-weight: 700; display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.chess-captured { font-size: 20px; letter-spacing: -2px; min-height: 1em; overflow-wrap: anywhere; }
.chess-captured.w { color: var(--cloud); }
.chess-captured.b { color: var(--muted); }
.chess-board {
  position: relative; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: min(100%, 620px); aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: 0 18px 50px #0009, 0 0 0 4px #0b1030;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.chess-sq {
  position: relative; aspect-ratio: 1; min-height: 0; padding: 0; border: 0; border-radius: 0;
  display: grid; place-items: center; cursor: default;
}
.chess-sq.light { background: #cdd6f4; }
.chess-sq.dark { background: #3d56c4; }
.chess-sq.light:hover, .chess-sq.dark:hover { filter: brightness(1.04); }
.chess-sq.can { cursor: grab; }
.chess-sq.light.last { background: #efe2b0; }
.chess-sq.dark.last { background: #c7ad5f; }
.chess-sq.sel::before { content: ""; position: absolute; inset: 0; background: rgb(110 139 255 / .55); }
.chess-sq.check::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgb(255 211 122 / .95) 0, rgb(255 211 122 / .35) 45%, transparent 72%); }
.chess-sq.dest::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgb(7 10 18 / .38); }
.chess-sq.take::after { content: ""; position: absolute; inset: 6%; border-radius: 50%; border: 5px solid rgb(7 10 18 / .38); }
.chess-sq:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.chess-piece {
  position: relative; z-index: 1; font-size: min(9.5vw, 58px); line-height: 1;
  font-family: "DejaVu Sans", "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", sans-serif;
  pointer-events: none; transition: transform .12s ease;
}
.chess-piece.w { color: #fbfbf8; text-shadow: 0 0 1px #070a12, 0 1px 0 #070a12, 0 -1px 0 #070a12, 1px 0 0 #070a12, -1px 0 0 #070a12, 0 3px 6px #0007; }
.chess-piece.b { color: #0b0f1a; text-shadow: 0 0 1px #f7f7f3, 0 2px 5px #0006; }
.chess-piece.dragging { z-index: 5; transition: none; transform-origin: center; filter: drop-shadow(0 10px 12px #000a); }
.coord { position: absolute; z-index: 1; font-size: 11px; font-weight: 700; pointer-events: none; }
.coord.rank { top: 3px; left: 4px; }
.coord.file { bottom: 2px; right: 4px; }
.chess-sq.light .coord { color: #3d56c4; }
.chess-sq.dark .coord { color: #cdd6f4; }
.chess-promote {
  position: absolute; z-index: 10; inset: 0; display: grid; place-content: center; grid-auto-flow: column; gap: 8px;
  background: rgb(7 10 18 / .72); backdrop-filter: blur(3px);
}
.chess-promote button { width: 72px; height: 72px; border-radius: 14px; background: var(--slate-2); }
.chess-promote .chess-piece { font-size: 48px; }
.chess-moves {
  margin: 0; padding: 0; list-style: none; max-height: 240px; overflow-y: auto;
  display: grid; grid-template-columns: 1fr; font-variant-numeric: tabular-nums;
}
.chess-moves li { display: grid; grid-template-columns: 3ch 1fr 1fr; gap: 8px; padding: 3px 4px; border-radius: 6px; }
.chess-moves li:nth-child(odd) { background: #0f1422; }
.chess-moves .n { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .chess-piece { transition: none; } }
.room-main { max-width: 1080px; }
.room-meta { color: var(--muted); font-weight: 600; margin-left: auto; }
.seat .face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--slate-2); border: 2px solid var(--line); flex: none; }
.seat .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.turn .face { border-color: var(--cobalt-lift); box-shadow: 0 0 0 3px rgb(110 139 255 / .25); }
.seat .clock {
  font: 800 22px/1 "Hubot Sans", ui-sans-serif, system-ui, sans-serif; font-variant-numeric: tabular-nums;
  padding: 8px 12px; border-radius: 10px; background: var(--slate-2); border: 1px solid var(--line); min-width: 5.2ch; text-align: center;
}
.seat .clock.running { background: var(--cobalt); border-color: var(--cobalt); }
.seat .clock.low { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.room-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat h2 { display: flex; justify-content: space-between; align-items: baseline; }
.chat .watching { font: 600 13px/1 "Mona Sans", ui-sans-serif, system-ui, sans-serif; color: var(--muted); }
.chat-lines { list-style: none; margin: 0; padding: 0; height: 280px; overflow-y: auto; display: grid; align-content: start; gap: 4px; overflow-wrap: anywhere; }
.chat-lines li { padding: 4px 8px; border-radius: 8px; background: #0f1422; }
.chat-lines li.system { background: transparent; color: var(--muted); font-size: 13px; font-style: italic; }
.chat-lines li b { font-weight: 700; }
.chat-lines li.player.w b { color: var(--cloud); }
.chat-lines li.player.b b { color: var(--gold); }
.reactions { display: flex; gap: 6px; flex-wrap: wrap; }
.reactions button { min-width: 44px; padding: 0 8px; font-size: 20px; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); }
.floats { position: fixed; inset: auto 0 0 0; height: 0; pointer-events: none; z-index: 20; }
.floats .float { position: absolute; bottom: 24px; font-size: 34px; animation: rise 2.4s ease-out forwards; }
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .floats .float { animation: none; opacity: 0; } }
.bb-wrap { position: relative; width: 100%; max-width: 960px; margin: 0 auto; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--ink); }
#bb-stage { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
.bb-overlay {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 16px;
  background: rgb(7 10 18 / .72); text-align: center; overflow-y: auto;
}
.bb-overlay h2 { font: 800 22px/1.2 "Hubot Sans", ui-sans-serif, system-ui, sans-serif; margin: 0; }
.bb-songs { display: grid; gap: 8px; width: min(100%, 420px); }
@media (min-width: 720px) { .bb-songs { grid-template-columns: repeat(3, 1fr); width: min(100%, 780px); } }
.bb-song { display: grid; gap: 2px; text-align: left; background: var(--slate); }
.bb-song span { color: var(--muted); font-size: 13px; }
.bb-song[aria-pressed="true"], .bb-row button[aria-pressed="true"] { border-color: var(--cobalt-lift); background: #16215e; }
.bb-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bb-who { color: var(--muted); margin: 0; }
.bb-who a { color: var(--cobalt-lift); font-weight: 700; display: inline-block; min-height: 44px; line-height: 44px; }
.bb-pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 960px; margin: 10px auto 0; }
.bb-pads button { min-height: 72px; font-size: 26px; touch-action: none; user-select: none; -webkit-user-select: none; }
.bb-pads button:nth-child(1) { color: #b07cff; }
.bb-pads button:nth-child(2) { color: #22d3ee; }
.bb-pads button:nth-child(3) { color: #3ee089; }
.bb-pads button:nth-child(4) { color: #ffd37a; }
@media (max-width: 519px) {
  .bb-wrap { aspect-ratio: 180 / 300; width: min(100%, calc((100dvh - 120px - var(--safe-top) - var(--safe-bottom)) * 180 / 300)); }
  .bb-overlay h2 { font-size: 19px; }
  body.bb-playing .bar, body.bb-playing #panel-battle .head, body.bb-playing #panel-battle .how { display: none; }
  body.bb-playing main { padding-top: calc(8px + var(--safe-top)); }
}
.wild-card { display: grid; gap: 18px; align-items: center; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 640px) { .wild-card { grid-template-columns: 240px 1fr; } }
.wild-card img { width: 100%; max-width: 320px; height: auto; border-radius: 14px; border: 1px solid var(--line); }
.wild-play { display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 10px; background: var(--cobalt); color: var(--cloud); text-decoration: none; font-weight: 650; }
