/* Токены платформы (--bg, --surface, --ink, --accent и др.) приходят из shared/theme.css; общий вид стартового экрана — из shared/start.css.
   Здесь доска шашек: деревянные клетки, шашки и дамки, выбор и подсветка хода, окна и экраны онлайна (как у «Морского боя»). */
:root {
  --light: oklch(0.9 0.04 80); --darksq: oklch(0.56 0.07 55); --frame: oklch(0.4 0.06 50);
  --wp: oklch(0.97 0.01 90); --wpEdge: oklch(0.78 0.03 80); --bp: oklch(0.3 0.03 30); --bpEdge: oklch(0.18 0.02 30);
  --sel: oklch(0.8 0.16 140); --dest: oklch(0.85 0.15 140 / .85); --lastsq: oklch(0.72 0.1 85); --crown: oklch(0.78 0.16 85);
  --scrim: oklch(0.2 0.02 260 / .45); --focus: oklch(0.55 0.18 260); --danger: oklch(0.55 0.2 27);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --light: oklch(0.72 0.04 75); --darksq: oklch(0.42 0.06 50); --frame: oklch(0.3 0.04 45); --focus: oklch(0.78 0.14 260); }
}
:root[data-theme="dark"] { --light: oklch(0.72 0.04 75); --darksq: oklch(0.42 0.06 50); --frame: oklch(0.3 0.04 45); --focus: oklch(0.78 0.14 260); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
button { font-family: inherit; transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .15s ease, opacity .2s ease; }
button:not(:disabled):active { transform: scale(.97); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.noscript { margin: 0; padding: 12px 16px; background: var(--accent-soft); color: var(--ink); text-align: center; }
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.page { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 24px; width: 100%; max-width: 560px; margin: 0 auto; }
.muted { color: var(--muted); }

/* Кнопки */
.btn { min-height: 46px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-align: center; line-height: 1.15; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { background: var(--line); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.btn.full { width: 100%; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; }

/* Окна */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 30; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { margin: 0; font-size: 20px; }
.modal p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.4; }
.modal ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.4; }
.modal.over { text-align: center; }
.modal.over.win h2 { color: var(--accent); }
.modal.over.lose h2 { color: var(--ink-r); }


/* Онлайн: вход, список столов, комната ожидания (вид как у «Ятзи») */
@keyframes pop-in { from { transform: scale(.82); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.name-input { padding: 8px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-size: 17px; min-height: 48px; font-family: inherit; }
.mode-btn.o-mode { width: 100%; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; min-width: 0; }
.name-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.o-page { display: flex; flex-direction: column; gap: 14px; max-width: 560px; width: 100%; margin: 0 auto; }
.o-box { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.o-box h3 { margin: 0; font-size: 16px; }
.o-center { text-align: center; align-items: center; }
.o-p { margin: 0; font-size: 16px; }
.o-err { color: var(--danger, #c0392b); font-weight: 700; font-size: 14px; margin: 0; }
.o-hint { font-size: 14px; color: var(--muted); text-align: center; }
.o-dashed { border: 2px dashed var(--line); border-radius: 20px; padding: 16px; text-align: center; color: var(--muted); font-size: 15px; }
.o-msg { border-radius: 20px; padding: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.o-msg.bad { border: 1.5px solid var(--danger, #c0392b); }
.o-msg span { color: var(--muted); font-size: 14px; }
.o-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.o-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.o-row .who small { color: var(--muted); font-size: 14px; }
.o-row.skel .av, .o-row.skel .ln { background: var(--line); display: block; }
.o-row.skel .ln { height: 12px; width: 50%; border-radius: 6px; flex: 1; max-width: 50%; }
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--accent-soft); color: var(--ink); }
.o-you { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px 0 6px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 700; white-space: nowrap; }
.o-you .av { width: 32px; height: 32px; }
.o-code-row { display: flex; gap: 8px; }
.o-code { flex: 1; min-width: 0; text-align: center; font-size: 24px; letter-spacing: .3em; text-transform: uppercase; }
.o-mode b { display: block; }
.o-mode small { display: block; margin-top: 2px; color: var(--muted); font-weight: 400; font-size: 14px; }
.o-bigcode { font-size: 46px; font-weight: 700; letter-spacing: 10px; padding-left: 10px; }
.o-mode-tag { font-size: 14px; color: var(--muted); }
.o-seats { display: flex; flex-direction: column; gap: 8px; }
.o-seat { display: flex; align-items: center; gap: 12px; padding: 8px 14px; min-height: 56px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.o-seat.empty { background: transparent; border: 2px dashed var(--line); color: var(--muted); animation: none; }
.o-seat .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-seat .tg { font-size: 14px; color: var(--muted); }
.o-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; font-size: 15px; font-weight: 700; background: var(--accent-soft); border: 1.5px solid var(--accent); }
.o-banner.bad { border-color: var(--danger, #c0392b); }
.o-banner span { flex: 1; min-width: 0; }
.o-ask { display: flex; align-items: baseline; gap: 10px; }
.o-ask b { font-size: 56px; line-height: 1; }
.o-ask span { color: var(--muted); }
.modal .reward { color: var(--ink); font-weight: 700; font-size: 16px; }

.modal .reward { color: var(--ink); font-weight: 700; font-size: 16px; }
.modal .reward.lost { color: var(--danger); }
.modal.over.draw h2 { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Логотип на стартовом экране: две шашки на клетках */
.logo-ck { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(2, 34px); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 0 var(--line); }
.logo-ck i { display: flex; align-items: center; justify-content: center; background: var(--light); }
.logo-ck i.d { background: var(--darksq); }
.logo-ck .pc { width: 26px; height: 26px; }

/* Экран партии */
.game { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 20px; width: 100%; max-width: 560px; margin: 0 auto; }
.o-head .theme-btn { flex: none; }
.player { display: flex; align-items: center; gap: 10px; padding: 6px 12px; min-height: 48px; border-radius: 14px; background: var(--surface); border: 2px solid var(--line); }
.player.turn { border-color: var(--accent); background: var(--accent-soft); }
.player .disc { width: 26px; height: 26px; flex: none; }
.player .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .cnt { font-size: 14px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.player .tag { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.note { min-height: 20px; font-size: 14px; color: var(--muted); text-align: center; line-height: 1.4; }
.note.must { color: var(--danger); font-weight: 700; }

.board {
  position: relative; width: min(100%, 520px); aspect-ratio: 1; margin: 0 auto; padding: clamp(6px, 1.8vw, 10px); border-radius: 12px; background: var(--frame);
  box-shadow: 0 2px 0 oklch(0.3 0.04 45), 0 10px 24px -10px oklch(0.2 0.03 40 / .5);
}
.grid { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 4px; overflow: hidden; touch-action: manipulation; }
.sq { position: relative; border: none; padding: 0; margin: 0; background: var(--light); display: flex; align-items: center; justify-content: center; }
.sq.d { background: var(--darksq); cursor: pointer; }
.sq.last::before { content: ''; position: absolute; inset: 0; background: var(--lastsq); opacity: .5; }
.sq.sel::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 4px var(--sel); }
.sq.can .pc { cursor: pointer; }
.sq.dest::after { content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: var(--dest); box-shadow: 0 0 0 3px oklch(0.4 0.1 140 / .4); }
.sq.must .pc { animation: must 1.2s ease-in-out infinite; }
@keyframes must { 50% { filter: drop-shadow(0 0 6px var(--sel)); } }
.sq .lbl { position: absolute; left: 3px; bottom: 1px; font-size: 10px; color: oklch(0.95 0.02 80 / .7); pointer-events: none; }
.pc { position: relative; width: 80%; height: 80%; z-index: 1; pointer-events: none; }
.pc.gone { animation: gone .3s ease .25s forwards; }
@keyframes gone { to { opacity: 0; transform: scale(.4); } }
.pc .body.w { fill: var(--wp); stroke: var(--wpEdge); }
.pc .body.b { fill: var(--bp); stroke: var(--bpEdge); }
.pc .ring.w { fill: none; stroke: var(--wpEdge); }
.pc .ring.b { fill: none; stroke: oklch(0.45 0.03 30); }
.pc .crown { fill: var(--crown); stroke: oklch(0.5 0.12 70); stroke-width: 2; }
.actions { display: flex; gap: 10px; }
.actions .btn { flex: 1; }
.scrim { z-index: 30; }
@media (max-width: 360px) { .player .tag { display: none; } .player { gap: 8px; padding: 6px 10px; } }
.pc.taken { opacity: .35; }
/* Уровень и цвет — в одну строку: короткие варианты */
.modes.seg { flex-direction: row; }
.modes.seg .mode-btn { flex: 1 1 0; min-width: 0; text-align: center; padding-left: 6px; padding-right: 6px; }
.modes.duo { flex-direction: row; }
.modes.duo .mode-btn { flex: 1 1 0; min-width: 0; }
