/* Egon PLU — design system. Brand palette from the Android app:
   cream #efeee8 · dark olive #393f33 · warm tan/gold #dda47d · beige #d2c9b9
   Typography: Cormorant Garamond (elegant serif headings) + Inter (clean sans body), self-hosted. */

@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/cormorant-600.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/cormorant-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/inter-700.woff2') format('woff2'); }

:root {
  --cream: #efeee8;
  --olive: #393f33;
  --olive-700: #2a2f26;
  --tan: #dda47d;
  --tan-600: #c68e68;
  --tan-300: #e6b896;
  --beige: #d2c9b9;
  --white: #ffffff;

  --bg: var(--cream);
  --bg-elev: #f7f6f1;
  --surface: var(--white);
  --surface-2: #f1efe8;
  --text: var(--olive);
  --text-soft: #6f7468;
  --text-faint: #9aa090;
  --border: #e3e0d5;
  --accent: var(--tan);
  --accent-strong: var(--tan-600);
  --primary: var(--olive);
  --on-primary: var(--cream);
  --good: #4f9d6b;
  --good-bg: #e7f2ea;
  --bad: #c8553d;
  --bad-bg: #f7e7e2;
  --shadow: 0 6px 24px rgba(57, 63, 51, 0.10);
  --shadow-sm: 0 2px 8px rgba(57, 63, 51, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --maxw: 1040px;
  --font: 'Inter', "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-num: 'Inter', "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --serif: 'Cormorant Garamond', "Georgia", "Times New Roman", serif;
  --gold-line: rgba(216, 167, 124, 0.28);
  --bg-glow: radial-gradient(circle at 50% -8%, rgba(216, 167, 124, 0.05), transparent 42%);
}

[data-theme="dark"] {
  --bg: #2b3026;
  --bg-elev: #313629;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.03);
  --text: #efe9dd;
  --text-soft: #b9bdac;
  --text-faint: #8b9079;
  --border: rgba(255, 255, 255, 0.08);
  /* Buttons keep light-mode colors per request */
  /* --primary: var(--tan); */
  /* --on-primary: #2a2f26; */
  --good-bg: rgba(79, 157, 107, 0.16);
  --bad-bg: rgba(200, 85, 61, 0.16);
  --gold-line: rgba(216, 167, 124, 0.32);
  --bg-glow: radial-gradient(circle at 50% -6%, rgba(216, 167, 124, 0.10), transparent 46%);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.40);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.26);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  letter-spacing: 0.1px;
  overscroll-behavior-y: none;
}
h1, h2, h3 { letter-spacing: 0.2px; }
button { font-family: inherit; }
a { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--tan); outline-offset: 2px; border-radius: 6px; }

/* ---------- App frame ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }
.screen { flex: 1; padding: 26px 0 110px; animation: fadeUp .28s ease both; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.1) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; height: 64px; }
.topbar__side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar__side--right { justify-content: flex-end; }

/* Centered EGON Restaurant logo (inline SVG, themed via currentColor). */
.brand { display: grid; place-items: center; justify-self: center; background: none; border: none;
  cursor: pointer; padding: 4px 8px; color: var(--text); transition: opacity .12s ease, transform .12s ease; }
.brand:hover { opacity: .82; }
.brand:active { transform: scale(.97); }
.egon-logo-container { position: relative; display: flex; flex-direction: row; align-items: center; gap: clamp(8px, 2vw, 12px); }
.egon-uoffisiell { font-size: 8.5px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-faint); font-weight: 600; opacity: 0.7; user-select: none; }
.egon-logo-inner { display: flex; flex-direction: column; align-items: center; gap: 0px; }
.egon-logo { display: block; height: 34px; width: auto; overflow: visible; }
.egon-logo path { fill: currentColor; }
.egon-logo-line { display: block; width: 100%; height: auto; max-width: 44px; overflow: visible; transform: translateY(4px); }
.egon-logo-line .egon-logo__line { fill: none; stroke: currentColor; }

.iconbtn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 18px; display: grid; place-items: center;
  transition: transform .12s ease, background .12s ease; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn:active { transform: scale(.94); }
