/* Rumpus -- one small stylesheet for the portal and every game. */

:root {
  --bg: #12101c;
  --bg-lift: #1b1828;
  --bg-card: #221e33;
  --line: #332e48;
  --line-soft: #2a2640;

  --ink: #f2eefc;
  --ink-dim: #a79fc4;
  --ink-faint: #756d92;

  --accent: #ffb347;
  --accent-ink: #2a1c05;
  --pop: #7c6cff;
  --good: #4ade80;
  --bad: #fb7185;

  --radius: 14px;
  --radius-lg: 20px;
  --pad: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body {
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(124, 108, 255, 0.18), transparent 60%),
    radial-gradient(700px 400px at 95% 0%, rgba(255, 179, 71, 0.12), transparent 55%);
  background-attachment: fixed;
}

/* ------------------------------------------------------------- chrome */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(var(--pad), env(safe-area-inset-left)) 12px max(var(--pad), env(safe-area-inset-right));
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(18, 16, 28, 0.86);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.brand-mark { font-size: 22px; }
.brand-name { font-size: 19px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-dim);
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px max(var(--pad), env(safe-area-inset-left)) 64px max(var(--pad), env(safe-area-inset-right));
}

.loading { color: var(--ink-faint); text-align: center; padding: 60px 0; }

/* ------------------------------------------------------------- type */

h1 { font-size: 30px; line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 21px; margin: 0 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 0 0 6px; }
p  { margin: 0 0 12px; }

.lede { color: var(--ink-dim); font-size: 16px; }
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 14px; }
.center { text-align: center; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

/* ------------------------------------------------------------- blocks */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 6px; align-items: center; }
.spread { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ------------------------------------------------------------- controls */

button, .btn {
  font: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 13px 18px;
  background: var(--bg-lift);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
}
button:hover:not(:disabled), .btn:hover { filter: brightness(1.12); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--pop);
  outline-offset: 2px;
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-pop     { background: var(--pop); color: #fff; }
.btn-ghost   { background: transparent; border-color: var(--line); color: var(--ink-dim); }
.btn-danger  { background: transparent; border-color: var(--line); color: var(--bad); }
.btn-block   { width: 100%; }
.btn-sm      { padding: 8px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }

input[type="text"], textarea, select {
  font: inherit;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  min-height: 46px;
}
textarea { resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }

label.field { display: block; }
label.field > span { display: block; font-size: 14px; color: var(--ink-dim); margin-bottom: 6px; font-weight: 600; }

.counter { font-size: 13px; color: var(--ink-faint); text-align: right; margin-top: 4px; }
.counter.over { color: var(--bad); }

/* ------------------------------------------------------------- home */

.hero { text-align: center; padding: 12px 0 22px; }
.hero h1 { font-size: 38px; }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  padding-left: 0.35em;
}

.game-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .game-grid { grid-template-columns: 1fr 1fr; } }

.game-card {
  text-align: left;
  align-items: stretch;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 0;
}
.game-card[aria-pressed="true"] { border-color: var(--accent); background: #2b2440; }
.game-card:disabled { opacity: 0.5; }
.game-card .gc-top { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 800; }
.game-card .gc-emoji { font-size: 22px; }
.game-card .gc-tag { font-weight: 500; font-size: 14px; color: var(--ink-dim); }
.game-card .gc-meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 6px; font-weight: 600; }

/* ------------------------------------------------------------- room */

.roomcode {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 0.16em;
  padding-left: 0.16em;
  color: var(--accent);
  line-height: 1.05;
}

.players { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-lift);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 14.5px;
  font-weight: 600;
}
.pill.is-you { border-color: var(--accent); }
.pill.is-done { border-color: var(--good); color: var(--good); }
.pill .tick { font-size: 12px; }
.pill .x { cursor: pointer; color: var(--ink-faint); font-weight: 800; }
.pill .x:hover { color: var(--bad); }

.progress { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width 0.3s ease; }

/* ------------------------------------------------------------- game bits */

.prompt-box {
  background: linear-gradient(160deg, #2c2544, #221e33);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}

.sentence {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.4;
  background: var(--bg-lift);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.sentence.hidden-now {
  color: transparent;
  background: repeating-linear-gradient(45deg, #1b1828, #1b1828 10px, #201c2f 10px, #201c2f 20px);
  user-select: none;
}

.timer-ring { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); }

.chain { display: grid; gap: 0; }
.chain-item { padding: 14px 0; border-bottom: 1px dashed var(--line-soft); }
.chain-item:last-child { border-bottom: 0; }
.chain-item .who { font-size: 13px; color: var(--ink-faint); font-weight: 700; margin-bottom: 3px; }
.chain-item .what { font-size: 18px; line-height: 1.4; }
.chain-item.is-first .what { color: var(--accent); }
.chain-item.is-last .what { color: var(--pop); font-weight: 700; }
.chain-item .auto-tag { font-size: 12px; color: var(--ink-faint); font-style: italic; }

.answer-btn {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  background: var(--bg-lift);
  border: 1px solid var(--line);
  font-weight: 600;
  line-height: 1.35;
  padding: 15px 16px;
}
.answer-btn[aria-pressed="true"] { border-color: var(--accent); background: #2b2440; }
.answer-btn.is-truth { border-color: var(--good); }
.answer-btn.is-picked-wrong { border-color: var(--bad); }
.answer-btn .who { display: block; font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; font-weight: 700; }

.scoreboard { display: grid; gap: 8px; }
.score-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--bg-lift);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.score-row.rank-1 { border-color: var(--accent); }
.score-row .rank { color: var(--ink-faint); font-weight: 800; }
.score-row .pts { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.score-row .delta { font-size: 13px; color: var(--good); font-weight: 700; }

.waiting { display: flex; align-items: center; gap: 10px; color: var(--ink-dim); }
.dots::after {
  content: "";
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--bad);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: min(92vw, 460px);
  text-align: center;
}
.toast.ok { background: var(--good); color: #08240f; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
