/* Mobile-first, 375px baseline. Warm, uncluttered — a game two people play
   to feel closer, not a dashboard. See docs/ARCHITECTURE.md §2, §9 (slice 6). */

:root {
  --bg: #fff9f5;
  --surface: #ffffff;
  --text: #2b241f;
  --text-muted: #7c7169;
  --border: #efe2d7;
  --accent: #e2703f;
  --accent-dark: #b8532a;
  --accent-soft: #fbe2d3;
  --hit: #3f8f68;
  --hit-soft: #dff1e7;
  --miss: #a3814f;
  --miss-soft: #f3ead9;
  --danger: #b3452f;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --shadow: 0 1px 2px rgba(43, 36, 31, 0.06), 0 6px 20px rgba(43, 36, 31, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 24px;
}

.app-header {
  padding: 20px 4px 8px;
}

.app-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--accent-dark);
}

main {
  flex: 1;
}

h1 {
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 8px 0 8px;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.35;
  margin: 4px 0 12px;
}

h3 {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 20px 0 10px;
  font-weight: 600;
}

.lede {
  color: var(--text-muted);
  margin: 0 0 20px;
  font-size: 0.98rem;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
}

.optional-tag {
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.85em;
}

input[type="text"] {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

input[type="text"]:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 1px;
}

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

.btn {
  min-height: var(--tap);
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:focus-visible {
  outline: 2.5px solid var(--accent-dark);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:disabled {
  background: #f0c9b6;
  color: #fff;
  cursor: not-allowed;
}

.btn-primary:not(:disabled):active {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.btn-secondary:active {
  background: #f6cbb2;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-ghost:active {
  background: var(--bg);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 600;
  padding: 8px 2px;
  min-height: var(--tap);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn.danger {
  color: var(--danger);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.button-row .btn {
  flex: 1 1 auto;
}

/* ---- Messages ---- */

.error-text {
  color: var(--danger);
  background: #fbe9e3;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  margin: 12px 0 0;
}

.ai-disclosure {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 16px 0 0;
}

.have-code {
  margin-top: 24px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.privacy-note {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---- Option buttons (answer + prediction) ---- */

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}

.option-btn {
  min-height: var(--tap);
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
}

.option-btn:active {
  background: var(--bg);
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

#input-why {
  margin-top: 4px;
}

/* ---- Game screen chrome ---- */

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 4px;
  gap: 10px;
}

.game-progress {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 18px 22px;
  margin-top: 10px;
  box-shadow: var(--shadow);
}

/* ---- Alive waiting states ---- */

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin: 2px 0 14px;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot { animation: none; }
}

.invite-code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

#invite-code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}

.copied-note {
  margin: 10px 0 0;
  color: var(--hit);
  font-size: 0.88rem;
  font-weight: 600;
}

/* ---- Reveal: the emotional peak, given room ---- */

.reveal-eyebrow {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin: 0 0 4px;
}

.reveal-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 18px;
}

.reveal-answer-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.reveal-answer-card.skipped {
  opacity: 0.75;
  border-style: dashed;
}

.reveal-answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reveal-name {
  font-weight: 700;
}

.prediction-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.chip-hit {
  background: var(--hit-soft);
  color: var(--hit);
}

.chip-miss {
  background: var(--miss-soft);
  color: var(--miss);
}

.reveal-answer-label {
  font-size: 1.1rem;
  margin: 8px 0 2px;
}

.reveal-why {
  color: var(--text-muted);
  font-style: italic;
  margin: 4px 0 0;
}

.reflection {
  font-size: 1.08rem;
  line-height: 1.6;
  padding: 16px 4px 20px;
  margin: 4px 0 6px;
  border-top: 1px solid var(--border);
}

.ai-credit {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: -4px 0 16px;
}

.continue-wait-note {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 10px;
  text-align: center;
}

/* ---- Our Story ---- */

.story-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.story-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.story-question {
  font-weight: 700;
  margin: 0 0 8px;
}

.story-answers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.story-answer-line {
  margin: 0;
  font-size: 0.95rem;
}

.story-answer-name {
  font-weight: 600;
  color: var(--accent-dark);
}

.story-reflection {
  color: var(--text-muted);
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ---- Recap ---- */

.recap-scores {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-top: 8px;
}

.recap-score-line {
  margin: 4px 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.disclaimer {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 10px 0 24px;
}

.recap-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.recap-line {
  margin: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.recap-line-q {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 3px;
}

.memory-count {
  margin-top: 22px;
  font-weight: 600;
}

.closing {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ---- Footer / dialog ---- */

.app-footer {
  padding: 18px 4px 4px;
  text-align: center;
}

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 20px;
  max-width: 340px;
  width: calc(100% - 48px);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(43, 36, 31, 0.45);
}

/* ---- Session-started banner (above the round question) ---- */

.session-started-banner {
  font-size: 0.85rem;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 0 0 14px;
}

/* ---- Your Dynamics ---- */

.journey-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 4px;
}

.journey-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.journey-stage-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.journey-stage-name {
  font-weight: 600;
}

.journey-stage-active .journey-stage-name {
  color: var(--accent-dark);
}

.journey-stage-muted {
  opacity: 0.55;
}

.journey-stage-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}

.journey-stage-muted .journey-stage-chip {
  background: var(--border);
  color: var(--text-muted);
}

.dynamics-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 4px;
}

.knowing-line {
  margin: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.knowing-name {
  font-weight: 700;
}

.knowing-trend {
  color: var(--hit);
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.territory-chip {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.dynamics-coverage {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 18px 0 4px;
}

.dynamics-note {
  font-size: 1.02rem;
  line-height: 1.55;
  padding: 16px 4px 4px;
  margin: 10px 0 0;
  border-top: 1px solid var(--border);
}

/* ---- Small screens: guarantee no horizontal scroll at 375px ---- */

@media (max-width: 380px) {
  .app-shell {
    padding: 0 12px 20px;
  }

  .panel {
    padding: 16px 14px 18px;
  }
}
