/* ═══════════════════════════════════════════════════════════════════════════
   ItsOneOfUs – Global Stylesheet
   Cinematic black & crimson theme  ·  Impact + Barlow
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Barlow:wght@400;500;600&display=swap');

/* ── Custom Properties ──────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:          #000000;
  --bg2:         #0c0c0c;
  --bg3:         #141414;
  --card:        #0f0f0f;

  /* Borders */
  --border:      #1f1f1f;
  --border-hi:   #3d0a14;

  /* Brand red — matched to logo */
  --red:         #A00018;
  --red-light:   #C8001E;
  --red-bright:  #e8001e;
  --red-dim:     #5c000f;
  --red-glow:    rgba(160, 0, 24, 0.18);

  /* Status colours */
  --green:       #1a8a40;
  --green-light: #22b050;
  --blue:        #1a5a9a;
  --blue-light:  #2274c8;
  --purple:      #7b2d8b;
  --purple-light:#9b3dab;

  /* Typography */
  --text:        #F2F2F2;
  --text-dim:    #7a7a7a;
  --text-faint:  #383838;

  /* Fonts */
  --font-display: 'Barlow Condensed', Impact, sans-serif;
  --font-sans:    'Barlow', system-ui, -apple-system, sans-serif;
  --font-mono:    'Courier New', monospace;

  /* Misc */
  --radius:      4px;
  --radius-lg:   8px;
  --shadow:      0 4px 32px rgba(0,0,0,0.9);
  --shadow-red:  0 0 28px rgba(160,0,24,0.14);
  --transition:  180ms ease;
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Prevent font size inflation on iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background:
    linear-gradient(rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.88)),
    url('../../Images/blackthorn-manor.webp') center center / cover no-repeat fixed,
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  /* Prevent overscroll bounce on iOS */
  overscroll-behavior: none;
}

a { color: var(--red-light); text-decoration: none; }
a:hover { color: var(--red-bright); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--text); }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); color: var(--text); }
h3 { font-size: 1.1rem; color: var(--text-dim); }

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}
.container--narrow { max-width: 540px; }
.container--wide   { max-width: 1100px; }

/* ── Site Header ────────────────────────────────────────────────────────── */
.site-header {
  background: #000;
  border-bottom: 1px solid var(--border-hi);
  /* respect iOS notch */
  padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
  padding-top: env(safe-area-inset-top, 0);
  height: calc(54px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.8);
}

.site-header .logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.site-header .logo-img {
  height: 30px;
  width: auto;
}

.site-header .room-badge {
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius);
  letter-spacing: 0.14em;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card--highlight {
  border-color: var(--border-hi);
  box-shadow: var(--shadow-red);
}

.card__title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--red-light);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card__title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--red);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  /* 44px min-height = recommended mobile touch target */
  min-height: 44px;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  /* Prevent double-tap zoom */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled, .btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary = crimson red (replaces btn--gold as the main CTA) */
