/* ============================================================================
   Wortliste Trainer — "warm editorial study" theme
   Cream paper · ink · vermillion + ochre · grain · notebook margin
   Type: Fraunces (display) / Hanken Grotesk (UI) / Newsreader (sentences)
   ========================================================================== */

:root {
  --paper:        #f3ecdd;
  --paper-2:      #ece2cd;
  --card:         #fbf7ec;
  --ink:          #211b14;
  --ink-soft:     #5b4f40;
  --ink-faint:    #8a7c69;
  --line:         #d8ccb2;
  --line-strong:  #c7b797;

  --red:          #c4382a;   /* vermillion accent / margin line */
  --red-deep:     #9e2b20;
  --ochre:        #c08a1e;
  --ochre-deep:   #9a6c11;
  --green:        #3c6e4f;
  --green-deep:   #2c5a3e;
  --teal:         #2f6f7a;   /* method III accent */
  --teal-deep:    #235862;
  --teal-wash:    #d8e8ea;
  --blue:         #5b7da3;   /* masculine */

  --gold-wash:    #f6e8c4;
  --red-wash:     #f6dcd5;
  --green-wash:   #dceadd;

  --shadow:       0 1px 0 rgba(255,255,255,.6), 0 18px 40px -22px rgba(33,27,20,.55);
  --shadow-sm:    0 1px 0 rgba(255,255,255,.5), 0 10px 22px -16px rgba(33,27,20,.5);

  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 7px;

  --serif:   "Fraunces", Georgia, serif;
  --read:    "Newsreader", Georgia, serif;
  --sans:    "Hanken Grotesk", system-ui, sans-serif;

  --maxw: 940px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* the HTML hidden attribute always wins */
html, body { margin: 0; padding: 0; }
/* when a drawer is open, pin the page so it can't scroll behind it (iOS-safe) */
body.scroll-locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--gold-wash) 0%, transparent 55%),
    radial-gradient(1000px 700px at -10% 110%, #efe6d2 0%, transparent 60%),
    var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--red); outline-offset: 3px; border-radius: 3px; }

/* ---------- paper grain ---------- */
.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
}

/* ============================================================================
   Masthead
   ========================================================================== */
.masthead {
  border-bottom: 2.5px solid var(--ink);
  background: linear-gradient(to bottom, rgba(251,247,236,.6), transparent);
}
.masthead__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 24px 14px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}
.masthead__brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.masthead__mark {
  font-family: var(--serif); font-weight: 900; font-size: 34px; line-height: 1;
  width: 54px; height: 54px; display: grid; place-items: center;
  color: var(--paper); background: var(--ink);
  border-radius: var(--r-sm); box-shadow: 3px 3px 0 var(--red);
  transition: transform .25s ease, box-shadow .25s ease;
}
.masthead__brand:hover .masthead__mark { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--red); }
.masthead__titles { display: flex; flex-direction: column; }
.masthead__title {
  font-family: var(--serif); font-weight: 800; font-size: clamp(28px, 5vw, 40px);
  line-height: .95; letter-spacing: -.01em;
}
.masthead__kicker {
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin-top: 4px;
}
.masthead__right { display: flex; align-items: center; gap: 16px; min-width: 0; }
.masthead__nav { display: flex; align-items: center; gap: 10px; width: 200px; }
.masthead__edition {
  font-family: var(--read); font-style: italic; font-size: 14px; color: var(--ink-soft);
  white-space: nowrap;
}
.rule { height: 1.5px; background: var(--line-strong); flex: 1; }

/* account chip + logout */
.account { display: flex; align-items: center; gap: 9px; min-width: 0; }
.account__avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--serif); font-weight: 800;
  font-size: 16px; color: var(--paper); background: var(--red); box-shadow: 2px 2px 0 var(--ink);
}
.account__name {
  font-weight: 700; font-size: 14px; color: var(--ink);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account__out {
  border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink-soft);
  border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 12.5px;
  transition: border-color .15s ease, color .15s ease;
}
.account__out:hover { border-color: var(--red-deep); color: var(--red-deep); }

/* ============================================================================
   Screen wrapper + transitions
   ========================================================================== */
#screen {
  flex: 1; width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: 30px 24px 60px;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }

/* ============================================================================
   LOGIN
   ========================================================================== */
