/* ==========================================================================
   1GTrack: retro arcade + BBS, the modern way.
   All colors, sizes and fonts live in the tokens below. Change them here.
   ========================================================================== */

/* ---------- Design tokens ---------- */

:root {
  /* Fonts */
  --font-pixel: "Press Start 2P", ui-monospace, monospace; /* logo + big headings only */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --tap: 44px; /* smallest tap target */

  /* Layout */
  --content-width: 44rem;
  --gutter: 16px;
  --nav-height: 64px;
  /* The phone's bars. In the Android app, Capacitor sets --safe-area-inset-* (Android's WebView doesn't fill env()). */
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));

  /* Motion */
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur-med: 220ms;

  /* Dark theme colors (default) */
  --bg: #0a0b1e;
  --bg-grid: rgba(34, 228, 255, 0.05);
  --surface: #141733;
  --surface-2: #1c2046;
  --surface-3: #262b5a;
  --border: #2e3474;
  --text: #eef0ff;
  --text-muted: #a9aed8;
  --pink: #ff4fa3;
  --cyan: #22e4ff;
  --lime: #a6ff3b;
  --gold: #ffd400;
  --danger: #ff6b86;
  --on-accent: #16001a;
  --heart-empty: #3a4080;
  --focus: #22e4ff;
  --glow-pink: 0 0 0 1px rgba(255, 79, 163, 0.55), 0 0 18px rgba(255, 79, 163, 0.35);
  --glow-cyan: 0 0 0 1px rgba(34, 228, 255, 0.55), 0 0 18px rgba(34, 228, 255, 0.3);
  --glow-lime: 0 0 0 1px rgba(166, 255, 59, 0.55), 0 0 18px rgba(166, 255, 59, 0.3);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --scanline: rgba(0, 0, 0, 0.18);
  --toast-ok-bg: #0f2a12;
  --toast-bad-bg: #2d0b18;
  color-scheme: dark;
}

/* Light theme: the same neon, darkened so text stays readable on white. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f3ff;
    --bg-grid: rgba(90, 70, 200, 0.06);
    --surface: #ffffff;
    --surface-2: #efecfd;
    --surface-3: #e2ddfa;
    --border: #cdc6ef;
    --text: #17152f;
    --text-muted: #524e78;
    --pink: #c2156e;
    --cyan: #00717f;
    --lime: #2e7a00;
    --gold: #8a6100;
    --danger: #b3123a;
    --on-accent: #ffffff;
    --heart-empty: #cbc3ee;
    --focus: #6a3cff;
    --glow-pink: 0 0 0 1px rgba(194, 21, 110, 0.45), 0 6px 18px rgba(194, 21, 110, 0.18);
    --glow-cyan: 0 0 0 1px rgba(0, 113, 127, 0.45), 0 6px 18px rgba(0, 113, 127, 0.16);
    --glow-lime: 0 0 0 1px rgba(46, 122, 0, 0.45), 0 6px 18px rgba(46, 122, 0, 0.16);
    --shadow: 0 8px 24px rgba(40, 30, 110, 0.14);
    --scanline: rgba(40, 30, 110, 0.035);
    --toast-ok-bg: #eaf8e2;
    --toast-bad-bg: #fde8ee;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f5f3ff;
  --bg-grid: rgba(90, 70, 200, 0.06);
  --surface: #ffffff;
  --surface-2: #efecfd;
  --surface-3: #e2ddfa;
  --border: #cdc6ef;
  --text: #17152f;
  --text-muted: #524e78;
  --pink: #c2156e;
  --cyan: #00717f;
  --lime: #2e7a00;
  --gold: #8a6100;
  --danger: #b3123a;
  --on-accent: #ffffff;
  --heart-empty: #cbc3ee;
  --focus: #6a3cff;
  --glow-pink: 0 0 0 1px rgba(194, 21, 110, 0.45), 0 6px 18px rgba(194, 21, 110, 0.18);
  --glow-cyan: 0 0 0 1px rgba(0, 113, 127, 0.45), 0 6px 18px rgba(0, 113, 127, 0.16);
  --glow-lime: 0 0 0 1px rgba(46, 122, 0, 0.45), 0 6px 18px rgba(46, 122, 0, 0.16);
  --shadow: 0 8px 24px rgba(40, 30, 110, 0.14);
  --scanline: rgba(40, 30, 110, 0.035);
  --toast-ok-bg: #eaf8e2;
  --toast-bad-bg: #fde8ee;
  color-scheme: light;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
  scroll-padding-bottom: calc(var(--nav-height) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  overflow-x: hidden;
}

/* CRT scanlines, drawn over everything but never catching taps. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, var(--scanline) 2px 3px);
}

h1, h2, h3, p {
  margin: 0;
}

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

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

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hint {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.kicker,
.field-label,
.meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kicker {
  color: var(--cyan);
}

.avatar {
  image-rendering: pixelated;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---------- Layout shell ---------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: calc(var(--space-2) + var(--safe-top)) max(var(--gutter), calc((100% - var(--content-width)) / 2 + var(--gutter))) var(--space-2);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-pixel);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 2px 2px 0 color-mix(in srgb, var(--pink) 55%, transparent);
}

.logo-1g {
  color: var(--pink);
  text-shadow: 0 0 10px color-mix(in srgb, var(--pink) 60%, transparent);
}

.shell {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-4) var(--gutter) calc(var(--nav-height) + var(--space-6) + var(--safe-bottom));
}

/* ---------- Buttons ---------- */

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast), box-shadow var(--dur-med), border-color var(--dur-med), background var(--dur-med);
}

