/* igra.css — «Играть вдвоём» (igra.html, igra.js): доска на одном телефоне и
   шахматные часы. Страница на весь экран телефона, без шапки сайта. */
.igra-page {
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
.igra-page main { flex: 1; display: flex; flex-direction: column; }

.ig-head {
  display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3);
  max-width: 560px; width: 100%; margin: 0 auto;
}
.ig-back {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill);
  color: var(--ink); flex: none;
}
.ig-back:hover { background: var(--surface-2); }
.ig-modes {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border-radius: var(--r-pill); background: var(--surface-2);
}
.ig-mode {
  min-height: 40px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted);
  font: 600 1rem var(--font); cursor: pointer;
}
.ig-mode { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ig-mode-i { flex: none; }
.ig-mode-i .ig-fill { fill: currentColor; stroke: none; opacity: .35; }
.ig-mode[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.ig-mode:focus-visible, .ig-act:focus-visible, .ig-c-btn:focus-visible, .ig-tc-pick:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ig-net {
  flex: none; padding: 4px 10px; border-radius: var(--r-pill); background: var(--warn-soft); color: var(--warn);
  font-size: .8125rem; font-weight: 600;
}

/* ---------------------------------------------------------------- доска */

.ig-doska { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 var(--s3) var(--s4); }
.ig-doska[hidden], .ig-chasy[hidden] { display: none; }
.ig-side {
  display: flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 4px 2px;
}
.ig-who { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.ig-who::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink);
}
.ig-side-top .ig-who::before, .ig-side-bottom .ig-who::before { background: transparent; }
.ig-turn .ig-who { color: var(--ok); }
.ig-turn .ig-who::before { border-color: var(--ok); background: var(--ok); }
.ig-taken { flex: 1; display: flex; flex-wrap: wrap; align-items: center; min-width: 0; }
.ig-tk { width: 18px; height: 18px; margin-right: -5px; }
.ig-adv { margin-left: 10px; font-size: .875rem; font-weight: 600; color: var(--muted); }
.ig-clock {
  flex: none; min-width: 84px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-2);
  font: 700 1.25rem var(--font-num); text-align: right; font-variant-numeric: tabular-nums;
}
.ig-clock[hidden] { display: none; }
.ig-clock.ig-run { background: var(--ink); color: #fff; }
.ig-clock.ig-low.ig-run { background: var(--danger); }
.ig-clock.ig-flag { background: var(--danger-soft); color: var(--danger); }

.ig-board-wrap { position: relative; }
.ig-board {
  display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; width: 100%;
  border-radius: 6px; overflow: hidden; touch-action: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none; box-shadow: var(--shadow-md);
}
.ig-sq {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; margin: 0;
  border: 0; border-radius: 0; min-height: 0; cursor: pointer;
}
.ig-light { background: var(--sq-light, #f0d9b5); }
.ig-dark { background: var(--sq-dark, #b58863); }
.ig-last.ig-light { background: var(--sq-last-light, #cdd26a); }
.ig-last.ig-dark { background: var(--sq-last-dark, #aaa23a); }
.ig-sel { box-shadow: inset 0 0 0 4px rgba(20, 85, 30, .6); }
.ig-check { background: radial-gradient(circle, #ff3b30 0%, rgba(255, 59, 48, .6) 35%, transparent 75%) !important; }
.ig-dot::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 28%; height: 28%;
  transform: translate(-50%, -50%); border-radius: 50%; background: rgba(20, 85, 30, .45);
}
.ig-take::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 5px rgba(20, 85, 30, .45); border-radius: 50%; }
.ig-sq:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.ig-pc { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ig-pc.ig-lifted { opacity: .3; }
.ig-ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; will-change: transform; }
.ig-coord { position: absolute; font-size: .625rem; font-weight: 700; line-height: 1; pointer-events: none; }
.ig-rank { left: 2px; top: 2px; }
.ig-file { right: 2px; bottom: 2px; }
.ig-light .ig-coord { color: var(--sq-coord-light, #b58863); }
.ig-dark .ig-coord { color: var(--sq-coord-dark, #f0d9b5); }

.ig-promo {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  align-content: center; gap: var(--s2); background: rgba(20, 21, 26, .55); border-radius: 6px;
}
.ig-promo[hidden] { display: none; }
.ig-promo-btn {
  width: 22%; aspect-ratio: 1; padding: 6%; border: 0; border-radius: 50%; background: var(--surface); cursor: pointer;
}
.ig-promo-btn img { width: 100%; height: 100%; display: block; }
.ig-promo-no { flex-basis: 100%; max-width: 160px; min-height: 44px; border: 0; border-radius: var(--r-pill); background: var(--surface); font: 600 1rem var(--font); }

.ig-status { margin: var(--s2) 0; min-height: 1.5em; font-weight: 600; text-align: center; }
.ig-status.ig-end {
  padding: var(--s3); border-radius: var(--r-md); background: var(--ok-soft); color: var(--ok); font-size: 1.125rem;
}
.ig-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.ig-act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: 600 .875rem var(--font); cursor: pointer;
}
.ig-act:disabled { opacity: .4; cursor: default; }
.ig-act:not(:disabled):active { background: var(--surface-2); }

.ig-opts { margin-top: var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.ig-opts summary { min-height: 36px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.ig-check { display: flex; gap: var(--s2); align-items: center; min-height: 44px; }
.ig-check input { width: 22px; height: 22px; }
.ig-field { display: grid; gap: 4px; margin-top: var(--s2); font-weight: 600; }
.ig-field select { min-height: 44px; padding: 0 var(--s2); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font: 1rem var(--font); }
.ig-hint { margin: 4px 0 0; color: var(--muted); font-size: .875rem; }

.ig-moves {
  display: flex; gap: var(--s3); margin: var(--s3) 0 0; padding: var(--s2) var(--s3); overflow-x: auto;
  list-style: none; counter-reset: mv; border-radius: var(--r-md); background: var(--surface-2);
  font: .9375rem var(--font-num); white-space: nowrap; scrollbar-width: thin;
}
.ig-moves[hidden] { display: none; }
.ig-moves li { counter-increment: mv; display: flex; gap: 6px; }
.ig-moves li::before { content: counter(mv) "."; color: var(--muted); }

/* ---------------------------------------------------------------- часы */

.ig-clock-mode .ig-head { padding-bottom: 4px; }
.ig-chasy {
  flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 0 6px 6px; position: relative;
  min-height: calc(100dvh - 60px); max-width: 720px; width: 100%; margin: 0 auto;
}
.ig-half {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  border: 0; border-radius: var(--r-lg); background: var(--surface-2); color: var(--ink);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer;
  transition: background-color .15s;
}
.ig-half-top { transform: rotate(180deg); }
.ig-time {
  font: 700 clamp(4rem, 22vw, 9rem)/1 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.ig-moves-n { min-height: 1.25em; font-size: 1rem; color: var(--muted); }
.ig-half.ig-run { background: #1f7a3f; color: #fff; }
.ig-half.ig-run .ig-moves-n { color: rgba(255, 255, 255, .8); }
.ig-half.ig-run.ig-low { background: var(--danger); }
.ig-half.ig-wait { opacity: .7; }
.ig-half.ig-flag { background: var(--danger); color: #fff; opacity: 1; }
.ig-half.ig-flag .ig-moves-n { color: #fff; }
.ig-half:focus-visible { outline: 3px solid var(--focus); outline-offset: -6px; }

.ig-c-bar { display: flex; justify-content: center; gap: var(--s3); padding: 2px 0; }
.ig-c-btn {
  min-width: 56px; height: 56px; padding: 0 var(--s3); display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink);
  font: 700 1.0625rem var(--font-num); cursor: pointer;
}
.ig-c-btn:disabled { opacity: .4; cursor: default; }
.ig-c-btn.ig-paused { background: var(--ink); color: #fff; }
.ig-c-btn .ig-i-play, .ig-c-btn.ig-paused .ig-i-pause { display: none; }
.ig-c-btn.ig-paused .ig-i-play { display: block; }
.ig-c-btn.ig-mute .ig-wave { display: none; }
.ig-c-tip { margin: 0; padding: 0 var(--s3); color: var(--muted); font-size: .875rem; text-align: center; }
.ig-c-tip[hidden] { display: block; visibility: hidden; } /* место держим: половины не прыгают */

.ig-dialog {
  width: min(100vw - 24px, 420px); padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.ig-dialog::backdrop { background: rgba(20, 21, 26, .55); }
.ig-tc-form { display: grid; gap: var(--s3); padding: var(--s4); }
.ig-tc-form h2 { margin: 0; font-size: 1.125rem; }
.ig-tc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.ig-tc-pick {
  min-height: 52px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
  color: var(--ink); font: 700 1.125rem var(--font-num); cursor: pointer;
}
.ig-tc-pick[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.ig-tc-own { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s2); margin: 0; padding: var(--s2) var(--s3) var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); }
.ig-tc-own legend { padding: 0 4px; font-weight: 600; }
.ig-tc-own label { display: grid; gap: 4px; font-size: .875rem; color: var(--muted); }
.ig-tc-own input { width: 96px; min-height: 44px; padding: 0 var(--s2); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font: 1rem var(--font); }

@media (prefers-reduced-motion: reduce) {
  .ig-half { transition: none; }
}
