/* German Frequency Trainer - one stylesheet, no build step.
   Designed for a narrow frame as much as a full tab (plan, section 6). */

:root {
  --ink: #1d2126;
  --muted: #6b7280;
  --line: #e3e6ea;
  --paper: #ffffff;
  --ground: #f5f6f8;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #e6f4ec;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --warn-bg: #fff6e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--ground); }
body { font-size: 17px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.brand { font-weight: 700; letter-spacing: .02em; color: var(--ink); }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 15px; }
.top nav a.active { background: var(--ground); color: var(--ink); }

.app { max-width: 760px; margin: 0 auto; padding: 18px 14px 60px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1 { font-size: 26px; margin: 8px 0 14px; }
h2 { font-size: 19px; margin: 18px 0 8px; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .n { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 14px; }
.stat .sub { font-size: 14px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer; min-height: 46px;
}
.btn:hover { border-color: #c9cdd3; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { font-size: 19px; padding: 14px 28px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 54px; margin-top: 6px; }
.bars .bar { flex: 1; background: #cfd8e8; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar.today { background: var(--accent); }
.bars .bar span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }

/* --- lesson ------------------------------------------------------------- */
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0 14px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--ground); color: var(--muted); border: 1px solid var(--line); }
.badge.new { background: #e8f0fe; color: var(--accent); border-color: #cfdcf7; }
.badge.retry { background: var(--warn-bg); color: #8a5a00; border-color: #f3e1b0; }

.word-big { font-size: 40px; font-weight: 700; line-height: 1.15; margin: 8px 0 4px; word-break: break-word; }
.word-big .art { color: var(--muted); font-weight: 500; margin-right: .3em; }
.word-meta { color: var(--muted); font-size: 15px; }
.gloss-big { font-size: 24px; margin: 6px 0 10px; }
/* the polysemy mark: one line under the gloss, seen without a click (letter 95) */
.senses { margin: -4px 0 10px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--ground); border-radius: 6px; font-size: 16px; }
.senses .l { color: var(--muted); }
/* a thing or a scene sits in one frame of 16:9 whatever the file's own ratio, so that the card
   keeps its height from one picture to the next; a narrower file gets side bands of the card's
   ground colour, never a crop (decided 2026-09-22 - Vadim generates at 16:9, the photo libraries
   give anything). A plate is a drawn sign of its own shape and takes no frame. */
.pic { display: block; width: 100%; max-width: 480px; aspect-ratio: 16 / 9; object-fit: contain;
  background: var(--ground); border-radius: 10px; margin: 8px auto; }
.pic.plate { width: auto; max-width: 100%; aspect-ratio: auto; object-fit: unset; background: none;
  max-height: 110px; margin: 6px 0 2px; }
.example { margin-top: 12px; padding: 12px 14px; background: var(--ground); border-radius: 10px; font-size: 18px; }
.example .l { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.options { display: grid; gap: 10px; margin: 14px 0; }
.opt {
  text-align: left; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); cursor: pointer; font-size: 19px; display: flex; gap: 12px; align-items: center;
}
.opt .k { width: 26px; height: 26px; border-radius: 6px; background: var(--ground); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.opt.selected { border-color: var(--accent); box-shadow: 0 0 0 2px #cfdcf7 inset; }
.opt.right { background: var(--ok-bg); border-color: var(--ok); }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); }
.opt:disabled { cursor: default; opacity: 1; }

.answer-row { display: flex; gap: 8px; margin: 12px 0 6px; }
.answer-row input {
  flex: 1; font: inherit; font-size: 22px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); min-width: 0;
}
.answer-row input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.answer-row input.shake { animation: shake .3s; }
@keyframes shake { 20% { transform: translateX(-5px) } 60% { transform: translateX(5px) } 100% { transform: none } }
.keys { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.keys button { min-width: 44px; height: 42px; font-size: 20px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.keys button:hover { background: var(--ground); }

.feedback { padding: 12px 14px; border-radius: 10px; margin: 10px 0; }
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.feedback.hint { background: var(--warn-bg); color: #5a4300; }
.feedback .title { font-weight: 700; }
.reveal { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.notices { margin: 6px 0 0; padding-left: 18px; color: #7a4d00; font-size: 15px; }
.hintbox { margin-top: 10px; }
.hintbox .lvl { font-weight: 700; margin-right: 6px; }

.done .n { font-size: 44px; font-weight: 700; }

/* --- words -------------------------------------------------------------- */
table.words { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; }
table.words th, table.words td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: top; }
table.words th { color: var(--muted); font-weight: 500; }
.search { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 10px; }

/* --- settings ----------------------------------------------------------- */
.field { margin: 12px 0; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); min-width: 220px; }
.field .help { font-size: 14px; color: var(--muted); margin-top: 4px; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .word-big { font-size: 32px; }
  .btn.big { width: 100%; }
}

/* --- the door: login, application, password, the page about kept data ------ */
body.anon .top nav { display: none; }                 /* nothing to open before a login */
body.no-staff [data-nav="words"] { display: none; }   /* the word list is for the staff (2026-10-08) */
.account-form { max-width: 460px; }
.account-form .field label { font-size: 15px; color: var(--ink); }
.account-form .field label input:not([type="checkbox"]) {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 18px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper);
}
.account-form .field label input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.account-form label.check { display: flex; gap: 8px; align-items: flex-start; }
.account-form label.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
label.check-line { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 15px; }
label.check-line input { margin-top: 3px; width: 18px; height: 18px; flex: none; min-width: 0; }
.form-error { color: var(--bad); min-height: 1.2em; margin: 8px 0; }
.form-error:empty { margin: 0; min-height: 0; }
.notice { background: var(--warn-bg); padding: 10px 14px; border-radius: 10px; }

/* --- exam ---------------------------------------------------------------- */
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.timer.late { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 10px; border-radius: 10px; border: 1px dashed var(--line); margin: 8px 0; }
.chips.sentence { background: var(--paper); border-style: solid; }
.chip { font: inherit; font-size: 19px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.chips.sentence .chip { background: #e8f0fe; border-color: #cfdcf7; }
.report table.words th { width: 40%; }
@media print {
  .noprint, .top { display: none !important; }
  body { background: #fff; font-size: 13px; }
  .app { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
