/* Swipe Games — shared styles (index / v1 / v2).
   FE-2 appends a `/* === v2 === *\/` section at the end of this file. */

/* ------------------------------------------------------------ tokens ---- */
:root {
  color-scheme: dark;

  --bg: #0a0c12;
  --bg-elev: #11141d;
  --surface: #181c28;
  --surface-2: #222738;
  --surface-glass: rgba(18, 21, 31, 0.78);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #eef0f6;
  --text-dim: #a2a8bb;
  --text-faint: #6b7287;

  --accent: #8b6cff;
  --accent-2: #ff6fae;
  --accent-grad: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --gold: #ffc65c;
  --ok: #3ddc97;
  --warn: #ffc65c;
  --danger: #ff5c7a;

  --radius: 16px;
  --radius-sm: 10px;
  --tap: 44px;

  --topbar-h: 52px; /* content height; safe-area inset is added on top */
  --topbar-total: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  --handle-w: 44px;
  --feed-gutter-x: 0px;  /* room around the stage on wide screens */
  --feed-gutter-y: 0px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border);
}

/* -------------------------------------------------------------- base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  border-color: transparent;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 8px 24px rgba(139, 108, 255, 0.35);
}

.btn-block { width: 100%; min-height: 52px; font-size: 16px; }

.link-btn {
  min-height: var(--tap);
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================= HOME ==== */
.page-home {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    calc(24px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(24px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  background:
    radial-gradient(60rem 40rem at 20% -10%, rgba(139, 108, 255, 0.22), transparent 60%),
    radial-gradient(50rem 35rem at 110% 110%, rgba(255, 111, 174, 0.16), transparent 60%),
    var(--bg);
}

.home { width: 100%; max-width: 460px; display: grid; gap: 24px; }

.home-brand { text-align: center; }
.home-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 10px 30px rgba(139, 108, 255, 0.4);
}
.home-title { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.home-tagline { margin: 4px 0 0; color: var(--text-dim); }

.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* id form */
.id-form { display: grid; gap: 8px; }
.field-label { font-weight: 600; font-size: 14px; color: var(--text-dim); }
.input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  font-size: 17px; /* ≥16px: no iOS zoom on focus */
  font-family: var(--mono);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--text-faint); font-family: var(--font); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, 0.25); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.18); }
.field-hint { margin: 0; font-size: 13px; color: var(--text-faint); }
.field-error { margin: 0; font-size: 14px; color: var(--danger); }
.id-form .btn { margin-top: 8px; }

/* variant choice */
.choice { display: grid; gap: 16px; }
.choice-id {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.choice-id-label { flex: none; font-size: 13px; color: var(--text-faint); }
.choice-id-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-weight: 600;
}
.choice-list { display: grid; gap: 12px; }
.choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--text);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.choice-btn:hover { border-color: var(--accent); box-shadow: 0 10px 30px rgba(139, 108, 255, 0.25); }
.choice-btn:active { transform: scale(0.985); }
.choice-num {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}
.choice-btn + .choice-btn .choice-num { background: linear-gradient(135deg, #2bc4ff, #3ddc97); }
.choice-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.choice-title { font-weight: 700; font-size: 16px; }
.choice-desc { font-size: 13px; color: var(--text-dim); }
.choice-arrow { flex: none; font-size: 20px; color: var(--text-dim); }
.choice .link-btn { justify-self: center; }

/* ============================================================= FEED ==== */
.page-feed {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---- topbar (contract markup) ---- */
.topbar {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto 0;
  height: var(--topbar-total);
  padding: var(--safe-top) calc(8px + var(--safe-right)) 0 calc(8px + var(--safe-left));
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 12, 18, 0.88);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}

.btn-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn-back:hover { background: var(--surface); }
.btn-back:active { background: var(--surface-2); }

.topbar-title {
  flex: none;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-id {
  flex: 0 1 auto;
  min-width: 0;
  margin-right: auto; /* pushes status + counter to the right */
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-dim);
  font: 12px/1.4 var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-id:empty { display: none; }

/* connection status (v2): <span.status-dot><span.status-label> */
.topbar-status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}
.topbar-status[data-state="connecting"] .status-dot { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.topbar-status[data-state="open"] .status-dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.topbar-status[data-state="closed"] .status-dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: 0.35; } }

.topbar-counter {
  flex: none;
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .topbar { gap: 6px; }
  .btn-back { padding: 0 8px; }
  .topbar-title { font-size: 14px; }
  .topbar-status { padding: 0; min-width: 28px; justify-content: center; }
  .topbar-status .status-label { display: none; }
  .topbar-counter { min-width: 0; padding: 4px 8px; font-size: 13px; }
}

/* ---- feed: vertical scroll-snap ---- */
.feed {
  position: fixed;
  inset: var(--topbar-total) 0 auto 0;
  height: calc(100vh - var(--topbar-total));
  height: calc(100dvh - var(--topbar-total));
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  outline: none;
}
.feed::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  padding: var(--feed-gutter-y) var(--feed-gutter-x);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  container-type: size; /* stage sizes itself in cq units */
  background: var(--bg);
}

