/* ═══════════════════════════════════════════
   DRACO ADVENTURE — Minimal Game Styles
   ═══════════════════════════════════════════ */

:root {
  --bg: #0f0f1a;
  --bg-surface: #16162a;
  --text: #e8e8e8;
  --text-dim: #888;
  --gold: #FFD700;
  --gold-dim: rgba(255, 215, 0, 0.3);
  --fire: #FF4136;
  --water: #0074D9;
  --grass: #2ECC40;
  --electric: #FFDC00;
  --psychic: #B10DC9;
  --spirit: #7B42A0;
  --font-pixel: "Press Start 2P", monospace;
  --font-body: "Space Mono", monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  min-height: 100dvh;
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  flex-direction: column;
  overflow: hidden;
}
.screen.active {
  display: flex;
}

/* ── Welcome ── */
.welcome-box {
  margin: auto;
  text-align: center;
  padding: 2rem;
  max-width: 400px;
}
.game-title {
  font-family: var(--font-pixel);
  font-size: 1.6rem;
  color: var(--gold);
  line-height: 1.8;
  margin-bottom: 1.5rem;
  letter-spacing: 2px;
}
.welcome-tagline {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-style: italic;
  margin-bottom: 2.5rem;
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.btn-link-codex {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-decoration: none;
  margin-top: 0.5rem;
  transition: color 0.2s;
}
.btn-link-codex:hover {
  color: var(--text);
}

/* ── Buttons ── */
.btn-primary {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover {
  background: rgba(255, 215, 0, 0.1);
}
.btn-secondary {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
}
.btn-secondary:hover {
  color: var(--text);
}

/* ── Onboarding ── */
.onboard-box {
  margin: auto;
  text-align: center;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  overflow-y: auto;
  max-height: 100%;
}
.onboard-title {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.onboard-hint {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.player-count-options {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.btn-count {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  width: 48px;
  height: 48px;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-count:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ── Name Inputs ── */
#name-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.text-input {
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: transparent;
  color: var(--text);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.6rem 0.4rem;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}
.text-input:focus {
  border-bottom-color: var(--gold);
}
.text-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* ── Egg Selection ── */
.egg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 320px;
  margin: 0 auto;
}
.egg-btn {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.8rem 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: border-color 0.2s, color 0.2s;
}
.egg-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
}
.egg-btn.selected {
  border-color: var(--gold);
  color: var(--text);
}
.egg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.egg-dot.fire { background: var(--fire); }
.egg-dot.water { background: var(--water); }
.egg-dot.grass { background: var(--grass); }
.egg-dot.electric { background: var(--electric); }
.egg-dot.psychic { background: var(--psychic); }
.egg-dot.spirit { background: var(--spirit); }

/* ── Load Screen ── */
#save-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
}
.save-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: border-color 0.2s;
}
.save-entry:hover {
  border-color: rgba(255, 255, 255, 0.3);
}
.save-name {
  font-size: 0.8rem;
}
.save-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.save-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
}
.save-delete:hover { color: var(--fire); }
.save-archive, .save-unarchive {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  padding: 0.2rem 0.5rem;
  transition: color 0.2s;
}
.save-archive:hover { color: var(--electric); }
.save-unarchive:hover { color: var(--grass); }
.archived-entry {
  opacity: 0.6;
  border-style: dashed;
}
.archived-entry:hover { opacity: 0.85; }
#archived-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-align: left;
}
.no-saves {
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 1rem;
}

/* ── Adventure Screen ── */
#screen-adventure {
  flex-direction: column;
}

/* Status bar */
.status-bar {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  line-height: 1.5;
}
.status-player {
  flex: 1;
  min-width: 140px;
  padding: 0.3rem 0;
}
.status-player-name {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  margin-bottom: 0.25rem;
}
.status-dragon {
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
}
.status-hp-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.2rem 0;
}
.status-hp-fill {
  height: 100%;
  background: var(--grass);
  transition: width 0.3s;
}
.status-hp-fill.low { background: var(--fire); }
.status-hp-fill.mid { background: var(--electric); }
.status-detail {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.35);
}
.status-items {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.15rem;
}

