/* Мини-игра «Пустой угол»: карточка игры помещается в экран телефона без прокрутки.
   Цвета корта заданы переменными — их читает и скрипт, который рисует игру. */

.game-page { padding: 14px var(--gutter) 40px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; max-width: 1080px; margin: 0 auto; }

.game {
  --g-floor: #0a2219; --g-apron: #10382b; --g-court: #1d7052; --g-alley: #175c45; --g-post: #d5dbd6; --g-zone: rgba(255, 255, 255, .1);
  --g-line: #f6efe2; --g-net: #f6efe2; --g-me: #ff6b24; --g-skin: #f3d9bd; --g-ink: #fff7e8;
  --g-good: #8fe39a; --g-warn: #ffd166; --g-bad: #ff8a7a; --g-hot: #ff4530; --g-shuttle: #ffffff; --g-legs: #0f1d17;
  --g-panel: rgba(7, 28, 21, .94); --g-chip: rgba(255, 247, 232, .09); --g-edge: rgba(255, 247, 232, .16);
  --g-accent: #ff6b24; --g-accent-ink: #1a0f08; --g-muted: #b7cbbf;
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  height: calc(100vh - var(--header-h) - var(--tabbar-h) - 28px);
  height: calc(100dvh - var(--header-h) - var(--safe-top) - var(--tabbar-h) - var(--safe-bottom) - 28px);
  min-height: 430px; max-height: 860px;
  border-radius: 26px; background: var(--g-floor); color: var(--g-ink);
  box-shadow: 0 26px 60px -32px rgba(0, 0, 0, .7);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .game {
  --g-floor: #050506; --g-apron: #0c0d10; --g-court: #1e2026; --g-alley: #15171b; --g-post: #a4aab2; --g-zone: rgba(255, 255, 255, .07);
  --g-line: #dfe3e8; --g-net: #dfe3e8; --g-me: #ff6b1a; --g-ink: #f2f4f6; --g-legs: #868c95;
  --g-panel: rgba(6, 6, 8, .94); --g-chip: rgba(255, 255, 255, .07); --g-edge: rgba(255, 255, 255, .16);
  --g-accent: #ff6b1a; --g-muted: #a9aeb6;
  border: 1px solid rgba(255, 255, 255, .1);
}

/* ---------- счёт и кнопки ---------- */
.game-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 16px; background: rgba(0, 0, 0, .28); }
.game-score { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-family: var(--font-display); font-weight: 800; }
.game-side { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.game-side b { font-size: 1.7rem; line-height: 1; min-width: .7em; text-align: center; }
.game-side:first-child b { color: var(--g-accent); }
.game-side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-body); font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--g-muted); }
.game-colon { font-size: 1.3rem; opacity: .6; }
.game.is-drill .game-colon { font-family: var(--font-body); font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.game-tools { display: flex; gap: 6px; flex: none; }
.game-tool { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--g-edge); border-radius: 50%; background: var(--g-chip); color: var(--g-ink); cursor: pointer; }
.game-tool .icon { width: 21px; height: 21px; }
.game-tool:hover, .game-tool:focus-visible { border-color: var(--g-accent); }
.game-tool.is-off { opacity: .5; }
.game-tool[data-act="full"][aria-pressed="true"] { background: var(--g-accent); border-color: var(--g-accent); color: var(--g-accent-ink); }
.game:not(.is-playing) .game-tool[data-act="menu"] { display: none; }

