/* ¡Vamos, Phoebe! - editorial aesthetic, paprika accent over cream + navy */

:root {
  --cream: #f5efe4;
  --cream-light: #fdfaf3;
  --cream-dark: #ede4d3;
  --paper: #fffdf7;
  --ink: #1a1a1a;
  --ink-light: #4a4a4a;
  --ink-muted: #6b6b6b;
  --line: #d8c9b0;
  --line-soft: #e4d8bf;
  --navy: #1D2238;
  /* accent kept under the names app.js references; values are the paprika palette */
  --ochre: #A93226;        /* paprika red - primary accent */
  --ochre-soft: #9c5a44;   /* muted terracotta - small-caps labels */
  --green: #3d6b3d;
  --amber: #b07d28;
  --red: #8B2E2E;
  --serif: 'EB Garamond', Georgia, serif;
  --sans: 'Source Sans 3', system-ui, sans-serif;
}

[data-theme="dark"] {
  --cream: #1a1a1f;
  --cream-light: #22222a;
  --cream-dark: #15151a;
  --paper: #2a2a32;
  --ink: #e8e3d6;
  --ink-light: #c4bfb1;
  --ink-muted: #908b7e;
  --line: #3a3a44;
  --line-soft: #2e2e36;
  --navy: #d8b48a;
  --ochre: #d4543f;
  --ochre-soft: #c98a6e;
  --green: #7ab07a;
  --amber: #d6a44a;
  --red: #c47373;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-dark) 100%);
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: none;
  color: inherit;
}

button:disabled { opacity: 0.4; cursor: not-allowed; }
button:hover:not(:disabled) { transform: translateY(-1px); }

input, textarea, select {
  font-family: inherit;
  outline: none;
  border: 1px solid var(--line);
  background: var(--cream-light);
  color: var(--ink);
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 17px;
}

input::placeholder, textarea::placeholder { color: var(--ink-muted); font-style: italic; }

/* ===== BRAND SUN MARK ===== */

.sun-mark { display: inline-block; line-height: 0; }
.sun-mark svg { display: block; }

/* ===== LANDING / AUTH ===== */

.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}

.brand-mark {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ochre-soft);
  margin: 20px 0 16px;
}

.brand-title {
  font-size: 52px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin: 0 0 16px;
  line-height: 1.05;
}

.brand-subtitle {
  font-size: 18px;
  color: var(--ink-light);
  margin: 0 0 40px;
  max-width: 380px;
  line-height: 1.55;
}

.text-button {
  background: none;
  border: none;
  color: var(--ochre-soft);
  font-family: var(--sans);
  font-size: 13px;
  font-style: italic;
  text-decoration: underline;
  padding: 8px;
}

.passphrase-form {
  max-width: 320px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.passphrase-form input { text-align: center; font-size: 18px; }

.btn-primary {
  background: var(--ochre);
  color: #fff;
  padding: 14px 24px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.btn-secondary {
  background: transparent;
  color: var(--navy);
  padding: 14px 24px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 15px;
  border: 1px solid var(--line);
}

.error-msg {
  color: var(--red);
  font-family: var(--sans);
  font-size: 13px;
  font-style: italic;
  margin-top: 8px;
}

/* ===== HEADER ===== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(253, 250, 243, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

[data-theme="dark"] .app-header { background: rgba(34, 34, 42, 0.85); }

.header-left { display: flex; align-items: center; gap: 10px; }

.header-eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ochre-soft);
}

.header-title {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 400;
  font-style: italic;
  color: var(--navy);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.score-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--navy);
  color: var(--cream);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.timer-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--ochre);
  color: #fff;
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 100px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-light);
  background: transparent;
}

/* ===== MAIN MENU ===== */

.menu-page {
  padding: 24px 20px 40px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.greeting {
  font-size: 32px;
  font-style: italic;
  font-weight: 400;
  color: var(--navy);
  margin: 16px 0 8px;
}

.greeting-sub {
  color: var(--ink-light);
  font-size: 16px;
  margin-bottom: 20px;
}

.exam-countdown {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ochre-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 24px;
}
.exam-countdown strong { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ochre); letter-spacing: 0; }

.mot-du-jour {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ochre);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 28px;
}

.mot-label {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ochre-soft);
  margin-bottom: 8px;
}