/* In the editorial top bar, icons read as clean glyphs (no boxed chrome). */
.topbar .iconbtn { background: transparent; border-color: transparent; }
.topbar .iconbtn:hover { background: var(--surface); }
.iconbtn--sm { width: 32px; height: 32px; border-radius: 8px; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn { appearance: none; border: 1px solid transparent; border-radius: 14px; padding: 13px 18px;
  font-size: 15px; font-weight: 700; cursor: pointer; background: var(--surface); color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, opacity .12s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn--accent { background: var(--accent); color: #3a2a1c; box-shadow: var(--shadow-sm); }
.btn--accent:hover { background: var(--tan-300); }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--block { display: block; width: 100%; }
.btn--lg { padding: 16px 22px; font-size: 16px; border-radius: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px; }
.card--pad-lg { padding: 22px; }
/* Thin gold divider above each section title — an EGON signature. */
.section-title { font-size: 12px; font-weight: 600; letter-spacing: 2.4px; text-transform: uppercase;
  color: var(--text-faint); margin: 38px 2px 16px; padding-top: 22px; border-top: 1px solid var(--gold-line); }

/* Large serif section header with a serving-dome flourish (the EGON "MAT" treatment). */
.section-head { display: flex; align-items: center; gap: 11px; margin: 34px 2px 14px; padding-top: 22px;
  border-top: 1px solid var(--gold-line); }
.section-head__icon { color: var(--accent); display: grid; place-items: center; flex: none; }
.section-head__title { font-family: var(--serif); font-size: 27px; font-weight: 700; line-height: 1;
  color: var(--accent); letter-spacing: .4px; margin: 0; }

/* Warm instructional notice banner with a vertical accent rule (EGON-app style). */
.notice { display: flex; gap: 14px; margin-top: 16px; padding: 15px 18px; border-radius: var(--radius);
  background: linear-gradient(180deg, #cdac86, #c09a71); color: #3a2a1c; box-shadow: var(--shadow-sm); }
.notice::before { content: ""; flex: none; width: 3px; border-radius: 99px; background: rgba(58,42,28,.5); }
.notice__text { font-size: 14px; font-weight: 600; font-style: italic; line-height: 1.45; }

/* ---------- Hero (home) — circular photo-in-ring medallion ---------- */
.hero { background: linear-gradient(165deg, var(--olive), var(--olive-700)); color: var(--cream);
  border: 1px solid var(--gold-line); border-radius: var(--radius-lg); padding: 26px 22px 24px;
  box-shadow: var(--shadow); position: relative; overflow: hidden; text-align: center; }
.hero::after { content: ""; position: absolute; left: 50%; top: -130px; width: 340px; height: 340px;
  transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(circle, rgba(221,164,125,.20), transparent 66%); }
.hero > * { position: relative; }
.hero__greeting { font-size: 11.5px; opacity: .9; text-transform: uppercase; letter-spacing: 2.6px;
  font-weight: 700; color: var(--tan-300); }
.hero__title { font-family: var(--serif); font-size: 31px; font-weight: 700; line-height: 1.04; margin: 6px 0 16px; }

.hero__medallion { position: relative; width: 188px; height: 188px; margin: 0 auto; padding: 0;
  background: none; border: none; cursor: pointer; display: block; transition: transform .14s ease; }
.hero__medallion:active { transform: scale(.98); }
.hero__photo { width: 138px; height: 138px; border-radius: 50%; overflow: hidden;
  background: rgba(255,255,255,.06); box-shadow: 0 8px 22px rgba(0,0,0,.34); }
.hero__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero__photo-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--tan-300); }
.hero__level { position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%); white-space: nowrap;
  background: linear-gradient(180deg, var(--tan-300), var(--tan-600)); color: #3a2a1c; font-weight: 800;
  font-size: 12.5px; padding: 5px 15px; border-radius: 99px; box-shadow: 0 4px 12px rgba(0,0,0,.32); }

.hero__meta { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.hero__metric { text-align: center; min-width: 56px; }
.hero__metric-num { font-family: var(--font-num); font-size: 25px; font-weight: 800; line-height: 1;
  color: var(--cream); font-variant-numeric: tabular-nums; }
.hero__metric-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .78; margin-top: 5px; }
.hero__meta-div { width: 1px; height: 26px; background: rgba(255,255,255,.16); }
.hero__carried { margin-top: 16px; display: inline-block; background: rgba(221,164,125,.16);
  border: 1px solid rgba(221,164,125,.42); padding: 6px 14px; border-radius: 99px;
  font-size: 12px; font-weight: 700; color: var(--tan-300); }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 20px 14px 16px; text-align: center; display: flex; flex-direction: column-reverse; gap: 6px;
  box-shadow: var(--shadow-sm); }
.stat__num { font-family: var(--font-num); font-size: 34px; font-weight: 700; color: var(--accent); line-height: .85; }
.stat__label { font-size: 9.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1.8px; font-weight: 700; }
.stat__num--accent { color: var(--accent); }

/* ---------- Action grid ---------- */
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.action { display: flex; align-items: center; gap: 14px; padding: 18px; text-align: left; border-radius: var(--radius);
  color: var(--text); border: none; }
.action__icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px;
  background: var(--surface-2); flex: none; }