button:hover:not(:disabled) {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

button:disabled {
  cursor: default;
  opacity: 0.7;
}

.btn-primary {
  background: var(--pink);
  border-color: var(--pink);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--pink) 45%, #000);
}

.btn-primary:hover:not(:disabled) {
  border-color: var(--pink);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--pink) 45%, #000), var(--glow-pink);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--pink) 45%, #000);
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 60%, var(--border));
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

.btn-small {
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

.btn-block {
  width: 100%;
}

.icon-button {
  width: var(--tap);
  padding: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: 1.1rem;
}

.theme-icon::before {
  content: "☀️";
}

:root[data-theme="light"] .theme-icon::before {
  content: "🌙";
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-icon::before {
    content: "🌙";
  }
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- Forms ---------- */

.sheet {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  box-shadow: var(--shadow);
}

.sheet h2 {
  font-size: var(--text-xl);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.field > .hint {
  margin-bottom: var(--space-2);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-md); /* 16px stops phones zooming in */
  transition: border-color var(--dur-med), box-shadow var(--dur-med);
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--text-muted) 80%, transparent);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

input:disabled {
  opacity: 0.7;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.form-actions .btn-primary {
  flex: 1 1 12rem;
}

/* ---------- Pixel hearts (ratings) ---------- */

.heart {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--heart-empty);
  shape-rendering: crispEdges;
}

.heart.full {
  color: var(--pink);
}

/* Rating inputs: one row of 5 tappable hearts per category. */
.rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--border);
}

.rating-row:last-child {
  border-bottom: 0;
}

.rating-name {
  flex: 1 1 8rem;
  font-weight: 600;
  font-size: var(--text-sm);
}

.rating-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: var(--space-2);
  font-weight: 400;
}

.heart-buttons {
  display: flex;
  gap: 2px;
}

.heart-button {
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  padding: 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.heart-button:hover:not(:disabled) {
  border: 0;
  box-shadow: none;
  background: var(--surface-2);
}

.heart-button.on .heart {
  color: var(--pink);
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--pink) 60%, transparent));
}

.heart-button.bump .heart {
  animation: heart-bump var(--dur-med) var(--ease-pop);
}

@keyframes heart-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---------- Visibility picker ---------- */

.visibility-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

/* Three choices side by side once there's room; stacked on phones. */
@media (min-width: 560px) {
  .visibility-picker {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
  }
}

.vis-option {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon name" "desc desc";
  align-items: center;
  justify-items: start;
  gap: var(--space-1) var(--space-2);
  min-height: 4.5rem;
  padding: var(--space-3);
  text-align: left;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.vis-icon {
  grid-area: icon;
  font-size: 1.4rem;
}

.vis-name {
  grid-area: name;
  font-size: var(--text-md);
  font-weight: 700;
}

.vis-desc {
  grid-area: desc;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
}

.vis-option[aria-checked="true"] {
  position: relative;
  border-color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 12%, var(--surface-2));
  box-shadow: var(--glow-cyan);
}

.vis-option[data-value="everyone"][aria-checked="true"] {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 12%, var(--surface-2));
  box-shadow: var(--glow-lime);
}

.vis-option[data-value="friends"][aria-checked="true"] {
  border-color: var(--pink);
  background: color-mix(in srgb, var(--pink) 12%, var(--surface-2));
  box-shadow: var(--glow-pink);
}

.vis-option[data-value="friends"][aria-checked="true"]::after {
  color: var(--pink);
}

.vis-option[aria-checked="true"]::after {
  content: "✓" / "";
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--cyan);
}

.vis-option[data-value="everyone"][aria-checked="true"]::after {
  color: var(--lime);
}

/* ---------- Top bar: player ---------- */

.player-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
}

.player-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.player-avatar:empty {
  display: none;
}

.player-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-right: auto;
  line-height: 1.2;
}

.player-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--lime);
  letter-spacing: 0.08em;
}

#player-nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Tabs: bottom bar on phones, top bar on bigger screens ---------- */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  padding: 0 var(--space-2) var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 2px solid var(--border);
}

.tabs button {
  position: relative;
  flex: 1 1 0;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  height: var(--nav-height);
  padding: 0 var(--space-1);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tabs button:hover:not(:disabled) {
  border: 0;
  box-shadow: none;
  color: var(--text);
}

.tab-icon {
  font-size: 1.35rem;
  line-height: 1;
  transition: transform var(--dur-med) var(--ease-pop);
}

.tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs button.active {
  color: var(--pink);
}

.tabs button.active .tab-icon {
  transform: translateY(-2px) scale(1.12);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--pink) 70%, transparent));
}

.tabs button.active::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 22%;
  right: 22%;
  height: 3px;
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink);
}

.tab-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 8px);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--gold);
  color: var(--on-accent);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

/* The ( ) are there for screen readers and tests, the pill shows just the number. */
.tab-badge .paren {
  font-size: 0;
}