.login { display: flex; justify-content: center; padding: 4vh 0 40px; }
.login__card {
  width: 100%; max-width: 460px; background: var(--card);
  border: 2px solid var(--ink); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 34px 32px 28px 38px; position: relative;
}
.login__card::before {     /* notebook margin */
  content: ""; position: absolute; left: 22px; top: 18px; bottom: 18px; width: 1.5px;
  background: var(--red); opacity: .4;
}
.login__kicker { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--red-deep); font-weight: 700; }
.login__title { font-family: var(--serif); font-weight: 800; font-size: clamp(30px, 6vw, 40px); line-height: 1.02; margin: 6px 0 10px; }
.login__lede { font-family: var(--read); font-size: 16px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 20px; }
.login__msg {
  background: var(--gold-wash); border: 1.5px solid var(--ochre-deep); color: var(--ochre-deep);
  border-radius: var(--r-sm); padding: 10px 14px; font-size: 14px; font-weight: 600; margin-bottom: 18px;
}
.login__form { display: flex; flex-direction: column; gap: 16px; }
.login__field { display: flex; flex-direction: column; gap: 7px; }
.login__label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.login__input {
  font-family: var(--sans); font-size: 18px; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: var(--r-md); padding: 13px 16px; width: 100%;
  transition: box-shadow .15s ease;
}
.login__input:focus { outline: none; box-shadow: 0 0 0 4px var(--red-wash); }
.login__input::placeholder { color: var(--ink-faint); letter-spacing: .08em; }
.login__go { justify-content: center; margin-top: 2px; }
.login__hint { font-family: var(--read); font-style: italic; font-size: 13.5px; color: var(--ink-faint); margin: 14px 0 0; text-align: center; }

/* ============================================================================
   Speaker (German text-to-speech) button + text rows
   ========================================================================== */
.speak {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--paper); color: var(--ink-soft);
  display: inline-grid; place-items: center; vertical-align: middle;
  transition: transform .12s ease, border-color .15s ease, color .15s ease;
}
.speak:hover { border-color: var(--red-deep); color: var(--red-deep); transform: translateY(-2px); }
.speak:active { transform: scale(.9); }
.headword-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.headword-row .headword { margin: 4px 0 0; }
.sentence-row { display: flex; align-items: flex-start; gap: 14px; }
.sentence-row .sentence { flex: 1; }
.sentence-row .speak { margin-top: 10px; }
.answer-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.drawer-head { display: flex; align-items: center; gap: 12px; }
.drawer-head .speak { width: 32px; height: 32px; }
.ex .de { display: flex; align-items: center; gap: 8px; }
.ex .de .speak { width: 28px; height: 28px; }

/* ============================================================================
   HOME
   ========================================================================== */
.lede {
  font-family: var(--read); font-size: clamp(19px, 2.6vw, 24px); line-height: 1.45;
  color: var(--ink-soft); max-width: 30ch; margin: 4px 0 26px;
}
.lede em { color: var(--red-deep); font-style: italic; }

.statband {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 2px solid var(--ink); border-radius: var(--r-md);
  overflow: hidden; background: var(--card); box-shadow: var(--shadow-sm);
  margin-bottom: 36px;
}
.stat { padding: 16px 18px; border-right: 1.5px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat__n { font-family: var(--serif); font-weight: 800; font-size: clamp(26px, 4vw, 36px); line-height: 1; }
.stat__n .small { font-size: .5em; color: var(--ink-faint); font-weight: 600; }
.stat__l { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-top: 7px; font-weight: 600; }
.stat--accent .stat__n { color: var(--red-deep); }

.section-h {
  display: flex; align-items: center; gap: 12px; margin: 0 0 16px;
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700;
}
.section-h::after { content: ""; flex: 1; height: 1.5px; background: var(--line); }

.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 16px; margin-bottom: 34px; }
.mode {
  position: relative; text-align: left; background: var(--card);
  border: 2px solid var(--ink); border-radius: var(--r-lg); padding: 22px 22px 20px;
  box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease;
  display: flex; flex-direction: column; gap: 10px;
}
.mode::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  background: var(--accent, var(--red)); border-radius: 4px;
}
.mode[data-mode="mc"]       { --accent: var(--red); }
.mode[data-mode="sentence"] { --accent: var(--ochre); }
.mode[data-mode="write"]    { --accent: var(--teal); }
.mode__desc em { font-style: italic; color: var(--accent, var(--red)); font-weight: 600; }
.mode:hover { transform: translateY(-3px); box-shadow: 0 1px 0 rgba(255,255,255,.6), 0 26px 46px -24px rgba(33,27,20,.6); }
.mode__num { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--accent, var(--red)); font-weight: 600; }
.mode__title { font-family: var(--serif); font-weight: 800; font-size: 25px; line-height: 1.05; }
.mode__desc { font-size: 14.5px; color: var(--ink-soft); line-height: 1.5; }
.mode__go {
  margin-top: 6px; align-self: flex-start; font-weight: 700; font-size: 14px;
  color: var(--ink); display: inline-flex; align-items: center; gap: 8px;
}
.mode__go .arrow { transition: transform .2s ease; }
.mode:hover .mode__go .arrow { transform: translateX(5px); }