/* Primary CTA: warm peach/salmon tile — the dashboard's focal action. */
.action--primary { background: linear-gradient(135deg, var(--tan-300), var(--tan-600)); color: #3a2a1c;
  border-color: transparent; box-shadow: var(--shadow); }
.action--primary .action__icon { background: rgba(255,255,255,.28); }
.action__title { font-weight: 800; font-size: 16px; }
.action__desc { font-size: 12.5px; opacity: .8; }

/* ---------- Category picker ---------- */
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 99px; padding: 7px 13px; font-size: 13px; font-weight: 700; cursor: pointer; }
.chip--on { background: var(--accent); color: #3a2a1c; border-color: transparent; }
.cat-controls { position: sticky; top: 64px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0 12px; margin: 4px 0 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.cat-controls__btns { display: flex; gap: 8px; }
.cat-controls__count { margin-left: auto; font-family: var(--font-num); font-size: 12.5px; color: var(--text-soft); font-weight: 700; }
.btn--sm { padding: 8px 13px; font-size: 13px; border-radius: 11px; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cat-card { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s; padding: 0; display: block; }
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-card:active { transform: translateY(-1px) scale(.995); }
.cat-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow); }
.cat-card__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.cat-card:hover .cat-card__img { transform: scale(1.05); }
.cat-card__img--ph { display: grid; place-items: center; color: var(--text-faint); }
/* Bottom-weighted scrim keeps the cream serif label legible over any photo. */
.cat-card__scrim { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(18,20,15,.88) 0%, rgba(18,20,15,.55) 26%, rgba(18,20,15,.05) 52%, transparent 70%); }
.cat-card__name { position: absolute; left: 10px; right: 10px; bottom: 15px; z-index: 2; margin: 0;
  font-family: var(--serif); font-weight: 700; font-size: 19px; line-height: 1.08; text-align: center;
  text-transform: uppercase; letter-spacing: 1.4px; color: var(--cream); text-shadow: 0 1px 10px rgba(0,0,0,.6); }
