/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1A1A1A;
  --surface: #242424;
  --surface-2: #2e2e2e;
  --text: #F5ECD7;
  --text-muted: #9A8E7A;
  --accent: #8B3A2A;
  --comedy: #D4A82A;
  --comedy-dark: #7a5e10;
  --rsl: #A8341F;
  --rsl-dark: #6B2010;
  --show: #2A4F6E;
  --show-dark: #1A3245;
  --play: #2A6B45;
  --play-dark: #1A4A2E;
  --gold: #E3B23C;
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.hidden { display: none; }
.hidden { display: none !important; }

/* ===== SETUP ===== */
#setup-screen { background: var(--bg); }

.setup-header {
  text-align: center;
  padding: 2.25rem 1.5rem 1.25rem;
  border-bottom: 1px solid #333;
}
.game-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.setup-header h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: 0.5px; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

.setup-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; flex: 1; }

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.count-selector { display: flex; gap: 0.5rem; }
.count-btn {
  flex: 1;
  padding: 0.6rem 0;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.count-btn:hover { background: var(--surface-2); color: var(--text); }
.count-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.player-row {
  display: grid;
  grid-template-columns: 36px 1.6fr 2fr 1.6fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.char-preview-img {
  width: 36px;
  height: 54px;
  border-radius: 4px;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  flex-shrink: 0;
}

input[type="text"], select {
  width: 100%;
  background: var(--surface);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus, select:focus { border-color: var(--text-muted); }
select option { background: #2a2a2a; }

/* Toggle */
.family-mode-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.toggle-label { display: flex; flex-direction: column; gap: 0.2rem; }
.toggle-label.small { font-size: 0.85rem; }
.toggle-hint { font-size: 0.72rem; color: var(--text-muted); }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #3a3a3a; border-radius: 12px; transition: 0.2s; cursor: pointer; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: #2A6B45; }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== BUTTONS ===== */
.btn-primary {
  width: 100%;
  padding: 1rem;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: none;
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--fail, #8B3A2A); color: #e57373; }

.btn-allplayers {
  background: var(--surface);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-allplayers:hover { background: var(--surface-2); }
.btn-allplayers.small { padding: 0.4rem 0.6rem; }

/* ===== TURN SCREEN ===== */
#turn-screen { background: var(--bg); }

.char-card-wrap {
  width: 42px;
  height: 63px;
  border-radius: 5px;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  flex-shrink: 0;
}

.turn-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid #2a2a2a;
}
.player-info { flex: 1; min-width: 0; }
.player-name-display { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.player-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.dot { margin: 0 0.3rem; }

.token-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.1rem;
  background: var(--surface);
  border-bottom: 1px solid #2a2a2a;
  flex-wrap: wrap;
}
.token-bar-label { font-size: 1rem; font-weight: 700; color: var(--gold); flex-shrink: 0; }
.token-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.token-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #2a2410;
  border: 1px solid #5a4a20;
  color: var(--gold);
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 0.18rem 0.6rem 0.18rem 0.18rem;
  cursor: pointer;
}
.token-chip.empty {
  background: transparent;
  border-style: dashed;
  border-color: #3a3a3a;
  color: var(--text-muted);
  cursor: default;
  padding: 0.25rem 0.6rem;
}
.token-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.turn-body { flex: 1; padding: 1rem 1.1rem; overflow-y: auto; }
.section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 0.6rem; }
.section-hint { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.8; margin-left: 0.4rem; }

/* Hand grid — each card ~1/16 of screen */
.hand-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.hand-card {
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  position: relative;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: transform 0.1s;
}
.hand-card:active { transform: scale(0.97); }
.hand-card-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 0.62rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 0.5rem 0.2rem 0.25rem;
  line-height: 1.1;
}
.hand-empty { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; padding: 0.5rem 0; }

/* Your-turn / Interrupt corner badge on cards */
.card-type-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.7rem;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
}
.card-type-badge.your_turn { box-shadow: 0 0 0 1.5px #D4A82A; }
.card-type-badge.interrupt  { box-shadow: 0 0 0 1.5px #A8341F; }

.turn-actions { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.5rem 1.1rem 0.75rem; }
.btn-cash {
  width: 100%;
  padding: 0.8rem;
  background: #2a2410;
  border: 1px solid #5a4a20;
  border-radius: var(--radius);
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-cash:hover { background: #352f18; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.1rem 1rem;
  border-top: 1px solid #2a2a2a;
}

/* ===== DRAW / PERFORM ===== */
#draw-screen { background: var(--bg); }

.draw-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.1rem;
}
.draw-header.comedy { background: var(--comedy-dark); }
.draw-header.rsl { background: var(--rsl-dark); }
.draw-header.royal_show { background: var(--show-dark); }
.draw-header.school_play { background: var(--play-dark); }
.draw-venue-label { flex: 1; font-size: 1rem; font-weight: 600; }

.back-btn {
  background: rgba(0,0,0,0.25);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}
.back-btn:hover { background: rgba(0,0,0,0.4); }

.draw-body { flex: 1; padding: 1.25rem 1.1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; overflow-y: auto; }

.drawn-card {
  width: 190px;
  max-width: 55vw;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.drawn-card-meta { text-align: center; }
.drawn-card-title { font-size: 1.3rem; font-weight: 700; }
.drawn-card-animal { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }
.drawn-card-power { font-size: 0.85rem; color: var(--gold); margin-top: 0.5rem; font-style: italic; line-height: 1.4; }

.perform-block { width: 100%; background: var(--surface); border-radius: var(--radius); padding: 1rem; }
.prompt-text { font-size: 1.1rem; line-height: 1.6; color: var(--text); margin: 0.5rem 0; }
.prompt-text.muted { color: var(--text-muted); font-style: italic; }

.timer-block { display: flex; align-items: center; gap: 1rem; background: var(--surface-2); border-radius: var(--radius); padding: 0.6rem 0.8rem; margin: 0.75rem 0; }
.timer-display { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.2rem; }
.timer-display.warning { color: #ef5350; }
.btn-timer { flex: 1; padding: 0.55rem 1rem; background: #3a3a3a; border: none; border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.btn-timer.running { background: #4a1010; color: #ef9a9a; }

.success-block { display: flex; align-items: flex-start; gap: 0.7rem; background: var(--surface-2); border-radius: var(--radius); padding: 0.8rem; margin-top: 0.75rem; }
.success-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.1rem; }
.success-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 0.25rem; }
.success-text { font-size: 0.88rem; line-height: 1.5; }

.prompt-footer { display: flex; gap: 0.75rem; padding: 0.75rem 1.1rem 1.25rem; }
.btn-fail, .btn-pass {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.4px;
  transition: filter 0.15s, transform 0.1s;
}
.btn-fail:active, .btn-pass:active { transform: scale(0.97); }
.btn-fail { background: #3a1a1a; color: #ef9a9a; border: 1px solid #5a2a2a; }
.btn-fail:hover { background: #4a2020; }
.btn-pass { background: #1a3a1a; color: #a5d6a7; border: 1px solid #2a5a2a; }
.btn-pass:hover { background: #204020; }

/* ===== VERDICT ===== */
#verdict-screen { background: var(--bg); }
.verdict-topbar { width: 100%; display: flex; justify-content: flex-end; padding: 0.8rem 1.1rem 0; flex-shrink: 0; }
.verdict-content { text-align: center; padding: 1rem 1.5rem 2rem; max-width: 360px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; }
.verdict-icon { font-size: 3.5rem; }
.verdict-content h2 { font-size: 1.5rem; }
.verdict-content p { color: var(--text-muted); line-height: 1.55; }
.verdict-card {
  width: 150px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  margin: 0.5rem 0;
}
.verdict-content .btn-primary { margin-top: 0.5rem; }
.verdict-change { font-size: 0.78rem; }
.verdict-override { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.override-btn {
  padding: 0.7rem;
  background: var(--surface);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.override-btn:hover { background: var(--surface-2); }

/* ===== WIN ===== */
#win-screen { background: var(--bg); align-items: center; justify-content: center; }
.win-content { text-align: center; padding: 2rem; max-width: 340px; }
.win-icon { font-size: 4rem; margin-bottom: 1rem; }
.win-content h2 { font-size: 1.6rem; margin-bottom: 0.75rem; }
.win-content p { color: var(--text-muted); line-height: 1.6; margin-bottom: 1.5rem; }

/* ===== MODALS (possessions + card sheet) ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; }
.modal.hidden { display: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.65); }
.modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.modal-content.tall { max-height: 90vh; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid #3a3a3a;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close { background: var(--surface-2); border: none; border-radius: 50%; width: 30px; height: 30px; color: var(--text-muted); font-size: 0.8rem; cursor: pointer; }
.modal-body { overflow-y: auto; padding: 1rem 1.25rem 2rem; flex: 1; }

.token-btn {
  width: 30px; height: 30px;
  background: var(--surface-2);
  border: none; border-radius: 50%;
  color: var(--text); font-size: 1.2rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.token-btn:hover { background: #3a3a3a; }

/* Possessions */
.poss-player { padding: 0.9rem 0; border-bottom: 1px solid #2a2a2a; }
.poss-player.current { background: rgba(227,178,60,0.06); border-radius: var(--radius); padding: 0.9rem 0.75rem; margin: 0 -0.25rem; }
.poss-head { margin-bottom: 0.6rem; }
.poss-name { font-size: 1.05rem; font-weight: 700; }
.poss-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.poss-subtitle { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin: 0.6rem 0 0.4rem; }
.poss-token-controls { display: flex; align-items: center; gap: 0.5rem; }
.poss-hand { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.poss-card {
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
  border: 1px solid #3a3a3a;
  position: relative;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.poss-card .hand-card-label { font-size: 0.5rem; padding: 0.35rem 0.1rem 0.15rem; }
.poss-hand-empty { font-size: 0.8rem; color: var(--text-muted); }

/* Card sheet */
.sheet-card {
  width: 160px;
  aspect-ratio: 2 / 3;
  margin: 0 auto 1rem;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}
.sheet-animal {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.sheet-type {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  margin: 0 auto 0.75rem;
  width: fit-content;
  max-width: 100%;
}
.sheet-type.your_turn { background: rgba(212,168,42,0.12); border: 1px solid #6a5218; color: #D4A82A; }
.sheet-type.interrupt  { background: rgba(168,52,31,0.15);  border: 1px solid #6a2010; color: #e07060; }

.sheet-timing-note {
  font-size: 0.8rem;
  color: #e07060;
  background: rgba(168,52,31,0.12);
  border: 1px solid #6a2010;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.sheet-power-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 0.3rem; }
.sheet-power { font-size: 0.95rem; line-height: 1.6; color: var(--text); }
.sheet-affinity { font-size: 0.82rem; line-height: 1.5; color: var(--text-muted); margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #3a3a3a; }
.sheet-actions { margin-top: 1.25rem; }

/* ===== JOIN SCREEN ===== */
#join-screen { background: var(--bg); }

.join-header {
  text-align: center;
  padding: 2.25rem 1.5rem 1.25rem;
  border-bottom: 1px solid #333;
}
.join-header h1 { font-size: 1.75rem; font-weight: 700; }

.join-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; overflow-y: auto; }

.join-player-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, border-color 0.15s;
}
.join-player-card:hover { background: var(--surface-2); border-color: #5a5a5a; }
.join-player-card:active { transform: scale(0.98); }

.join-char-img {
  width: 48px;
  height: 72px;
  border-radius: 6px;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  flex-shrink: 0;
}
.join-player-info { flex: 1; min-width: 0; }
.join-player-name { font-size: 1.1rem; font-weight: 700; }
.join-player-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }
.join-player-stats { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ===== SPECTATE SCREEN ===== */
#spectate-screen { background: var(--bg); }

.spectate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid #2a2a2a;
}
.spectate-turn-info { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.spectate-active-name { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.spectate-active-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.spectate-phase-label { font-size: 0.78rem; color: var(--gold); margin-top: 0.2rem; font-style: italic; }

.spectate-drawn-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  background: var(--surface);
  border-bottom: 1px solid #2a2a2a;
}
.spectate-drawn-card {
  width: 52px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  border: 1px solid #3a3a3a;
  flex-shrink: 0;
}
.spectate-drawn-title { font-size: 0.88rem; font-weight: 600; }

.spectate-hand-section { flex: 1; padding: 1rem 1.1rem; overflow-y: auto; }

.spectate-footer {
  padding: 0.6rem 1.1rem 1rem;
  border-top: 1px solid #2a2a2a;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== SETTINGS ROW BUTTONS ===== */
.settings-btns { display: flex; gap: 0.4rem; }

/* ===== JOIN SCREEN EXTRAS ===== */
.join-back-row { padding: 0 0 0.5rem; }
.join-back-btn { font-size: 0.85rem; }
.join-player-card.active {
  border-color: var(--gold);
  background: rgba(227,178,60,0.08);
}
.join-player-turn {
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* ===== SETUP EXTRAS ===== */
.sim-entry-btn { width: 100%; text-align: center; margin-top: -0.5rem; }

/* ===== SIMULATION SCREEN ===== */
#sim-screen { background: var(--bg); }

.sim-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}
.sim-title { font-size: 1rem; font-weight: 700; }

.sim-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sim-section {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.sim-section .form-label { margin-bottom: 0; }
.sim-hint { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

.sim-slider-group { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.25rem; }

.sim-slider-row {
  display: grid;
  grid-template-columns: 1fr auto 120px;
  align-items: center;
  gap: 0.6rem;
}
.sim-slider-label {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.sim-slider-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 3rem;
  text-align: right;
}
.sim-range {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}

.sim-results { padding: 0; }
.sim-results .sim-section:last-child { border-bottom: none; }

.sim-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  padding: 0.2rem 0;
}
.sim-stat-val { font-weight: 700; color: var(--gold); }

.sim-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.2rem 0;
}
.sim-bar-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-bar-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.sim-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.4s;
  min-width: 2px;
}
.sim-bar-pct { font-weight: 700; text-align: right; }

/* ===== SAVE MODAL ===== */
.save-name-row { display: flex; gap: 0.5rem; align-items: center; }
.save-name-row input { flex: 1; }
.btn-save-now {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-save-now:disabled { opacity: 0.5; }

.saves-empty { color: var(--text-muted); font-size: 0.85rem; padding: 0.5rem 0; }

.save-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #2a2a2a;
}
.save-item:last-child { border-bottom: none; }
.save-item-info { flex: 1; min-width: 0; }
.save-item-name { font-size: 0.95rem; font-weight: 600; }
.save-item-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; line-height: 1.4; }
.save-item-btns { display: flex; gap: 0.4rem; flex-shrink: 0; }
.btn-save-action {
  background: var(--surface-2);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-save-action:hover { border-color: #5a5a5a; }
.btn-save-action.delete { color: #ef9a9a; border-color: #5a2a2a; }
.btn-save-action.delete:hover { background: #3a1a1a; }

/* ===== GAME LOG MODAL ===== */
.log-entry {
  padding: 0.65rem 0;
  border-bottom: 1px solid #2a2a2a;
}
.log-entry:last-child { border-bottom: none; }
.log-entry-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.log-turn-num {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.log-player-name { font-size: 0.88rem; font-weight: 700; }
.log-outcome-badge {
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  flex-shrink: 0;
}
.log-outcome-badge.animal { background: rgba(139,58,42,0.25); color: #e07060; }
.log-outcome-badge.venue  { background: rgba(42,107,69,0.25); color: #81c784; }
.log-outcome-badge.power  { background: rgba(212,168,42,0.15); color: var(--gold); }
.log-outcome-badge.fail   { background: rgba(80,80,80,0.25); color: var(--text-muted); }
.log-outcome-badge.cash_pair { background: rgba(212,168,42,0.15); color: var(--gold); }
.log-entry-detail { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }
.log-entry-powers { font-size: 0.75rem; color: #c8a84b; margin-top: 0.2rem; }

/* ===== PERSISTENT GAME MENU ===== */
#game-menu-wrap {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 200;
}

/* Hide on draw screen (back button conflict) and sim screen */
body[data-phase="draw"] #game-menu-wrap,
body[data-phase="sim"] #game-menu-wrap { display: none; }

#game-menu-btn {
  width: 36px;
  height: 36px;
  background: rgba(26,26,26,0.88);
  border: 1px solid #484848;
  border-radius: 8px;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s;
}
#game-menu-btn:hover,
#game-menu-btn.open { background: rgba(50,50,50,0.96); border-color: #666; }

#game-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  background: var(--surface);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius);
  min-width: 188px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.65);
  overflow: hidden;
}

.game-menu-item {
  display: block;
  width: 100%;
  padding: 0.72rem 1rem;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid #2a2a2a;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.1s;
}
.game-menu-item:last-child { border-bottom: none; }
.game-menu-item:hover { background: var(--surface-2); }
.game-menu-item.danger { color: #ef9a9a; }
.game-menu-sep { height: 1px; background: #3a3a3a; }
