:root {
  --bg: #0b1020;
  --bg-soft: #141a2e;
  --card: #1a2138;
  --card-2: #222a44;
  --line: #2c3557;
  --text: #eef1fb;
  --muted: #99a3c4;
  --accent: #ffcc4d;      /* румынский жёлтый */
  --blue: #3d6bff;        /* румынский синий */
  --red: #e23b4e;         /* румынский красный */
  --good: #2fbf71;
  --bad: #e2536a;
  --radius: 16px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

body {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px;
  background: linear-gradient(180deg, var(--bg) 60%, transparent);
  backdrop-filter: blur(6px);
}
.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .3px;
}

.page { padding: 6px 18px 24px; max-width: 640px; margin: 0 auto; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 4px 2px 14px; }

/* ---- home ---- */
.hero { padding: 18px 2px 6px; }
.hero h1 { margin: 0 0 4px; font-size: 30px; }

.menu-grid { display: grid; gap: 14px; margin-top: 16px; }
.menu-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 20px;
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
  transition: transform .08s ease;
}
.menu-card:active { transform: scale(.98); }
.menu-card.learn { background: linear-gradient(135deg, #1b2547, #16203e); }
.menu-card.practice { background: linear-gradient(135deg, #2a1f42, #1c1830); }
.menu-emoji { font-size: 30px; }
.menu-title { font-size: 22px; font-weight: 700; }
.menu-sub { color: var(--muted); font-size: 14px; }

/* ---- day bar / segmented ---- */
.daybar {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 12px;
}
.daybar label { color: var(--muted); font-size: 14px; }
select {
  flex: 1;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 16px; appearance: none;
}

.segmented {
  display: flex; gap: 6px; background: var(--bg-soft);
  padding: 5px; border-radius: 14px; margin-bottom: 14px;
}
.seg {
  flex: 1; text-align: center; text-decoration: none;
  color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 9px 6px; border-radius: 10px;
}
.seg.is-active { background: var(--card-2); color: var(--text); }

/* ---- flashcards ---- */
.cards { display: grid; gap: 12px; }
.flip { perspective: 1000px; cursor: pointer; }
.flip-inner {
  position: relative; width: 100%; min-height: 128px;
  transition: transform .5s; transform-style: preserve-3d;
}
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 16px; text-align: center;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card);
}
.flip-front { }
.flip-back { transform: rotateY(180deg); background: linear-gradient(135deg, #23305c, #1a2444); }
.flip-front .ro { font-size: 24px; font-weight: 700; }
.flip-front .tr { color: var(--accent); font-size: 15px; }
.flip-back .ru { font-size: 24px; font-weight: 700; }
.daybadge {
  position: absolute; top: 10px; right: 12px;
  font-size: 11px; color: var(--muted);
}
.tags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 4px; }
.tag {
  font-size: 11px; color: var(--muted);
  background: var(--card-2); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px;
}

/* ---- theory ---- */
.theory {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 6px; margin-bottom: 14px;
}
.theory-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.theory h2 { margin: 0 0 6px; font-size: 18px; }
.theory-head .daybadge { position: static; }
.theory p { margin: 8px 0; }
.theory ul { margin: 8px 0; padding-left: 20px; }
.theory li { margin: 4px 0; }
.theory .note {
  background: rgba(255,204,77,.08);
  border-left: 3px solid var(--accent);
  padding: 8px 12px; border-radius: 8px; font-size: 15px;
}

/* ---- practice setup ---- */
.setup h1 { font-size: 26px; margin: 14px 0 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { color: var(--muted); font-size: 14px; }
.field-label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.choices { display: grid; gap: 10px; margin-bottom: 22px; }
.choice {
  text-align: left; font-size: 16px; color: var(--text);
  background: var(--card); border: 1px solid var(--line);
  padding: 14px 16px; border-radius: 12px; cursor: pointer;
}
.choice.is-active { border-color: var(--accent); background: var(--card-2); }

.btn-primary {
  width: 100%; border: none; cursor: pointer;
  background: var(--accent); color: #1a1400;
  font-size: 18px; font-weight: 700;
  padding: 15px; border-radius: 14px;
}
.btn-primary:active { filter: brightness(.95); }
.btn-primary:disabled { opacity: .6; }
.link {
  background: none; border: none; color: var(--muted);
  font-size: 15px; cursor: pointer; padding: 8px;
}

/* ---- quiz ---- */
.hidden { display: none !important; }
.quiz-top { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.progress { flex: 1; height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.quiz-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-bottom: 12px; }

.qcard {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 18px; margin-bottom: 16px; min-height: 180px;
}
.q-tag { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.q-prompt-row { display: flex; align-items: center; gap: 10px; }
.q-prompt { font-size: 24px; font-weight: 700; margin: 8px 0 4px; }
.q-sub { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.q-speak, .speak-inline {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; cursor: pointer; font-size: 15px;
  width: 34px; height: 34px; line-height: 1; padding: 0; flex: none;
}
.speak-inline { width: 28px; height: 28px; font-size: 13px; vertical-align: middle; }
.q-speak:active, .speak-inline:active { filter: brightness(1.2); }

.answer-wrap input {
  width: 100%; font-size: 18px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.answer-wrap input:focus { outline: none; border-color: var(--accent); }

.options { display: grid; gap: 10px; }
.opt {
  text-align: left; font-size: 17px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 14px 16px; border-radius: 12px; cursor: pointer;
}
.opt.is-selected { border-color: var(--accent); }
.opt.is-correct { border-color: var(--good); background: rgba(47,191,113,.12); }
.opt.is-wrong { border-color: var(--bad); background: rgba(226,83,106,.12); }

.feedback { margin-top: 14px; font-weight: 600; font-size: 16px; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

/* ---- result ---- */
.result { text-align: center; padding-top: 30px; }
.result h1 { font-size: 64px; margin: 0; }
.result p { font-size: 20px; margin: 10px 0 26px; }
.result-actions { display: grid; gap: 12px; }

/* ---- tab bar ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(11,16,32,.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px;
}
.tab-icon { font-size: 21px; }
.tab.is-active { color: var(--text); }
.tab.is-active .tab-icon { transform: translateY(-1px); }