/* Dragon pills — clickable dragon selector */
.dragon-pills {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 0.15rem;
}
.dragon-pill {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  padding: 0.15rem 0.4rem;
  border-radius: 1rem;
  border: 1px solid var(--dragon-color);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s;
}
.dragon-pill.active {
  background: var(--dragon-color);
  color: #fff;
  box-shadow: 0 0 6px var(--dragon-color);
}
.dragon-pill:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.status-location {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: rgba(255, 255, 255, 0.25);
  width: 100%;
  text-align: center;
  padding-top: 0.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Narrative area */
.narrative {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.msg {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  line-height: 1.8;
  overflow-wrap: break-word;
  word-break: break-word;
}
.msg-narrator {
  color: var(--text);
  white-space: pre-wrap;
  background: rgba(255, 215, 0, 0.03);
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  position: relative;
}

/* Replay narration button */
.btn-replay-narrator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255, 215, 0, 0.2);
  color: rgba(255, 215, 0, 0.5);
  border-radius: 3px;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  line-height: 1;
}
.btn-replay-narrator:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.08);
}
.btn-replay-narrator svg {
  display: block;
}
.msg-player {
  color: var(--text-dim);
  font-size: 0.85rem;
}
.msg-player .player-label {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  margin-bottom: 0.2rem;
}
.msg-system {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
}

/* Narrative scene images */
.narrative-image {
  display: block;
  max-width: 200px;
  width: 100%;
  margin: 0.5rem auto 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.85;
}

/* Player selector */
.select-player {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 0.3rem 0.4rem;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}
.select-player option {
  background: var(--bg);
  color: var(--text);
}

/* Input area */
.input-area {
  flex-shrink: 0;
  padding: 0.6rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}
.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.input-row .text-input {
  flex: 1;
}
.btn-icon {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
}
.btn-icon:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
}
.btn-icon.recording {
  color: var(--fire);
  border-color: var(--fire);
  animation: pulse-rec 1s ease-in-out infinite;
}
@keyframes pulse-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.btn-send {
  color: var(--gold);
  border-color: var(--gold-dim);
}
.btn-send:hover {
  border-color: var(--gold);
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.4rem;
  padding-top: 0.3rem;
}
.btn-sm {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  transition: color 0.2s;
}
.btn-sm:hover { color: var(--text); }
.link-codex {
  text-decoration: none;
  margin-left: auto;
}
.select-model {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  outline: none;
}
.select-model option {
  background: var(--bg);
  color: var(--text);
}

/* Discoveries */
.discoveries-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  padding: 0.5rem;
}
.discoveries-panel .btn-sm {
  font-size: 0.55rem;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 0.3rem 0.6rem;
  border-radius: 2px;
}
.discoveries-panel .btn-sm:hover { color: #fff; border-color: var(--gold); }
.discoveries-list {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.6rem;
  max-height: 40vh;
  overflow-y: auto;
  font-size: 0.75rem;
  margin-top: 0.3rem;
  min-width: 220px;
}
.discovery-item {
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.discovery-item:last-child { border-bottom: none; }

/* Discovery notification toast */
.discovery-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--gold);
  background: var(--bg-surface);
  border: 1px solid var(--gold-dim);
  padding: 0.5rem 1rem;
  z-index: 100;
  animation: toast-fade 3s ease-in-out forwards;
}
@keyframes toast-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Status wrapper ── */
.status-wrapper {
  flex-shrink: 0;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* Collapsed status bar — hidden on desktop, shown on mobile */
.status-collapsed {
  display: none;
}

/* ── Voice icon button (mobile input row) — hidden on desktop ── */
.btn-voice {
  display: none;
}
.btn-voice.voice-on {
  color: var(--gold);
  border-color: var(--gold-dim);
}
.btn-voice .voice-on-wave {
  transition: opacity 0.2s;
}
.btn-voice:not(.voice-on) .voice-on-wave {
  opacity: 0;
}

/* ── More button (mobile) — hidden on desktop ── */
.btn-more {
  display: none;
}

/* ── Recording state glow on input row ── */
.input-row.recording-active {
  box-shadow: 0 0 8px rgba(255, 65, 54, 0.4);
  border-radius: 4px;
}

/* ── Bottom sheet ── */
.bottom-sheet-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
}
.bottom-sheet-overlay.open { display: block; }

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px 12px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 51;
  padding: 0.5rem 1rem calc(1rem + env(safe-area-inset-bottom));
  display: none;
}
.bottom-sheet.open {
  transform: translateY(0);
}
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 0 auto 0.75rem;
}
.bottom-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.bottom-sheet-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 1rem 0.75rem;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  text-decoration: none;
  display: block;
  min-height: 48px;
}
.bottom-sheet-btn:hover, .bottom-sheet-btn:active {
  background: rgba(255, 255, 255, 0.06);
}
.bottom-sheet-model {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bottom-sheet-model .select-model {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0.3rem 0.5rem;
}
.bottom-sheet-link {
  color: var(--text-dim);
}

/* ── Discoveries overlay (mobile drawer) ── */
.discoveries-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}
.discoveries-overlay.open { display: block; }

