/* AskThem — Family Story Preservation */
/* Design: warm, intimate, slightly vintage — like a family photo album */

:root {
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --bg-warm: #f5efe8;
  --text: #2c2420;
  --text-secondary: #8a7e74;
  --text-muted: #b5aa9e;
  --accent: #c45d3e;
  --accent-light: #f0d4cb;
  --accent-dark: #9e3d24;
  --green: #5a8f5c;
  --green-light: #e8f0e4;
  --blue: #4a7c9b;
  --gold: #c9a84c;
  --border: #e8e0d8;
  --shadow: 0 2px 12px rgba(44, 36, 32, 0.08);
  --shadow-lg: 0 8px 32px rgba(44, 36, 32, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Georgia', 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-ui);
  background: #2c2420;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
}

.app-container {
  width: 100%;
  max-width: 430px;
  height: 932px;
  background: var(--bg);
  border-radius: 40px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
}

/* Top Nav */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg);
  z-index: 10;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon { font-size: 24px; }

.brand-name {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.nav-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--bg-warm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover { background: var(--border); }

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.main-content::-webkit-scrollbar { width: 0; }

/* Screens */
.screen { display: none; padding: 0 24px 100px; }
.screen.active { display: block; }

/* Hero */
.hero-section {
  padding: 8px 0 24px;
}

.hero-text h1 {
  font-family: var(--font);
  font-size: 32px;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.urgency-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fef3e8, #fde8d8);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--accent-dark);
  border: 1px solid #f0d4cb;
}

.urgency-icon { font-size: 18px; }

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 12px;
}

.section-header h2 {
  font-family: var(--font);
  font-size: 20px;
  color: var(--text);
}

.see-all {
  font-size: 14px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}

/* People Row */
.people-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.people-row::-webkit-scrollbar { display: none; }

.person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.person-card:hover { background: var(--bg-warm); }

.person-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 22px;
  color: white;
  font-weight: 700;
}

.person-avatar.add {
  background: var(--bg-warm);
  color: var(--text-secondary);
  border: 2px dashed var(--border);
  font-size: 24px;
}

.person-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.person-stories {
  font-size: 11px;
  color: var(--text-muted);
}

/* Daily Question */
.daily-question {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.daily-question:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.dq-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold);
  margin-bottom: 8px;
}

.dq-text {
  font-family: var(--font);
  font-size: 22px;
  font-style: italic;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 12px;
}

.dq-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dq-topic {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-warm);
  padding: 4px 10px;
  border-radius: 20px;
}

.dq-action {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

/* Story Cards */
.story-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.story-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.story-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 48px;
  height: 48px;
}

.wave-bar {
  width: 4px;
  background: var(--accent-light);
  border-radius: 2px;
  transition: height 0.3s;
}

.story-card:hover .wave-bar { background: var(--accent); }

.story-info { flex: 1; min-width: 0; }

.story-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.story-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.story-person {
  color: var(--accent);
  font-weight: 500;
}

.story-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Family Stats */
.family-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 24px;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-num {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Screen Header */
.screen-header {
  padding: 8px 0 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.screen-header h2 {
  font-family: var(--font);
  font-size: 24px;
  margin-top: 8px;
}

.back-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  padding: 4px 0;
}

.topic-person-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.person-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  font-weight: 700;
}

/* Topic Grid */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.topic-card {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.topic-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent-light);
}

.topic-emoji { font-size: 28px; display: block; margin-bottom: 8px; }

.topic-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.topic-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.topic-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic-progress span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-warm);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Question List */
.question-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.question-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.question-item:hover { background: var(--bg-warm); }

.question-item.asked { opacity: 0.6; }

.question-item.next {
  background: var(--accent-light);
  cursor: pointer;
}

.q-status { font-size: 16px; margin-top: 2px; }

.q-content { flex: 1; }

.q-content p {
  font-family: var(--font);
  font-size: 15px;
  font-style: italic;
  color: var(--text);
  line-height: 1.4;
}

.q-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.q-arrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 16px;
  margin-top: 4px;
}

/* Session / Recording Screen */
.session-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 700px;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 16px;
}

.session-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.session-timer {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 16px;
  color: var(--accent);
  font-weight: 600;
}