.mot-word {
  font-size: 24px;
  font-style: italic;
  color: var(--navy);
  margin-bottom: 4px;
}

.mot-def {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.5;
}

.section-label {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ochre-soft);
  margin: 6px 0 12px;
}

.mode-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}

.mode-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
  color: inherit;
}

.mode-roman {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ochre);
  letter-spacing: 0.1em;
}

.mode-name {
  font-size: 22px;
  color: var(--navy);
  font-weight: 500;
}

.mode-desc {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 14px 12px;
  text-align: center;
}

.stat-num {
  font-size: 28px;
  font-style: italic;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ochre-soft);
  margin-top: 6px;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-link {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  padding: 16px 4px;
  text-align: left;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-link-arrow {
  color: var(--ochre);
  font-family: var(--sans);
  font-size: 18px;
}

/* ===== SUB-MODE PICKER ===== */

.submode-page { padding: 28px 20px 40px; max-width: 600px; width: 100%; margin: 0 auto; }
.submode-intro {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.6;
  margin: 0 0 24px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--ochre);
  border-radius: 4px;
  padding: 14px 16px;
}
.submode-grid { display: grid; gap: 12px; }

/* ===== CHAT ===== */

.chat-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 16px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}

.task-card {
  background: var(--navy);
  color: var(--cream);
  border-radius: 4px;
  padding: 16px 18px;
  margin-bottom: 16px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  max-width: 88%;
  margin-right: auto;
  white-space: pre-wrap;
}
.task-card .task-label {
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream-dark);
  opacity: 0.8;
  margin-bottom: 8px;
}

.bubble {
  padding: 14px 18px;
  border-radius: 4px;
  margin-bottom: 16px;
  max-width: 88%;
  animation: fadeIn 0.4s ease;
}

.bubble-user {
  background: var(--navy);
  color: var(--cream);
  margin-left: auto;
}

.bubble-assistant {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  margin-right: auto;
}

.bubble-user .text { font-size: 17px; line-height: 1.5; }
.bubble-assistant .text { font-size: 18px; line-height: 1.6; color: var(--ink); }

.audio-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
}
.audio-prompt .play-big {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--ochre); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.audio-prompt .audio-hint { font-family: var(--sans); font-size: 14px; color: var(--ink-muted); font-style: italic; }

.bubble-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.bubble-action {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ochre-soft);
}

.bubble-text-btn {
  background: transparent;
  border: none;
  color: var(--ochre-soft);
  font-family: var(--sans);
  font-size: 12px;
  font-style: italic;
  text-decoration: underline;
  padding: 0;
}

.gloss {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}

/* ===== MARKING CARD with three sub-scores ===== */

.marking-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ochre);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 8px;
  margin-right: auto;
  max-width: 88%;
  animation: fadeIn 0.4s ease;
}

.marking-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.score-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--sans);
  line-height: 1;
}
.score-dot .score-num { font-size: 15px; font-weight: 700; }
.score-dot .score-den { font-size: 9px; opacity: 0.85; }

.grade-badge {
  display: flex;
  flex-direction: column;
}
.grade-badge .grade-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  color: var(--navy);
  line-height: 1;
}
.grade-badge .grade-label {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ochre-soft);
  margin-top: 3px;
}

.subbars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.subbar-row { display: grid; grid-template-columns: 78px 1fr 30px; align-items: center; gap: 10px; }
.subbar-name { font-family: var(--sans); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); }
.subbar-track { height: 7px; background: var(--cream-dark); border-radius: 100px; overflow: hidden; }
.subbar-fill { height: 100%; border-radius: 100px; transition: width 0.5s ease; }
.subbar-val { font-family: var(--sans); font-size: 12px; color: var(--ink-light); text-align: right; font-variant-numeric: tabular-nums; }

.corrected {
  font-family: var(--sans);
  font-size: 13px;
  margin: 4px 0 8px;
  color: var(--ink-light);
}

.corrected-text {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--navy);
}

.error-row {
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 0;
  border-top: 1px dotted var(--line-soft);
}

.error-old {
  text-decoration: line-through;
  color: var(--red);
  font-family: var(--serif);
  font-size: 15px;
}

.error-new {
  color: var(--green);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  margin: 0 6px;
}

.error-expl {
  margin-top: 4px;
  color: var(--ink-muted);
  font-style: italic;
}