/* the game box; v1 puts iframes here, v2 moves its <canvas> here */
.slide-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-elev);
  container-type: size;
}

/* iframe (v1) / canvas (v2) fill the stage above the placeholder */
.stage-media,
.slide-stage > iframe,
.slide-stage > canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

/* wide screens: 16:9 stage centered, background around it */
@media (orientation: landscape) and (min-width: 768px) {
  :root {
    --feed-gutter-x: clamp(72px, 5vw, 120px); /* clears the ▲▼ buttons */
    --feed-gutter-y: clamp(12px, 3vh, 32px);
  }
  .slide {
    background:
      radial-gradient(70% 60% at 50% 45%, rgba(139, 108, 255, 0.10), transparent 70%),
      var(--bg);
  }
  .slide-stage {
    width: min(100cqw, 100cqh * 16 / 9);
    height: min(100cqh, 100cqw * 9 / 16);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
  }
}

/* ---- placeholder (thumb + title) ---- */
.ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}
.ph-bg {
  position: absolute;
  inset: -12%;
  z-index: -1;
  background: var(--thumb, none) center / cover no-repeat, var(--surface);
  filter: blur(48px) saturate(1.4) brightness(0.4);
}
.ph-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}
.ph-thumb {
  width: min(72cqw, 420px, 45cqh * 16 / 9); /* thumbs are 16:9 */
  aspect-ratio: 16 / 9;
  margin-bottom: 8px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-strong);
}
.ph-thumb.is-broken { visibility: hidden; }
.ph-title {
  font-weight: 800;
  font-size: clamp(20px, 5cqmin, 34px);
  letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.ph-provider {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ph-provider:empty { display: none; }
.ph-status {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  font-size: 13px;
  color: var(--text-dim);
}
.slide-stage[data-state="loading"] .ph-status { display: inline-flex; }

/* ---- floating ▲▼ ---- */
.feed-nav {
  position: fixed;
  z-index: 25;
  right: calc(10px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nav-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
}
.nav-btn:hover:not(:disabled) { background: var(--surface-2); }
.nav-btn:active:not(:disabled) { transform: scale(0.92); }
.nav-btn:disabled { opacity: 0.3; cursor: default; }

@media (orientation: landscape) and (min-width: 768px) {
  .feed-nav {
    right: calc(14px + var(--safe-right));
    bottom: auto;
    top: calc(var(--topbar-total) + (100dvh - var(--topbar-total)) / 2);
    transform: translateY(-50%);
  }
}

/* ---- swipe handle: a strip on the right edge (iframes eat touch scroll) ---- */
.swipe-handle {
  position: fixed;
  z-index: 20;
  top: var(--topbar-total);
  right: 0;
  bottom: 0;
  width: calc(var(--handle-w) + var(--safe-right));
  display: grid;
  place-items: center;
  padding-right: var(--safe-right);
  padding-bottom: 130px; /* keep the grip visually above the ▲▼ buttons */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: ns-resize;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.28), transparent);
}
.swipe-grip {
  width: 5px;
  height: 64px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, height 0.15s ease;
}
.swipe-handle.is-dragging .swipe-grip { background: #fff; height: 84px; }

/* mouse + wide screen: wheel / keys / buttons are enough */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .swipe-handle { display: none; }
}

/* ---- full-width layouts (phones, portrait): a right "rail" ----
   The stage stops at the rail, so the swipe handle and ▲▼ never cover the game
   (real slot UIs put controls near the edges; v2's canvas stays fully tappable). */
@media (orientation: portrait), (max-width: 767.98px) {
  :root { --rail-w: 48px; }
  .slide { padding-right: calc(var(--rail-w) + var(--safe-right)); }
  .swipe-handle {
    width: calc(var(--rail-w) + var(--safe-right));
    padding-bottom: calc(112px + var(--safe-bottom)); /* grip sits above the ▲▼ */
    background: rgba(10, 12, 18, 0.88); /* same tone as the topbar */
    border-left: 1px solid var(--border);
  }
  .swipe-grip { height: 72px; background: rgba(255, 255, 255, 0.28); box-shadow: none; }
  .swipe-handle.is-dragging .swipe-grip { height: 96px; }
  .feed-nav {
    right: calc((var(--rail-w) - 44px) / 2 + var(--safe-right));
    bottom: calc(8px + var(--safe-bottom));
    gap: 8px;
  }
  .nav-btn {
    width: 44px;
    height: 44px;
    background: var(--surface);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ---- full-feed message (loading / error) ---- */
.feed-message {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}
.feed-message-title { font-size: 18px; font-weight: 700; }
.feed-message-text { color: var(--text-dim); max-width: 32rem; }
.feed-message-text:empty { display: none; }

/* ============================================================ METRICS ==== */
.metrics {
  position: fixed;
  z-index: 26;
  left: calc(8px + var(--safe-left));
  bottom: calc(8px + var(--safe-bottom));
  max-width: min(340px, calc(100vw - 80px - var(--safe-left) - var(--safe-right)));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(10, 12, 18, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font: 11px/1.35 var(--mono);
  color: var(--text-dim);
}
.metrics-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
@media (pointer: coarse) { .metrics-toggle { min-height: var(--tap); } }
.metrics-toggle-label { flex: none; color: var(--text); font-weight: 700; font-family: var(--font); font-size: 12px; }
.metrics-last {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gold);
}
.metrics-chevron { flex: none; transition: transform 0.15s ease; }
.metrics.is-open .metrics-chevron { transform: rotate(180deg); }
.metrics-body { display: none; padding: 0 10px 8px; }
.metrics.is-open .metrics-body { display: block; }
.metrics.is-open .metrics-last { visibility: hidden; }
/* phones: collapsed chip stays tiny so it does not cover game controls */
@media (max-width: 600px) {
  .metrics:not(.is-open) .metrics-last { display: none; }
}

.metrics-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.metrics-table th {
  padding: 2px 6px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-weight: 600;
  text-align: right;
}
.metrics-table td { padding: 2px 6px; text-align: right; white-space: nowrap; }
.metrics-table th:first-child,
.metrics-table td:first-child { padding-left: 0; text-align: left; }
.metrics-table tr.is-mounted td { color: var(--text); }
.metrics-table tr.is-active td { color: var(--gold); }
.m-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: transparent;
  vertical-align: 1px;
}
.metrics-table tr.is-mounted .m-dot { background: var(--ok); }
.metrics-table tr.is-active .m-dot { background: var(--gold); }
.m-wait { color: var(--warn); }
.m-abort { color: var(--danger); }
.m-none { color: var(--text-faint); }
.metrics-note { margin-top: 6px; color: var(--text-faint); font-size: 10px; }

/* === v2 === (CLIENT: variant 2 — server stream, protocol v2) ========= */
/* the view (canvas + status overlay) moves into the active slide's stage */
.v2-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  touch-action: none;
}
/* the video canvas: every touch/press goes to the game (or flips the feed on a quick swipe) */
.v2-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  background: #000;
}