.btn--gold {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn--gold:hover {
  background: var(--red-light);
  border-color: var(--red-light);
  box-shadow: 0 0 16px rgba(160,0,24,0.35);
}

.btn--outline {
  background: transparent;
  color: #fff;
  border-color: #444;
}
.btn--outline:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.btn--red {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn--red:hover {
  background: var(--red-light);
  border-color: var(--red-light);
  box-shadow: 0 0 16px rgba(160,0,24,0.35);
}

.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn--ghost:hover { color: var(--text); border-color: #444; }

.btn--lg { padding: 0.95rem 2rem; font-size: 1.05rem; min-height: 52px; border-radius: var(--radius-lg); }
.btn--sm { padding: 0.45rem 0.9rem; font-size: 0.78rem; min-height: 38px; }
.btn--block { width: 100%; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  /* 16px minimum prevents iOS from zooming in on focus */
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  transition: border-color var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  /* Prevent double-tap zoom on mobile */
  touch-action: manipulation;
}

::placeholder { color: var(--text-faint); }

input:focus, select:focus, textarea:focus {
  border-color: var(--red-dim);
  box-shadow: 0 0 0 3px rgba(160,0,24,0.12);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A00018' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}

select option { background: var(--bg3); color: var(--text); }
textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}
.form-row .form-group { flex: 1; margin-bottom: 0; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid;
}

.badge--setup    { color: var(--text-dim); border-color: var(--border); background: transparent; }
.badge--questions{ color: #4a9eff; border-color: #1a5aaa; background: rgba(26,90,170,0.15); }
.badge--briefings{ color: #ff9a00; border-color: #aa6000; background: rgba(170,96,0,0.12); }
.badge--voting   { color: #ff4444; border-color: var(--red); background: rgba(160,0,24,0.15); }
.badge--reveal   { color: #44dd88; border-color: #1a8840; background: rgba(26,136,64,0.12); }
.badge--complete { color: #cc88ff; border-color: #7b2d8b; background: rgba(123,45,139,0.12); }
.badge--active   { color: var(--green-light); border-color: var(--green); background: rgba(26,138,64,0.1); }

/* ── Player List ────────────────────────────────────────────────────────── */
.player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  transition: border-color var(--transition);
}

.player-item:hover { border-color: var(--border-hi); }

.player-item__order {
  width: 1.4rem;
  height: 1.4rem;
  background: var(--red-dim);
  color: #fff;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
}

.player-item__name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
}

.player-item__role {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.player-item__remove {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1rem;
  /* Larger tap target */
  min-width: 40px;
  min-height: 40px;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: color var(--transition);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.player-item__remove:hover { color: var(--red-light); }

/* ── Character Chooser (Setup) ─────────────────────────────────────────── */
.char-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.char-pick {
  display: block;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 0.85rem;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.char-pick--selected {
  border-color: var(--red);
  background: rgba(160,0,24,0.08);
  box-shadow: 0 0 0 1px rgba(160,0,24,0.25);
}

.char-pick__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.char-pick__name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.2;
}

.char-pick__check-wrap {
  flex-shrink: 0;
}

.char-pick__check {
  width: 22px;
  height: 22px;
  accent-color: var(--red);
  cursor: pointer;
  touch-action: manipulation;
}

.char-pick__occ {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.char-pick__bio {
  font-size: 0.86rem;
  color: #cfcfcf;
  line-height: 1.45;
}

/* ── Phase Panel ────────────────────────────────────────────────────────── */
.phase-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.phase-panel__header {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.phase-panel__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.phase-panel__body { padding: 1.5rem; }

/* ── Turn Card ──────────────────────────────────────────────────────────── */
.turn-card {
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-red);
}

.turn-card__who {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.turn-card__label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
}

.turn-card__prompt {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-style: italic;
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

/* ── Progress Bar ───────────────────────────────────────────────────────── */
.progress-bar {
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  margin: 0.75rem 0;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-dim), var(--red-light));
  border-radius: 2px;
  transition: width 500ms ease;
}

/* ── Overlay System ─────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  text-align: center;
  animation: fadeIn 220ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay--hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.overlay--neutral { background: #000; }

.overlay--neutral .overlay__icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.2;
}

.overlay__eyebrow {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.overlay__name {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 4rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  margin-bottom: 0.5rem;
  line-height: 1.05;
}

.overlay__sub {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 2.5rem;
}

/* Secret message */
.overlay--secret {
  background: radial-gradient(ellipse at center, #1a0005 0%, #000 70%);
}

/* Killer reveal secret — darker, more intense */
.overlay--killer {
  background: radial-gradient(ellipse at center, #2a0008 0%, #0a0000 60%, #000 100%);
}

.secret-scroll--killer {
  border-color: var(--red-bright);
  box-shadow: 0 0 60px rgba(200,0,30,0.25), var(--shadow);
}

.secret-scroll--killer .secret-scroll__eyebrow {
  color: var(--red-bright);
  letter-spacing: 0.2em;
}

.secret-scroll--killer .secret-scroll__warning {
  color: var(--red-dim);
}

.secret-scroll {
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  /* Ensure it never exceeds screen height with scroll if needed */
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  box-shadow: var(--shadow-red), var(--shadow);
  position: relative;
}

.secret-scroll::before {
  content: '✦';
  position: absolute;
  top: -0.7rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--red-light);
  font-size: 1rem;
  background: var(--bg2);
  padding: 0 0.4rem;
}

.secret-scroll__eyebrow {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--red-dim);
  margin-bottom: 1rem;
}

.secret-scroll__message {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.75rem;
}

.secret-scroll__warning {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

/* ── Vote Screen ────────────────────────────────────────────────────────── */
.vote-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 1.5rem;
}

.vote-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Generous tap target */
  padding: 1rem 1.1rem;
  min-height: 52px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
  text-align: left;
  color: var(--text);
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.vote-item:hover { border-color: var(--red-dim); background: rgba(160,0,24,0.04); }

.vote-item.selected {
  border-color: var(--red);
  background: rgba(160,0,24,0.1);
  color: #fff;
}

.vote-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all var(--transition);
}
.vote-item.selected .vote-item__dot {
  background: var(--red);
  border-color: var(--red);
}

/* ── Reveal Screen ──────────────────────────────────────────────────────── */
.reveal-solution {
  text-align: center;
  padding: 1.5rem 1rem;
}

.reveal-solution__label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.reveal-solution__name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--red-light);
  margin-bottom: 0.25rem;
}

.reveal-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.reveal-detail {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.reveal-detail__label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}

.reveal-detail__value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}

.narrative-text {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text-dim);
  font-style: italic;
  background: var(--bg2);
  border-left: 3px solid var(--red-dim);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
}

/* ── Vote Table ─────────────────────────────────────────────────────────── */
.vote-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.vote-table th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.vote-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--bg3);
  color: var(--text);
}

.vote-table tr:last-child td { border-bottom: none; }
.vote-table tr.correct-row td { color: var(--green-light); }
.vote-table tr.wrong-row td   { color: var(--text-dim); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 0.7rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 2000;
  opacity: 1;
  transition: opacity 400ms, transform 400ms;
  pointer-events: none;
  white-space: nowrap;
}

.toast--hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(1rem);
}