/* ── Transcript Screen ── */
.transcript-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--bg-surface);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1;
}
.transcript-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  margin: 0;
}
.transcript-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}
.transcript-entry {
  margin-bottom: 1rem;
}
.transcript-entry p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.8;
}
.transcript-entry.narrator p {
  color: var(--text);
  background: rgba(255, 215, 0, 0.03);
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
}
.transcript-entry.player p {
  color: var(--text-dim);
  font-size: 0.85rem;
}
.transcript-player-name {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  display: block;
  margin-bottom: 0.2rem;
}
.transcript-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem;
}

/* ── Utilities ── */
.hidden { display: none !important; }

/* Loading indicator */
.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ── Scrollbar (minimal) ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); }

/* ── Mobile ── */
@media (max-width: 600px) {
  body {
    /* Account for notched phones */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* Use dynamic viewport height so keyboard shrinks the container */
  #screen-adventure.active {
    position: relative;
    height: 100dvh;
  }

  .game-title { font-size: 1.2rem; }
  .onboard-title { font-size: 0.7rem; }
  .onboard-hint { font-size: 0.8rem; }
  .welcome-tagline { font-size: 0.75rem; }

  /* Egg grid — 2 cols with bigger touch targets */
  .egg-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .egg-btn {
    font-size: 0.6rem;
    padding: 1rem 0.5rem;
    min-height: 48px;
  }

  /* Bigger player count buttons */
  .btn-count {
    width: 56px;
    height: 56px;
    font-size: 1rem;
  }

  /* ── Status wrapper: collapsible on mobile ── */
  .status-wrapper {
    position: relative;
    z-index: 20;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .status-wrapper.status-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
  }

  /* Collapsed status bar — visible on mobile */
  .status-collapsed {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(22, 22, 42, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    align-items: center;
    min-height: 44px;
  }
  .status-collapsed-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    flex: 1;
    min-width: 0;
  }
  .status-collapsed-name {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    white-space: nowrap;
  }
  .status-collapsed-dragon {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .status-collapsed-hp {
    width: 50px;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    flex-shrink: 0;
  }
  .status-collapsed-hp-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
  }
  .status-collapsed-hp-pct {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    min-width: 30px;
  }
  .btn-status-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-left: auto;
  }
  .btn-status-toggle.expanded {
    transform: rotate(180deg);
  }

  /* Expandable detail status bar on mobile */
  .status-bar {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    font-size: 0.85rem;
    padding: 0;
    border-bottom: none;
    gap: 0.75rem;
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .status-bar.expanded {
    max-height: 500px;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
  }
  .status-player {
    min-width: 100%;
    flex-shrink: 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }
  .status-player:last-of-type { border-bottom: none; }
  .status-player-name {
    font-size: 0.6rem;
    margin-bottom: 0.4rem;
  }
  .status-dragon { font-size: 0.85rem; }
  .status-hp-bar { height: 5px; margin: 0.3rem 0; }
  .status-detail {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
  }
  .status-items {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.2rem;
  }
  .status-location {
    font-size: 0.55rem;
    padding-top: 0.4rem;
  }

  /* Dragon pills — proper touch targets on mobile */
  .dragon-pill {
    font-size: 0.55rem;
    padding: 0.45rem 0.75rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Narrative — iOS momentum scrolling, more padding */
  .narrative {
    padding: 0.6rem;
    -webkit-overflow-scrolling: touch;
  }
  .msg { font-size: 0.9rem; line-height: 1.7; }
  .msg-player { font-size: 0.8rem; }
  .msg-system { font-size: 0.75rem; }
  .narrative-image { max-width: 160px; }

  /* Replay button — bigger touch target on mobile */
  .btn-replay-narrator {
    padding: 0.4rem;
    min-width: 32px;
    min-height: 32px;
  }
  .btn-replay-narrator svg { width: 16px; height: 16px; }

  /* Input area — safe area padding at bottom */
  .input-area {
    padding: 0.5rem 0.6rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  }

  /* Bigger touch targets for mic/send */
  .btn-icon {
    width: 44px;
    height: 44px;
  }
  .btn-icon svg { width: 20px; height: 20px; }

  .input-row .text-input {
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
    padding: 0.5rem 0.3rem;
  }

  /* Player selector */
  .select-player {
    font-size: 0.5rem;
    padding: 0.4rem;
    min-height: 44px;
  }

  /* Toolbar — hidden on mobile (moved to bottom sheet) */
  .toolbar {
    display: none;
  }

  /* Voice icon button — visible on mobile */
  .btn-voice {
    display: flex;
  }

  /* More button — visible on mobile */
  .btn-more {
    display: flex;
  }

  /* Bottom sheet — visible on mobile */
  .bottom-sheet {
    display: block;
  }

  /* Discoveries panel — slide-out drawer on mobile */
  .discoveries-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 280px;
    max-width: 80vw;
    background: var(--bg-surface);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 41;
    padding: 1rem 0.6rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .discoveries-panel.hidden {
    display: flex !important;
    transform: translateX(100%);
  }
  .discoveries-panel.drawer-open {
    transform: translateX(0);
  }
  .discoveries-panel .btn-sm {
    font-size: 0.7rem;
    padding: 0.75rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .discoveries-list {
    font-size: 0.85rem;
    max-height: none;
    flex: 1;
    overflow-y: auto;
    display: block !important;
    border: none;
    padding: 0;
    margin-top: 0.5rem;
    min-width: 0;
  }
  .discovery-item {
    padding: 0.6rem 0;
  }

  /* Save list entries — bigger touch targets */
  .save-entry {
    padding: 0.8rem;
    min-height: 48px;
  }
  .save-name { font-size: 0.8rem; }
  .save-meta { font-size: 0.7rem; }
  .save-archive, .save-unarchive {
    font-size: 0.45rem;
    padding: 0.4rem 0.6rem;
    min-height: 36px;
  }

  /* Primary/secondary buttons — bigger on mobile */
  .btn-primary {
    font-size: 0.7rem;
    padding: 1rem 1.5rem;
    min-height: 48px;
  }
  .btn-secondary {
    font-size: 0.6rem;
    padding: 0.8rem 1.2rem;
    min-height: 44px;
  }

  /* Text input in onboarding */
  .text-input {
    font-size: 16px; /* Prevents iOS auto-zoom */
    padding: 0.7rem 0.4rem;
  }

  /* Transcript screen mobile */
  .transcript-header {
    padding: 0.6rem 0.75rem;
  }
  .transcript-header .btn-sm {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .transcript-content {
    padding: 0.75rem;
    -webkit-overflow-scrolling: touch;
  }
  .transcript-entry.player p { font-size: 0.8rem; }
  .transcript-entry.narrator p { font-size: 0.9rem; }
  .transcript-player-name { font-size: 0.55rem; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