/* scope / options */
.controls {
  display: flex; flex-wrap: wrap; gap: 22px 30px; align-items: flex-end;
  padding: 20px 22px; background: var(--card); border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.segmented { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); }
.segmented button {
  border: 0; background: transparent; padding: 9px 16px; font-weight: 600; font-size: 13.5px; color: var(--ink-soft);
  transition: color .15s ease;
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.selectwrap { position: relative; }
select {
  appearance: none; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 999px;
  padding: 9px 38px 9px 16px; cursor: pointer;
}
.selectwrap::after { content: "▾"; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--ink-soft); }

/* marked-words call-to-action */
.marked-banner {
  width: 100%; text-align: left; margin-top: 18px;
  display: flex; align-items: center; gap: 16px; padding: 15px 20px;
  border-radius: var(--r-md); border: 2px solid var(--ochre-deep);
  background: linear-gradient(110deg, var(--gold-wash), var(--card));
  box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.marked-banner:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.marked-banner__star { font-size: 26px; color: var(--ochre); flex: none; }
.marked-banner__text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.marked-banner__text b { font-family: var(--serif); font-size: 19px; font-weight: 800; }
.marked-banner__text span { color: var(--ink-soft); font-size: 14px; }
.marked-banner__go { font-weight: 700; font-size: 14px; color: var(--ochre-deep); display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.marked-banner__go .arrow { transition: transform .2s ease; }
.marked-banner:hover .marked-banner__go .arrow { transform: translateX(5px); }
.marked-banner--active { border-color: var(--green-deep); background: linear-gradient(110deg, var(--green-wash), var(--card)); }
.marked-banner--active .marked-banner__star,
.marked-banner--active .marked-banner__go { color: var(--green-deep); }

/* ============================================================================
   Buttons
   ========================================================================== */
.btn {
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: 12px 22px; font-weight: 700; font-size: 14.5px;
  display: inline-flex; align-items: center; gap: 9px;
  transition: transform .12s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--ink); color: var(--paper); box-shadow: 4px 4px 0 var(--red); }
.btn--primary:hover { box-shadow: 6px 6px 0 var(--red); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn--small { padding: 9px 15px; font-size: 13px; }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .kbd, .kbd {
  font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 5px; border: 1.5px solid currentColor; opacity: .65; line-height: 1.2;
}
kbd {
  font-family: var(--sans); font-size: 11px; font-weight: 700; background: var(--ink); color: var(--paper);
  padding: 2px 7px; border-radius: 5px;
}

.home-start { margin-top: 30px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.home-start .note { font-family: var(--read); font-style: italic; color: var(--ink-faint); font-size: 14px; }

/* ============================================================================
   TRAINER
   ========================================================================== */
.trainer { display: flex; flex-direction: column; gap: 22px; }

.hud { display: flex; flex-direction: column; gap: 12px; }
.hud__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hud__left { display: flex; align-items: baseline; gap: 14px; }
.counter { font-family: var(--serif); font-weight: 800; font-size: 22px; letter-spacing: -.01em; }
.counter .of { color: var(--ink-faint); font-weight: 600; }
.modepill {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700;
  padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--ink);
}
.modepill[data-mode="mc"]       { background: var(--red-wash);  border-color: var(--red-deep);  color: var(--red-deep); }
.modepill[data-mode="sentence"] { background: var(--gold-wash); border-color: var(--ochre-deep); color: var(--ochre-deep); }
.modepill[data-mode="write"]    { background: var(--teal-wash); border-color: var(--teal-deep); color: var(--teal-deep); }
.hud__right { display: flex; align-items: center; gap: 10px; }
.score { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.score b { font-family: var(--serif); color: var(--green-deep); font-size: 16px; }

.iconbtn {
  border: 2px solid var(--ink); background: var(--paper); width: 42px; height: 42px;
  border-radius: 50%; display: grid; place-items: center; font-size: 18px; line-height: 1;
  transition: transform .15s ease, background .15s ease;
}
.iconbtn:hover { transform: translateY(-2px); }
.iconbtn[aria-pressed="true"] { background: var(--ochre); border-color: var(--ochre-deep); color: #fff; }
.iconbtn--mark.bump { animation: bump .4s ease; }
@keyframes bump { 0%,100% { transform: scale(1); } 35% { transform: scale(1.28) rotate(-8deg); } }

.progress { height: 9px; background: var(--paper-2); border: 1.5px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--ochre)); border-radius: 999px; transition: width .45s cubic-bezier(.2,.7,.2,1); }

/* ---- the card ---- */
.cardwrap { perspective: 1600px; }
.card {
  position: relative; background: var(--card); border: 2px solid var(--ink);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 30px 34px 32px 46px; min-height: 360px;
  display: flex; flex-direction: column;
}
/* notebook margin line */
.card::before { content: ""; position: absolute; left: 26px; top: 0; bottom: 0; width: 1.5px; background: var(--red); opacity: .45; }
.card.slide-left  { animation: slideL .34s cubic-bezier(.2,.7,.2,1); }
.card.slide-right { animation: slideR .34s cubic-bezier(.2,.7,.2,1); }
@keyframes slideL { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }
@keyframes slideR { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: none; } }

.card__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tag {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--line-strong); color: var(--ink-soft);
}
.tag--type { border-color: var(--ink); color: var(--ink); }
.tag--g-masculine { background:#dde7f1; border-color:#5b7da3; color:#3c5d80; }
.tag--g-feminine  { background: var(--red-wash); border-color: var(--red-deep); color: var(--red-deep); }
.tag--g-neuter    { background: var(--green-wash); border-color: var(--green-deep); color: var(--green-deep); }
.tag--page { margin-left: auto; border: 0; color: var(--ink-faint); font-family: var(--read); font-style: italic; text-transform: none; letter-spacing: 0; }

.headword {
  font-family: var(--serif); font-weight: 800; font-size: clamp(38px, 7vw, 64px);
  line-height: 1.02; letter-spacing: -.015em; margin: 4px 0 6px;
}
.subline { font-family: var(--read); font-style: italic; color: var(--ink-soft); font-size: 17px; margin-bottom: 4px; }

.prompt-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; margin-bottom: 18px; }

