:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #222;
  --gold: #c9a84c;
  --gold-light: #e2c97e;
  --text: #f0ede8;
  --text-subtle: #888;
  --error: #e05c5c;
  --radius: 16px;
  --nav-height: 64px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* SCREENS */
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: flex; }
.screen.hidden { display: none; }

/* AUTH */
.auth-container {
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.logo {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.logo-fr { color: var(--gold); }
.logo-dot { color: var(--text-subtle); margin: 0 8px; }
.logo-en { color: var(--text); }

.tagline {
  color: var(--text-subtle);
  font-size: 0.95rem;
  margin-top: -8px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 12px;
  width: 100%;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-subtle);
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.tab.active {
  background: var(--gold);
  color: #000;
  font-weight: 600;
}

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

input[type="email"],
input[type="password"],
.select-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, .select-input:focus { border-color: var(--gold); }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: #000;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.88; }

.error {
  color: var(--error);
  font-size: 0.85rem;
  text-align: center;
}

.hidden { display: none !important; }

/* APP */
#app-screen { flex-direction: column; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid #2a2a2a;
  display: flex;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text-subtle);
  font-size: 0.7rem;
  cursor: pointer;
  transition: color 0.2s;
}
.nav-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.nav-btn.active { color: var(--gold); }

/* PAGES */
.page {
  position: absolute;
  inset: 0;
  bottom: var(--nav-height);
  overflow-y: auto;
  padding: 0 20px 24px;
  display: none;
}
.page.active { display: block; }

.page-header {
  padding: 24px 0 16px;
  font-size: 0.85rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.page-header h2 {
  font-size: 1.4rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

/* WORD CARD */
.word-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.word-card.loading { opacity: 0.4; }

.word-pair {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.word-fr {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
}
.word-separator {
  color: var(--text-subtle);
  font-size: 1.5rem;
}
.word-en {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
}

.word-section { display: flex; flex-direction: column; gap: 6px; }

.section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 600;
}

.def-text, .example-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}
.def-text.subtle, .example-text.subtle { color: var(--text-subtle); font-style: italic; }

.anecdote-section { background: var(--surface2); border-radius: 12px; padding: 16px; }
.anecdote-text { font-size: 0.88rem; line-height: 1.6; color: var(--text-subtle); }

.fav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid #333;
  border-radius: 10px;
  background: transparent;
  color: var(--text-subtle);
  font-size: 0.85rem;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s;
}
.fav-btn svg { width: 18px; height: 18px; fill: currentColor; }
.fav-btn.active { color: var(--error); border-color: var(--error); }

/* HISTORY */
.history-list { display: flex; flex-direction: column; gap: 12px; }

.history-item {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.history-item:hover { background: var(--surface2); }

.history-words { display: flex; flex-direction: column; gap: 2px; }
.history-fr { font-size: 1.05rem; font-weight: 600; color: var(--gold); }
.history-en { font-size: 0.85rem; color: var(--text-subtle); }
.history-date { font-size: 0.75rem; color: var(--text-subtle); }
.history-fav { color: var(--error); font-size: 1rem; }

.empty-state { color: var(--text-subtle); text-align: center; padding: 40px 0; }

/* SETTINGS */
.settings-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  font-weight: 600;
}
.btn-secondary {
  padding: 12px 16px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid #333;
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s;
  text-align: left;
}
.btn-secondary:hover { border-color: var(--gold); }
.btn-logout {
  padding: 12px 16px;
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}
.settings-msg {
  text-align: center;
  font-size: 0.85rem;
  color: var(--gold);
  padding: 8px 0;
}
