/* Vokabeln — iPhone-first, offline. Sized for 390–440 pt wide screens
   (iPhone 14 Pro Max: 430 × 932, iPhone 17: 402 × 874), light and dark. */

:root {
  color-scheme: light dark;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #ece9e1;
  --ink: #1b1c1f;
  --muted: #6c6f76;
  --line: #dedad0;
  --primary: #1b1c1f;
  --on-primary: #ffffff;
  --gold: #e0a100;
  --correct: #17794a;
  --correct-bg: #e5f4ec;
  --wrong: #c0322b;
  --wrong-bg: #fbe9e7;
  --skip-bg: #ecebe6;
  --notice-bg: #fff4d6;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 5%);
  --radius: 16px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1d1f23;
    --surface-2: #2a2d33;
    --ink: #f2f1ed;
    --muted: #9a9ca3;
    --line: #34373e;
    --primary: #f2f1ed;
    --on-primary: #121316;
    --gold: #f2b705;
    --correct: #4cc38a;
    --correct-bg: #13301f;
    --wrong: #ff6b5e;
    --wrong-bg: #3a1714;
    --skip-bg: #2a2d33;
    --notice-bg: #3a2e0c;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

#app {
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 8px)
    calc(env(safe-area-inset-right) + var(--gutter))
    calc(env(safe-area-inset-bottom) + 24px)
    calc(env(safe-area-inset-left) + var(--gutter));
}

[hidden] { display: none !important; }

h1, h2, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 15px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.screen { display: flex; flex-direction: column; gap: 14px; }
.loading, .center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ─── Surfaces ─────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
}
.banner.notice { background: var(--notice-bg); flex-direction: row; align-items: flex-start; gap: 12px; }
.banner.notice p { flex: 1; }
.banner.telegram { background: var(--surface-2); }

/* ─── Controls ─────────────────────────────────────────────────────────── */

button {
  font: inherit;
  border: 0;
  border-radius: 14px;
  min-height: 50px;
  padding: 12px 16px;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--primary); color: var(--on-primary); font-weight: 600; }
button.secondary { background: var(--surface-2); font-weight: 500; }
button.big { min-height: 58px; font-size: 18px; }
button.link {
  background: none;
  min-height: 44px;
  padding: 8px 4px;
  color: var(--ink);
  font-weight: 600;
}

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }

/* 16 px or more stops iOS from zooming in when a field gets focus. */
input, textarea {
  font: inherit;
  font-size: 18px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
textarea { resize: vertical; }

.message { font-size: 15px; color: var(--muted); min-height: 1.4em; }
.message.error { color: var(--wrong); }
.hint-text { font-size: 14px; color: var(--muted); }

/* ─── Top bars ─────────────────────────────────────────────────────────── */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 44px;
}
.topbar > :first-child { justify-self: start; }
.topbar > :last-child { justify-self: end; }
.topbar h1 { font-size: 17px; }

.home-header { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; }

.pill {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.pill.online { color: var(--correct); }
.pill.offline { color: var(--muted); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.online { background: var(--correct); }

/* ─── Home ─────────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 15px; }
.stat .number { font-size: 40px; font-weight: 700; color: var(--ink); letter-spacing: -0.03em; line-height: 1.1; }
.stat.due .number { color: var(--gold); }

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

.topics ul { list-style: none; margin: 8px 0 0; padding: 0; }
.topics li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.topics li:first-child { border-top: 0; }

.sync-row { display: flex; justify-content: center; }

.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 0 12px; }
.brand img { border-radius: 16px; }

/* ─── Revision ─────────────────────────────────────────────────────────── */

.progress-text { font-weight: 600; font-variant-numeric: tabular-nums; }
.progress { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--gold); transition: width 0.25s ease; }

.feedback { border-radius: var(--radius); padding: 12px 14px; font-size: 15px; display: flex; flex-direction: column; gap: 2px; }
.feedback .title { font-weight: 700; font-size: 16px; }
.feedback.correct { background: var(--correct-bg); }
.feedback.correct .title { color: var(--correct); }
.feedback.wrong { background: var(--wrong-bg); }
.feedback.wrong .title { color: var(--wrong); }
.feedback.skip { background: var(--skip-bg); }

.question-area { display: flex; flex-direction: column; gap: 12px; }
.question { display: flex; flex-direction: column; gap: 6px; padding: 20px 18px; }
.question .label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.question .prompt { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.question .ask { color: var(--muted); }
.choice-note { font-size: 14px; color: var(--gold); font-weight: 600; }

.answer { display: flex; gap: 8px; }
.answer input { flex: 1; min-width: 0; font-size: 20px; }
.answer button { flex: none; }

.options { display: flex; flex-direction: column; gap: 8px; }
button.option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  min-height: 56px;
}
button.option .number {
  flex: none;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 14px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}
button.option:active { border-color: var(--gold); }

.hints { display: flex; flex-direction: column; gap: 4px; }
.hint { font-size: 15px; color: var(--muted); }
.hint span { color: var(--ink); }

.summary .title { font-size: 24px; font-weight: 700; }
.summary .score { font-size: 20px; }

/* ─── Shift dates ──────────────────────────────────────────────────────── */

.recommendations { display: flex; flex-direction: column; gap: 8px; }
.days { align-items: stretch; }
.days .sign { flex: 0 0 56px; font-size: 22px; font-weight: 700; }

/* ─── Toast ────────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  transform: translate(-50%, 20px);
  max-width: calc(100% - 2 * var(--gutter));
  background: var(--primary);
  color: var(--on-primary);
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