/* ---- multiple choice options ---- */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: auto; }
.reveal-row { display: flex; justify-content: center; margin-top: 16px; }
.option {
  text-align: left; background: var(--paper); border: 2px solid var(--line-strong);
  border-radius: var(--r-md); padding: 15px 16px 15px 14px; font-size: 16px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 12px; min-height: 60px;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.option:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--ink); }
.option__key {
  flex: none; width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; background: var(--ink); color: var(--paper);
}
.option__text { font-family: var(--read); font-size: 17px; font-weight: 500; }
.option:disabled { cursor: default; }
.option.correct  { background: var(--green-wash); border-color: var(--green-deep); color: var(--green-deep); }
.option.correct .option__key  { background: var(--green-deep); }
.option.wrong    { background: var(--red-wash); border-color: var(--red-deep); color: var(--red-deep); }
.option.wrong .option__key    { background: var(--red-deep); }
.option.wrong { animation: shake .4s cubic-bezier(.36,.07,.19,.97); }
.option.faded { opacity: .5; }
@keyframes shake { 10%,90%{transform:translateX(-1px);} 20%,80%{transform:translateX(2px);} 30%,50%,70%{transform:translateX(-4px);} 40%,60%{transform:translateX(4px);} }

/* ---- sentence-recall ---- */
.sentence {
  font-family: var(--read); font-size: clamp(22px, 3.6vw, 31px); line-height: 1.4;
  font-weight: 500; margin: 6px 0 8px; max-width: 36ch;
}
.sentence .focus { color: var(--red-deep); font-style: italic; font-weight: 600; }
.reveal-box {
  margin-top: 20px; padding: 18px 20px; border-radius: var(--r-md);
  background: var(--paper); border: 1.5px dashed var(--line-strong);
}
.reveal-box.show { animation: rise .4s ease both; border-style: solid; }
.reveal-en { font-family: var(--read); font-size: 19px; color: var(--ink-soft); line-height: 1.45; }
.reveal-trans { margin-top: 12px; padding-top: 12px; border-top: 1.5px solid var(--line); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.reveal-trans .de { font-family: var(--serif); font-weight: 800; font-size: 20px; }
.reveal-trans .en { font-family: var(--read); font-style: italic; color: var(--red-deep); font-size: 18px; }

.sentence-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btn--know { background: var(--green-deep); border-color: var(--green-deep); color: #fff; box-shadow: 4px 4px 0 rgba(44,90,62,.3); }
.btn--know:hover { box-shadow: 6px 6px 0 rgba(44,90,62,.3); }
.btn--reveal { background: var(--paper); }

.afterbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.afterbar .verdict { font-family: var(--read); font-style: italic; font-size: 16px; }
.verdict.good { color: var(--green-deep); }
.verdict.bad  { color: var(--red-deep); }
.detail-link { background: none; border: 0; color: var(--ink-soft); font-weight: 700; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.detail-link:hover { color: var(--red-deep); }
.verdict.warn { color: var(--ochre-deep); }

/* ---- method III: write the word ---- */
.headword--en {
  font-size: clamp(30px, 5.4vw, 50px); line-height: 1.05; color: var(--ink);
}
.headword--en::before {
  content: "“"; color: var(--teal); margin-right: .04em;
}
.headword--en::after { content: "”"; color: var(--teal); }
.write-form { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.write-inputwrap { position: relative; flex: 1; min-width: 240px; display: flex; }
.write-inputwrap .write-input { width: 100%; min-width: 0; flex: 1; padding-right: 54px; }
.write-input {
  flex: 1; min-width: 240px; font-family: var(--serif); font-weight: 600;
  font-size: clamp(22px, 3vw, 28px); color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-md);
  padding: 12px 18px; transition: border-color .15s ease, box-shadow .15s ease;
}
/* microphone (German dictation) button, docked inside the input */
.mic {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--teal-deep); background: var(--teal-wash); color: var(--teal-deep);
  display: grid; place-items: center; transition: transform .12s ease, background .15s ease, color .15s ease;
}
.mic:hover { transform: translateY(-50%) scale(1.06); }
.mic:active { transform: translateY(-50%) scale(.94); }
.mic.listening { background: var(--red); border-color: var(--red-deep); color: #fff; animation: micpulse 1s ease-in-out infinite; }
@keyframes micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196,56,42,.5); }
  50%      { box-shadow: 0 0 0 9px rgba(196,56,42,0); }
}
.write-input::placeholder { color: var(--ink-faint); font-weight: 500; font-style: italic; }
.write-input:focus { outline: none; border-color: var(--teal-deep); box-shadow: 0 0 0 4px var(--teal-wash); }
.write-input:disabled { background: var(--paper-2); opacity: .9; }
#writeSubmit { flex: none; }

