:root {
  color-scheme: light dark;
  --bg: #f7f5f2;
  --panel: #ffffff;
  --text: #24211d;
  --muted: #6b665f;
  --accent: #a4402a;
  --accent-hover: #832f1d;
  --border: #e2ddd5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17;
    --panel: #262320;
    --text: #f2ede6;
    --muted: #a89f93;
    --accent: #e08a5f;
    --accent-hover: #f0a377;
    --border: #3a352f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

h1 { margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); margin-top: 0; margin-bottom: 1.5rem; }

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.top-nav h1 { margin: 0; }

.top-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
}

.top-nav a:hover { text-decoration: underline; }

.nav-links {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.user-bar {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.lookup, .vocab-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

textarea, input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%;
  font-size: 1rem;
  font-family: inherit;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

textarea { resize: vertical; }

.auth-main { max-width: 360px; }
.wide-main { max-width: 900px; }

.auth-form { display: flex; flex-direction: column; gap: 0.4rem; }

.auth-form label { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }

.auth-form button {
  margin-top: 1rem;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  align-self: flex-start;
}

.auth-form button:hover { background: var(--accent-hover); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.checkbox-label input { width: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.admin-table th { color: var(--muted); font-weight: 600; }

.admin-table th.num, .admin-table td.num { text-align: right; }

.admin-table td input, .admin-table td select { padding: 0.4rem; font-size: 0.85rem; }

.reset-password-input { width: 11rem; }

.buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

button {
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

button:hover { border-color: var(--accent); }

#micBtn.listening {
  background: #c0392b;
  border-color: #c0392b;
  color: white;
}

#translateBtn, #saveBtn {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

#translateBtn:hover, #saveBtn:hover { background: var(--accent-hover); }

.result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

#translationText { font-size: 1.15rem; margin: 0 0 0.25rem; }

.error { color: #c0392b; }

.hidden { display: none; }

/* Contact form: spam trap kept off-screen (not display:none, which bots skip) and the result line. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-result { margin: 0.6rem 0 0; font-weight: 600; }
.form-result.success { color: #2e8b57; }
.form-result.error { color: #c0392b; }

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.list-header h2 { margin: 0; font-size: 1.1rem; }

#wordList, .day-word-list { list-style: none; padding: 0; margin: 0; }

#wordList li, .day-word-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

#wordList li:last-child, .day-word-list li:last-child { border-bottom: none; }

.entry-text .original { font-weight: 600; }
.entry-text .translation { color: var(--muted); margin: 0.15rem 0 0; }

.entry-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.entry-actions button { padding: 0.35rem 0.6rem; font-size: 0.85rem; }

.entry-edit { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.entry-edit input { padding: 0.4rem 0.5rem; font-size: 0.9rem; }

.empty { color: var(--muted); }

#lists details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

#lists summary {
  cursor: pointer;
  font-weight: 600;
  list-style: revert;
}

#lists summary::marker { color: var(--accent); }

.day-body { margin-top: 0.75rem; }

.day-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.day-export-btn {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.mode-option input { width: auto; margin-top: 0.2rem; }
.mode-option span { color: var(--muted); }
.mode-option strong { color: var(--text); }

.mode-option-inline {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.mode-option-inline input { width: auto; }

.prompt {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0.5rem 0;
}

.hint {
  font-size: 1.3rem;
  letter-spacing: 0.15rem;
  color: var(--muted);
  font-family: monospace;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}

.choices button {
  padding: 1rem;
  font-size: 1rem;
}

.choices button.correct {
  background: #2e7d32;
  border-color: #2e7d32;
  color: white;
}

.choices button.wrong {
  background: #c0392b;
  border-color: #c0392b;
  color: white;
}

.feedback { font-size: 1.05rem; font-weight: 600; margin: 0.75rem 0; }

#missedList { padding-left: 1.2rem; }
#missedList li { margin-bottom: 0.3rem; }