@media (min-width: 720px) {
  .tabs {
    position: sticky;
    top: 61px;
    bottom: auto;
    gap: var(--space-2);
    margin: 0 0 var(--space-5);
    padding: var(--space-1);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
  }

  .tabs button {
    flex-direction: row;
    gap: var(--space-2);
    height: var(--tap);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
  }

  .tabs button.active {
    background: color-mix(in srgb, var(--pink) 14%, transparent);
    box-shadow: inset 0 0 0 2px var(--pink);
  }

  .tabs button.active::before {
    display: none;
  }

  .tabs button.active .tab-icon {
    transform: none;
  }

  .tab-icon {
    font-size: 1.1rem;
  }

  .tab-badge {
    position: static;
  }

  .shell {
    padding-bottom: var(--space-6);
  }

  html {
    scroll-padding-top: 130px;
    scroll-padding-bottom: 24px;
  }

  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Section headings: > THE ARCADE_ ---------- */

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.section-title {
  margin-top: var(--space-2);
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--text);
  overflow-wrap: anywhere;
}

.section-title::before {
  content: "> " / "";
  color: var(--lime);
}

.section-title::after {
  content: "_" / "";
  color: var(--pink);
  animation: blink 1.1s steps(1) infinite;
}

#mine-tab .section-title {
  margin-top: var(--space-5);
}

@keyframes blink {
  50% { opacity: 0; }
}

.list-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* ---------- Game cards ---------- */

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: border-color var(--dur-med), box-shadow var(--dur-med), transform var(--dur-med);
}

.game-card:hover,
.game-card:focus-within {
  border-color: color-mix(in srgb, var(--pink) 70%, var(--border));
  box-shadow: var(--glow-pink);
}

.byline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.byline strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byline .meta {
  margin-left: auto;
  white-space: nowrap;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.card-title {
  flex: 1;
  min-width: 0;
}

.game-card h3 {
  font-size: var(--text-lg);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.card-sub {
  margin-top: 2px;
  overflow-wrap: anywhere;
}

/* Big overall score with a 10-block power bar. */
.score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.score-number {
  font-family: var(--font-pixel);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--lime);
  text-shadow: 0 0 10px color-mix(in srgb, var(--lime) 45%, transparent);
}

.score-number small {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-shadow: none;
}

.score.perfect .score-number {
  color: var(--gold);
  text-shadow: 0 0 12px color-mix(in srgb, var(--gold) 55%, transparent);
}

.score.none .score-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-shadow: none;
  text-transform: uppercase;
}

.power-bar {
  display: grid;
  grid-template-columns: repeat(10, 7px);
  gap: 2px;
}

.power-bar span {
  height: 10px;
  background: var(--heart-empty);
}

.power-bar span.on {
  background: var(--lime);
}

.score.perfect .power-bar span.on {
  background: var(--gold);
}

.ratings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px var(--space-4);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  list-style: none;
}

.ratings li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 24px;
}

.ratings .meta {
  font-size: 0.7rem;
}

.mini-hearts {
  display: flex;
  gap: 3px;
}

.mini-hearts .heart {
  width: 14px;
  height: 12px;
}

.ratings li.unrated .mini-hearts {
  opacity: 0.5;
}

/* On wide screens keep the hearts close to their labels instead of stretching across the card. */
@media (min-width: 560px) {
  .ratings {
    max-width: 22rem;
  }
}

.notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-sm);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.card-foot .spacer {
  flex: 1;
}

.vis-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.vis-badge.everyone {
  border-color: var(--lime);
  color: var(--lime);
}

.vis-badge.friends {
  border-color: var(--pink);
  color: var(--pink);
}

/* ---------- Reactions ---------- */

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.reactions:empty {
  display: none;
}

.reaction {
  min-width: var(--tap);
  padding: 0 8px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 700;
}

.reaction.mine {
  border-color: var(--pink);
  background: color-mix(in srgb, var(--pink) 18%, var(--surface-2));
  box-shadow: var(--glow-pink);
}

.reaction:disabled {
  opacity: 1;
  min-height: 32px;
  border-width: 1px;
  font-size: var(--text-sm);
}

.reaction.pop {
  animation: pop 320ms var(--ease-pop);
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ---------- Empty and loading states ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty .avatar {
  animation: bob 1.6s steps(2) infinite;
}

.empty-title {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes bob {
  50% { transform: translateY(-4px); }
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) 0;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.loading-bar {
  width: 12rem;
  height: 14px;
  padding: 2px;
  border: 2px solid var(--cyan);
  overflow: hidden;
}

.loading-bar span {
  display: block;
  width: 40%;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--cyan) 0 8px, transparent 8px 10px);
  animation: load 1.2s steps(12) infinite;
}