/* Subtle mastery sliver pinned to the bottom edge (no % text on the card face). */
.cat-card__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; z-index: 3; background: rgba(255,255,255,.16); }
.cat-card__progress-fill { display: block; height: 100%; background: var(--tan); transition: width .5s ease; }
.cat-card__select, .cat-card__check { position: absolute; top: 9px; width: 27px; height: 27px; z-index: 4;
  display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.cat-card__select { left: 9px; border-radius: 9px; background: rgba(20,22,18,.5); color: #fff; backdrop-filter: blur(3px);
  border: 1px solid rgba(255,255,255,.32); transition: background .12s, border-color .12s; }
.cat-card__select .icon { opacity: 0; transition: opacity .12s; }
.cat-card.is-selected .cat-card__select { background: var(--accent); color: #2a2f26; border-color: transparent; }
.cat-card.is-selected .cat-card__select .icon { opacity: 1; }
.cat-card__check { right: 9px; border-radius: 50%; background: var(--good); color: #fff; display: none; }
.cat-card.is-mastered .cat-card__check { display: grid; }

/* Shared thin progress bar (also used by the stats screen's category breakdown). */
.bar { flex: 1; height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--good); border-radius: 99px; transition: width .5s ease; }

/* ---------- Quiz ---------- */
.quiz { max-width: 600px; margin: 0 auto; }
.quiz__hud { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.streak-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 6px 12px; font-family: var(--font-num); font-weight: 800; box-shadow: var(--shadow-sm); }
.streak-pill.is-hot { background: linear-gradient(90deg, var(--tan), var(--tan-600)); color: #3a2a1c; border-color: transparent; }
.quiz__xpwrap { flex: 1; }
.quiz__xpbar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.quiz__xpfill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.quiz__lvl { font-family: var(--font-num); font-size: 12px; color: var(--text-soft); font-weight: 800; }

.quiz__card { padding: 0; overflow: hidden; }
.quiz__imgwrap { position: relative; aspect-ratio: 4/3; background: var(--surface-2); }
.quiz__img { width: 100%; height: 100%; object-fit: cover; display: block; animation: imgIn .4s ease both; }
.quiz__noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); font-size: 48px; }
.quiz__cat { position: absolute; left: 12px; top: 12px; background: rgba(0,0,0,.55); color: #fff;
  border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 700; backdrop-filter: blur(4px); pointer-events: none; }
.quiz__info-btn { position: absolute; right: 12px; top: 12px; background: rgba(0,0,0,.55); color: #fff;
  border: none; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center;
  backdrop-filter: blur(4px); cursor: pointer; transition: transform .1s, background .1s; z-index: 5; }
.quiz__info-btn:hover { background: rgba(0,0,0,.7); transform: scale(1.05); }
.quiz__info-btn:active { transform: scale(.95); }
.quiz__name { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  font-family: var(--serif); font-size: 38px; font-weight: 700; padding: 40px 18px 14px; line-height: 1.1;
  color: var(--cream); text-shadow: 0 2px 12px rgba(0,0,0,0.8);
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%); pointer-events: none; }
.quiz__desc { padding: 0 18px 4px; color: var(--text-soft); font-size: 13.5px; min-height: 18px; }
.quiz__prompt { padding: 10px 18px 0; color: var(--text-soft); font-weight: 700; font-size: 13px; }

.plu-display { margin: 24px 18px 0px; height: 64px; border-radius: 14px; background: var(--surface-2);
  border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-size: 38px; font-weight: 900; letter-spacing: 8px; color: var(--text); font-variant-numeric: tabular-nums; }
.plu-display--btn { border-style: solid; border-color: var(--accent); cursor: pointer; transition: transform .1s, background .1s, border-color .1s; width: calc(100% - 36px); }
.plu-display--btn:hover:not(:disabled) { background: var(--surface); border-color: var(--accent-strong); }
.plu-display--btn:active:not(:disabled) { transform: scale(.98); }
.plu-display--btn.is-ready { background: var(--primary); color: var(--on-primary); border-style: solid; border-color: var(--primary); box-shadow: var(--shadow); margin-bottom: 0; }
.plu-display--btn.is-ready:hover { background: var(--olive-700); }
.plu-display--btn:disabled { cursor: default; }
.plu-display.is-good { background: var(--good-bg); border-color: var(--good); border-style: solid; color: var(--good); margin-bottom: 24px; }
.plu-display.is-bad { background: var(--bad-bg); border-color: var(--bad); border-style: solid; color: var(--bad); margin-bottom: 24px; }
.plu-display__placeholder { color: var(--text-faint); letter-spacing: 6px; font-weight: 700; font-size: 18px; }

.quiz__plu-hint { text-align: center; font-size: 12px; font-weight: 700; color: var(--primary); 
  margin: 4px 0 12px; opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; pointer-events: none; }
[data-theme="dark"] .quiz__plu-hint { color: var(--white); }
.quiz__plu-hint.is-visible { opacity: 1; transform: none; }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 18px 18px; }
.key { height: 60px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  font-family: var(--font-num); font-size: 24px; font-weight: 800; color: var(--text); cursor: pointer; box-shadow: var(--shadow-sm);
  display: grid; place-items: center;
  transition: transform .08s ease, background .1s; user-select: none; }
.key:active { transform: scale(.95); background: var(--surface-2); }
.key--action { background: var(--surface-2); font-size: 18px; }
.key--enter { background: var(--primary); color: var(--on-primary); }
.key--enter:disabled { opacity: .5; }