.toast--error   { border-color: var(--red);   color: #ff6666; }
.toast--success { border-color: var(--green);  color: var(--green-light); }

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin ──────────────────────────────────────────────────────────────── */
.admin-header {
  background: #000;
  border-bottom: 1px solid var(--border-hi);
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-header .logo-img {
  height: 28px;
  width: auto;
}

.admin-header h1 {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0;
  letter-spacing: 0.08em;
}

.import-result {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
}

.import-result .ok   { color: var(--green-light); }
.import-result .warn { color: #ff9a00; }
.import-result .err  { color: #ff4444; }

.import-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.import-tab {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--transition);
}

.import-tab.active,
.import-tab:hover {
  border-color: var(--red-dim);
  color: #fff;
  background: rgba(160,0,24,0.08);
}

/* ── Landing Page ───────────────────────────────────────────────────────── */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 25% 15%, rgba(160,0,24,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 85%, rgba(160,0,24,0.05) 0%, transparent 50%),
    #000;
}

.landing__logo-img {
  width: min(480px, 90vw);
  height: auto;
  margin-bottom: 1.5rem;
  display: block;
}

.landing__tagline {
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 3rem;
}

.landing__divider {
  width: 48px;
  height: 2px;
  background: var(--red);
  margin: 0 auto 3rem;
  border-radius: 1px;
}

.landing__actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 340px;
}

.landing__story-picker {
  text-align: left;
  margin-bottom: 0.25rem;
}

.join-form {
  display: flex;
  gap: 0.5rem;
}

.landing__footer {
  position: fixed;
  bottom: 1rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-decoration: none;
}
.landing__footer:hover { color: var(--text-dim); text-decoration: none; }

/* ── Utility ────────────────────────────────────────────────────────────── */
.text-gold      { color: var(--red-light); }   /* legacy alias → red */
.text-dim       { color: var(--text-dim); }
.text-faint     { color: var(--text-faint); }
.text-red       { color: #ff4444; }
.text-green     { color: var(--green-light); }
.text-center    { text-align: center; }
.text-serif     { font-family: var(--font-sans); }
.text-mono      { font-family: var(--font-mono); }
.text-sm        { font-size: 0.82rem; }
.text-xs        { font-size: 0.72rem; }
.text-lg        { font-size: 1.15rem; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.08em; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex            { display: flex; }
.flex-wrap       { flex-wrap: wrap; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1           { gap: 0.5rem; }
.gap-2           { gap: 1rem; }

.hidden  { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Confirm Modal ──────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: fadeIn 150ms ease;
}
.modal-backdrop.hidden { display: none !important; }

.modal-confirm {
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.75rem 1.5rem;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow), var(--shadow-red);
}

.modal-confirm__title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.modal-confirm__msg {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.modal-confirm__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ── Narrator Screen (host reads between phases) ────────────────────────── */
.narrator-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(1.5rem, 6vw, 3rem) clamp(1.25rem, 5vw, 2.5rem);
  padding-top: max(2rem, env(safe-area-inset-top, 2rem));
  animation: fadeIn 300ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.narrator-screen.hidden { display: none !important; }

.narrator-card {
  max-width: 560px;
  width: 100%;
}

.narrator-card__eyebrow {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1rem;
}

.narrator-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1.05;
  margin-bottom: 1.25rem;
}

.narrator-card__divider {
  width: 40px;
  height: 2px;
  background: var(--red);
  margin: 0 0 1.5rem;
  border-radius: 1px;
}

.narrator-card__text {
  font-size: 1.05rem;
  color: #aaa;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.narrator-card__tidbits {
  list-style: none;
  margin: 0 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.narrator-card__tidbits li {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding-left: 1.25rem;
  position: relative;
}

.narrator-card__tidbits li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--red-dim);
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE — primary target, design from the ground up for small screens
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  html { font-size: 17px; }
  .text-sm { font-size: 0.92rem; }
  .text-xs { font-size: 0.84rem; }

  /* ── Layout ─────────────────────────────────────────────────────────── */
  .container { padding: 0.75rem 1rem; }

  /* ── Header ─────────────────────────────────────────────────────────── */
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding: 0.6rem 1rem;
    gap: 0.5rem;
  }
  .site-header .logo-img { height: 26px; }
  .site-header .room-badge { font-size: 0.82rem; padding: 0.2rem 0.55rem; }

  /* ── Cards ──────────────────────────────────────────────────────────── */
  .card { padding: 1.1rem; }
  .phase-panel__body { padding: 1rem; }

  /* ── Form layout ────────────────────────────────────────────────────── */
  .form-row { flex-direction: column; gap: 0.6rem; }
  .form-row .form-group { margin-bottom: 0; }

  /* ── Phase panel header ─────────────────────────────────────────────── */
  .phase-panel__header { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .phase-panel__title  { font-size: 1rem; }

  /* ── Buttons ────────────────────────────────────────────────────────── */
  .btn--lg {
    font-size: 1rem;
    padding: 0.9rem 1.5rem;
    min-height: 52px;
  }

  /* ── Turn card ──────────────────────────────────────────────────────── */
  .turn-card { padding: 1.25rem 1rem; }
  .turn-card__who {
    font-size: clamp(1.6rem, 7vw, 2rem);
  }
  .turn-card__prompt {
    font-size: 1rem;
    padding: 0.65rem 0.85rem;
  }

  /* ── Player list ────────────────────────────────────────────────────── */
  .player-item { padding: 0.65rem 0.75rem; }
  .player-item__name { font-size: 0.95rem; }
  .player-item__role { font-size: 0.82rem; }

  .char-pick { padding: 0.75rem 0.75rem; }
  .char-pick__name { font-size: 1rem; }
  .char-pick__occ { font-size: 0.84rem; }
  .char-pick__bio { font-size: 0.95rem; }

  /* ── Overlay names ─────────────────────────────────────────────────── */
  .overlay__name {
    font-size: clamp(2rem, 10vw, 3rem);
    margin-bottom: 0.4rem;
  }
  .overlay__sub { font-size: 0.9rem; margin-bottom: 1.75rem; }

  /* ── Secret scroll ──────────────────────────────────────────────────── */
  .secret-scroll {
    padding: 1.5rem 1.25rem;
    max-height: 90vh;
  }
  .secret-scroll__message { font-size: 1rem; }

  /* ── Vote list ──────────────────────────────────────────────────────── */
  .vote-list { gap: 0.6rem; }
  .vote-item { font-size: 1rem; min-height: 52px; padding: 1rem 1rem; }

  /* ── Reveal ─────────────────────────────────────────────────────────── */
  .reveal-details { grid-template-columns: 1fr 1fr; }
  .reveal-solution__name { font-size: clamp(1.6rem, 6vw, 2.4rem); }

  /* ── Landing ────────────────────────────────────────────────────────── */
  .landing__logo-img  { width: min(340px, 90vw); }
  .landing__tagline   { font-size: 0.82rem; letter-spacing: 0.12em; }
  .landing__actions   { max-width: 100%; }
  .join-form input    { font-size: 1rem; }

  /* ── Narrator screen ────────────────────────────────────────────────── */
  .narrator-screen { padding: 1.5rem 1.25rem; justify-content: flex-start; padding-top: 2rem; }
  .narrator-card__title { font-size: clamp(1.6rem, 6vw, 2.2rem); }
  .narrator-card__text  { font-size: 1rem; line-height: 1.7; }
  .narrator-card__tidbits li { font-size: 0.9rem; }

  /* ── Confirm modal ──────────────────────────────────────────────────── */
  .modal-confirm { padding: 1.4rem; }
  .modal-confirm__msg { font-size: 1rem; }
  .modal-confirm__actions { flex-direction: column-reverse; gap: 0.5rem; }
  .modal-confirm__actions .btn { width: 100%; justify-content: center; }

  /* ── Progress bar — slightly taller to see on small screens ─────────── */
  .progress-bar { height: 4px; }

  /* ── Vote confirm / back overlays ───────────────────────────────────── */
  #overlay-pass   .overlay__sub,
  #overlay-back   .overlay__name { font-size: clamp(1.4rem, 7vw, 2rem); }
}

/* Very small phones (< 380px) ─────────────────────────────────────────── */
@media (max-width: 380px) {
  html             { font-size: 16px; }
  .overlay__name    { font-size: clamp(1.5rem, 9vw, 2.2rem); }
  .turn-card__who   { font-size: clamp(1.4rem, 8vw, 1.8rem); }
  .btn--lg          { font-size: 1rem; padding: 0.85rem 1.25rem; }
  .card__title      { font-size: 0.82rem; }
}
