:root {
  --bg: #f6f1e6; --bg2: #efe7d6; --ink: #1d1a14; --ink2: #4a4436; --ink3: #7a725f; --line: #e2d8c3; --card: #fffdf8;
  --accent: #e76f51; --accent2: #f4a261; --good: #2a9d8f; --bad: #d1495b;
  --blue: #3b82f6; --blue-d: #1e40af; --red: #ef4444; --red-d: #991b1b;
  --grass: #79bf5f; --grass2: #6cb453; --sand: #e9c46a; --water: #38b6e8; --water2: #1f8fd0;
  --chrome: 300px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15130f; --bg2: #1d1a15; --ink: #f1ebdd; --ink2: #cfc6b3; --ink3: #9a917e; --line: #34302a; --card: #221f1a; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.emoji, .face, .rules-art, .vs-av, .result-icon, .choice-icon, .paws { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }

/* ---------- top bar ---------- */
.ac-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; padding: 0 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.ac-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.01em; text-decoration: none; font-size: 17px; }
.ac-brand .emoji { font-size: 22px; }
.ac-top-right { display: flex; align-items: center; gap: 8px; }
.ac-online { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.ac-online i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: live 2s infinite; }
.ac-online b { color: var(--ink); font-variant-numeric: tabular-nums; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.ac-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 16px; }
.ac-lang { font-size: 13px; font-weight: 600; text-decoration: none; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); white-space: nowrap; }
.ac-brand { white-space: nowrap; min-width: 0; overflow: hidden; }
@media (max-width: 440px) { .ac-brand .bt { display: none; } .ac-top-right { gap: 6px; } .ac-top { padding: 0 10px; } }