.feedback { margin: 0 18px 16px; border-radius: 14px; padding: 14px 16px; display: none; animation: pop .25s ease both; }
.feedback.is-good { display: block; background: var(--good-bg); border: 1px solid var(--good); }
.feedback.is-bad { display: block; background: var(--bad-bg); border: 1px solid var(--bad); }
.feedback__headline { font-weight: 900; font-size: 16px; }
.feedback__detail { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.feedback__actions { margin-top: 10px; }

.toolbtns { display: flex; gap: 10px; padding: 0 18px 18px; }
.hint-text { padding: 0 18px 12px; color: var(--text-soft); font-size: 13px; font-style: italic; min-height: 16px; }

/* ---------- Reverse quiz options ---------- */
.options { display: grid; gap: 10px; padding: 12px 18px 18px; }
.option { text-align: left; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 700; cursor: pointer; transition: background .1s, border-color .1s, transform .08s; }
.option:hover { background: var(--surface-2); }
.option:active { transform: scale(.99); }
.option.is-correct { background: var(--good-bg); border-color: var(--good); }
.option.is-wrong { background: var(--bad-bg); border-color: var(--bad); }
.option__plu { display: inline-grid; place-items: center; min-width: 56px; height: 38px; border-radius: 9px;
  background: var(--olive); color: var(--cream); font-family: var(--font-num); font-weight: 900; margin-right: 12px; font-variant-numeric: tabular-nums; }

/* ---------- Lookup ---------- */
.search { width: 100%; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 16px; }
.lookup-list { display: grid; gap: 10px; margin-top: 14px; }
.lookup-item { display: flex; align-items: center; gap: 14px; padding: 10px; cursor: pointer; transition: background .12s; }
.lookup-item:hover { background: var(--surface-2); }
.lookup-item__img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-2); flex: none; }
.lookup-item__name { font-weight: 800; }
.lookup-item__cat { font-size: 12.5px; color: var(--text-soft); }
.lookup-item__side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; }
.lookup-item__plu { font-family: var(--font-num); font-size: 22px; font-weight: 900; color: var(--accent-strong); font-variant-numeric: tabular-nums; line-height: 1; }
.lookup-item__plu--none { font-size: 13px; color: var(--text-faint); font-weight: 700; }