.save-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 10px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ochre-soft);
  margin-left: 8px;
}

.save-btn.saved { background: var(--ochre); color: #fff; border-color: var(--ochre); }

.praise {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--cream);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--green);
  font-style: italic;
}

.tip {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--cream);
  border-left: 2px solid var(--ochre);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-light);
}
.tip strong { color: var(--ochre); font-weight: 600; }

.thinking {
  display: flex;
  gap: 6px;
  padding: 16px 20px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ochre);
  animation: pulse 1.2s ease-in-out infinite;
}

.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

/* ===== INPUT BAR ===== */

.input-bar {
  border-top: 1px solid var(--line);
  background: rgba(253, 250, 243, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}

[data-theme="dark"] .input-bar { background: rgba(34, 34, 42, 0.9); }

.voice-error {
  max-width: 720px;
  margin: 0 auto 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--red);
  font-style: italic;
  text-align: center;
}

.accent-bar {
  display: flex;
  gap: 4px;
  max-width: 720px;
  margin: 0 auto 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.accent-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--cream-light);
  border-radius: 4px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--navy);
}

.input-row {
  display: flex;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
  align-items: flex-end;
}

.mic-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mic-btn.listening { background: var(--red); animation: pulseListening 1.5s ease-in-out infinite; }

.input-field {
  flex: 1;
  padding: 12px 16px;
  font-size: 17px;
  min-height: 46px;
  resize: none;
  line-height: 1.4;
  max-height: 140px;
}

.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ochre);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== SUBPAGES (settings, phrasebook, vocab, progreso, pasadas) ===== */

.subpage {
  padding: 20px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.subpage h2 {
  font-size: 28px;
  font-style: italic;
  font-weight: 400;
  color: var(--navy);
  margin: 0 0 8px;
}
.subpage .subpage-sub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 24px;
}

.setting-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.setting-label { font-size: 16px; color: var(--ink); }
.setting-desc { font-family: var(--sans); font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

.setting-row select,
.setting-row input[type="text"],
.setting-row input[type="date"] { min-width: 150px; }

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--line);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle.on { background: var(--ochre); }

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--cream-light);
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle.on::after { transform: translateX(22px); }

.phrase-item {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.phrase-fr { font-size: 17px; color: var(--ink); font-style: italic; margin-bottom: 4px; }
.phrase-en { font-family: var(--sans); font-size: 13px; color: var(--ink-muted); }
.phrase-meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ochre-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 6px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-muted);
  font-style: italic;
}

/* ===== PROGRESO ===== */

.prog-block { margin-bottom: 32px; }
.prog-block h3 {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ochre-soft);
  margin: 0 0 14px;
}

.estimate-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ochre);
  border-radius: 4px;
  padding: 18px 20px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 8px;
}
.estimate-card .big-grade { font-family: var(--serif); font-style: italic; font-size: 48px; color: var(--ochre); line-height: 1; }
.estimate-card .est-text { font-family: var(--sans); font-size: 13px; color: var(--ink-light); line-height: 1.5; }
.estimate-note { font-family: var(--sans); font-size: 11px; color: var(--ink-muted); font-style: italic; margin-bottom: 4px; }

.theme-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.theme-name { font-size: 16px; color: var(--ink); }
.theme-meta { font-family: var(--sans); font-size: 12px; color: var(--ink-muted); }
.theme-track { height: 6px; background: var(--cream-dark); border-radius: 100px; overflow: hidden; margin-top: 6px; }
.theme-fill { height: 100%; background: var(--ochre); border-radius: 100px; }

.heatmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.heat-cell {
  border-radius: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
}
.heat-name { font-family: var(--sans); font-size: 12px; color: var(--ink); margin-bottom: 4px; }
.heat-meta { font-family: var(--sans); font-size: 10px; color: var(--ink-muted); }

/* ===== PASADAS ===== */
.pasadas-intro {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.6;
  margin-bottom: 16px;
}
.pasadas-box { width: 100%; min-height: 120px; margin-bottom: 12px; }

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

@keyframes pulseListening {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 46, 46, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(139, 46, 46, 0); }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 480px) {
  .brand-title { font-size: 42px; }
  .greeting { font-size: 26px; }
  .mode-name { font-size: 20px; }
}