.write-reveal {
  margin-top: 22px; padding: 18px 20px; border-radius: var(--r-md);
  background: var(--paper); border: 1.5px solid var(--line-strong);
}
.write-reveal.show { animation: rise .4s ease both; }
.write-reveal .verdict { font-family: var(--read); font-style: italic; font-size: 17px; margin-bottom: 8px; }
.write-reveal .answer { font-family: var(--serif); font-weight: 800; font-size: clamp(26px, 4vw, 34px); line-height: 1.1; }
.write-reveal .answer-sub { font-family: var(--read); font-style: italic; color: var(--ink-soft); font-size: 16px; margin-top: 6px; }
.write-reveal .detail-link { margin-top: 12px; display: inline-block; }
.art-m { color: var(--blue); font-weight: 800; }
.art-f { color: var(--red-deep); font-weight: 800; }
.art-n { color: var(--green-deep); font-weight: 800; }

/* ---- nav row ---- */
.navrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.navrow__center { display: flex; gap: 10px; }

/* ============================================================================
   DONE screen
   ========================================================================== */
.done { text-align: center; padding: 30px 0; }
.done__big { font-family: var(--serif); font-weight: 900; font-size: clamp(40px, 8vw, 72px); line-height: 1; }
.done__sub { font-family: var(--read); font-style: italic; font-size: 20px; color: var(--ink-soft); margin: 10px 0 28px; }
.done__stats { display: inline-grid; grid-template-columns: repeat(3, auto); gap: 0 0; border: 2px solid var(--ink); border-radius: var(--r-md); overflow: hidden; background: var(--card); margin-bottom: 30px; }
.done__stat { padding: 18px 28px; border-right: 1.5px solid var(--line); }
.done__stat:last-child { border-right: 0; }
.done__actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ============================================================================
   Drawer (word details)
   ========================================================================== */