/* ---------- корт ---------- */
.game-stage { position: relative; flex: 1; min-height: 0; }
.game.is-playing .game-stage { touch-action: none; cursor: crosshair; }
.game-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.game-banner, .game-tip { position: absolute; margin: 0; pointer-events: none; text-align: center; }
.game-banner { left: 50%; top: 40%; transform: translate(-50%, -50%); padding: .5em 1.1em; border-radius: 999px; background: rgba(0, 0, 0, .66); color: var(--g-good); font-size: clamp(1.1rem, 5.4vw, 1.6rem); font-weight: 800; white-space: nowrap; animation: game-pop .28s ease-out; }
.game-banner.is-lost { color: var(--g-bad); }
.game-tip { left: 12px; right: 12px; bottom: calc(10px + var(--game-safe-bottom, 0px)); padding: 9px 14px; border-radius: 14px; background: rgba(0, 0, 0, .55); font-size: .9rem; line-height: 1.35; }
.game-banner[hidden], .game-tip[hidden], .game-panel[hidden] { display: none; }
@keyframes game-pop { from { opacity: 0; transform: translate(-50%, -40%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ---------- выбор соперника и итог партии ---------- */
.game-panel { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-start; justify-content: safe center; overflow-y: auto; padding: 18px 16px calc(18px + var(--game-safe-bottom, 0px)); background: var(--g-panel); }
.game-kicker { margin: 0 0 4px; font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--g-accent); }
.game-title { margin: 0; font-family: var(--font-display); font-size: clamp(1.9rem, 8vw, 2.6rem); line-height: 1.05; color: var(--g-ink); }
.game-lead { margin: 8px 0 0; font-size: .95rem; line-height: 1.45; color: var(--g-muted); }
.game-opponents { display: grid; gap: 8px; margin-top: 16px; }
.game-opponent { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 3px; min-height: 58px; padding: 9px 12px; border: 1px solid var(--g-edge); border-radius: 18px; background: var(--g-chip); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.game-opponent:hover, .game-opponent:focus-visible { border-color: var(--g-accent); }
.game-opponent:active { transform: scale(.985); }
.game-opponent-dot { grid-row: 1 / span 2; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--shirt, var(--g-line)); color: #14181c; font-weight: 800; }
.game-opponent-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; }
.game-opponent-body strong { font-size: 1.02rem; }
.game-opponent-body em { font-style: normal; font-size: .8rem; color: var(--g-muted); }
.game-opponent-hint { grid-column: 2 / span 2; font-size: .76rem; line-height: 1.3; color: var(--g-muted); opacity: .85; }
.game-opponent-medal { padding: 5px 11px; border-radius: 999px; background: var(--g-accent); color: var(--g-accent-ink); font-size: .78rem; font-weight: 800; white-space: nowrap; }
.game-opponent-medal.is-won { background: var(--g-good); color: #0d2a14; }

.game-result { align-items: center; text-align: center; }
.game-result-kicker { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--g-accent); }
.game-result-score { margin: 2px 0 6px; font-family: var(--font-display); font-size: clamp(3.2rem, 17vw, 4.8rem); font-weight: 800; line-height: 1; }
.game-result-score.is-word { font-size: clamp(2.3rem, 12vw, 3.4rem); }
.game-result-stats { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: .88rem; color: var(--g-muted); }
.game-result-tip { max-width: 34ch; margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--g-chip); font-size: .92rem; line-height: 1.4; }
.game-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.game-btn { min-height: 46px; padding: 10px 22px; border: 1px solid var(--g-accent); border-radius: 999px; background: var(--g-accent); color: var(--g-accent-ink); font: inherit; font-weight: 700; cursor: pointer; transition: transform .15s, filter .15s; }
.game-btn:hover, .game-btn:focus-visible { filter: brightness(1.08); }
.game-btn:active { transform: scale(.97); }
.game-btn-quiet { border-color: var(--g-edge); background: var(--g-chip); color: var(--g-ink); }
.game-result-real { margin-top: 16px; font-size: .86rem; color: var(--g-muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- полный экран ---------- */
.game.is-full, .game:fullscreen { position: fixed; inset: 0; z-index: 200; width: 100%; height: 100%; min-height: 0; max-height: none; border: 0; border-radius: 0;
  --game-safe-bottom: env(safe-area-inset-bottom, 0px); }
.game.is-full .game-hud, .game:fullscreen .game-hud { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
html.game-full { overflow: hidden; }

/* ---------- правила рядом с игрой ---------- */
.game-about h2 { margin: 0 0 14px; font-size: clamp(1.4rem, 3vw, 1.9rem); }
.game-rules { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: rule; }
.game-rules li { position: relative; padding-left: 44px; line-height: 1.5; counter-increment: rule; }
.game-rules li::before { content: counter(rule); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--orange-100-bg); color: var(--orange-600-ink); font-weight: 800; font-size: .9rem; }
.game-about .note { margin-top: 18px; }
.game-about .text-link { display: inline-flex; margin-top: 18px; }

@media (max-height: 740px) { .game-opponent-hint { display: none; } .game-opponent { min-height: 54px; } }
@media (max-width: 960px) {
  .game-page { padding: 8px 8px 28px; }
  .game { height: calc(100vh - var(--header-h) - var(--tabbar-h) - 16px); height: calc(100dvh - var(--header-h) - var(--safe-top) - var(--tabbar-h) - var(--safe-bottom) - 16px); border-radius: 22px; }
  .game-about { padding: 0 12px; }
  .game-lead { display: none; } /* на телефоне место нужнее списку: суть игры — в правилах под ней */
  /* …и подписи разработчика: на небольшом телефоне меню помещается в экран целиком, без прокрутки */
  .game-kicker { display: none; }
  .game-panel { padding-top: 14px; padding-bottom: calc(12px + var(--game-safe-bottom, 0px)); }
  .game-opponents { gap: 6px; }
  .game-opponent { padding-block: 8px; }
  .game-first { padding-block: 8px; }
  .game-credit { margin-top: 8px; }
}
@media (min-width: 961px) {
  .game-layout { grid-template-columns: minmax(0, 470px) minmax(0, 1fr); align-items: start; gap: 48px; }
  .game-page { padding-top: 24px; }
  .game { height: min(calc(100dvh - var(--header-h) - 48px), 820px); }
  .game-about { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { .game-banner { animation: none; } }



/* на широком экране (полный экран на компьютере, телефон боком) список не растягивается во всю ширину */
.game-panel > * { width: 100%; max-width: 540px; margin-left: auto; margin-right: auto; }

/* ---------- слова тренера: задание и оценка удара (тренировка и обучение) ---------- */
.game-say { display: flex; align-items: flex-start; gap: 10px; flex: none; min-height: calc(3 * 1.35em + 16px); padding: 8px 10px 8px 16px; border-top: 1px solid var(--g-edge); background: rgba(0, 0, 0, .42); font-size: .9rem; line-height: 1.35; }
.game-say[hidden] { display: none; }
.game.is-intro .game-say { min-height: calc(5 * 1.35em + 16px); }
.game-say-text { flex: 1; min-width: 0; margin: 0; }
.game-say-who { display: block; font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--g-accent); }
.game-say b.is-ok { color: var(--g-good); }
.game-say b.is-bad { color: var(--g-bad); }
.game-skip { flex: none; min-height: 34px; padding: 6px 12px; border: 1px solid var(--g-edge); border-radius: 999px; background: transparent; color: var(--g-muted); font: inherit; font-size: .8rem; cursor: pointer; }
.game-skip:hover, .game-skip:focus-visible { border-color: var(--g-accent); color: var(--g-ink); }
.game-skip[hidden] { display: none; }

/* ---------- меню: партия или тренировка ---------- */
.game-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 14px; padding: 4px; border: 1px solid var(--g-edge); border-radius: 999px; background: var(--g-chip); }
.game-tab { min-height: 38px; padding: 6px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--g-muted); font: inherit; font-weight: 700; cursor: pointer; transition: background-color .15s, color .15s; }
.game-tab:hover, .game-tab:focus-visible { color: var(--g-ink); }
.game-tab.is-on { background: var(--g-accent); color: var(--g-accent-ink); }
.game-tabs + .game-opponents, .game-first + .game-opponents { margin-top: 10px; }
.game-first { margin-top: 10px; padding: 10px 14px; border: 1px dashed var(--g-accent); border-radius: 14px; background: transparent; color: var(--g-ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.game-first b { color: var(--g-accent); }
.game-first[hidden] { display: none; }
.game-panel.is-drills .game-lead { display: none; }
.game-panel.is-drills .game-opponents { gap: 6px; }
.game-panel.is-drills .game-opponent { min-height: 52px; padding: 7px 12px; }
.game-panel.is-drills .game-credit { margin-top: 8px; }

/* подпись разработчика: знак abso.games, намеренно неяркий */
.game-credit { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 4px 6px; color: var(--g-muted); font-size: .62rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; opacity: .5; transition: opacity .15s; }
.game-credit:hover, .game-credit:focus-visible { opacity: 1; }
.game-panel > .game-credit { width: auto; }
.abso-mark { display: block; flex: none; width: auto; height: 14px; color: var(--g-ink); }
.abso-mark-pin { fill: #66baff; }
.abso-mark-die { fill: #0b0c0f; }