/* ---------- hero ---------- */
.ac-hero { text-align: center; padding: 10px 16px 4px; }
.ac-hero h1 { margin: 0; font-size: clamp(22px, 5.2vw, 34px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 850; }
.ac-hero p { margin: 2px 0 0; color: var(--ink3); font-size: 14px; }

/* ---------- stage ---------- */
.ac-stage { --w: min(100%, calc((100svh - var(--chrome)) * 7 / 9), 560px); width: var(--w); margin: 6px auto 0; padding: 0 0 8px; position: relative; }
@media (max-width: 600px) { .ac-stage { --w: min(calc(100vw - 20px), calc((100svh - var(--chrome)) * 7 / 9)); } }
/* Short portrait screens: smaller title so the board, both bars and the buttons stay on one screen. */
@media (max-height: 760px) and (orientation: portrait), (max-height: 760px) and (min-width: 900px) {
  :root { --chrome: 268px; }
  .ac-hero { padding: 4px 16px 0; }
  .ac-hero h1 { font-size: 20px; }
  .ac-hero p { display: none; }
  .ac-bar { height: 40px; margin: 4px 0; }
  .ac-actions { margin-top: 2px; }
  .ac-actions button { min-height: 34px; }
}
/* Landscape phones: board on the left, players and buttons on the right. */
@media (orientation: landscape) and (max-height: 560px) {
  .ac-top { height: 44px; }
  .ac-hero { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; }
  .ac-stage { --bw: calc((100svh - 58px) * 7 / 9); width: auto; margin: 6px auto 0; display: grid; grid-template-columns: var(--bw) minmax(200px, 260px); grid-template-rows: auto auto 1fr auto; gap: 0 14px; justify-content: center; }
  .ac-stage > .ac-boardwrap { grid-column: 1; grid-row: 1 / span 4; width: var(--bw); }
  #bar-opp { grid-column: 2; grid-row: 1; }
  #banner { grid-column: 2; grid-row: 2; }
  #bar-me { grid-column: 2; grid-row: 3; align-self: end; }
  .ac-actions { grid-column: 2; grid-row: 4; justify-content: stretch; }
  .ac-actions button { flex: 1; }
  .panel { padding: 14px 14px 12px; }
  .panel h2 { font-size: 17px; }
  .rules-art { font-size: 26px; margin: 6px 0 2px; }
  .panel p { font-size: 13px; margin-bottom: 6px; }
  .choice { padding: 8px 10px; margin-top: 6px; }
  .choice-icon { font-size: 22px; width: 30px; }
  .btn { min-height: 38px; font-size: 14px; }
}
.ac-bar { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; margin: 6px 0; border-radius: 14px; background: var(--card); border: 1px solid var(--line); transition: box-shadow .25s, border-color .25s; }
.ac-bar .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; color: #fff; font-weight: 800; flex: none; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",Inter,sans-serif; }
.ac-bar[data-side="0"] .av { background: linear-gradient(145deg, #60a5fa, var(--blue-d)); }
.ac-bar[data-side="1"] .av { background: linear-gradient(145deg, #f87171, var(--red-d)); }
.ac-bar .who { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ac-bar .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-bar .color { font-size: 11px; color: var(--ink3); text-transform: uppercase; letter-spacing: .06em; }
.ac-bar .taken { flex: 1; text-align: right; font-size: 15px; letter-spacing: -2px; overflow: hidden; white-space: nowrap; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.ac-bar .thinking { display: inline-flex; gap: 3px; }
.ac-bar .thinking[hidden] { display: none; }
.ac-bar .thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink3); animation: dot 1.1s infinite; }
.ac-bar .thinking i:nth-child(2) { animation-delay: .15s; } .ac-bar .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ac-bar .clock { font: 700 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 6px 8px; border-radius: 8px; background: var(--bg2); font-variant-numeric: tabular-nums; }
.ac-bar .clock.is-low { background: var(--bad); color: #fff; animation: pulse .8s infinite; }
.ac-bar.is-active[data-side="0"] { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
.ac-bar.is-active[data-side="1"] { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }
@keyframes pulse { 50% { transform: scale(1.06); } }

.ac-boardwrap { position: relative; width: 100%; aspect-ratio: 7 / 9; }
.ac-board { position: absolute; inset: 0; container-type: inline-size; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 5px #3d5a2a, 0 0 0 7px #2b4220, 0 18px 40px rgba(30, 40, 20, .35); background: var(--grass); touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(9, 1fr); }
.cell { position: relative; background:
  radial-gradient(circle at 30% 25%, rgba(255,255,255,.10) 0 18%, transparent 19%),
  radial-gradient(circle at 70% 80%, rgba(0,0,0,.05) 0 14%, transparent 15%), var(--grass); }
.cell.alt { background-color: var(--grass2); background-image: radial-gradient(circle at 65% 30%, rgba(255,255,255,.08) 0 16%, transparent 17%), radial-gradient(circle at 25% 75%, rgba(0,0,0,.06) 0 12%, transparent 13%); }
.cell.water { background: linear-gradient(115deg, var(--water) 0%, #5fd0f5 25%, var(--water) 45%, var(--water2) 75%, var(--water) 100%); background-size: 300% 300%; animation: flow 7s linear infinite; box-shadow: inset 0 0 0 0 transparent; }
.cell.water::after { content: ''; position: absolute; inset: 0; background: repeating-radial-gradient(circle at 30% 40%, rgba(255,255,255,.18) 0 2px, transparent 3px 14px); opacity: .55; animation: shimmer 3.5s ease-in-out infinite alternate; }
.cell.water.wt { box-shadow: inset 0 4px 0 rgba(255,255,255,.35); }
.cell.water.wt.wl { border-top-left-radius: 22%; } .cell.water.wt.wr { border-top-right-radius: 22%; }
.cell.water.wb.wl { border-bottom-left-radius: 22%; } .cell.water.wb.wr { border-bottom-right-radius: 22%; }
@keyframes flow { to { background-position: 300% 0; } }
@keyframes shimmer { from { transform: translate(-3%, -2%); } to { transform: translate(3%, 2%); } }
.cell.trap { background: var(--sand); }
.cell.trap .trap-mark { position: absolute; inset: 14%; border-radius: 22%; background: repeating-linear-gradient(45deg, rgba(120, 80, 30, .45) 0 2px, transparent 2px 9px), repeating-linear-gradient(-45deg, rgba(120, 80, 30, .45) 0 2px, transparent 2px 9px); }
.cell.trap.side-0 { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--blue) 45%, transparent); }
.cell.trap.side-1 { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--red) 45%, transparent); }
.cell.den { background: radial-gradient(circle at 50% 62%, #1d140e 0 30%, #5b4130 31% 56%, #8a6a4c 57%); }
.cell.den .den-mark { position: absolute; inset: 0; display: grid; place-items: center; font-size: 6cqw; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.cell.den.side-0 { box-shadow: inset 0 0 0 4px var(--blue); } .cell.den.side-1 { box-shadow: inset 0 0 0 4px var(--red); }
.cell.last-from::before { content: ''; position: absolute; inset: 30%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .7); }
.cell.last-to::before { content: ''; position: absolute; inset: 0; background: rgba(255, 236, 120, .35); }

/* ---------- pieces ---------- */
#pieces, #hints { position: absolute; inset: 0; pointer-events: none; }
.piece, .hint { pointer-events: auto; }
.piece { position: absolute; left: 0; top: 0; width: calc(100% / 7); height: calc(100% / 9); transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%)); display: grid; place-items: center; z-index: 1; }
.piece.is-moving { z-index: 5; }
.disc { position: relative; width: 84%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 34% 28%, #fffef9 0 30%, #f3e8cf 70%, #e2d2ad); transition: transform .18s cubic-bezier(.2,.8,.3,1.4), box-shadow .2s, opacity .3s, filter .3s; }
.side-0 .disc { border: .9cqw solid var(--blue); box-shadow: 0 .7cqw 0 var(--blue-d), 0 1.6cqw 2.4cqw rgba(0,0,0,.28); }
.side-1 .disc { border: .9cqw solid var(--red); box-shadow: 0 .7cqw 0 var(--red-d), 0 1.6cqw 2.4cqw rgba(0,0,0,.28); }
.face { font-size: 6.6cqw; line-height: 1; transform: translateY(2%); filter: drop-shadow(0 1px 0 rgba(0,0,0,.12)); }
.side-1 .face { transform: translateY(2%) scaleX(-1); }
.rank { position: absolute; right: -3%; bottom: -3%; min-width: 3.9cqw; height: 3.9cqw; padding: 0 .6cqw; border-radius: 99px; display: grid; place-items: center; font: 800 2.5cqw/1 Inter, system-ui, sans-serif; color: #fff; border: .4cqw solid #fffdf6; }
.side-0 .rank { background: var(--blue-d); } .side-1 .rank { background: var(--red-d); }
.piece.can-move .disc { animation: ready 1.8s ease-in-out infinite; }
@keyframes ready { 50% { filter: brightness(1.08) drop-shadow(0 0 1.2cqw rgba(255, 245, 160, .95)); } }
.piece.is-selected { z-index: 4; }
.piece.is-selected .disc { transform: translateY(-9%) scale(1.1); animation: none; filter: drop-shadow(0 0 1.6cqw rgba(255, 220, 90, 1)); }
.piece.is-trapped .disc { filter: saturate(.55) brightness(.92); }
.piece.is-trapped .disc::after { content: ''; position: absolute; inset: -4%; border-radius: 50%; background: repeating-linear-gradient(45deg, rgba(90, 60, 20, .55) 0 2px, transparent 2px 8px), repeating-linear-gradient(-45deg, rgba(90, 60, 20, .55) 0 2px, transparent 2px 8px); pointer-events: none; }
.piece.is-trapped .rank { background: #b91c1c; }
.piece.trap-snap .disc::after { animation: net .45s ease-out; }
@keyframes net { from { transform: translateY(-60%) scale(1.4); opacity: 0; } to { transform: none; opacity: 1; } }
.piece.is-doomed .disc { transform: scale(.3) rotate(-25deg); opacity: 0; filter: brightness(2); transition: transform .2s ease-in, opacity .2s ease-in, filter .1s; }

/* ---------- hints ---------- */
#hints { z-index: 3; }
.hint { position: absolute; left: 0; top: 0; width: calc(100% / 7); height: calc(100% / 9); transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%)); display: grid; place-items: center; cursor: pointer; }
.hint i { display: block; border-radius: 50%; }
.hint--move i, .hint--swim i { width: 30%; aspect-ratio: 1; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); animation: pop .25s cubic-bezier(.2,.8,.3,1.5); }
.hint--swim i { background: #e0f7ff; box-shadow: 0 0 0 4px rgba(255,255,255,.35), 0 2px 6px rgba(0,0,0,.3); }
.hint--capture i { width: 90%; aspect-ratio: 1; border: 1.1cqw solid rgba(239, 68, 68, .95); box-shadow: 0 0 1.6cqw rgba(239, 68, 68, .8), inset 0 0 1.2cqw rgba(239, 68, 68, .6); animation: ring 1s ease-in-out infinite; }
.hint--den i { width: 62%; aspect-ratio: 1; background: radial-gradient(circle, #fff6c2, #ffd23f 60%, rgba(255, 210, 63, 0) 72%); box-shadow: 0 0 2.4cqw #ffd23f; animation: ring .9s ease-in-out infinite; }
.hint--den i::after { content: '★'; display: grid; place-items: center; height: 100%; color: #8a5a00; font-size: 4.2cqw; }
@keyframes pop { from { transform: scale(0); } }
@keyframes ring { 50% { transform: scale(1.08); } }

/* ---------- fx, toast, screens ---------- */
.ac-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.ac-toast { position: absolute; left: 50%; top: 10px; transform: translate(-50%, -12px); opacity: 0; z-index: 7; max-width: 92%; padding: 8px 14px; border-radius: 99px; background: rgba(20, 18, 14, .86); color: #fff; font-size: 13.5px; font-weight: 600; text-align: center; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.ac-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.ac-toast.good { background: rgba(21, 128, 61, .92); } .ac-toast.bad { background: rgba(185, 28, 28, .92); }
.ac-banner { margin: 6px 0; padding: 8px 12px; border-radius: 12px; background: #fff4d6; color: #7a4e00; font-size: 13.5px; font-weight: 600; text-align: center; }
.ac-screen { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 12px; border-radius: 16px; background: rgba(20, 26, 14, .42); backdrop-filter: blur(5px) saturate(1.1); -webkit-backdrop-filter: blur(5px); animation: fade .25s; }
.ac-screen[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.panel { position: relative; width: min(100%, 380px); max-height: 100%; overflow: auto; padding: 22px 20px 18px; border-radius: 22px; background: var(--card); color: var(--ink); text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); animation: rise .35s cubic-bezier(.2,.8,.3,1.2); }
@keyframes rise { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.panel h2 { margin: 6px 0 6px; font-size: 21px; line-height: 1.25; letter-spacing: -0.01em; }
.panel p { margin: 0 0 12px; color: var(--ink2); font-size: 15px; }
.panel .muted { color: var(--ink3); }
.row { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.btn { flex: 1; min-height: 46px; padding: 0 18px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #f08a6c, var(--accent)); color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 #b9533a; transition: transform .1s, box-shadow .1s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9533a; }
.btn--ghost { background: var(--bg2); color: var(--ink); box-shadow: 0 4px 0 var(--line); }
.btn--ghost:active { box-shadow: 0 1px 0 var(--line); }
.skip { position: absolute; top: 10px; right: 10px; border: 0; background: var(--bg2); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--ink2); }
.rules-art { font-size: 40px; line-height: 1.25; margin: 14px 0 4px; letter-spacing: 2px; }
.rules-art small { display: block; font: 700 12px/1.4 Inter, system-ui, sans-serif; color: var(--ink3); letter-spacing: .02em; }
.dots { display: flex; justify-content: center; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: width .2s; }
.dots i.on { width: 20px; border-radius: 99px; background: var(--accent); }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; margin: 10px 0 0; padding: 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--bg); text-align: left; flex-wrap: wrap; }
button.choice:hover, button.choice:focus-visible { border-color: var(--accent); }
.choice--online { background: linear-gradient(135deg, #fff1e8, #ffe0cf); border-color: #f6b79f; }
@media (prefers-color-scheme: dark) { .choice--online { background: linear-gradient(135deg, #3a2419, #4a2a1c); border-color: #7a4430; } }
.choice-icon { font-size: 30px; width: 44px; text-align: center; }
.choice b { display: block; font-size: 17px; } .choice small { display: block; color: var(--ink3); font-size: 13px; }
.levels { display: flex; gap: 6px; width: 100%; margin-top: 4px; }
.lvl { flex: 1; min-height: 40px; border-radius: 12px; border: 0; background: var(--card); box-shadow: 0 3px 0 var(--line); font-weight: 700; }
.lvl:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.link { margin-top: 12px; border: 0; background: none; color: var(--ink3); text-decoration: underline; font-size: 13.5px; }
.paws { font-size: 26px; display: flex; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.paws span { animation: walk 1.2s infinite; } .paws span:nth-child(2) { animation-delay: .2s; } .paws span:nth-child(3) { animation-delay: .4s; }
@keyframes walk { 0%, 100% { opacity: .2; transform: translateY(4px) rotate(-12deg); } 50% { opacity: 1; transform: translateY(-4px) rotate(8deg); } }
.vs-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 12px; }
.vs-p { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; animation: slideL .5s cubic-bezier(.2,.8,.3,1.3); }
.vs-p:last-child { animation-name: slideR; }
.vs-p b { font-size: 14px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-av { font-size: 38px; }
.vs-x { font-size: 26px; font-weight: 900; font-style: italic; color: var(--accent); animation: boom .5s .25s both cubic-bezier(.2,.8,.3,1.8); }
@keyframes slideL { from { transform: translateX(-40px); opacity: 0; } } @keyframes slideR { from { transform: translateX(40px); opacity: 0; } }
@keyframes boom { from { transform: scale(2.4); opacity: 0; } }
.result-icon { font-size: 58px; line-height: 1; margin-top: 4px; animation: boom .6s cubic-bezier(.2,.8,.3,1.6); }
.panel--result.is-win h2 { color: #c47f00; } .panel--result.is-lose h2 { color: var(--bad); }
.ac-stage.is-lost .ac-board { filter: grayscale(.55) brightness(.85); transition: filter 1s; }
.ac-stage.is-won .ac-board { animation: glow 1.4s ease-out; }
@keyframes glow { 30% { box-shadow: 0 0 0 5px #3d5a2a, 0 0 0 7px #2b4220, 0 0 60px rgba(255, 210, 63, .9); } }

.ac-actions { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.ac-actions button { min-height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; color: var(--ink2); }

/* ---------- ad slots (hidden until ads are switched on; see public/js/ads.js) ---------- */
.ad-slot[hidden] { display: none !important; }
.ad-content { display: block; max-width: 760px; min-height: 280px; margin: 28px auto; padding: 0 18px; }
.ad-content::before, .ad-rail::before { content: 'Advertisement'; display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); margin-bottom: 4px; text-align: center; }
html[lang^="zh"] .ad-content::before, html[lang^="zh"] .ad-rail::before { content: '广告'; }
.ad-rail { display: none; }
@media (min-width: 1280px) and (min-height: 700px) {
  main { position: relative; }
  .ad-rail { position: absolute; top: 96px; width: 160px; min-height: 600px; }
  .ad-rail:not([hidden]) { display: block; }
  .ad-rail--left { left: max(16px, calc(50% - 280px - 32px - 160px)); }
  .ad-rail--right { right: max(16px, calc(50% - 280px - 32px - 160px)); }
}
.ad-slot.is-preview { background: repeating-linear-gradient(45deg, var(--bg2) 0 10px, transparent 10px 20px); border: 1px dashed var(--line); border-radius: 12px; }
.ad-content.is-preview { min-height: 250px; }

/* ---------- share sheet ---------- */
.ac-share { color: var(--ink); }
.share-link { display: block; margin: 12px auto 0; font-weight: 600; text-decoration: none; color: var(--accent); }
.share-dialog { width: min(94vw, 440px); max-width: none; max-height: 96svh; overflow: auto; }
.share-wrap { position: relative; padding: 16px 16px 14px; text-align: center; }
.share-title { margin: 2px 0 12px; font-size: 18px; }
.share-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg2); font-size: 15px; }
.share-card { position: relative; border-radius: 16px; overflow: hidden; background: var(--bg2); aspect-ratio: 4 / 5; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.share-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.share-card .share-loading { position: absolute; inset: 0; display: none; place-items: center; color: var(--ink3); font-size: 14px; }
.share-card.is-loading .share-loading { display: grid; }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.share-actions .share-native { grid-column: 1 / -1; }
.share-actions .share-native[hidden] + .share-copy { grid-column: auto; }
.share-actions .btn { min-height: 44px; font-size: 15px; }
.share-note { min-height: 20px; margin: 8px 0 0; font-size: 13px; color: var(--ink3); }
@media (orientation: landscape) and (max-height: 560px) { .share-card { max-height: 60svh; aspect-ratio: auto; } .share-card img { object-fit: contain; } }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 20px; padding: 0; max-width: min(92vw, 520px); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10, 10, 8, .5); }
.dlg { padding: 20px; }
.dlg h2 { margin: 0 0 8px; font-size: 20px; }
.dlg ul { padding-left: 20px; margin: 0; } .dlg li { margin: 4px 0; }
.dlg .row { margin-top: 16px; }

/* ---------- content ---------- */
.ac-content { max-width: 760px; margin: 28px auto 0; padding: 0 18px 40px; }
.ac-content h2 { font-size: 24px; letter-spacing: -0.01em; margin: 36px 0 10px; line-height: 1.25; }
.ac-content h3 { font-size: 18px; margin: 22px 0 6px; }
.ac-content p, .ac-content li { color: var(--ink2); }
.ac-content table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 15px; }
.ac-content th, .ac-content td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.ac-content th { color: var(--ink3); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.ac-content td.e { font-size: 22px; width: 44px; }
.ac-content details { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0; background: var(--card); }
.ac-content summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.ac-content details p { margin: 8px 0 0; }
.ac-content .note { font-size: 14px; color: var(--ink3); }
.ac-cta { display: inline-block; margin-top: 6px; padding: 10px 16px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; }
.ac-foot { border-top: 1px solid var(--line); padding: 22px 18px 36px; text-align: center; color: var(--ink3); font-size: 13.5px; }
.ac-foot a { color: var(--ink2); }
.ac-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 8px; }
.noscript { padding: 16px; text-align: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ===================== Flying Chess (layout after the reference screenshot of 2026-11-04) ===================== */
:root { --accent: #2f8ee8; --c0: #e8463c; --c1: #2f8ee8; --c2: #22b35c; --c3: #f6b81f; --navy: #12406f; --navy2: #0d3358; }
.btn { background: linear-gradient(180deg, #4fa6f5, #2f8ee8); box-shadow: 0 4px 0 #1d64aa; }
.btn:active { box-shadow: 0 1px 0 #1d64aa; }
.btn--ghost { background: var(--bg2); color: var(--ink); box-shadow: 0 4px 0 var(--line); }
.choice--online { background: linear-gradient(135deg, #eaf4ff, #d6e9ff); border-color: #9cc5ef; }
@media (prefers-color-scheme: dark) { .choice--online { background: linear-gradient(135deg, #142536, #183049); border-color: #2c5378; } }
.dots i.on { background: var(--accent); }
.share-link { color: var(--accent); }

.fc-game { position: relative; overflow: hidden; color: #fff; background: linear-gradient(180deg, #1683ec 0%, #2c97f2 46%, #63b6f6 78%, #a9d7fb 100%); min-height: 100svh; }
.fc-sky { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; pointer-events: none;
  background:
    radial-gradient(ellipse 22% 26% at 8% 92%, rgba(255,255,255,.95) 60%, transparent 62%),
    radial-gradient(ellipse 20% 22% at 26% 98%, rgba(255,255,255,.9) 60%, transparent 62%),
    radial-gradient(ellipse 26% 24% at 52% 100%, rgba(255,255,255,.92) 60%, transparent 62%),
    radial-gradient(ellipse 24% 26% at 80% 95%, rgba(255,255,255,.9) 60%, transparent 62%),
    radial-gradient(ellipse 18% 16% at 95% 82%, rgba(255,255,255,.85) 60%, transparent 62%),
    radial-gradient(ellipse 14% 10% at 66% 70%, rgba(255,255,255,.55) 60%, transparent 62%),
    radial-gradient(ellipse 12% 8% at 18% 66%, rgba(255,255,255,.5) 60%, transparent 62%); }
.fc-inner { position: relative; width: min(100%, 560px); margin: 0 auto; padding-bottom: 10px; }
.fc-toolbar { display: flex; align-items: center; gap: 8px; height: 60px; padding: 8px 10px 0; }
.tb { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 2px solid rgba(255,255,255,.35); border-radius: 12px; background: linear-gradient(180deg, #2b6fb8, #1b4f8c); color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.18); line-height: 1; }
.tb .ic { font-size: 18px; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.tb small { font-size: 10.5px; font-weight: 800; margin-top: -2px; }
.tb--exit { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8a6a, #e8463c 60%, #b8301f); border-color: #fff; }
.tb--exit svg { width: 24px; height: 24px; }
.tb:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.tb-space { flex: 1; }
.fc-online { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 99px; background: rgba(0,0,0,.18); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.fc-online i { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; animation: live 2s infinite; }
.fc-lang { color: #fff; font-size: 12.5px; font-weight: 700; text-decoration: none; padding: 6px 9px; border-radius: 10px; background: rgba(0,0,0,.18); white-space: nowrap; }
.fc-info { text-align: center; margin: 2px 0 0; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.fc-info h1 { margin: 0; font-size: 18px; letter-spacing: .02em; }
.fc-info p { margin: 0; font-size: 13px; font-weight: 600; opacity: .95; }

.fc-seats { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 10px; min-height: 92px; }
.fc-seats--bottom { align-items: flex-start; }
.seat { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.seat[data-corner="1"], .seat[data-corner="2"] { align-items: flex-end; }
.fc-seats--top .seat { flex-direction: column; }
.fc-seats--bottom .seat { flex-direction: column-reverse; }
.seat .row1 { display: flex; align-items: center; gap: 8px; }
.seat[data-corner="1"] .row1, .seat[data-corner="2"] .row1 { flex-direction: row-reverse; }
.ava { position: relative; width: 66px; height: 66px; border-radius: 12px; border: 3px solid #4fd3ff; background: var(--seat-soft, #ddd); box-shadow: 0 4px 10px rgba(0,0,0,.25); flex: none; }
.ava img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 9px; }
.ava .emo { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 9px; font-size: 34px; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.ava .hm { position: absolute; top: 3px; right: 3px; padding: 1px 5px; border-radius: 99px; background: rgba(0,0,0,.55); font-size: 10.5px; font-weight: 800; }
.ava .nm { position: absolute; left: 50%; bottom: 3px; z-index: 1; transform: translateX(-50%); width: max-content; max-width: 104px; padding: 1px 7px; border-radius: 99px; background: rgba(0,0,0,.62); font-size: 11px; font-weight: 800; line-height: 1.35; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat.is-active .ava { border-color: #ffe14d; box-shadow: 0 0 0 3px rgba(255,225,77,.45), 0 0 18px rgba(255,225,77,.8); }
.seat .ring { position: absolute; inset: -3px; border-radius: 14px; pointer-events: none; }
.kills { display: flex; gap: 6px; font-size: 12.5px; font-weight: 800; text-shadow: 0 1px 1px rgba(0,0,0,.3); }
.kills span { display: inline-flex; align-items: center; gap: 2px; }
.kills svg { width: 16px; height: 16px; background: #fff; border-radius: 50%; padding: 1px; }
/* every seat, mine included, shows a die only on its own turn */
.seat-die { position: relative; isolation: isolate; width: 48px; height: 48px; display: none; --h: 24px; }
.seat.is-active .seat-die { display: block; }
.dice { position: relative; isolation: isolate; width: 54px; height: 54px; border: 0; padding: 0; background: none; cursor: pointer; display: none; --h: 27px; }
.seat.is-me.is-active .dice { display: block; }
.seat.is-me.is-active .seat-die { display: none; }
.arrow { display: none; font-size: 30px; color: #ffd23f; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); animation: point .8s ease-in-out infinite; }
.seat.is-me .dice.is-ready + .arrow { display: block; }
@keyframes point { 50% { transform: translateX(-8px); } }

.fc-band { background: var(--navy); padding: 6px 0; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.fc-boardwrap { width: min(100%, calc(100svh - var(--chrome)), 560px); margin: 0 auto; aspect-ratio: 1; }
:root { --chrome: 312px; }
@media (max-height: 760px) and (orientation: portrait) { :root { --chrome: 270px; } .ava { width: 54px; height: 54px; } .fc-seats { min-height: 78px; } .fc-info p { font-size: 12px; } .tb { width: 40px; height: 40px; } .fc-toolbar { height: 52px; } }
.fc-board { position: absolute; inset: 0; background: var(--navy); overflow: hidden; container-type: inline-size; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#boardsvg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* board units: N = 13 (public/js/engine/board.js), drawn with a .25 margin */
#planes, #ghosts { position: absolute; inset: calc(100% * .25 / 13.5); pointer-events: none; }
.plane, .ghost { position: absolute; left: 0; top: 0; width: calc(100% / 13); height: calc(100% / 13); margin: calc(-100% / 26) 0 0 calc(-100% / 26); transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%)); pointer-events: auto; }
.plane { z-index: 2; display: grid; place-items: center; }
.plane .chip { position: relative; width: 82%; aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .35cqw currentColor, 0 .5cqw 1.2cqw rgba(0, 0, 0, .45); display: grid; place-items: center; transition: transform .18s cubic-bezier(.2,.8,.3,1.4); transform: scale(var(--s, 1)); }
.plane .craft { width: 90%; height: 90%; transform: rotate(var(--a, 0deg)); transition: transform .15s; }
.plane .num { position: absolute; right: -12%; bottom: -12%; width: 2.7cqw; height: 2.7cqw; border-radius: 50%; background: var(--pc); color: #fff; font: 800 1.85cqw/1 Inter, system-ui, sans-serif; display: grid; place-items: center; box-shadow: 0 0 0 .25cqw #fff; }
.plane .num span { color: #fff; }
.plane.seat-0 { color: var(--c0); --pc: var(--c0); } .plane.seat-1 { color: var(--c1); --pc: var(--c1); } .plane.seat-2 { color: var(--c2); --pc: var(--c2); } .plane.seat-3 { color: var(--c3); --pc: var(--c3); }
.plane .star { display: none; width: 82%; height: 82%; }
.plane.is-home .craft { display: none; }
.plane.is-home .star { display: block; filter: drop-shadow(0 .2cqw .3cqw rgba(0,0,0,.25)); }
.plane.is-home .chip { box-shadow: 0 0 0 .35cqw currentColor, 0 0 0 .8cqw #ffd23f, 0 .5cqw 1.2cqw rgba(0, 0, 0, .45); }
/* several planes on one spot: a pile, the top one carries the count */
.plane[data-pile] .num { display: none; }
.plane[data-pile]::after { content: "×" attr(data-pile); position: absolute; z-index: 3; padding: .15cqw .7cqw; border-radius: 99px; background: #fff; color: var(--pc); font: 900 2.2cqw/1.2 Inter, system-ui, sans-serif; box-shadow: 0 0 0 .3cqw var(--pc), 0 .3cqw .6cqw rgba(0,0,0,.3); }
.plane[data-pile-at~="t"]::after { top: -16%; } .plane[data-pile-at~="b"]::after { bottom: -16%; }
.plane[data-pile-at~="l"]::after { left: -10%; } .plane[data-pile-at~="r"]::after { right: -10%; }
.plane.can-move { z-index: 4; cursor: pointer; }
.plane.can-move .chip { animation: lift 1s ease-in-out infinite; box-shadow: 0 0 0 .5cqw #fff, 0 0 0 1cqw #ffe14d, 0 0 3cqw #ffe14d; }
@keyframes lift { 50% { transform: scale(calc(var(--s, 1) * 1.14)) translateY(-6%); } }
.plane.is-moving { z-index: 6; }
.ghost { z-index: 3; display: grid; place-items: center; cursor: pointer; }
.ghost i { width: 86%; aspect-ratio: 1; border-radius: 50%; border: .5cqw dashed #ffe14d; background: rgba(255, 225, 77, .25); animation: ring 1s ease-in-out infinite; }
.ghost b { position: absolute; top: -52%; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: .2cqw .9cqw; border-radius: 99px; background: #ffe14d; color: #3b2a00; font: 900 2.5cqw/1.3 Inter, system-ui, sans-serif; box-shadow: 0 .3cqw .8cqw rgba(0,0,0,.35); }
.ghost.is-capture i { border-color: #ff5a4f; background: rgba(255, 90, 79, .28); }
.ghost.is-capture b { background: #ff5a4f; color: #fff; }

.fc-turn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; display: flex; align-items: center; gap: 2.5cqw; padding: 1.6cqw 5cqw 1.6cqw 2cqw; border-radius: 99px; background: rgba(30, 30, 30, .72); border: .5cqw solid rgba(255,255,255,.55); color: #fff; font-size: 7cqw; font-weight: 900; letter-spacing: .04em; white-space: nowrap; pointer-events: none; animation: turnin .35s cubic-bezier(.2,.8,.3,1.4); }
.fc-turn[hidden] { display: none; }
.fc-turn .mini-die { position: relative; width: 11cqw; height: 11cqw; border-radius: 2.5cqw; background: linear-gradient(145deg, #fff, #e9e3d6); box-shadow: inset 0 -.6cqw 0 rgba(0,0,0,.1); }
.fc-turn .mini-die i { position: absolute; left: 50%; top: 50%; width: 3.2cqw; height: 3.2cqw; margin: -1.6cqw 0 0 -1.6cqw; border-radius: 50%; background: #e8463c; }
@keyframes turnin { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.fc-status { margin: 4px 10px 0; min-height: 20px; text-align: center; font-size: 13.5px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.fc-game .ac-banner { margin: 4px 10px; }

/* die: a 3D cube (six faces + core planes that fill the rounded corners), resting slightly turned */
.cube { position: relative; display: block; width: 100%; height: 100%; perspective: 420px; }
.c3 { position: absolute; inset: 0; transform-style: preserve-3d; }
.c3 .f { position: absolute; inset: 0; border-radius: 18%; background: linear-gradient(145deg, #ffffff, #efe8d8); box-shadow: inset 0 0 0 1px rgba(0,0,0,.05), inset 0 -2px 4px rgba(0,0,0,.06); backface-visibility: hidden; }
.c3 .f1 { transform: translateZ(var(--h)); }
.c3 .f6 { transform: rotateY(180deg) translateZ(var(--h)); }
.c3 .f2 { transform: rotateY(90deg) translateZ(var(--h)); }
.c3 .f5 { transform: rotateY(-90deg) translateZ(var(--h)); }
.c3 .f3 { transform: rotateX(90deg) translateZ(var(--h)); }
.c3 .f4 { transform: rotateX(-90deg) translateZ(var(--h)); }
.c3 .core { position: absolute; inset: 1px; background: #e6dcc6; }
.c3 .cx { transform: rotateY(90deg); } .c3 .cy { transform: rotateX(90deg); }
.c3 .f i { position: absolute; width: 18%; height: 18%; border-radius: 50%; background: #2a2620; transform: translate(-50%, -50%); box-shadow: inset 0 1px 1px rgba(0,0,0,.35); }
.c3 .f1 i { width: 26%; height: 26%; }
.c3 .f1 i, .c3 .f4 i { background: #d1362c; }
.dice::after, .seat-die::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: -12%; height: 16%; border-radius: 50%; background: rgba(0,0,0,.28); filter: blur(3px); z-index: -1; }
.dice::before, .seat-die::before { content: ""; position: absolute; inset: -4px; border-radius: 16px; pointer-events: none; }
.dice.is-ready::before { box-shadow: 0 0 0 4px #ffe14d, 0 0 20px #ffe14d; }
.dice.is-ready .cube { animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-12deg) scale(1.06); } 90% { transform: rotate(10deg) scale(1.06); } }
.dice:has(.cube.is-six)::before, .seat-die:has(.cube.is-six)::before { box-shadow: 0 0 0 4px #ffd23f, 0 0 22px #ffd23f; }

/* the big die thrown into the middle of the board on every roll */
.bigdie { position: absolute; left: 50%; top: 50%; z-index: 9; width: 17cqw; height: 17cqw; --h: 8.5cqw; transform: translate(-50%, -50%); pointer-events: none; }
.bigdie[hidden] { display: none; }
.bigdie .cube { perspective: 120cqw; filter: drop-shadow(0 2.2cqw 1.6cqw rgba(0,0,0,.45)); }
.bigdie .c3 .f { border-radius: 16%; }
.bigdie.is-six .c3 .f { box-shadow: inset 0 0 0 .8cqw #ffd23f, 0 0 3cqw #ffd23f; }

/* lobby: seats filling one by one, room code */
.lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 12px; }
.slot { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px; border-radius: 14px; background: var(--bg2); border: 2px dashed var(--line); min-height: 56px; }
.slot.is-filled { border-style: solid; border-color: var(--seat); background: color-mix(in srgb, var(--seat) 12%, var(--card)); animation: rise .35s cubic-bezier(.2,.8,.3,1.4); }
.slot .sa { width: 36px; height: 36px; border-radius: 10px; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--line); font-size: 20px; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.slot .sa img { width: 100%; height: 100%; object-fit: cover; }
.slot b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.slot small { display: block; font-size: 11px; color: var(--ink3); }
.slot.is-empty .sa { animation: pulse 1.2s infinite; }
.code { font: 900 40px/1 ui-monospace, Menlo, monospace; letter-spacing: .18em; color: var(--ink); margin: 4px 0 2px; }
.code-in { display: flex; gap: 8px; margin: 10px 0 4px; }
.code-in input { flex: 1; min-width: 0; height: 46px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: 800 22px/1 ui-monospace, Menlo, monospace; letter-spacing: .3em; text-align: center; }
.code-in .btn { flex: none; min-width: 92px; }
.choice .code-in { width: 100%; }
.btn--wide { width: 100%; }
.panel--lobby .muted { margin: 4px 0; }
.friends { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.friends .btn { min-height: 42px; font-size: 14px; }

@media (orientation: landscape) and (max-height: 560px) {
  .fc-inner { width: auto; display: grid; grid-template-columns: calc(100svh - 70px) 300px; grid-template-rows: auto auto auto 1fr auto; gap: 0 12px; justify-content: center; }
  .fc-toolbar { grid-column: 1 / -1; height: 50px; }
  .fc-info { grid-column: 2; grid-row: 2; }
  .fc-band { grid-column: 1; grid-row: 2 / span 4; padding: 0; background: none; }
  .fc-boardwrap { width: calc(100svh - 70px); }
  .fc-seats--top { grid-column: 2; grid-row: 3; }
  .fc-seats--bottom { grid-column: 2; grid-row: 4; }
  .fc-status { grid-column: 2; grid-row: 5; }
  .ava { width: 48px; height: 48px; }
  .fc-seats { min-height: 70px; }
}

.code-in input:placeholder-shown { letter-spacing: normal; font: 600 15px/1 Inter, system-ui, sans-serif; }
.panel--friends .or { margin: 14px 0 0; }
.panel--friends .btn--wide { margin-top: 6px; }