/* ---------- Badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-sm); }
.badge.is-locked { opacity: .5; filter: grayscale(.7); }
.badge__icon { font-size: 30px; }
.badge__name { font-weight: 800; font-size: 13.5px; margin-top: 6px; }
.badge__desc { font-size: 11.5px; color: var(--text-soft); margin-top: 3px; }

/* ---------- Leaderboard ---------- */
.lb-list { display: grid; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); }
.lb-row.is-me { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.lb-rank { width: 30px; font-weight: 900; color: var(--text-soft); text-align: center; }
.lb-rank--1 { color: #d4a017; } .lb-rank--2 { color: #9a9a9a; } .lb-rank--3 { color: #b87333; }
.lb-name { font-weight: 800; }
.lb-sub { font-size: 12px; color: var(--text-soft); }
.lb-score { margin-left: auto; font-family: var(--font-num); font-weight: 900; font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth__card { width: 100%; max-width: 400px; }
.auth__logo { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 16px; overflow: hidden;
  background: var(--olive); display: grid; place-items: center; box-shadow: var(--shadow); }
.auth__logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth__title { text-align: center; font-family: var(--serif); font-size: 26px; margin: 0; }
.auth__sub { text-align: center; color: var(--text-soft); margin: 4px 0 20px; }

/* ---------- Legal Screens ---------- */
.legal-card h2 { font-size: 18px; margin: 24px 0 8px; font-family: var(--serif); color: var(--olive); }
.legal-card p { margin-bottom: 16px; }
.legal-card ul { padding-left: 20px; margin-bottom: 16px; }
.legal-card li { margin: 6px 0; }
.legal-card .note { background: var(--surface-2); border-left: 3px solid var(--tan); padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.legal-card footer { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; }

.btn-link { background: none; border: none; padding: 0; color: var(--tan); text-decoration: underline; font: inherit; cursor: pointer; display: inline; }
.btn-link:hover { color: var(--olive); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-soft); margin-bottom: 5px; }
.field input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 16px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; }
.link-btn { background: none; border: none; color: var(--accent-strong); font-weight: 700; cursor: pointer; padding: 4px; }

/* ---------- Settings ---------- */
.setting { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: none; }
.setting__label { font-weight: 700; }
.setting__desc { font-size: 12.5px; color: var(--text-soft); }
.setting__control { margin-left: auto; }
.switch { position: relative; width: 50px; height: 28px; border-radius: 99px; background: var(--border); cursor: pointer; border: none; transition: background .2s; }
.switch.is-on { background: var(--good); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.is-on::after { transform: translateX(22px); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--olive); color: var(--cream); padding: 12px 18px; border-radius: 12px; font-weight: 700;
  box-shadow: var(--shadow); z-index: 100; transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--good { background: var(--good); } .toast--bad { background: var(--bad); } .toast--accent { background: var(--tan-600); color: #fff; }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--text-soft); padding: 40px 20px; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 30px auto; }
.progress-ring__track { stroke: var(--surface-2); }
.progress-ring__bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1); }
.muted { color: var(--text-soft); }
.center { text-align: center; }
.mt { margin-top: 14px; } .mt-lg { margin-top: 24px; }
.flash { animation: flash .5s ease; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 1000; display: grid; place-items: center; padding: 20px; animation: fadeIn .2s ease; }
.modal-card { background: var(--bg); border-radius: var(--radius-lg); width: 100%; max-width: 440px; box-shadow: var(--shadow); overflow: hidden; animation: pop .3s cubic-bezier(.2,.8,.2,1); padding: 24px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { font-family: var(--serif); font-size: 24px; margin: 0; color: var(--accent); }
.modal-close { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 4px; transition: color .12s; }
.modal-close:hover { color: var(--text); }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.modal-info { display: flex; flex-direction: column; gap: 14px; }
.modal-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-bottom: 1px solid var(--gold-line); padding-bottom: 14px; }
.modal-info-item .label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; color: var(--text-faint); margin-bottom: 2px; }
.modal-info-item .value { font-weight: 700; color: var(--text); font-family: var(--font-num); }
.modal-info-item .value:not(.mt-xs) { font-size: 16px; }

.allergen-list { display: flex; flex-wrap: wrap; gap: 8px; }
.allergen-chip { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); padding: 5px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--text-soft); }
.allergen-chip .icon { color: var(--accent); }
.mt-xs { margin-top: 4px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes imgIn { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.96); opacity: 0; } 60% { transform: scale(1.02); } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); } 30%,50%,70% { transform: translateX(-7px); } 40%,60% { transform: translateX(7px); } }
@keyframes flash { 0% { background: var(--good-bg); } 100% { background: transparent; } }
.is-shake { animation: shake .5s; }

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

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .egon-uoffisiell { display: none; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .actions { grid-template-columns: 1fr; }
  .hero { padding: 22px 16px 20px; }
  .hero__title { font-size: 26px; }
  .section-head__title { font-size: 23px; }
  .cat-card__name { font-size: 16px; letter-spacing: 1.2px; }
}
@media (min-width: 760px) {
  .quiz { max-width: 560px; }
}

/* ============================================================
   Round 2 — icons, hero points, fit-to-viewport screens, polish
   ============================================================ */

