/* Морской бой — дизайн-система из макета Claude Design.
   Чернила #16305C на бумаге #FBF8F1, акцент — сурик #C8412A. */

:root {
  --ink: #16305C;
  --paper: #FBF8F1;
  --canvas: #EFE9DE;
  --accent: #C8412A;
  --gold: #B8871B;
  --gold-deep: #8A6512;
  --gold-soft: #E9C46A;
  --green: #7FC3A5;

  --ink-04: rgba(22, 48, 92, .045);
  --ink-06: rgba(22, 48, 92, .06);
  --ink-09: rgba(22, 48, 92, .09);
  --ink-10: rgba(22, 48, 92, .10);
  --ink-13: rgba(22, 48, 92, .13);
  --ink-18: rgba(22, 48, 92, .18);
  --ink-38: rgba(22, 48, 92, .38);
  --ink-45: rgba(22, 48, 92, .45);
  --ink-55: rgba(22, 48, 92, .55);
  --ink-72: rgba(22, 48, 92, .72);

  --sans: Manrope, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* DM Mono — латиница и цифры, IBM Plex Mono подхватывает кириллицу поглифно */
  --mono: 'DM Mono', 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --pad: 20px;
  --safe-top: max(env(safe-area-inset-top), 8px);
  --safe-bot: max(env(safe-area-inset-bottom), 12px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Наши display:flex/grid перебивают UA-правило для [hidden] — возвращаем приоритет. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#app {
  position: relative;
  height: 100dvh;
  height: var(--tg-viewport-stable-height, 100dvh);
  overflow: hidden;
}

/* ── каркас экрана ─────────────────────────────────────────────────────── */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  padding-top: var(--safe-top);
  animation: fade .22s ease both;
}
.screen[hidden] { display: none; }
.screen--ink { background: var(--ink); color: var(--paper); }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.pad { padding: 0 var(--pad); margin-top: 18px; }
.pad:first-child { margin-top: 0; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mt6 { margin-top: 6px; } .mt12 { margin-top: 12px; }
.mt20 { margin-top: 20px; } .mt32 { margin-top: 32px; }
.mb12 { margin-bottom: 12px; }
.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--pad) 4px;
  gap: 10px;
}
.nav-btn {
  width: 34px; height: 34px;
  border: 0; border-radius: 11px;
  background: var(--ink-06); color: var(--ink);
  font: 600 20px/1 var(--sans);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.nav-btn--ghost { background: none; pointer-events: none; }
.nav-btn--wide { width: auto; padding: 0 14px; font-size: 16px; }
.nav-title {
  font: 500 11px/1 var(--mono);
  letter-spacing: .16em;
  color: var(--ink-55);
}

.foot {
  padding: 12px var(--pad) calc(var(--safe-bot) + 8px);
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(to top, var(--paper) 70%, rgba(251, 248, 241, 0));
}
.foot-note { font: 500 12px/1 var(--mono); color: var(--ink-45); text-align: center; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* ── типографика ───────────────────────────────────────────────────────── */

.eyebrow {
  font: 500 10px/1 var(--mono);
  letter-spacing: .16em;
  color: var(--ink-45);
  text-transform: uppercase;
}
.eyebrow--light { color: rgba(251, 248, 241, .55); }
.eyebrow.xs { font-size: 9px; letter-spacing: .14em; }

.h2 { font: 800 24px/1.08 var(--sans); letter-spacing: -.015em; margin: 0; }
.sub { font: 500 13px/1.45 var(--sans); color: var(--ink-55); margin: 8px 0 0; text-wrap: pretty; }
.hint { font: 500 11px/1.4 var(--sans); color: var(--ink-45); margin: 10px 0 0; }
.mono { font-family: var(--mono); font-weight: 500; }
.muted { color: var(--ink-55); }
.sm { font-size: 11px; } .xs { font-size: 10px; }
.accent { color: var(--accent); }
.gold { color: var(--gold); }

/* ── кнопки ────────────────────────────────────────────────────────────── */

.btn {
  border: 0; border-radius: 16px;
  min-height: 48px;
  padding: 0 18px;
  font: 700 15px/1 var(--sans);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
  background: none; color: inherit;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: 1; cursor: default; }

.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:disabled { background: var(--ink-10); color: var(--ink-45); }
.btn--paper { background: var(--paper); color: var(--ink); }
.btn--outline { box-shadow: inset 0 0 0 1.5px var(--ink-18); color: var(--ink-72); font-weight: 600; }
.btn--lg { min-height: 56px; border-radius: 18px; font-size: 17px; }
.btn--xl { min-height: 60px; border-radius: 20px; font-size: 20px; font-weight: 800; }
.btn-note { font: 500 12px/1 var(--mono); opacity: .5; font-weight: 500; }

/* ── меню (1B) ─────────────────────────────────────────────────────────── */

.hero-grid {
  position: absolute;
  top: 90px; left: -40px; right: -40px; bottom: 0;
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  grid-auto-rows: min-content;
  gap: 6px;
  opacity: .16;
  overflow: hidden;
  pointer-events: none;
  /* к низу текстура уходит, чтобы не спорить с плитками статистики */
  -webkit-mask-image: linear-gradient(to bottom, #000 48%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 48%, transparent 88%);
}
.hero-grid > i { aspect-ratio: 1; border-radius: 4px; background: rgba(251, 248, 241, .35); display: block; }
.hero-grid > i.on { background: var(--paper); }
.hero-grid > i.hit { background: var(--accent); opacity: .9; }

.menu-top { position: relative; padding: 18px var(--pad) 0; }
.sound-toggle {
  position: absolute;
  top: 12px; right: var(--pad);
  width: 36px; height: 36px;
  border: 0; border-radius: 12px;
  background: rgba(251, 248, 241, .1);
  box-shadow: inset 0 0 0 1px rgba(251, 248, 241, .16);
  color: var(--paper);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.sound-toggle:active { transform: scale(.92); }
.sound-toggle.is-off { opacity: .45; }
.sound-toggle .slash { display: none; }
.sound-toggle.is-off .slash { display: block; }
.sound-toggle.is-off .wave { display: none; }
.menu-title {
  font: 800 46px/.98 var(--sans);
  letter-spacing: -.028em;
  margin: 14px 0 0;
}
.menu-meta {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px;
  font: 500 12px/1 var(--mono);
  color: rgba(251, 248, 241, .7);
}
.menu-meta .gold { color: var(--gold-soft); }
.dot { width: 6px; height: 6px; border-radius: 3px; display: inline-block; }
.dot--green { background: var(--green); }
.sep { width: 1px; height: 12px; background: rgba(251, 248, 241, .25); }

.menu-bottom {
  position: relative;
  margin-top: auto;
  padding: 0 var(--pad) calc(var(--safe-bot) + 10px);
  display: flex; flex-direction: column; gap: 10px;
}
.stat-row { display: flex; gap: 8px; }
.stat-card {
  flex: 1;
  border-radius: 18px;
  background: rgba(251, 248, 241, .09);
  box-shadow: inset 0 0 0 1px rgba(251, 248, 241, .14);
  padding: 13px 14px;
  min-width: 0;
}
.stat-label { font: 500 10px/1 var(--mono); letter-spacing: .1em; color: rgba(251, 248, 241, .55); }
.stat-value { font: 700 19px/1 var(--sans); margin-top: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card--light { background: var(--ink-04); box-shadow: none; }
.stat-card--light .stat-label { color: var(--ink-45); }
.stat-card--gold { background: rgba(184, 135, 27, .1); box-shadow: none; }
.stat-card--gold .stat-label, .stat-card--gold .stat-value { color: var(--gold-deep); }

.tile-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile {
  border: 0; border-radius: 16px;
  background: rgba(251, 248, 241, .09);
  box-shadow: inset 0 0 0 1px rgba(251, 248, 241, .14);
  color: var(--paper);
  padding: 14px 4px;
  font: 700 12px/1 var(--sans);
  cursor: pointer;
  transition: transform .12s ease;
}
.tile:active { transform: scale(.96); }

/* ── комната (1K) ──────────────────────────────────────────────────────── */

.code-card {
  margin: 20px var(--pad) 0;
  border-radius: 22px;
  background: var(--ink);
  color: var(--paper);
  padding: 24px 20px;
  text-align: center;
}
.code-value {
  font: 500 40px/1 var(--mono);
  letter-spacing: .16em;
  margin-top: 14px;
  padding-left: .16em;
}
.code-note { font: 400 11px/1 var(--mono); color: rgba(251, 248, 241, .5); margin-top: 14px; }

.bet-row { display: flex; gap: 8px; margin-top: 12px; }
.bet {
  flex: 1; height: 46px;
  border: 0; border-radius: 14px;
  box-shadow: inset 0 0 0 1.5px var(--ink-18);
  background: none;
  font: 500 13px/1 var(--mono);
  color: var(--ink-55);
  cursor: pointer;
}
.bet.is-on {
  background: rgba(184, 135, 27, .14);
  box-shadow: inset 0 0 0 1.5px var(--gold);
  color: var(--gold-deep);
}

.join-row { display: flex; gap: 8px; margin-top: 12px; }
.code-input {
  flex: 1; min-width: 0; height: 52px;
  border: 0; border-radius: 14px;
  box-shadow: inset 0 0 0 1.5px var(--ink-18);
  background: var(--paper);
  color: var(--ink);
  font: 500 22px/1 var(--mono);
  letter-spacing: .3em;
  text-align: center;
  text-transform: uppercase;
  -webkit-user-select: text; user-select: text;
}
.code-input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
.code-input::placeholder { color: var(--ink-18); letter-spacing: .3em; }
.join-row .btn { flex: 0 0 96px; }

.waiting {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 18px; border-radius: 18px; background: var(--ink-04);
  font: 600 14px/1 var(--sans); color: var(--ink-72);
}
.pulse {
  width: 9px; height: 9px; border-radius: 5px;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* ── поиск (1C) ────────────────────────────────────────────────────────── */

.search-body {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 0 30px;
}
.ping-wrap { position: relative; width: 132px; height: 132px; display: grid; place-items: center; }
.ping {
  position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(22, 48, 92, .3);
  animation: ping 2.4s ease-out infinite;
}
.ping--delay { animation-delay: 1.2s; }
@keyframes ping { 0% { transform: scale(.7); opacity: .55; } 100% { transform: scale(1.9); opacity: 0; } }
.ping-core {
  width: 74px; height: 74px; border-radius: 26px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  font: 500 21px/1 var(--mono);
}
.chips { display: flex; gap: 8px; margin-top: 26px; flex-wrap: wrap; justify-content: center; }
.chip { font: 500 11px/1 var(--mono); background: var(--ink-06); padding: 9px 12px; border-radius: 9px; }
.chip--gold { background: rgba(184, 135, 27, .14); color: var(--gold-deep); }
.tip { border-radius: 20px; background: var(--ink-04); padding: 16px 18px; }
.tip-text { font: 600 14px/1.4 var(--sans); margin-top: 8px; color: var(--ink-72); text-wrap: pretty; }

/* ── поля ──────────────────────────────────────────────────────────────── */

/* Поле всегда квадратное и вписывается и по ширине, и по высоте контейнера. */
.board-wrap { display: flex; justify-content: center; align-items: flex-start; }
[data-screen="battle"] .board-wrap { flex: 1; min-height: 0; align-items: center; }

/* Координатная рамка: буквы сверху, цифры слева — можно назвать клетку голосом. */
.board-frame {
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 4px 5px;
  width: 100%;
  max-height: 100%;
  min-height: 0;
}
.board-frame > .col-labels { grid-area: 1 / 2; display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.board-frame > .row-labels { grid-area: 2 / 1; display: grid; grid-template-rows: repeat(10, 1fr); gap: 2px; }
.board-frame > .board { grid-area: 2 / 2; }
.col-labels > span, .row-labels > span {
  display: grid; place-items: center;
  font: 400 10px/1 var(--mono);
  color: var(--ink-38);
}
.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 2px;
  aspect-ratio: 1;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  touch-action: none;
}
.cell {
  min-width: 0; min-height: 0;
  border-radius: 4px;
  background: var(--ink-06);
  box-shadow: inset 0 0 0 1px var(--ink-13);
  display: grid; place-items: center;
  font: 500 15px/1 var(--mono);
  color: transparent;
  transition: background .14s ease, box-shadow .14s ease;
}
.cell.ship { background: var(--ink); box-shadow: none; }
/* Промах должен читаться темнее нетронутой воды, иначе поле выглядит пустым.
   Точка нарисована градиентом в процентах — одинаково видна и на большом поле, и на миникарте. */
.cell.miss {
  background-color: rgba(22, 48, 92, .17);
  background-image: radial-gradient(circle at center, rgba(22, 48, 92, .66) 0 13%, transparent 14%);
  box-shadow: inset 0 0 0 1px rgba(22, 48, 92, .22);
  color: transparent;
}
.cell.hit  { background: var(--accent); box-shadow: none; color: var(--paper); }
.cell.sunk { background: var(--ink); box-shadow: none; color: var(--paper); }
.cell.ship.hit { background: var(--accent); }
.cell.ship.sunk { background: var(--ink); }

.board--enemy .cell { cursor: crosshair; }
.board--enemy.is-live .cell:not(.miss):not(.hit):not(.sunk):active { background: var(--ink-13); }
.board--enemy:not(.is-live) { opacity: .72; }

.cell.aim { box-shadow: inset 0 0 0 2px var(--accent); }
.cell.fresh { animation: pop .32s ease; }
@keyframes pop { 0% { transform: scale(.55); } 60% { transform: scale(1.12); } 100% { transform: none; } }

.board--mini { gap: 1.5px; }
.board--mini .cell { border-radius: 2px; font-size: 9px; box-shadow: inset 0 0 0 1px var(--ink-10); }
.board--result { gap: 2px; }
.board--result .cell { border-radius: 3px; font-size: 11px; }

/* расстановка */
.board--setup .cell.preview-ok { background: rgba(22, 48, 92, .35); box-shadow: none; }
.board--setup .cell.preview-bad { background: rgba(200, 65, 42, .45); box-shadow: none; }
.board--setup .cell.ship { cursor: grab; }
.board--setup.shake { animation: shake .32s ease; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Док прижимается к низу свободного места, как в макете 1D. */
[data-screen="place"] .scroll { display: flex; flex-direction: column; }
#dockBlock { margin-top: auto; padding-top: 18px; padding-bottom: 4px; }

.dock { display: flex; gap: 8px; margin-top: 12px; align-items: stretch; }
.dock-slot {
  flex: 1;
  border-radius: 16px;
  background: var(--ink-04);
  min-height: 62px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  cursor: grab;
  position: relative;
  transition: box-shadow .14s ease, opacity .14s ease;
}
.dock-slot.is-empty { opacity: .32; cursor: default; }
.dock-slot.is-active { box-shadow: inset 0 0 0 1.5px var(--accent); }
.dock-ship { display: flex; gap: 2px; }
.dock-ship > i { width: 15px; height: 15px; border-radius: 3px; background: var(--ink); display: block; }
.dock-count { font: 500 9px/1 var(--mono); color: var(--ink-55); }

.drag-ghost {
  position: fixed;
  z-index: 90;
  display: flex;
  gap: 2px;
  pointer-events: none;
  opacity: .9;
  filter: drop-shadow(0 8px 18px rgba(22, 48, 92, .35));
}
.drag-ghost.vertical { flex-direction: column; }
.drag-ghost > i { border-radius: 4px; background: var(--ink); display: block; }

/* ── бой (1F) ──────────────────────────────────────────────────────────── */

.battle-head { display: flex; align-items: center; gap: 12px; padding: 10px var(--pad) 0; }
.avatar {
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--ink-09);
  display: grid; place-items: center;
  font: 700 14px/1 var(--sans); color: var(--ink-55);
  overflow: hidden; flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 62px; height: 62px; border-radius: 20px; font-size: 20px; }
.foe-name { font: 700 15px/1.1 var(--sans); }
.turn-clock { text-align: right; flex: 0 0 auto; }
.clock { font-size: 20px; line-height: 1; color: var(--ink); }
.clock.warn { color: var(--accent); }

.timebar { margin: 10px var(--pad) 0; height: 3px; border-radius: 2px; background: var(--ink-10); overflow: hidden; }
.timebar-fill { height: 3px; border-radius: 2px; background: var(--ink); width: 100%; transition: width .3s linear, background .3s ease; }
.timebar-fill.warn { background: var(--accent); }

.battle-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--pad) 0; }
.status { font: 800 17px/1.1 var(--sans); white-space: nowrap; }
.status.wait { color: var(--ink-45); }
.status.fire { color: var(--accent); }

.fleet-pips { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.fleet-pips .pip { display: flex; gap: 1.5px; padding: 0 2px; }
.fleet-pips .pip > i { width: 5px; height: 5px; border-radius: 1.5px; background: var(--ink); display: block; }
.fleet-pips .pip.dead { opacity: .25; }
.fleet-pips .pip.dead > i { background: var(--accent); }

.battle-foot { display: flex; gap: 14px; align-items: flex-end; padding: 14px var(--pad) 0; }
.mini-wrap { width: 44%; max-width: 170px; flex: 0 0 auto; }
.mini-wrap .board { margin-top: 7px; }
.kv { display: flex; justify-content: space-between; font: 500 11px/1 var(--mono); color: var(--ink-55); margin-top: 9px; }
.kv b { font-weight: 500; color: var(--ink); }

.bubble {
  position: absolute;
  left: var(--pad);
  bottom: 96px;
  background: var(--ink); color: var(--paper);
  padding: 9px 14px;
  border-radius: 16px 16px 16px 4px;
  font: 500 18px/1 var(--sans);
  animation: fade .2s ease;
  z-index: 5;
}
.bubble.mine { left: auto; right: var(--pad); border-radius: 16px 16px 4px 16px; background: var(--accent); }

.react-row {
  margin-top: auto;
  display: flex; gap: 7px;
  padding: 12px var(--pad) calc(var(--safe-bot) + 6px);
}
.react {
  flex: 1; height: 50px;
  border: 0; border-radius: 16px;
  background: rgba(22, 48, 92, .05);
  font-size: 20px;
  cursor: pointer;
  transition: transform .12s ease;
}
.react:active { transform: scale(.93); }
.react--wide {
  flex: 1.6;
  background: none;
  box-shadow: inset 0 0 0 1.5px var(--ink-18);
  font: 600 13px/1 var(--sans);
  color: var(--ink-72);
}

/* ── итог (1H) ─────────────────────────────────────────────────────────── */

.result-head { padding: 36px var(--pad) 0; text-align: center; }
.result-title { font: 800 52px/1 var(--sans); letter-spacing: -.03em; margin-top: 14px; }
.result-title.lose { color: var(--ink-45); }
.rating-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px;
  background: rgba(200, 65, 42, .09); color: var(--accent);
  padding: 10px 16px; border-radius: 12px;
  font: 500 13px/1 var(--mono);
}
.rating-pill.down { background: var(--ink-06); color: var(--ink-55); }
.rating-pill.flat { background: var(--ink-06); color: var(--ink-55); }

/* ── профиль и рейтинг ─────────────────────────────────────────────────── */

.profile-head { display: flex; align-items: center; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { border-radius: 18px; background: var(--ink-04); padding: 15px 16px; }
.metric .stat-label { color: var(--ink-45); }
.metric .stat-value { font: 500 24px/1 var(--mono); margin-top: 10px; }

.list { display: flex; flex-direction: column; margin-top: 10px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(22, 48, 92, .09);
}
.row:last-child { border-bottom: 0; }
.row.me { background: rgba(200, 65, 42, .06); border-radius: 12px; padding-left: 10px; padding-right: 10px; border-bottom: 0; }
.place { width: 26px; font: 500 13px/1 var(--mono); color: var(--ink-45); flex: 0 0 auto; }
.row-name { font: 600 14px/1.2 var(--sans); }
.row-note { font: 500 11px/1 var(--mono); color: var(--ink-45); margin-top: 5px; }
.row-val { font: 500 14px/1 var(--mono); flex: 0 0 auto; }
.badge { font: 500 10px/1 var(--mono); padding: 5px 8px; border-radius: 7px; flex: 0 0 auto; }
.badge--win { background: rgba(127, 195, 165, .22); color: #2E6B54; }
.badge--lose { background: var(--ink-06); color: var(--ink-55); }
.empty { padding: 26px 0; text-align: center; font: 500 13px/1.4 var(--sans); color: var(--ink-45); }

/* ── служебное ─────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--safe-bot) + 86px);
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100% - 40px);
  background: var(--ink); color: var(--paper);
  padding: 12px 18px; border-radius: 14px;
  font: 600 13px/1.35 var(--sans);
  text-align: center;
  animation: fade .18s ease;
  box-shadow: 0 12px 30px -12px rgba(22, 48, 92, .6);
}
.toast.bad { background: var(--accent); }

.veil {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(239, 233, 222, .94);
  display: grid; place-items: center;
}
.veil-box {
  display: flex; align-items: center; gap: 10px;
  font: 600 14px/1 var(--sans); color: var(--ink-72);
}

@media (max-height: 700px) {
  .menu-title { font-size: 38px; }
  .hero-grid { top: 74px; }
  .result-title { font-size: 42px; }
  .result-head { padding-top: 22px; }
  .ping-wrap { transform: scale(.85); }
}