.drawer { position: fixed; inset: 0; z-index: 200; }
.drawer[hidden] { display: none; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(33,27,20,.4); backdrop-filter: blur(2px); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer__panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(460px, 92vw);
  background: var(--paper); border-left: 2.5px solid var(--ink); box-shadow: -30px 0 60px -30px rgba(0,0,0,.5);
  padding: 26px 28px; overflow-y: auto; animation: slidein .3s cubic-bezier(.2,.7,.2,1);
}
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer__close { position: absolute; right: 16px; top: 14px; border: 0; background: none; font-size: 30px; line-height: 1; color: var(--ink-soft); }
.drawer__close:hover { color: var(--red-deep); }
.drawer h3 { font-family: var(--serif); font-weight: 800; font-size: 30px; margin: 4px 0 2px; }
.drawer .dsub { font-family: var(--read); font-style: italic; color: var(--ink-soft); margin-bottom: 18px; }
.dsection { margin-top: 18px; }
.dsection h4 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14.5px; }
.kv dt { color: var(--ink-soft); font-weight: 600; }
.kv dd { margin: 0; }
.conj { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.conj th, .conj td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.conj th { color: var(--ink-soft); font-weight: 600; width: 28%; }
.conj caption { text-align: left; font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--red-deep); margin: 12px 0 4px; }
.ex-list { display: flex; flex-direction: column; gap: 12px; }
.ex { padding-left: 12px; border-left: 2px solid var(--red); }
.ex .de { font-family: var(--read); font-size: 16px; }
.ex .en { font-family: var(--read); font-style: italic; color: var(--ink-soft); font-size: 14.5px; }

/* ============================================================================
   Toast + colophon + shortcuts
   ========================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px);
  background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 999px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; z-index: 300;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.colophon {
  border-top: 1.5px solid var(--line); margin-top: auto;
  padding: 16px 24px; text-align: center; color: var(--ink-faint);
  font-family: var(--read); font-style: italic; font-size: 13.5px;
  display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.colophon__dot { opacity: .5; }
.colophon kbd { font-style: normal; }

.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 26px; margin-top: 10px; }
.shortcut { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.shortcut kbd { min-width: 22px; text-align: center; }

/* ============================================================================
   Responsive
   ========================================================================== */
/* tablet / small laptop */
@media (max-width: 760px) {
  .masthead__nav { display: none; }      /* drop the edition rule, keep the account */
  .masthead__right { gap: 10px; }
}

/* phones */
@media (max-width: 680px) {
  #screen { padding: 22px 16px 48px; }
  .masthead__inner { padding: 14px 16px 12px; gap: 12px; }
  .masthead__mark { width: 44px; height: 44px; font-size: 28px; }
  .masthead__title { font-size: clamp(24px, 8vw, 32px); }
  .masthead__kicker { font-size: 10px; }

  .statband { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1.5px solid var(--line); }
  .controls { padding: 16px; gap: 16px 20px; }
  .modes { grid-template-columns: 1fr; }
  .options { grid-template-columns: 1fr; }
  .card { padding: 22px 18px 24px 32px; }
  .card::before { left: 16px; }
  .headword { font-size: clamp(34px, 11vw, 52px); }
  .done__stats { grid-template-columns: 1fr; }
  .done__stat { border-right: 0; border-bottom: 1.5px solid var(--line); }
  .done__stat:last-child { border-bottom: 0; }

  .write-form { gap: 10px; }
  .write-input { min-width: 0; }
  #writeSubmit { width: 100%; justify-content: center; }
  .login__card { padding: 26px 22px 22px 30px; }

  /* full-screen detail drawer on phones */
  .drawer__panel { left: 0; right: 0; width: auto; border-left: 0; padding: 22px 18px; animation: fade .25s ease; }
  .drawer__scrim { display: none; }
}

/* small phones */
@media (max-width: 460px) {
  .masthead__title { font-size: 24px; }
  .account__name { display: none; }              /* avatar + logout only */
  .hud__top { gap: 10px; }
  .score { display: none; }                       /* progress bar carries the count */
  .navrow .btn-label { display: none; }           /* reshuffle shows just ↻ */
  .btn { padding: 11px 16px; font-size: 14px; }
  .modepill { font-size: 10px; padding: 4px 9px; }
  .sentence-row { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