@keyframes load {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

/* ---------- Signed-out hero ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-sprites {
  display: flex;
  gap: var(--space-3);
}

.hero-sprites .avatar:nth-child(odd) {
  animation: bob 1.4s steps(2) infinite;
}

.hero-sprites .avatar:nth-child(even) {
  animation: bob 1.4s steps(2) 0.7s infinite;
}

.hero-kicker {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  color: var(--lime);
  line-height: 1.6;
}

.hero-text {
  max-width: 26rem;
  font-size: var(--text-lg);
  font-weight: 600;
}

.hero-points {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: left;
}

.hero-points span {
  display: inline-block;
  width: 1.6em;
  color: var(--pink);
}

/* "You need an invite" / "have a parent with you" on the sign-in screen. */
.signin-note {
  max-width: 26rem;
  font-size: var(--text-sm);
  text-align: left;
}

.hero .btn-primary {
  max-width: 20rem;
  margin-top: var(--space-2);
}

.hero-coin {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- Profile form ---------- */

#avatar-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.avatar-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-1);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--dur-med), box-shadow var(--dur-med), transform var(--dur-fast);
}

.avatar-option .avatar {
  width: 100%;
  max-width: 48px;
  height: auto;
  aspect-ratio: 1;
}

.avatar-name {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.avatar-option:hover {
  border-color: var(--cyan);
}

.avatar-option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.avatar-option:has(input:checked) {
  border-color: var(--pink);
  background: color-mix(in srgb, var(--pink) 15%, var(--surface-2));
  box-shadow: var(--glow-pink);
  transform: translateY(-2px);
}

.avatar-option:has(input:checked) .avatar-name {
  color: var(--pink);
  font-weight: 700;
}

.avatar-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#profile-form.editing #profile-kicker {
  display: none;
}

/* ---------- Toast messages ---------- */

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + var(--space-3) + var(--safe-bottom));
  z-index: 60;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  width: min(calc(100% - 2 * var(--gutter)), 30rem);
  padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4);
  border: 2px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--toast-bad-bg);
  color: var(--text);
  box-shadow: var(--shadow), 0 0 18px color-mix(in srgb, var(--danger) 30%, transparent);
  transform: translate(-50%, 0);
  pointer-events: none;
  animation: toast-in var(--dur-med) var(--ease-pop);
}

.toast-wrap.ok {
  border-color: var(--lime);
  background: var(--toast-ok-bg);
  box-shadow: var(--shadow), 0 0 18px color-mix(in srgb, var(--lime) 30%, transparent);
}

.toast-wrap:not(.show) {
  display: none;
}

#message {
  flex: 1;
  min-width: 0;
  align-self: center;
  font-size: var(--text-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

#message::before {
  content: "⚠ " / "";
  color: var(--danger);
}

#message.ok::before {
  content: "★ " / "";
  color: var(--lime);
}

.toast-close {
  flex-shrink: 0;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  pointer-events: auto;
}

