@font-face {
  font-family: 'Cinzel';
  font-weight: 400 900;
  font-display: swap;
  src: url(fonts/cinzel-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cinzel';
  font-weight: 400 900;
  font-display: swap;
  src: url(fonts/cinzel-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  font-weight: 200 1000;
  font-display: swap;
  src: url(fonts/nunito-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-weight: 200 1000;
  font-display: swap;
  src: url(fonts/nunito-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #12162A;
  --nav: #151A31;
  --surface: #1D2340;
  --surface-2: #272E52;
  --line: #2F3760;
  --line-2: #3A4270;
  --text: #F3F1EA;
  --muted: #A7ADC8;
  --muted-2: #C9CEE4;
  --gold: #F5C542;
  --flame: #FFB566;
  --m: #4D8DFF;
  --v: #FF6B8A;
  --o: #34C98B;
  --brons: #C8834B;
  --zilver: #D5DBE5;
  --goud: #F5C542;
  --diamant: #8BE9F5;
  --wrong: #FF8A80;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100dvh; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: calc(env(safe-area-inset-top) + 28px) 20px calc(env(safe-area-inset-bottom) + 28px);
}

.latin { font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: 0.04em; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

h1 { margin: 0; font-family: 'Cinzel', serif; font-size: 32px; font-weight: 700; letter-spacing: 0.03em; }
h2 { margin: 0; font-size: 18px; font-weight: 800; }

/* ---------- Buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: var(--gold);
  color: var(--bg);
  font-size: 19px;
  font-weight: 800;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); filter: brightness(0.95); }
.btn:disabled { opacity: 0.5; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-quiet { background: none; color: var(--muted); font-size: 15px; font-weight: 700; min-height: 48px; }
.btn-small { min-height: 44px; font-size: 15px; border-radius: 12px; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  flex-shrink: 0;
}

/* ---------- Home ---------- */

.date { font-size: 14px; font-weight: 600; color: var(--muted); }

.streak {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: #2A2340;
  color: var(--flame);
  font-size: 20px;
  font-weight: 800;
}
.streak.off { background: var(--surface); color: var(--muted); }

.panel {
  background: var(--surface);
  border-radius: 24px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.big-number { font-size: 26px; font-weight: 800; }

.fan { position: relative; height: 150px; }
.fan .mini-card { position: absolute; width: 96px; height: 128px; top: 14px; }
.fan .mini-card:nth-child(1) { left: calc(50% - 110px); transform: rotate(-10deg); }
.fan .mini-card:nth-child(2) { left: calc(50% + 14px); transform: rotate(10deg); }
.fan .mini-card:nth-child(3) { left: calc(50% - 48px); top: 4px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); }

.stats { display: flex; gap: 8px; }
.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}
.stat strong { font-size: 20px; font-weight: 800; }
.stat span { font-size: 13px; color: var(--muted); }
.stats.on-bg .stat { background: var(--surface); align-items: center; }

.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  flex: 1;
}
.progress > div { height: 100%; border-radius: 999px; background: var(--gold); transition: width 0.3s; }
.progress.thick { height: 12px; }

.tiers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tier-count { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.gem { width: 12px; height: 12px; border-radius: 3px; transform: rotate(45deg); flex-shrink: 0; }

.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
}
.chapter-row a { font-weight: 700; padding: 10px 0 10px 12px; }

.notice { padding: 14px 16px; border-radius: 14px; background: var(--surface); color: var(--muted-2); font-size: 15px; }
.notice.error { border: 1px solid var(--wrong); }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 12px);
  border-top: 1px solid var(--surface-2);
  background: var(--nav);
}
.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.nav a.active { color: var(--gold); }

/* ---------- Cards ---------- */

.g-m { background: var(--m); }
.g-v { background: var(--v); }
.g-o { background: var(--o); }
.t-0 { border-color: var(--line-2) !important; }
.t-1 { border-color: var(--brons) !important; }
.t-2 { border-color: var(--zilver) !important; }
.t-3 { border-color: var(--goud) !important; }
.t-4 { border-color: var(--diamant) !important; }
.c-1 { color: var(--brons); }
.c-2 { color: var(--zilver); }
.c-3 { color: var(--goud); }
.c-4 { color: var(--diamant); }
.bg-1 { background: var(--brons); }
.bg-2 { background: var(--zilver); }
.bg-3 { background: var(--goud); }
.bg-4 { background: var(--diamant); }

.mini-card {
  position: relative;
  height: 120px;
  border: 4px solid;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  color: var(--bg);
  text-align: center;
  overflow: hidden;
}
button.mini-card { width: 100%; }
.mini-card .word { font-family: 'Cinzel', serif; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; line-height: 1.15; }
.mini-card .gen { font-family: 'Cinzel', serif; font-size: 12px; font-weight: 600; }
.mini-card .corner { position: absolute; top: 5px; left: 8px; font-family: 'Cinzel', serif; font-size: 13px; font-weight: 700; opacity: 0.7; }
.mini-card .tier { position: absolute; bottom: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.75; }
.mini-card.t-4 { box-shadow: 0 0 0 2px var(--bg), 0 0 14px 2px rgba(139, 233, 245, 0.55); }
.mini-card.unknown { background: var(--surface); border: 2px dashed var(--line-2); color: var(--line-2); font-family: 'Cinzel', serif; font-size: 34px; font-weight: 700; }
.mini-card.locked { background: none; border: 2px dashed var(--line); }

.big-card {
  position: relative;
  width: min(290px, 100%);
  min-height: 400px;
  align-self: center;
  border: 7px solid;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  padding: 18px 20px 20px;
  color: var(--bg);
  box-shadow: 0 0 0 4px var(--bg), 0 24px 48px rgba(0, 0, 0, 0.45);
}
.big-card.t-3 { box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px rgba(245, 197, 66, 0.45), 0 24px 48px rgba(0, 0, 0, 0.45); }
.big-card.t-4 { box-shadow: 0 0 0 4px var(--bg), 0 0 24px 6px rgba(139, 233, 245, 0.55), 0 24px 48px rgba(0, 0, 0, 0.45); }
.big-card .top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.big-card .center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 16px 0; }
.big-card .word { font-family: 'Cinzel', serif; font-size: clamp(30px, 11vw, 48px); font-weight: 700; letter-spacing: 0.05em; overflow-wrap: anywhere; line-height: 1.1; }
.big-card .gen { font-family: 'Cinzel', serif; font-size: 24px; font-weight: 600; }
.big-card .gen .gen-end { font-weight: 700; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
.big-card hr { width: 100%; height: 2px; margin: 0; border: 0; border-radius: 2px; background: rgba(18, 22, 42, 0.2); }
.big-card .dutch { padding: 14px 0 12px; font-size: 26px; font-weight: 800; text-align: center; }
.big-card .tier-pill {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.big-card .tier-pill .gem { width: 10px; height: 10px; border-radius: 2px; }

.letter {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(18, 22, 42, 0.16);
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
}

.gen-end { color: var(--gold); font-weight: 700; }
.big-card .gen-end, .mini-card .gen-end { color: inherit; }

/* ---------- Lesson ---------- */

.lesson-top { display: flex; align-items: center; gap: 14px; }
.counter { font-size: 14px; font-weight: 700; color: var(--muted); min-width: 44px; text-align: right; }

.pill {
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pill.boss { background: var(--gold); color: var(--bg); }
.pill.new { background: var(--o); color: var(--bg); }

.prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  border: 2px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  text-align: center;
}
.prompt .ask { font-size: 15px; color: var(--muted); }
.prompt .dutch { font-size: 40px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.prompt .latin { font-size: 44px; letter-spacing: 0.06em; line-height: 1.1; overflow-wrap: anywhere; }
.prompt .latin-sub { font-family: 'Cinzel', serif; font-size: 22px; font-weight: 600; color: var(--muted); }
.prompt .blank { display: inline-block; min-width: 90px; border-bottom: 3px solid var(--gold); }

form.answer { display: flex; flex-direction: column; gap: 8px; }
label.field-label { font-size: 14px; font-weight: 700; color: var(--muted); }
input.text-input {
  width: 100%;
  height: 64px;
  padding: 0 20px;
  border: 2px solid var(--line-2);
  border-radius: 16px;
  background: #0D1022;
  font-size: 24px;
  font-weight: 700;
  outline: none;
}
input.text-input:focus { border-color: var(--gold); }
input.text-input.latin-input { font-family: 'Cinzel', serif; font-size: 26px; letter-spacing: 0.04em; }
.hint { font-size: 13px; color: var(--muted); }

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  min-height: 60px;
  padding: 12px 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: 19px;
  font-weight: 700;
  text-align: left;
}
.choice:active { border-color: var(--gold); }

.gender-buttons { display: flex; flex-direction: column; gap: 12px; }
.gender-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 0 18px;
  border: 3px solid transparent;
  border-radius: 18px;
  color: var(--bg);
  font-size: 20px;
  font-weight: 800;
}
.gender-btn .letter { width: 44px; height: 44px; border-radius: 12px; font-size: 24px; }
.gender-buttons.compact { flex-direction: row; gap: 8px; }
.gender-buttons.compact .gender-btn { flex: 1; min-height: 56px; padding: 0 8px; gap: 8px; font-size: 15px; justify-content: center; opacity: 0.55; }
.gender-buttons.compact .gender-btn .letter { width: 32px; height: 32px; font-size: 18px; }
.gender-buttons.compact .gender-btn[aria-pressed="true"] { opacity: 1; border-color: var(--text); }

/* ---------- Feedback ---------- */

.verdict { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.verdict .title { display: flex; align-items: center; gap: 10px; font-size: 30px; font-weight: 800; }
.verdict .badge-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--gold); color: var(--bg); }
.verdict.wrong .badge-icon { background: var(--wrong); }
.level-change { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: #2A2A3E; font-size: 15px; font-weight: 800; }

.given { margin: 0; text-align: center; color: var(--muted-2); font-size: 15px; }
.given s { color: var(--wrong); }

.tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted-2);
  font-size: 14px;
}
.tip svg { flex-shrink: 0; }
.tip strong { color: var(--text); }

