:root {
  --app-background: #FAF6F0;
  --app-background-elevated: #FFFFFF;
  --app-background-subtle: #F2EBE0;
  --app-text: #2A1F17;
  --app-text-secondary: #6B5D4F;
  --app-text-tertiary: #A89B8A;
  --app-border: #E8DFD0;
  --app-coral: #FF8A65;
  --app-peach: #FFB088;
  --app-purple: #9D7BFF;
  --app-purple-light: #B89DFF;
  --app-amber: #F5A65B;
  --app-sage: #84B58B;
  --app-sky: #7BB8FF;
  --app-butter: #FFE082;
}

@media (prefers-color-scheme: dark) {
  :root {
    --app-background: #1F1A14;
    --app-background-elevated: #2B241B;
    --app-background-subtle: #3A3024;
    --app-text: #F5EDE0;
    --app-text-secondary: #B8A992;
    --app-text-tertiary: #7A6E5C;
    --app-border: #4A3F30;
  }
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--app-background);
  color: var(--app-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  max-width: 600px;
  margin: 0 auto;
}

.hidden { display: none !important; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--app-border);
  border-top-color: var(--app-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.state {
  padding: 48px 8px;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
}

.state-icon {
  font-size: 64px;
  margin-bottom: 24px;
  text-align: center;
}

.state-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.state-message {
  font-size: 16px;
  color: var(--app-text-secondary);
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}

.page-header { padding: 16px 0 24px; }

.logo {
  font-size: 14px;
  font-weight: 700;
  color: var(--app-text-secondary);
  letter-spacing: 0.02em;
}

.greeting {
  font-size: 18px;
  color: var(--app-text-secondary);
  margin-bottom: 24px;
}

.greeting strong { color: var(--app-text); }

.memory-card {
  background: var(--app-background-elevated);
  border: 1px solid var(--app-border);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.03);
  margin-bottom: 32px;
}

.memory-quote {
  font-style: italic;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--app-text);
  margin-bottom: 24px;
}

.memory-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--app-border);
}

.memory-meta-line {
  font-size: 14px;
  color: var(--app-text-secondary);
}

.memory-meta-line.primary {
  font-weight: 600;
  color: var(--app-text);
}

.memory-photo {
  width: 100%;
  border-radius: 14px;
  margin-bottom: 20px;
  display: block;
}

.voice-player {
  background: linear-gradient(135deg, var(--app-sky) 0%, var(--app-purple) 100%);
  color: white;
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
}

.voice-player audio {
  width: 100%;
  margin-top: 12px;
}

.voice-transcript {
  font-style: italic;
  color: var(--app-text-secondary);
  margin-top: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--app-border);
}

.digest-header {
  text-align: center;
  margin-bottom: 32px;
}

.digest-header h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.digest-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.digest-list .memory-card { margin-bottom: 0; }

.welcome-card {
  text-align: center;
  padding: 48px 24px;
}

.welcome-card .memory-quote {
  font-style: normal;
  font-size: 28px;
}

.page-footer {
  text-align: center;
  padding: 32px 0;
}

.footer-text {
  font-size: 13px;
  color: var(--app-text-secondary);
  margin-bottom: 4px;
}

.footer-text-small {
  font-size: 11px;
  color: var(--app-text-tertiary);
}

@media (max-width: 380px) {
  .memory-quote { font-size: 21px; }
  .digest-header h1 { font-size: 26px; }
}