@keyframes toast-in {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@media (min-width: 720px) {
  .toast-wrap {
    bottom: var(--space-5);
  }
}

/* Signed out there's no bottom tab bar, so the toast can sit lower. */
body:has(#signed-in[hidden]) .toast-wrap,
body:has(#main[hidden]) .toast-wrap {
  bottom: calc(var(--space-5) + var(--safe-bottom));
}

/* While chatting, the toast moves to the top of the screen, so it never covers the message box
   (or what you typed, which you may want to fix). */
body:has(#chat-tab:not([hidden]) #chat-screen:not([hidden])) .toast-wrap {
  top: calc(var(--space-2) + var(--safe-top));
  bottom: auto;
  animation-name: toast-in-top;
}

@keyframes toast-in-top {
  from { transform: translate(-50%, -16px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ---------- NEW HIGH SCORE! ---------- */

.highscore {
  position: fixed;
  top: 30%;
  left: 50%;
  z-index: 70;
  width: min(calc(100% - 2 * var(--gutter)), 24rem);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  background: var(--surface);
  border: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 4px var(--bg), 0 0 40px color-mix(in srgb, var(--gold) 50%, transparent), var(--shadow);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: highscore 2.4s var(--ease-pop) forwards;
}

.highscore-title {
  font-family: var(--font-pixel);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--gold);
  text-shadow: 3px 3px 0 color-mix(in srgb, var(--pink) 70%, transparent);
  animation: rainbow 0.4s steps(1) infinite;
}

.highscore-detail {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text);
  overflow-wrap: anywhere;
}

@keyframes highscore {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  20% { transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

@keyframes rainbow {
  0% { color: var(--gold); }
  33% { color: var(--pink); }
  66% { color: var(--cyan); }
}

/* ---------- Admin ---------- */

.admin-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.block-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 2px solid var(--gold);
  border-left-width: 6px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.report + .report {
  margin-top: var(--space-3);
}

.report p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report .report-title {
  font-weight: 700;
}

.report .notes {
  padding: var(--space-2) var(--space-3);
  border-left: 2px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.invite-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.invite-form input {
  flex: 1 1 12rem;
  width: auto;
}

.invite-form .btn {
  flex: 0 0 auto;
}

.admin-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: 1px dashed var(--border);
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-row .who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px var(--space-2);
  flex: 1 1 14rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-row .who .meta {
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Friends ---------- */

.friend-block {
  display: flex;
  flex-direction: column;
}

.friend-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--border);
}

.friend-row:last-child {
  border-bottom: 0;
}

.friend-row .who {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 10rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ---------- Chat: BBS terminal ---------- */
/* The terminal is always a dark "screen", in both themes, like an old monitor. */

.terminal {
  --term-bg: #05060f;
  --term-panel: #0b0d1f;
  --term-line: #1d2250;
  --term-text: #c9ffd0;
  --term-dim: #7f8fc0;
  --term-accent: #a6ff3b;
  --term-link: #22e4ff;
  position: relative;
  background: var(--term-bg);
  color: var(--term-text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  border: 2px solid var(--term-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Faint scanlines on the screen. */
.terminal::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}

.term-dim {
  color: var(--term-dim);
}

.term-button {
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 1px solid var(--term-line);
  border-radius: var(--radius-sm);
  background: var(--term-panel);
  color: var(--term-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.term-button:hover,
.term-button:focus-visible {
  border-color: var(--term-accent);
  color: var(--term-accent);
}

.chat-switch {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.chat-switch[hidden] {
  display: none;
}

.chat-switch button {
  flex: 1;
  min-height: var(--tap);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.chat-switch button.active {
  border-color: var(--lime);
  color: var(--text);
  box-shadow: var(--glow-lime);
}

.dm-badge {
  display: inline-block;
  min-width: 1.4em;
  margin-left: var(--space-1);
  padding: 0 0.35em;
  border-radius: var(--radius-pill);
  background: var(--gold);
  color: #1a1300;
  font-size: var(--text-xs);
}

.dm-badge[hidden] {
  display: none;
}

.chat-list {
  display: flex;
  flex-direction: column;
  padding: var(--space-3);
  gap: var(--space-1);
}

.chat-list p {
  margin: var(--space-1) 0;
}

.chat-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.chat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name count" "sub sub";
  gap: 2px var(--space-2);
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--term-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-row:hover,
.chat-row:focus-visible {
  border-color: var(--term-accent);
  background: var(--term-panel);
}

.chat-row-name {
  grid-area: name;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--term-link);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.chat-row-sub {
  grid-area: sub;
  min-width: 0;
  color: var(--term-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row-count {
  grid-area: count;
  color: var(--term-dim);
  font-size: var(--text-xs);
}

.chat-row-count.live {
  color: var(--term-accent);
}

.chat-row.unread .chat-row-name::after {
  content: "● NEW";
  color: var(--gold);
  font-size: var(--text-xs);
}

.chat-row.unread .chat-row-sub {
  color: var(--term-text);
}

.chat-screen {
  display: flex;
  flex-direction: column;
  /* Fill the phone screen between the header and the bottom tab bar. */
  height: calc(100dvh - 19rem - var(--safe-bottom));
  min-height: 22rem;
}

.chat-screen[hidden] {
  display: none;
}

@media (min-width: 720px) {
  .chat-screen {
    height: min(70dvh, 42rem);
  }
}

.terminal-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-bottom: 1px solid var(--term-line);
  background: var(--term-panel);
}

.terminal-title {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.terminal-title strong {
  color: var(--term-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-title .term-dim {
  font-size: var(--text-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-who {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  max-height: 8rem;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px dashed var(--term-line);
}

.terminal-who[hidden] {
  display: none;
}

.terminal-who p {
  flex-basis: 100%;
  margin: 0;
}

.who-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.terminal-log {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
  overscroll-behavior: contain;
}

.line {
  position: relative;
  margin: 0;
  padding: 2px 3.5rem 2px 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.line.mine {
  background: rgba(166, 255, 59, 0.05);
}

.line.system {
  color: var(--term-dim);
  padding-right: 0;
  white-space: pre-wrap;
}

.me-line {
  color: #ffb3e0;
  font-style: italic;
}

/* Each player gets their own color. */
.nick-c0 { color: #22e4ff; }
.nick-c1 { color: #ff7ac3; }
.nick-c2 { color: #ffd400; }
.nick-c3 { color: #a6ff3b; }
.nick-c4 { color: #c3a6ff; }
.nick-c5 { color: #ffa55c; }

.line-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
}

.line:hover .line-actions,
.line:focus-within .line-actions {
  opacity: 1;
}

/* No hover on phones, so keep the buttons faintly visible. */
@media (hover: none) {
  .line-actions {
    opacity: 0.55;
  }
}

.line-button {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid var(--term-line);
  border-radius: var(--radius-sm);
  background: var(--term-panel);
  color: var(--term-dim);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.line-button:hover,
.line-button:focus-visible {
  color: var(--term-accent);
  border-color: var(--term-accent);
}

.terminal-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-top: 1px solid var(--term-line);
  background: var(--term-panel);
}

.terminal-input .prompt {
  color: var(--term-accent);
  font-weight: 700;
}

.terminal-input input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--space-2);
  border: 1px solid var(--term-line);
  border-radius: var(--radius-sm);
  background: var(--term-bg);
  color: var(--term-text);
  caret-color: var(--term-accent);
  font: inherit;
  font-size: 16px; /* 16px stops phones from zooming in when you tap the box */
}

.terminal-input input::placeholder {
  color: var(--term-dim);
}

.terminal-input input:focus {
  outline: 2px solid var(--term-accent);
  outline-offset: 1px;
}

.terminal-input .send {
  color: var(--term-accent);
}

.chat-rules {
  margin-top: var(--space-3);
}

/* New chat pop-up: pick friends. */
.pick-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 50dvh;
  overflow-y: auto;
}

.pick-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.pick-row:hover {
  background: var(--surface-2);
}

.pick-row input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--pink);
}

.pick-list .field {
  margin-top: var(--space-2);
}

.pick-list .field input {
  width: 100%;
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- Parent approval ---------- */

.notice-box {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.notice-box p,
.notice-box ul {
  margin: var(--space-2) 0;
}

.notice-box ul {
  padding-left: 1.2rem;
}

.notice-box a,
.doc a:not(.btn),
.parent-info a {
  color: var(--cyan);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  cursor: pointer;
}

.check input {
  flex: 0 0 auto;
  width: 1.3rem;
  height: 1.3rem;
  margin-top: 2px;
  accent-color: var(--pink);
}

.parent-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ---------- Admin: parent details and chat switch ---------- */

.parent-info {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--space-3);
  flex-basis: 100%;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.btn.chat-on {
  border-color: var(--lime);
  color: var(--lime);
}

/* Players under 13 stand out in the admin list. */
.vis-badge.age-young {
  border-color: var(--gold);
  color: var(--gold);
}

/* "Delete my account" at the bottom of the profile editor. */
.danger-zone {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--danger);
  border-radius: var(--radius-md);
}

.danger-zone .block-title {
  color: var(--danger);
}

.convo-log {
  max-height: 50dvh;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
}

.chat-list.locked p {
  margin: var(--space-2) 0;
}

/* ---------- Rules and privacy page ---------- */

.doc {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
}

.doc h1 {
  margin: 0;
  font-size: var(--text-xl);
}

.doc-block h2 {
  margin-top: 0;
  font-size: var(--text-lg);
}

.doc-block ul,
.doc-block ol {
  padding-left: 1.3rem;
}

.doc-block li {
  margin: var(--space-1) 0;
}

.app-bar a.logo {
  text-decoration: none;
  color: inherit;
}

.hero-links {
  margin: 0;
  font-size: var(--text-sm);
}

.hero-links a {
  color: var(--cyan);
}

/* ---------- Pop-up dialogs ---------- */

.dialog {
  width: min(26rem, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 2 * var(--gutter));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow), var(--glow-pink);
}

.dialog::backdrop {
  background: rgba(5, 6, 20, 0.7);
  backdrop-filter: blur(2px);
}

.dialog[open] {
  animation: dialog-in var(--dur-med) var(--ease-pop);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

.dialog-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
}

.dialog-title {
  margin: 0;
  font-size: var(--text-lg);
}

.dialog-text {
  margin: 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.dialog-input {
  width: 100%;
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* ---------- Reduced motion: keep it still ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .section-title::after,
  .hero-coin {
    animation: none;
  }

  /* The high score box still shows, it just doesn't bounce. JS hides it after a moment. */
  .highscore,
  .highscore-title {
    animation: none;
  }
}

/* ---------- Email sign-in ---------- */

.email-signin {
  width: 100%;
  text-align: left;
}

.email-signin summary {
  cursor: pointer;
  color: var(--cyan);
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
}

.email-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.email-form input {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

/* ---------- Covers (game cards and the catalog) ---------- */

.cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.cover > img,
.cover > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cover > img {
  object-fit: cover;
  opacity: 0;
}

.cover > img.ready {
  opacity: 1;
}

/* The pixel placeholder: a little invader in one of the neon colors. */
.cover-ph .ph-ground {
  fill: var(--border);
}

.ph-c0 { color: var(--pink); }
.ph-c1 { color: var(--cyan); }
.ph-c2 { color: var(--lime); }
.ph-c3 { color: var(--gold); }
.ph-c4 { color: color-mix(in srgb, var(--pink) 50%, var(--cyan)); }

.card-cover {
  flex: 0 0 5.5rem;
  align-self: flex-start;
}

@media (min-width: 560px) {
  .card-cover {
    flex-basis: 8rem;
  }
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-1);
}

/* Age ratings: green for kids, gold for teens, red for 17+. */
.age-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.age-kids { color: var(--lime); }
.age-teen { color: var(--gold); }
.age-mature { color: var(--danger); }
.age-unknown { color: var(--text-muted); }
.age-free { color: var(--cyan); }

/* ---------- Discover tab ---------- */

.discover-search {
  position: relative;
}

.discover-search::before {
  content: "🔎" / "";
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.discover-search input {
  padding-left: 2.6rem;
}

.search-note {
  color: var(--danger);
}

/* A switch-style checkbox ("Hide 17+ games"). */
.toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle-track {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  transition: background var(--dur-med), border-color var(--dur-med);
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--text-muted);
  transition: transform var(--dur-med) var(--ease-pop), background var(--dur-med);
}

.toggle input:checked + .toggle-track {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 18%, var(--surface-2));
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
  background: var(--lime);
}

.toggle input:focus-visible + .toggle-track {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.toggle .hint {
  font-weight: 400;
}

/* Locked by the admin: still shows it's on, but can't be changed. */
.toggle:has(input:disabled) {
  cursor: not-allowed;
}

.toggle input:disabled + .toggle-track {
  opacity: 0.6;
}

.discover-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.discover-credits {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
  font-size: var(--text-xs);
}

/* Shelves on the Discover home: a title and a row of games you can swipe through. */
.shelf {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.shelf-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  overflow-wrap: anywhere;
}

.shelf-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 9.5rem;
  gap: var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 2px 2px var(--space-2);
  margin: 0 -2px;
}

.shelf-row > * {
  scroll-snap-align: start;
}

.shelf-row:has(> .source-problem),
.shelf-row:has(> .hint) {
  display: block;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: var(--space-3);
}

.game-grid:empty {
  display: none;
}

/* One game in the catalog. The whole tile is a button that opens the details. */
.tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--space-1);
  min-width: 0;
  padding: var(--space-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  font-weight: 400;
}

.tile .cover {
  margin-bottom: var(--space-1);
}

.tile-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 700;
  font-size: var(--text-sm);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tile-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.tile-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 2px;
}

.source-chips {
  display: contents;
}

.source-chip {
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  line-height: 1.6;
  white-space: nowrap;
}

.tile.skeleton {
  pointer-events: none;
}

.tile.skeleton .cover,
.tile.skeleton .tile-title,
.tile.skeleton .tile-meta {
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  animation: skeleton 1.2s ease-in-out infinite alternate;
}

.tile.skeleton .tile-title {
  height: 1rem;
  width: 80%;
}

.tile.skeleton .tile-meta {
  height: 0.7rem;
  width: 50%;
}

@keyframes skeleton {
  to { opacity: 0.45; }
}

.discover-filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.discover-filters .field-label {
  margin-top: var(--space-2);
}

/* A row of choices you can swipe sideways on a phone. */
.chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px var(--space-1);
  margin: 0 -2px;
}

.chip {
  flex: 0 0 auto;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.chip[aria-pressed="true"] {
  border-color: var(--pink);
  background: color-mix(in srgb, var(--pink) 18%, var(--surface-2));
  color: var(--text);
}

.source-status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.source-status li {
  padding: 2px var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.source-status li.done strong {
  color: var(--lime);
}

.source-status li.busy strong {
  color: var(--cyan);
}

.source-status li.problem {
  border-color: color-mix(in srgb, var(--danger) 60%, var(--border));
  color: var(--danger);
}

.source-problem {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px dashed color-mix(in srgb, var(--danger) 60%, var(--border));
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.hidden-note {
  font-size: var(--text-xs);
}

/* The game details pop-up. */
.game-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.detail-desc {
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.detail-warning {
  font-size: var(--text-sm);
}

.detail-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0;
  font-size: var(--text-sm);
}

.detail-facts dt {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* "From the catalog" in the Add a game form. */
.catalog-pick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border: 1px dashed var(--cyan);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.catalog-pick-cover {
  flex: 0 0 5.5rem;
}

.catalog-pick-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Six tabs have to fit on a small phone. */
@media (max-width: 420px) {
  .tabs {
    padding-left: 2px;
    padding-right: 2px;
  }

  .tabs button {
    padding: 0 1px;
    font-size: 0.625rem;
    letter-spacing: 0;
  }
}

/* ---------- Arcade views: Feed | Fame | Tiers | Spin ---------- */

.arcade-switch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.arcade-switch button {
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: 56px;
  padding: var(--space-1);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.arcade-switch-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.arcade-switch button.active {
  border-color: var(--pink);
  background: color-mix(in srgb, var(--pink) 12%, var(--surface));
  color: var(--text);
  box-shadow: var(--glow-pink);
}

.arcade-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.fame-title {
  color: var(--gold);
}

/* ---------- 🆕 Since you were last here ---------- */

.whats-new {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: color-mix(in srgb, var(--gold) 7%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--gold) 65%, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: 0 0 18px color-mix(in srgb, var(--gold) 18%, transparent);
}

.whats-new-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.whats-new-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.whats-new-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.whats-new-item {
  justify-content: flex-start;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: 600;
}

.whats-new-item:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.whats-new-icon {
  flex: none;
  font-size: 1.15rem;
  line-height: 1;
}

/* ---------- 🏆 Hall of Fame ---------- */

.fame-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fame-row {
  display: grid;
  grid-template-columns: 2.25rem 4.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
}

.fame-row.rank-1 {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  box-shadow: 0 0 16px color-mix(in srgb, var(--gold) 35%, transparent);
}

.fame-row.rank-2 {
  border-color: color-mix(in srgb, var(--cyan) 70%, var(--border));
}

.fame-row.rank-3 {
  border-color: color-mix(in srgb, var(--pink) 60%, var(--border));
}

.fame-rank {
  text-align: center;
}

.fame-medal {
  font-size: 1.6rem;
  line-height: 1;
}

.fame-num {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.fame-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fame-name {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.fame-meta {
  font-size: 0.68rem;
}

.fame-score {
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  color: var(--lime);
  text-shadow: 0 0 10px color-mix(in srgb, var(--lime) 40%, transparent);
}

.rank-1 .fame-score {
  color: var(--gold);
  text-shadow: 0 0 10px color-mix(in srgb, var(--gold) 50%, transparent);
}

.fame-empty {
  list-style: none;
}

/* 🌱 Needs more ratings: games only one player has rated so far (no rank). */
.fame-rising-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.fame-rising-box .fame-title {
  color: var(--lime);
}

.fame-rising-row {
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  border-style: dashed;
}

.fame-rising-row .fame-score {
  color: var(--text-muted);
  text-shadow: none;
}

/* ---------- ▦ Tier list ---------- */

.tier-switch {
  display: flex;
  gap: var(--space-2);
}

.tier-switch button {
  flex: 1;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.tier-switch button.active {
  border-color: var(--lime);
  color: var(--text);
  box-shadow: var(--glow-lime);
}

.tier-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tier-row {
  --tier: var(--text-muted);
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  min-height: 3.5rem;
  background: var(--surface);
  border: 2px solid var(--tier);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 0 12px color-mix(in srgb, var(--tier) 22%, transparent);
}

.tier-s { --tier: var(--pink); }
.tier-a { --tier: var(--gold); }
.tier-b { --tier: var(--lime); }
.tier-c { --tier: var(--cyan); }
.tier-d { --tier: var(--text-muted); }

.tier-label {
  display: grid;
  place-items: center;
  background: var(--tier);
  color: var(--on-accent);
  font-family: var(--font-pixel);
  font-size: 1.25rem;
}

.tier-games {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 6px;
  margin: 0;
  padding: 6px;
  list-style: none;
}

.tier-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 34px;
  padding: 3px 8px 3px 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.tier-cover {
  flex: none;
  width: 2.75rem;
}

.tier-name {
  min-width: 0;
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tier-score {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--tier);
}

.tier-empty {
  align-self: center;
  padding: 0 var(--space-2);
  color: var(--text-muted);
}

/* ---------- 🎰 What should we play? ---------- */

.spin-link {
  border-color: color-mix(in srgb, var(--gold) 60%, var(--border));
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spin-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  border-color: color-mix(in srgb, var(--pink) 50%, var(--border));
}

.spin-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.spin-controls .field:first-child,
#spin-friend-field {
  grid-column: 1 / -1;
}

/* The slot machine's window is always a dark screen, like the chat terminal. */
.slot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--surface-3);
  border: 3px solid var(--gold);
  border-radius: var(--radius-md);
  box-shadow: 0 0 16px color-mix(in srgb, var(--gold) 30%, transparent);
}

.slot-light {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--pink);
  box-shadow: 0 0 8px var(--pink);
}

.slot-window {
  display: grid;
  flex: 1;
  place-items: center;
  min-width: 0;
  height: 3.5rem;
  overflow: hidden;
  background: #05060f repeating-linear-gradient(to bottom, transparent 0 3px, rgba(166, 255, 59, 0.06) 3px 4px);
  border: 2px solid #1d2250;
  border-radius: var(--radius-sm);
}

.slot-reel {
  max-width: 100%;
  padding: 0 var(--space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  line-height: 1.5;
  color: #a6ff3b;
  text-shadow: 0 0 8px rgba(166, 255, 59, 0.6);
}

.slot-window.spinning .slot-reel {
  animation: reel 90ms steps(2) infinite;
}

.slot:has(.spinning) .slot-light {
  animation: blink 0.2s steps(1) infinite;
}

@keyframes reel {
  50% { transform: translateY(-4px); opacity: 0.55; }
}

.spin-result:empty {
  display: none;
}

.spin-win {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  background: color-mix(in srgb, var(--lime) 6%, var(--surface));
  border: 2px dashed var(--lime);
  border-radius: var(--radius-md);
}

.ready-flourish {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
  color: var(--gold);
  text-shadow: 2px 2px 0 color-mix(in srgb, var(--pink) 70%, transparent);
  animation: ready-in 480ms var(--ease-pop), rainbow 0.4s steps(1) 480ms 4;
}

@keyframes ready-in {
  0% { transform: scale(0.3); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.spin-win-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.spin-cover {
  flex: none;
  width: 6rem;
}

.spin-win-info {
  min-width: 0;
}

.spin-win-title {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.spin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ---------- 🎖️ Badges ---------- */

.badge-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.badge-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2);
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
}

.badge-icon {
  flex: none;
  shape-rendering: crispEdges;
}

.badge-item .badge-icon {
  color: var(--heart-empty);
}

.badge-item.earned {
  border-color: var(--gold);
}

.badge-collector { --badge: var(--cyan); }
.badge-critic { --badge: var(--gold); }
.badge-social { --badge: var(--pink); }
.badge-explorer { --badge: var(--lime); }

.badge-item.earned .badge-icon,
.player-badge .badge-icon {
  color: var(--badge);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--badge) 60%, transparent));
}

.badge-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.badge-name {
  font-size: var(--text-sm);
}

.badge-text .meta {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.badge-bar {
  display: block;
  height: 6px;
  background: var(--heart-empty);
}

.badge-bar > span {
  display: block;
  height: 100%;
  background: var(--lime);
}

.badge-item.earned .badge-bar > span {
  background: var(--gold);
}

.player-tag-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-badges {
  display: inline-flex;
  gap: 3px;
}

.player-badges:empty {
  display: none;
}

.player-badge {
  display: inline-flex;
}

@media (prefers-reduced-motion: reduce) {
  .slot-window.spinning .slot-reel,
  .slot:has(.spinning) .slot-light,
  .ready-flourish {
    animation: none;
  }
}

/* ---------- Home button, invites, age check ---------- */

.app-bar-start {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.logo-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-shadow: inherit;
  cursor: pointer;
}

.logo-button:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 4px;
}

.invite-card {
  display: grid;
  gap: var(--space-2);
}

.invite-card #invite-tools {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
}

.invite-card #invite-tools .invite-form {
  width: 100%;
}

.block-subtitle {
  margin: var(--space-3) 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.invite-row .who strong {
  overflow-wrap: anywhere;
}

.code-note {
  margin: 0;
}

#redeem .invite-form input {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.logo-button:hover:not(:disabled) {
  border-color: transparent;
  box-shadow: none;
}

.copy-fields {
  display: grid;
  gap: var(--space-3);
}

.copy-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-1) var(--space-2);
  align-items: start;
}

.copy-field .field-label {
  grid-column: 1 / -1;
}

.copy-value {
  width: 100%;
  min-width: 0;
  font-size: var(--text-sm);
  resize: vertical;
}