/* "Восстанавливаем игру…" / "Нет связи": over the last frame, dimmed; never eats input */
.v2-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(8, 10, 16, 0.58);
  color: var(--text);
  font-weight: 700;
  font-size: clamp(14px, 4.2cqmin, 18px);
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: v2-fade-in 0.2s ease;
}
.v2-overlay .spinner { width: 22px; height: 22px; border-width: 3px; }
@keyframes v2-fade-in { from { opacity: 0; } }

/* warm-window dots: one per game (topbar strip + info panel) */
.v2-window,
.v2-dots {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}
.v2-window {
  flex: none;
  max-width: 160px;
  padding: 0 4px;
}
.v2-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease, transform 0.2s ease;
}
.v2-dot.has-preview { box-shadow: 0 0 0 1px rgba(139, 108, 255, 0.9); }
.v2-dot.is-warm { background: var(--ok); }
.v2-dot.is-active { background: var(--gold); transform: scale(1.4); }
@media (max-width: 560px) {
  .topbar .v2-window { display: none; }
}

/* info overlay: reuses the v1 `.metrics` panel chrome */
.v2-info.is-open { min-width: 230px; }
.v2-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.v2-kv dt { color: var(--text-faint); white-space: nowrap; }
.v2-kv dd {
  margin: 0;
  min-width: 0;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-kv dd.is-ok { color: var(--ok); }
.v2-kv dd.is-warn { color: var(--warn); }
.v2-kv dd.is-bad { color: var(--danger); }
.v2-kv dd[data-k="win"] { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.v2-info:not(.is-open) .metrics-last { color: var(--text-dim); }
/* phones: open panel stays compact and scrolls instead of covering the whole game */
@media (max-width: 600px) {
  .v2-info.is-open { min-width: 0; width: calc(100vw - 72px - var(--safe-left) - var(--safe-right)); }
  .v2-info .metrics-body { max-height: 46dvh; overflow-y: auto; overscroll-behavior: contain; }
  .v2-kv { font-size: 10.5px; gap: 1px 8px; }
  .v2-kv dd { white-space: normal; overflow-wrap: anywhere; }
  .v2-info .metrics-note { display: none; }
}
