:root {
  --color-bg: #fdf8f0;
  --color-panel: #ffffff;
  --color-border: #ece3d3;
  --color-accent: #ff5d8f;
  --color-accent-2: #2bb3a3;
  --color-text: #2b2536;
  --color-muted: #8a8294;
  --color-danger: #ef5350;
  --color-success: #2bb3a3;
  --radius: 16px;

  --chip-colors: #ff5d8f, #f6a623, #2bb3a3, #6c63ff, #ff8c42, #3aa1d8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
}

body {
  min-height: 100svh;
  min-height: 100dvh;
}

#app {
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1 {
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(2rem, 7vw, 3.6rem);
  margin: 0 0 0.5rem 0;
  color: var(--color-accent);
}

h2 {
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  margin: 0 0 0.5rem 0;
}

p {
  margin: 0 0 0.5rem 0;
}

/* Every screen renders inside a single centered portrait column so the focus
   is consistent across phone, tablet, and desktop -- no wide stretching, no
   horizontal scroll. */
.screen {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)) 16px;
  gap: 10px;
}

.screen > * {
  width: 100%;
  max-width: 100%;
}

.screen-centered {
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* Interactive ("stage") screens -- draw/decoy/vote/round-score -- are pinned to
   the viewport so the canvas and its controls are always fully visible with no
   pinch, scroll, or zoom. The canvas area flexes to fill leftover space. */
.screen--stage {
  height: 100svh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  justify-content: center;
}

.round-pill {
  align-self: center;
  width: auto;
  background: color-mix(in srgb, var(--color-accent-2) 14%, white);
  color: var(--color-accent-2);
  border: 1px solid var(--color-accent-2);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  margin: 0;
}

.points-breakdown p {
  margin: 0 0 4px 0;
}

.points-breakdown p:last-child {
  margin-bottom: 0;
}

.panel {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 10px rgba(43, 37, 54, 0.06);
}

.button {
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 700;
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  min-height: 44px;
  min-width: 44px;
  background: var(--color-accent);
  color: white;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button-secondary {
  background: var(--color-panel);
  color: var(--color-text);
  border: 2px solid var(--color-border);
}

.button-danger {
  background: var(--color-danger);
  color: white;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

input[type="text"] {
  font-size: 1.1rem;
  padding: 12px;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: white;
  color: var(--color-text);
  min-height: 44px;
}

input[type="text"]::placeholder {
  color: var(--color-muted);
}

/* Inputs fill their card so the landing/join forms read as tidy full-width
   fields rather than narrow boxes. */
.panel input[type="text"] {
  width: 100%;
}

.room-code {
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--color-accent);
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.player-list li {
  --i: 0;
  background: color-mix(in srgb, var(--chip-color, var(--color-accent)) 14%, white);
  border: 2px solid var(--chip-color, var(--color-accent));
  color: var(--color-text);
  border-radius: 999px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.player-disconnected {
  opacity: 0.5;
}

.timer {
  font-weight: 700;
  color: var(--color-accent-2);
}

.prompt-banner {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 600;
}

/* Bounding box for the canvas: sized by the column width but never taller than
   most of the viewport, so the canvas + its controls stay grouped as one
   compact portrait card. The frame inside letterboxes to 4:3, so capping the
   box height never distorts the drawing. position:relative anchors the frame. */
.canvas-wrap {
  flex: 0 1 auto;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 68vh;
  position: relative;
}

/* On scrollable info screens (reveal) the canvas is a bit shorter. */
.canvas-wrap--fixed {
  max-height: 42vh;
}

/* Aspect-locked white box: the largest 4:3 box that fits the available area,
   centered, so the canvas renders at one consistent ratio on every device and
   drawings never distort or get cropped. position:absolute + inset:0 +
   margin:auto + aspect-ratio + max-* is the reliable "fit and center" pattern
   (a flex/in-flow box collapses to 0 because the <canvas> is absolutely
   positioned and contributes no intrinsic size). */
.canvas-frame {
  position: absolute;
  inset: 0;
  margin: auto;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  max-height: 100%;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
}

.canvas-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}

.color-swatch.selected {
  border-color: var(--color-accent);
}

.answer-choice {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--color-panel);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  color: var(--color-text);
  font-size: clamp(1rem, 3vw, 1.3rem);
  cursor: pointer;
}

.answer-choice.selected {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, white);
}

.answer-choice:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.waiting-banner {
  color: var(--color-muted);
  font-style: italic;
}

.error-banner {
  background: var(--color-danger);
  color: white;
  border-radius: var(--radius);
  padding: 10px 14px;
}

.connection-banner {
  background: var(--color-danger);
  color: white;
  text-align: center;
  padding: 6px;
  font-size: 0.9rem;
}

.reveal-row {
  display: flex;
  justify-content: space-between;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 6px;
}

.reveal-row.is-real {
  border: 2px solid var(--color-success);
}

.score-table {
  width: 100%;
  border-collapse: collapse;
}

.score-table td, .score-table th {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.winner-card {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
  color: white;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-weight: 800;
}

/* Landing page */
.landing-title {
  text-align: center;
  margin-bottom: 8px;
}

.landing-subtitle {
  color: var(--color-muted);
  text-align: center;
  margin-bottom: 8px;
}

/* Cards stack in the centered portrait column on every device -- the lassoed
   column is too narrow for two side-by-side cards. */
.landing-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Lobby page */
.lobby-room-panel {
  text-align: center;
}

.lobby-join-url {
  color: var(--color-muted);
  font-size: 0.95rem;
  word-break: break-all;
}
