/* Rendezvous (/play/rendezvous, ADR 0111). The canvas reads its colors from
   the --rz-* variables (web/src/play/rendezvous/ui.ts), so the dark theme and
   night vision only change variables. Phones play it full screen in the
   games' stage (play.css). */

.rz-game {
  --rz-bg: #eef2fa;
  --rz-grid: #c9d2e6;
  --rz-text: #1d1f24;
  --rz-muted: #5b6479;
  --rz-path: #2f5fb8;
  --rz-plan: #c45f00;
  --rz-ship: #1d1f24;
  --rz-station: #13805a;
  --rz-body: #4f86c6;
  --rz-air: #9cc0e8;
  --rz-moon: #a3a5ab;
  --rz-ring: #13805a;
  --rz-hit: #c4372b;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Room between the introduction and the game. */
.rz-page .play-intro { margin-bottom: 22px; }

.rz-levels {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.rz-level {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.rz-level[aria-pressed="true"] { border-color: var(--accent-moon); background: var(--accent-moon-soft); }
.rz-level-n {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-moon);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}
.rz-level-name { font-weight: 600; font-size: 0.9rem; line-height: 1.2; }
.rz-level-stars { font-size: 0.85rem; }

/* The objective first, on its own line, then the tip. */
.rz-brief > div { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-inline-start: 3px solid var(--accent-moon); border-radius: 10px; background: var(--surface); }
.rz-brief > div[hidden] { display: none; }
.rz-brief p { margin: 0; max-width: 80ch; font-size: 0.95rem; line-height: 1.45; }
.rz-goal strong { color: var(--accent-moon); }
.rz-tip { color: var(--muted); font-size: 0.9rem; }

.rz-screen, .rz-frame { position: relative; }
.rz-canvas {
  display: block;
  width: 100%;
  height: clamp(300px, 56vw, 560px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--rz-bg);
  touch-action: none;
  cursor: crosshair;
}
.rz-canvas:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 2px; }

.rz-hud {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 14px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rz-bg) 82%, transparent);
  color: var(--rz-text);
  font-size: 0.8rem;
  pointer-events: none;
  max-width: calc(100% - 16px);
}
.rz-hud > div { display: contents; }
.rz-hud > div[hidden] { display: none; }
.rz-hud dt { color: var(--rz-muted); }
.rz-hud dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.rz-meter { display: block; width: 90px; height: 6px; margin-top: 2px; }

/* Top right: the readouts take the top left, the labels the middle of each edge. */
.rz-views {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 50%;
}

.rz-chip, .rz-btn, .rz-burn {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.rz-zoom { display: inline-flex; gap: 4px; }
.rz-chip-icon { min-width: 36px; padding: 6px 0; font-size: 1.1rem; font-weight: 700; line-height: 1; }
.rz-chip[aria-pressed="true"] { border-color: var(--accent-moon); background: var(--accent-moon-soft); font-weight: 650; }
.rz-chip:disabled, .rz-btn:disabled, .rz-burn:disabled { opacity: 0.45; cursor: default; }
.rz-btn-strong { border-color: var(--accent-sun); background: var(--accent-sun); color: #1d1f24; font-weight: 700; }

.rz-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  align-items: center;
}
.rz-burns {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.rz-burn {
  min-height: 48px;
  padding: 6px 4px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 0.95rem;
  white-space: nowrap;
}
.rz-burn:active { background: var(--accent-moon-soft); }
.rz-steps, .rz-plan, .rz-time, .rz-skips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rz-skips { grid-column: 1 / -1; }
.rz-label { color: var(--muted); font-size: 0.85rem; }
.rz-label strong { color: var(--text); }
.rz-warp { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px; }
.rz-warp input { flex: 1; min-width: 100px; accent-color: var(--accent-moon); }
.rz-note { grid-column: 1 / -1; min-height: 1.3em; margin: 0; color: var(--warn-text); font-size: 0.9rem; }

.rz-end {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
[dir="rtl"] .rz-end { transform: translate(50%, -50%); inset: 50% 50% auto auto; }
.rz-end-title { margin: 0; font-size: 1.4rem; font-weight: 750; }
.rz-end-stars { margin: 2px 0; font-size: 1.6rem; }
.rz-end-summary { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.rz-why { margin: 0 0 8px; text-align: start; font-size: 0.92rem; line-height: 1.45; }
.rz-end-learn { margin: 0 0 12px; }
.rz-end-learn a { color: var(--accent-moon); font-weight: 600; text-decoration: none; }
.rz-end-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.rz-text { max-width: 70ch; margin-top: 28px; }
.rz-text h2 { font-size: 1.15rem; }
.rz-text li { margin-bottom: 6px; }

/* A computer: the picture across the page, the controls in rows under it. */
@media (min-width: 1000px) {
  .rz-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
  .rz-burns { grid-column: 1 / -1; }
  .rz-level { flex: 1 1 0; }
  .rz-canvas { height: clamp(460px, 46vw, 640px); }
}

/* A phone: the readouts go under the picture so nothing covers it. */
@media (max-width: 799px) {
  .rz-controls { grid-template-columns: 1fr; gap: 8px; }
  .rz-level { min-width: 128px; padding: 6px 10px; }
  .rz-level-name { font-size: 0.82rem; }
  .rz-screen { display: flex; flex-direction: column; gap: 6px; }
  .rz-hud {
    position: static;
    grid-template-columns: repeat(3, auto);
    grid-auto-flow: row;
    gap: 0 12px;
    padding: 0 2px;
    background: none;
    color: var(--text);
    font-size: 0.75rem;
    max-width: none;
  }
  .rz-hud > div { display: flex; flex-direction: column; }
  .rz-hud dt { color: var(--muted); }
  .rz-hud-wide { grid-column: span 2; }
  .rz-meter { width: 64px; }
  .rz-views { position: static; max-width: none; margin-top: 6px; }
  .rz-end { position: fixed; z-index: 1001; max-height: calc(100dvh - 32px); }
  .rz-views .rz-chip { min-height: 30px; padding: 3px 9px; font-size: 0.78rem; }
  .rz-burn { font-size: 0.88rem; }
}

/* Full screen on a phone: the picture takes the room the controls leave. */
.game-stage.is-full .rz-game { height: 100%; gap: 6px; }
.game-stage.is-full .rz-brief p { font-size: 0.82rem; }
.game-stage.is-full .rz-brief .rz-tip { display: none; }
.game-stage.is-full .rz-screen { flex: 1 0 auto; display: flex; flex-direction: column; }
.game-stage.is-full .rz-frame { flex: 1 0 200px; display: flex; flex-direction: column; }
.game-stage.is-full .rz-canvas { height: auto; flex: 1; }
.game-stage.is-full .rz-note:empty { display: none; }