/* ---------- End ---------- */

.celebrate { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.celebrate .latin { font-size: 30px; }
.celebrate .sub { font-size: 17px; color: var(--muted-2); }
.celebrate .sub strong { color: var(--flame); }

.card-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.card-row figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.card-row figure .mini-card { width: 100%; height: 132px; }
.card-row figcaption { font-size: 13px; font-weight: 800; }

.word-line { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
.word-line .latin { flex: 1; font-size: 17px; overflow-wrap: anywhere; }
.word-line .letter { color: var(--bg); background: none; }
.word-line .letter.g-m { background: var(--m); }
.word-line .letter.g-v { background: var(--v); }
.word-line .letter.g-o { background: var(--o); }
.word-line .nl { font-size: 14px; color: var(--muted); text-align: right; }

/* ---------- Album ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }

.set { display: flex; flex-direction: column; gap: 12px; }
.set-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.set-head .done { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--gold); color: var(--bg); font-size: 13px; font-weight: 800; }
.set-head .locked-label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #8A90B0; }
.set.locked h2 { color: #6D7499; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.set.locked .card-grid { opacity: 0.55; }
.more { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  background: rgba(10, 12, 24, 0.88);
}
.modal .btn { max-width: 290px; }

/* ---------- Games ---------- */

.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.game {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 132px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  text-align: left;
}
.game:active { border-color: var(--gold); }
.game strong { font-size: 17px; font-weight: 800; line-height: 1.2; }
.game > span:last-child { font-size: 13px; color: var(--muted); }
.game-tag {
  margin-bottom: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted-2);
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
}
.game-tag.genders { display: flex; gap: 4px; padding: 0; background: none; }
.game-tag.genders i {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--bg);
  font-style: normal;
}
.game.wide { grid-column: 1 / -1; min-height: 104px; }
.game.featured { grid-column: 1 / -1; min-height: 104px; border-color: var(--gold); background: #2A2A3E; }
.game.featured .game-tag { background: var(--gold); color: var(--bg); }

/* ---------- Settings ---------- */

.setting { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 18px; background: var(--surface); }
.setting p { margin: 0; font-size: 14px; color: var(--muted); }
select.select {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 2px solid var(--line-2);
  border-radius: 14px;
  background: #0D1022;
  font-size: 18px;
  font-weight: 700;
}
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button { width: 52px; height: 52px; border: 0; border-radius: 14px; background: var(--surface-2); font-size: 26px; font-weight: 800; }
.stepper output { min-width: 40px; text-align: center; font-size: 26px; font-weight: 800; }
.file-btn { position: relative; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.danger { color: var(--wrong); }
.errors { margin: 0; padding-left: 18px; font-size: 13px; color: var(--wrong); }
.version { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