/* Icons */
.icon { display: block; flex: none; }
.iconbtn .icon { color: var(--text); }
.action__icon { color: var(--text); }
.action--primary .action__icon, .action--primary .action__title, .action--primary .action__desc { color: #3a2a1c !important; }
[data-theme="light"] .action:not(.action--primary),
[data-theme="light"] .action:not(.action--primary) .action__icon { color: #000; }
.action--primary .action__icon { background: rgba(255,255,255,.28); }
.action--disabled { opacity: .5; pointer-events: none; }
.btn--icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.streak-pill .icon { color: var(--accent-strong); }
.streak-pill.is-hot .icon { color: #3a2a1c; }
.screen-head { display: flex; align-items: center; gap: 10px; margin: 4px 2px 8px; }
.screen-head h2 { margin: 0; }
.screen-head .icon { color: var(--accent-strong); }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head .icon { color: var(--accent-strong); }
.big-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--surface-2);
  color: var(--accent-strong); display: grid; place-items: center; margin: 0 auto 8px; }
.badge__icon .icon { margin: 0 auto; color: var(--accent-strong); }
.badge.is-locked .badge__icon .icon { color: var(--text-faint); }

/* ---------- Fit-to-viewport screens (quiz / reverse / lookup) ---------- */
body.fit { overflow: hidden; }
body.fit .app { height: 100dvh; }
.screen--fit { flex: 1; min-height: 0; padding: 12px 0; overflow: hidden; display: flex; flex-direction: column; }

.screen--fit .quiz { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 640px; margin: 0 auto; }
.screen--fit .quiz__hud { flex: none; margin: 0; }
.screen--fit .quiz__card { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; }

/* Quiz card internals in fit mode */
.screen--fit .quiz__imgwrap { flex: 1; min-height: 84px; aspect-ratio: auto; position: relative; overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0; }
.screen--fit .quiz__img { width: 100%; height: 100%; object-fit: cover; }
.screen--fit .quiz__noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); }
.screen--fit .quiz__name { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 30px 16px 12px; font-size: 28px; line-height: 1.1; color: var(--cream);
  text-shadow: 0 2px 8px rgba(0,0,0,0.8); background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.screen--fit .plu-display { flex: none; margin: 8px 16px 0; height: clamp(46px, 7vh, 60px);
  font-size: clamp(26px, 6vw, 36px); }
.screen--fit .plu-display.is-good, .screen--fit .plu-display.is-bad { margin-bottom: 12px; }
.screen--fit .quiz__plu-hint { margin: 2px 0 8px; font-size: 11px; }
.screen--fit .numpad { flex: none; gap: 8px; padding: 0 16px 14px; }
.screen--fit .key { height: clamp(42px, 6.4vh, 58px); font-size: 22px; }
.screen--fit .key--enter { height: clamp(40px, 5.4vh, 50px); font-size: 16px; }

/* Quiz feedback overlay (does not shift layout) */
.quiz__feedback { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4;
  background: color-mix(in srgb, var(--olive) 92%, transparent); color: var(--cream);
  border-radius: 16px; padding: 18px; opacity: 0; transform: translateY(12px);
  transition: opacity .25s cubic-bezier(.2,.8,.2,1), transform .25s cubic-bezier(.2,.8,.2,1); 
  pointer-events: none; box-shadow: 0 8px 32px rgba(0,0,0,0.4); 
  border: 1px solid rgba(255,255,255,0.1); }
.quiz__feedback.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.quiz__feedback.is-good { background: linear-gradient(135deg, var(--good), color-mix(in srgb, var(--good) 80%, black)); }
.quiz__feedback.is-bad { background: linear-gradient(135deg, var(--bad), color-mix(in srgb, var(--bad) 80%, black)); }

.quiz__feedback-content { display: flex; align-items: center; gap: 16px; }
.quiz__feedback-icon { flex: none; width: 48px; height: 48px; border-radius: 12px; 
  background: rgba(255,255,255,0.2); display: grid; place-items: center; color: #fff; }
.quiz__feedback-txt { flex: 1; }
.quiz__feedback-head { font-size: 18px; font-weight: 900; letter-spacing: -0.2px; margin-bottom: 2px; }
.quiz__feedback-detail { font-size: 14px; opacity: 0.9; line-height: 1.4; }

/* Reverse quiz in fit mode */
.quiz__card--reverse { padding: 16px; gap: 12px; justify-content: center; }
.plu-display--xl { font-size: clamp(40px, 12vw, 64px); letter-spacing: 8px;
  height: clamp(72px, 13vh, 112px); margin: 0; }
.screen--fit .options { padding: 0; gap: 10px; }
.option__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lookup in fit mode */
.lookup { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lookup__head { flex: none; padding-top: 4px; }
.searchbox { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 0 14px; }
.searchbox .icon { color: var(--text-faint); }
.searchbox .search { flex: 1; width: auto; border: none; background: transparent; padding: 14px 0; }
.searchbox .search:focus { outline: none; }
.lookup-count { font-size: 12.5px; color: var(--text-soft); font-weight: 700; margin: 8px 2px 4px; }
.lookup__scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
.lookup-list { display: grid; gap: 8px; margin: 0; }
.lookup-item__txt { min-width: 0; }
.lookup-item__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lookup-item__img--ph { display: grid; place-items: center; color: var(--text-faint); }

/* Phone tuning */
@media (max-width: 560px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .notice__text { font-size: 13.5px; }
}
