/* Retrouver les mots - editorial French aesthetic */

:root {
  --cream: #f5efe4;
  --cream-light: #fdfaf3;
  --cream-dark: #ede4d3;
  --paper: #fffdf7;
  --ink: #1a1a1a;
  --ink-light: #4a4a4a;
  --ink-muted: #6b6b6b;
  --line: #d4c5a8;
  --line-soft: #e0d4ba;
  --navy: #1D2238;
  --ochre: #C9792C;
  --ochre-soft: #8a6d2a;
  --green: #3d6b3d;
  --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: #c9a04a;
  --ochre: #d89045;
  --ochre-soft: #b87f30;
  --green: #7ab07a;
  --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 { color: var(--ink-muted); font-style: italic; }

/* ===== 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-bottom: 20px;
}

.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;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
}

.profile-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
}

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

.profile-streak {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ochre-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.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: var(--cream-light);
  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-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;
}

.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: 28px;
}

.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;
}

.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;
}

/* ===== 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;
}

.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); }

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

.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 {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ochre);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 8px;
  margin-right: auto;
  max-width: 88%;
  animation: fadeIn 0.4s ease;
}

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

.score-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream-light);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}

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

.corrected {
  font-family: var(--sans);
  font-size: 13px;
  margin-bottom: 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: var(--cream-light); 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;
}

.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: center;
}

.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;
}

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

/* ===== SETTINGS / PHRASEBOOK / VOCAB ===== */

.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 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"] {
  min-width: 140px;
}

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

.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;
}

/* ===== 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; }
}