.question-display {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.q-card-large {
  text-align: center;
  padding: 32px 24px;
}

.q-number {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.q-main {
  font-family: var(--font);
  font-size: 28px;
  font-style: italic;
  color: var(--text);
  line-height: 1.4;
  margin: 16px 0;
}

.q-tips {
  text-align: left;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 20px;
}

.tip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.q-tips ul {
  list-style: none;
  padding: 0;
}

.q-tips li {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 4px 0;
}

.q-tips li::before {
  content: '→ ';
  color: var(--accent);
}

/* Recording Area */
.recording-area {
  padding: 24px 0;
}

.live-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 60px;
  margin-bottom: 24px;
}

.live-bar {
  width: 4px;
  background: var(--accent-light);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.live-bar.active {
  background: var(--accent);
}

.recording-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.rec-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.rec-btn.primary {
  position: relative;
}

.rec-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(196, 93, 62, 0.3);
}

.rec-circle::after {
  content: '';
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s;
}

.rec-circle.recording {
  background: #dc3545;
  animation: pulse-rec 1.5s ease infinite;
}

.rec-circle.recording::after {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 4px 20px rgba(220, 53, 69, 0.3); }
  50% { box-shadow: 0 4px 40px rgba(220, 53, 69, 0.5); }
}

#recLabel {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.rec-btn.secondary span {
  font-weight: 500;
}

/* AI Suggestions */
.ai-suggestions {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f0f0ff, #e8e8f8);
  border: 1px solid #d0d0e8;
  border-radius: var(--radius-sm);
}

.ai-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b5ce7;
  margin-bottom: 6px;
}

.ai-suggestions p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
}

.ai-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: #6b5ce7;
  color: white;
}

.btn-sm.ghost {
  background: transparent;
  color: var(--text-secondary);
}

/* Story Detail */
.story-detail {
  padding-bottom: 40px;
}

.sd-header h1 {
  font-family: var(--font);
  font-size: 26px;
  line-height: 1.3;
  margin-bottom: 12px;
}

.sd-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.sd-person {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 500;
}

/* Audio Player */
.audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.audio-timeline {
  flex: 1;
  height: 6px;
  background: var(--bg-warm);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.audio-progress {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.1s;
}

.audio-chapters { position: relative; }

.chapter-mark {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  transform: translateX(-50%);
}

.audio-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'SF Mono', monospace;
  white-space: nowrap;
}

/* Chapters */
.chapters-section,
.transcript-section,
.entities-section {
  margin-bottom: 24px;
}

.chapters-section h3,
.transcript-section h3,
.entities-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text);
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.chapter-item:hover { border-color: var(--accent-light); }

.ch-time {
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  min-width: 36px;
  margin-top: 2px;
}

.ch-content strong {
  font-size: 14px;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

.ch-content p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Transcript */
.transcript {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.t-line {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.t-line:last-child { border-bottom: none; }

.t-speaker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.t-speaker.mom { color: #c45d3e; }
.t-speaker.you { color: var(--blue); }

.t-line p {
  font-family: var(--font);
  font-size: 15px;
  font-style: italic;
  line-height: 1.6;
  color: var(--text);
}

.entity {
  background: #fef3e8;
  padding: 1px 6px;
  border-radius: 4px;
  border-bottom: 2px solid var(--gold);
  cursor: pointer;
  font-style: normal;
}

/* Entity Tags */
.entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.entity-tag {
  padding: 6px 14px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
}

/* Story Actions */
.story-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-outline {
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* Vault / Timeline */
.vault-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.vault-timeline {
  padding-left: 20px;
  border-left: 2px solid var(--border);
}

.timeline-year {
  margin-bottom: 24px;
}

.timeline-year h3 {
  font-family: var(--font);
  font-size: 20px;
  color: var(--text);
  margin-bottom: 12px;
  margin-left: -20px;
  padding-left: 20px;
  position: relative;
}

.timeline-year h3::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid var(--bg);
}

.timeline-stories {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-story {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tl-story:hover { border-color: var(--accent-light); }

.tl-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-light);
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.tl-content h4 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.tl-content p {
  font-size: 12px;
  color: var(--text-muted);
}

/* People Grid */
.people-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.person-detail-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.person-detail-card:hover {
  box-shadow: var(--shadow);
}

.person-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 28px;
  color: white;
  font-weight: 700;
  margin: 0 auto 12px;
}

.person-detail-card h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.person-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.person-topics {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.mini-tag {
  padding: 3px 10px;
  background: var(--bg-warm);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.last-session {
  font-size: 12px;
  color: var(--text-muted);
}

/* Bottom Nav */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 16px 28px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  padding: 4px 12px;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item span {
  font-weight: 500;
}

.record-nav { position: relative; }

.record-fab {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-top: -20px;
  box-shadow: 0 4px 16px rgba(196, 93, 62, 0.3);
}

/* Responsive */
@media (max-width: 480px) {
  body { padding: 0; }
  .app-container {
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
}
