@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/fonts/noto-sans-sc-400.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/static/fonts/noto-sans-sc-700.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Serif SC";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/fonts/noto-serif-sc-400.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Serif SC";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/static/fonts/noto-serif-sc-700.woff2") format("woff2");
}

:root {
  --forest-950: #082a21;
  --forest-900: #0d3a2d;
  --forest-850: #124434;
  --paper: #f4e7c9;
  --paper-soft: #fbf4e4;
  --paper-deep: #e8d3a8;
  --ink: #102f27;
  --ink-soft: #5f553e;
  --gold: #e7b22e;
  --orange: #df6a2f;
  --correct: #236b4f;
  --wrong: #a43b2f;
  --line-dark: rgba(8, 42, 33, 0.2);
  --line-light: rgba(244, 231, 201, 0.45);
  --paper-texture: url('/static/assets/paper-texture.webp');
  --display-font: "Noto Serif SC", "Songti SC", STSong, serif;
  --ui-font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html {
  background: var(--forest-950);
  color: var(--ink);
  font-family: var(--ui-font);
  scrollbar-width: none;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--forest-950);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-underline-offset: 0.22em;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
p,
figure,
dl,
dd {
  margin: 0;
}

.app-viewport {
  width: min(100%, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.28);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-140%);
  border-radius: 8px;
  background: white;
  color: black;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--paper-soft);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--forest-950);
}

.wordmark,
.brand-lockup,
.edition-kicker,
.eyebrow {
  letter-spacing: 0.1em;
}

.wordmark,
.brand-lockup {
  font-family: var(--display-font);
  font-weight: 700;
}

.edition-kicker,
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.primary-action,
.secondary-action,
.next-action {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-action,
.next-action {
  background: var(--forest-900);
  color: var(--paper-soft);
}

.primary-action:active,
.next-action:active,
.primary-action[aria-busy="true"] {
  background: var(--forest-850);
  transform: translateY(1px);
}

.secondary-action {
  margin-top: 8px;
  border: 1px solid rgba(16, 47, 39, 0.42);
  background: transparent;
  color: var(--ink);
}

.secondary-action:active {
  border-color: var(--forest-900);
  background: rgba(13, 58, 45, 0.08);
  transform: translateY(1px);
}

.text-link {
  font-weight: 600;
}

.text-link--light {
  color: var(--paper);
}

/* Landing */
.landing-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--forest-900);
  color: var(--paper);
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-top) 24px 12px;
}

.landing-hero {
  position: relative;
  display: flex;
  min-height: 380px;
  flex-direction: column;
  justify-content: center;
  padding: 28px 34px 44px;
  overflow: hidden;
}

.landing-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 340px;
  margin-top: 18px;
  font-family: var(--display-font);
  font-size: clamp(2.5rem, 11vw, 3.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.03em;
}

.landing-lede {
  position: relative;
  z-index: 1;
  max-width: 290px;
  margin-top: 26px;
  color: rgba(244, 231, 201, 0.8);
  font-size: 0.95rem;
  line-height: 1.8;
}

.cover-number {
  position: absolute;
  right: -8px;
  bottom: -50px;
  color: rgba(244, 231, 201, 0.09);
  font-family: var(--display-font);
  font-size: 14rem;
  line-height: 1;
}

.cover-rule {
  position: absolute;
  top: 22%;
  right: 24px;
  display: grid;
  width: 42px;
  gap: 22px;
}

.cover-rule span {
  height: 1px;
  background: var(--gold);
}

.cover-rule span:nth-child(3) {
  width: 42px;
  height: 3px;
}

.landing-paper {
  padding: 28px 24px var(--safe-bottom);
  background: var(--paper);
  color: var(--ink);
}

.landing-note {
  margin-bottom: 22px;
  font-family: var(--display-font);
  font-size: 1.1rem;
  line-height: 1.75;
}

/* Authentication */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(250px, 42vh) 1fr;
  background: var(--forest-900);
  color: var(--paper);
}

.back-link {
  width: fit-content;
  min-height: 48px;
  padding: var(--safe-top) 24px 8px;
  font-weight: 600;
}

.auth-heading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 30px 42px;
}

.auth-heading h1 {
  margin: 14px 0 12px;
  font-family: var(--display-font);
  font-size: 2.8rem;
  line-height: 1.2;
}

.auth-heading > p:last-child {
  color: rgba(244, 231, 201, 0.76);
}

.auth-paper {
  min-height: 390px;
  padding: 30px 24px var(--safe-bottom);
  background: var(--paper);
  color: var(--ink);
}

.form-stack {
  display: grid;
  gap: 18px;
}

.form-stack label {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.form-stack input {
  width: 100%;
  min-height: 52px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid rgba(16, 47, 39, 0.42);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.form-stack input:focus {
  border-bottom-color: var(--forest-900);
}

.form-stack small {
  font-weight: 400;
}

.form-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--wrong);
  background: rgba(164, 59, 47, 0.08);
  color: var(--wrong);
}

.form-footnote {
  margin-top: 22px;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 10px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line-dark);
  content: "";
}

/* Home */
.home-page {
  overflow: hidden;
}

.home-page .app-viewport {
  height: 100vh;
  height: 100dvh;
}

.home-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--forest-900);
  color: var(--paper);
}

.home-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: var(--safe-top) 22px 14px;
}

.home-header h1 {
  margin-top: 6px;
  font-family: var(--display-font);
  font-size: 1.15rem;
}

.quiet-button {
  min-width: 48px;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: rgba(244, 231, 201, 0.76);
  cursor: pointer;
}

.quiet-button--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.home-cover {
  position: relative;
  overflow: hidden;
  padding: 16px 24px 0 56px;
}

.home-food-arch {
  height: 72%;
  min-height: 0;
  overflow: hidden;
  border-radius: 48% 48% 0 0 / 34% 34% 0 0;
  background: var(--forest-850);
}

.home-food-arch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-food-arch--empty {
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 231, 201, 0.22);
  color: var(--paper-deep);
  font-family: var(--display-font);
  font-size: 1.35rem;
  line-height: 1.5;
  text-align: center;
}

.home-progress-mark {
  position: absolute;
  z-index: 2;
  bottom: 28px;
  left: 10px;
  font-family: var(--display-font);
  font-size: 5.5rem;
  line-height: 0.8;
  color: var(--paper-deep);
}

.home-caption {
  padding: 14px 0 16px 38px;
}

.home-caption h2 {
  margin-top: 6px;
  font-family: var(--display-font);
  font-size: 2.1rem;
  line-height: 1.25;
}

.home-paper {
  padding: 24px 24px var(--safe-bottom);
  background: var(--paper);
  color: var(--ink);
}

.home-paper > p:first-child {
  margin-bottom: 20px;
  font-family: var(--display-font);
  font-size: 1.05rem;
  line-height: 1.7;
}

.privacy-note {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-align: center;
}

.home-adjust-link {
  margin-left: 5px;
  color: var(--orange);
  font-family: var(--ui-font);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Primary navigation */
.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 430px);
  min-height: 64px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 auto;
  padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(16, 47, 39, 0.16);
  background: rgba(251, 244, 228, 0.97);
  color: var(--ink-soft);
  backdrop-filter: blur(12px);
}

.bottom-nav a {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.bottom-nav small {
  color: rgba(95, 85, 62, 0.62);
  font-family: var(--display-font);
  font-size: 0.56rem;
}

.bottom-nav a[aria-current="page"] {
  background: var(--forest-900);
  color: var(--paper-soft);
}

.bottom-nav a[aria-current="page"] small {
  color: var(--gold);
}

.home-paper--with-nav {
  padding-bottom: calc(var(--safe-bottom) + 58px);
}

/* Level, review and profile pages */
.section-page {
  background: var(--forest-950);
}

.section-page .app-viewport {
  padding-bottom: 64px;
}

.section-shell {
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  background: var(--forest-900);
  color: var(--paper);
}

.section-hero {
  position: relative;
  min-height: 292px;
  padding: calc(var(--safe-top) + 14px) 24px 30px;
  overflow: hidden;
}

.section-hero::after {
  position: absolute;
  right: -58px;
  bottom: -102px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(244, 231, 201, 0.12);
  border-radius: 50%;
  content: "";
}

.section-index {
  color: var(--gold);
  font-family: var(--display-font);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
}

.section-hero h1 {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  font-family: var(--display-font);
  font-size: clamp(2.25rem, 10vw, 3.1rem);
  line-height: 1.24;
}

.section-hero > p:last-child {
  position: relative;
  z-index: 1;
  max-width: 330px;
  margin-top: 18px;
  color: rgba(244, 231, 201, 0.72);
  font-size: 0.83rem;
  line-height: 1.7;
}

.section-paper {
  min-height: 360px;
  padding: 28px 18px 32px;
  background: var(--paper);
  color: var(--ink);
}

.level-form,
.level-form fieldset {
  display: grid;
  gap: 14px;
}

.level-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.level-form legend {
  margin-bottom: 12px;
  font-family: var(--display-font);
  font-size: 1.25rem;
  font-weight: 700;
}

.level-form legend span {
  margin-right: 8px;
  color: var(--orange);
  font-size: 0.72rem;
}

.option-cards {
  display: grid;
  gap: 8px;
}

.option-cards--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option-cards--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-cards label,
.category-select label {
  position: relative;
  cursor: pointer;
}

.option-cards input,
.category-select input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-cards label > span,
.category-select label > span {
  min-height: 66px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid rgba(16, 47, 39, 0.25);
  border-radius: 4px;
  background: rgba(251, 244, 228, 0.68);
}

.option-cards--stack label > span {
  min-height: 68px;
  padding-left: 18px;
}

.option-cards b,
.category-select b {
  font-family: var(--display-font);
  font-size: 0.95rem;
}

.option-cards small,
.category-select small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.62rem;
  line-height: 1.35;
}

.option-cards input:checked + span,
.category-select input:checked + span {
  border: 2px solid var(--forest-900);
  background: rgba(13, 58, 45, 0.08);
  box-shadow: inset 4px 0 0 var(--gold);
}

.category-select input:disabled + span {
  border-style: dashed;
  opacity: 0.52;
  cursor: not-allowed;
}

.option-cards input:focus-visible + span,
.category-select input:focus-visible + span {
  outline: 2px solid var(--paper-soft);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--forest-950);
}

.level-details {
  margin: 4px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}

.level-details summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  cursor: pointer;
}

.level-details summary::after {
  color: var(--orange);
  content: "＋";
}

.level-details[open] summary::after {
  content: "－";
}

.level-details fieldset {
  margin-top: 18px;
}

.category-select {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inventory-note,
.prototype-note {
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.6;
}

.prototype-note {
  padding: 10px 12px;
  border-left: 3px solid var(--orange);
  background: rgba(223, 106, 47, 0.07);
}

.resume-card {
  padding: 20px;
  border: 1px solid var(--line-dark);
  background: var(--paper-soft);
}

.resume-card h2 {
  margin: 9px 0;
  font-family: var(--display-font);
  font-size: 2rem;
}

.resume-card > p:not(.eyebrow) {
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.profile-hero {
  min-height: 310px;
}

.profile-hero .eyebrow {
  margin-top: 24px;
  color: var(--paper-deep);
}

.profile-hero h1 {
  margin-top: 8px;
  font-size: 5.2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.profile-hero h1 small {
  margin-left: 8px;
  color: var(--gold);
  font-family: var(--ui-font);
  font-size: 0.9rem;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line-dark);
  border-left: 1px solid var(--line-dark);
}

.profile-metrics div {
  padding: 15px;
  border-right: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}

.profile-metrics dt {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.profile-metrics dd {
  margin-top: 4px;
  font-family: var(--display-font);
  font-size: 1.7rem;
  font-weight: 700;
}

.points-policy {
  margin-top: 12px;
  padding-left: 10px;
  border-left: 3px solid var(--orange);
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.6;
}

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 12px;
}

.section-title-row h2 {
  font-family: var(--display-font);
  font-size: 1.25rem;
}

.section-title-row span {
  color: var(--ink-soft);
  font-size: 0.64rem;
}

.progress-list {
  display: grid;
  gap: 16px;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr 40px;
  align-items: center;
  gap: 10px;
}

.progress-row > div:first-child {
  display: grid;
}

.progress-row b {
  font-family: var(--display-font);
  font-size: 0.86rem;
}

.progress-row span {
  color: var(--ink-soft);
  font-size: 0.56rem;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  background: var(--paper-deep);
}

.progress-track i {
  height: 100%;
  display: block;
  background: var(--forest-900);
}

.progress-row > strong {
  font-family: var(--display-font);
  font-size: 0.75rem;
  text-align: right;
}

.empty-card {
  padding: 20px;
  border: 1px solid var(--line-dark);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.7;
}

.empty-card a {
  display: inline-block;
  margin-top: 12px;
  color: var(--ink);
  font-weight: 700;
}

.profile-logout {
  margin-top: 28px;
}

.review-hero h1 {
  white-space: pre-line;
}

.review-number {
  position: absolute;
  right: 10px;
  bottom: -28px;
  color: rgba(244, 231, 201, 0.08);
  font-family: var(--display-font);
  font-size: 12rem;
  line-height: 1;
}

.review-paper .prototype-note {
  margin-top: 14px;
}

/* Quiz */
.quiz-page {
  overflow: hidden;
}

.quiz-page .app-viewport {
  height: 100vh;
  height: 100dvh;
  min-height: 568px;
}

.quiz-shell {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 58%) minmax(0, 42%);
  background: var(--forest-900);
}

.quiz-visual {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: var(--safe-top) 18px 0 62px;
  color: var(--paper);
}

.quiz-progress-text {
  position: absolute;
  z-index: 4;
  top: var(--safe-top);
  left: 18px;
  color: var(--paper-deep);
  font-family: var(--display-font);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.progress-scale {
  position: absolute;
  z-index: 3;
  top: calc(var(--safe-top) + 34px);
  bottom: 55px;
  left: 18px;
  display: flex;
  width: 30px;
  margin: 0;
  padding: 0;
  flex-direction: column;
  justify-content: space-between;
  list-style: none;
}

.progress-scale::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 14px;
  width: 2px;
  background: rgba(244, 231, 201, 0.45);
  content: "";
}

.progress-scale li {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 2px;
  margin-left: 7px;
  background: var(--paper-deep);
}

.progress-scale li.is-done {
  background: var(--orange);
}

.progress-scale li.is-current {
  width: 16px;
  height: 16px;
  margin-left: 7px;
  border: 3px solid var(--paper-deep);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--forest-900);
}

.progress-scale--preview {
  bottom: 55%;
}

.brand-lockup {
  position: relative;
  z-index: 2;
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: clamp(1.45rem, 7vw, 2rem);
}

.brand-rule {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--gold);
}

.food-figure {
  position: relative;
  height: calc(100% - 42px);
  margin-top: 4px;
}

.food-arch {
  position: relative;
  height: calc(100% - 70px);
  min-height: 215px;
  overflow: hidden;
  border-radius: 48% 48% 0 0 / 30% 30% 0 0;
  background: var(--forest-850);
}

.illustration-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(244, 231, 201, 0.35);
  border-radius: 999px;
  background: rgba(8, 42, 33, 0.78);
  color: var(--paper-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.food-arch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.question-number {
  position: absolute;
  z-index: 2;
  bottom: 24px;
  left: -54px;
  font-family: var(--display-font);
  font-size: clamp(4.4rem, 22vw, 6.2rem);
  font-variant-numeric: tabular-nums;
  line-height: 0.78;
  color: var(--paper-deep);
}

.food-figure figcaption {
  height: 70px;
  padding: 10px 0 0 38px;
  text-align: center;
}

.food-figure figcaption h1 {
  font-family: var(--display-font);
  font-size: 1.35rem;
  line-height: 1.3;
}

.food-figure figcaption p {
  margin-top: 3px;
  color: var(--paper-deep);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}


.quiz-paper {
  position: relative;
  min-height: 0;
  background: var(--paper);
  color: var(--ink);
}

.paper-edge {
  position: absolute;
  z-index: 2;
  top: -11px;
  left: 0;
  width: 100%;
  height: 13px;
  background: transparent url('/static/assets/paper-edge.png') repeat-x 50% 100% / auto 13px;
}

.paper-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px 16px var(--safe-bottom);
}

.paper-content h2 {
  font-family: var(--display-font);
  font-size: clamp(1.45rem, 6.2vw, 1.9rem);
  line-height: 1.35;
  text-align: center;
}

.answer-hint {
  margin: 9px 0 12px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-align: center;
}

.answer-form {
  margin-top: auto;
}

.calorie-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
}

.calorie-input-row label {
  min-height: 58px;
  display: flex;
  align-items: baseline;
  border: 1px solid rgba(16, 47, 39, 0.42);
  border-radius: 4px;
  background: rgba(251, 244, 228, 0.72);
}

.calorie-input-row input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 4px 8px 4px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--display-font);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

.calorie-input-row b {
  padding-right: 12px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  white-space: nowrap;
}

.nutrition-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.nutrition-input-grid label {
  min-height: 54px;
  display: grid;
  grid-template-columns: 1fr 72px;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(16, 47, 39, 0.35);
  border-radius: 4px;
  background: rgba(251, 244, 228, 0.72);
}

.nutrition-input-grid span {
  display: grid;
  font-family: var(--display-font);
  font-size: 0.78rem;
  font-weight: 700;
}

.nutrition-input-grid small {
  color: var(--ink-soft);
  font-family: var(--ui-font);
  font-size: 0.75rem;
  font-weight: 400;
}

.nutrition-input-grid input {
  width: 100%;
  min-width: 0;
  padding: 6px 4px;
  border: 0;
  border-bottom: 1px solid rgba(16, 47, 39, 0.4);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--display-font);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

.nutrition-submit {
  margin-top: 7px;
}

.input-result-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.input-result-row span {
  padding: 12px 7px;
  border: 1px solid var(--line-dark);
  font-size: 0.66rem;
  text-align: center;
}

.input-result-row b {
  font-family: var(--display-font);
  font-size: 1.25rem;
}

.nutrition-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.nutrition-result-grid div {
  display: grid;
  padding: 6px 8px;
  border-left: 2px solid var(--forest-900);
  background: rgba(13, 58, 45, 0.06);
}

.nutrition-result-grid span {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.nutrition-result-grid b {
  font-family: var(--display-font);
  font-size: 0.85rem;
}

.nutrition-result-grid small {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.answer-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.answer-choice {
  position: relative;
  min-width: 0;
  min-height: 78px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border: 1px solid rgba(16, 47, 39, 0.42);
  border-radius: 5px;
  background: rgba(251, 244, 228, 0.72);
  color: var(--ink);
  cursor: pointer;
}

button.answer-choice:active,
.answer-choice.is-pressed {
  border-color: var(--gold);
  background: var(--gold);
  transform: translateY(1px);
}

.answer-choice strong {
  font-family: var(--display-font);
  font-size: clamp(1.7rem, 8vw, 2.35rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.answer-choice span {
  font-family: var(--display-font);
  font-size: 0.9rem;
}

.answer-choice small {
  position: absolute;
  right: 4px;
  bottom: 3px;
  left: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.reveal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 10px;
}

.reveal-symbol {
  width: auto;
  min-width: 42px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--forest-900);
  color: var(--paper-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

[data-quiz-state="wrong"] .reveal-symbol {
  background: var(--wrong);
}

.reveal-kicker {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.reveal-answer {
  margin-top: 2px;
  font-size: 0.82rem;
}

.answer-grid--result .answer-choice {
  min-height: 62px;
  cursor: default;
}

.answer-grid--result .answer-choice strong {
  font-size: clamp(1.35rem, 6.5vw, 1.9rem);
}

.answer-choice.is-correct {
  border: 2px solid var(--correct);
  background: rgba(35, 107, 79, 0.11);
}

.answer-choice.is-wrong {
  border: 2px solid var(--wrong);
  background: rgba(164, 59, 47, 0.09);
}

.answer-choice.is-wrong strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.nutrition-strip {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.nutrition-strip b {
  color: var(--ink);
}

.learning-cue {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: center;
}

.preview-register {
  margin-top: auto;
}

.preview-retry {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.next-form {
  margin-top: auto;
}

.next-action {
  min-height: 48px;
}

/* Result */
.result-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: minmax(390px, 58vh) auto;
  background: var(--forest-900);
  color: var(--paper);
}

.result-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 70px 28px 30px;
  overflow: hidden;
}

.result-visual h1 {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  font-family: var(--display-font);
  font-size: 2.8rem;
  line-height: 1.3;
}

.result-edition {
  position: absolute;
  right: -14px;
  bottom: -42px;
  color: rgba(244, 231, 201, 0.08);
  font-family: var(--display-font);
  font-size: 15rem;
  line-height: 1;
}

.result-score {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 30px;
}

.result-score strong {
  font-family: var(--display-font);
  font-size: clamp(4rem, 18vw, 5.5rem);
  font-weight: 500;
  line-height: 0.9;
}

.result-score span {
  color: var(--paper-deep);
  font-size: 1.2rem;
}

.result-paper {
  position: relative;
  padding: 34px 24px var(--safe-bottom);
  background: var(--paper);
  color: var(--ink);
}

.landing-paper,
.auth-paper,
.home-paper,
.section-paper,
.quiz-paper,
.result-paper {
  background-color: var(--paper);
  background-image: linear-gradient(rgba(244, 231, 201, 0.58), rgba(244, 231, 201, 0.58)), var(--paper-texture);
  background-size: auto, 320px 320px;
}

.result-summary {
  font-family: var(--display-font);
  font-size: 1.15rem;
  line-height: 1.65;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 22px 0;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}

.result-stats div {
  padding: 14px 4px;
}

.result-stats div + div {
  border-left: 1px solid var(--line-dark);
  padding-left: 16px;
}

.result-stats dt {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.result-stats dd {
  margin-top: 5px;
  font-family: var(--display-font);
  font-size: 1.65rem;
  font-weight: 700;
}

.next-session-note {
  margin: -6px 0 20px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.65;
}

.points-earned {
  margin: -8px 0 16px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.points-earned strong {
  color: var(--orange);
  font-family: var(--display-font);
  font-size: 1.25rem;
}

.result-evidence {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: -8px 0 18px;
  padding: 0;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
  list-style: none;
}

.result-evidence li {
  display: grid;
  gap: 3px;
  padding: 10px 5px;
  text-align: center;
}

.result-evidence li + li {
  border-left: 1px solid var(--line-dark);
}

.result-evidence span {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.result-evidence b {
  font-family: var(--display-font);
  font-size: 0.78rem;
}

/* Error */
.error-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
  background: var(--paper);
}

.error-code {
  color: var(--orange);
  font-family: var(--display-font);
  font-size: 5rem;
}

.error-shell h1 {
  margin: 8px 0 18px;
  font-family: var(--display-font);
  font-size: 2rem;
}

.error-shell > p:not(.error-code) {
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

@media (max-height: 700px) {
  .home-header {
    padding: var(--safe-top) 16px 8px;
  }

  .home-header h1 {
    font-size: 1rem;
  }

  .home-cover {
    padding: 8px 18px 0 48px;
  }

  .home-progress-mark {
    bottom: 15px;
    font-size: 3.6rem;
  }

  .home-caption {
    padding: 6px 0 4px 62px;
  }

  .home-caption h2 {
    margin-top: 2px;
    font-size: 1.18rem;
    white-space: nowrap;
  }

  .home-caption h2 br {
    display: none;
  }

  .home-food-arch {
    height: 62%;
  }

  .home-paper {
    padding: 14px 16px var(--safe-bottom);
  }

  .home-paper > p:first-child {
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .home-paper .primary-action {
    min-height: 52px;
  }

  .privacy-note {
    margin-top: 8px;
    font-size: 0.62rem;
    line-height: 1.45;
  }

  .home-paper--with-nav {
    padding-bottom: 68px;
  }

  .quiz-shell {
    grid-template-rows: minmax(0, 54%) minmax(0, 46%);
  }

  .quiz-shell[data-quiz-state="correct"],
  .quiz-shell[data-quiz-state="wrong"] {
    grid-template-rows: minmax(0, 48%) minmax(0, 52%);
  }

  .quiz-visual {
    padding-right: 12px;
    padding-left: 52px;
  }

  .quiz-progress-text {
    left: 12px;
  }

  .progress-scale {
    left: 9px;
    bottom: 42px;
  }

  .brand-lockup {
    height: 32px;
    font-size: 1.25rem;
  }

  .food-figure {
    height: calc(100% - 32px);
  }

  .food-arch {
    height: calc(100% - 50px);
    min-height: 145px;
  }

  .food-figure figcaption {
    height: 50px;
    padding-top: 0;
  }

  .food-figure figcaption h1 {
    font-size: 1rem;
    line-height: 1.15;
  }

  .food-figure figcaption p {
    margin-top: 1px;
    font-size: 0.7rem;
  }

  .question-number {
    bottom: 18px;
    left: -43px;
    font-size: 3.5rem;
  }

  .paper-content {
    padding-top: 13px;
  }

  .paper-content h2 {
    font-size: 1.2rem;
  }

  .answer-hint {
    margin: 4px 0 7px;
  }

  .answer-choice {
    min-height: 62px;
  }

  .answer-grid--result .answer-choice {
    min-height: 52px;
  }

  .reveal-header {
    margin: 3px 0 6px;
  }

  .learning-cue {
    line-height: 1.3;
  }

  .nutrition-strip,
  .learning-cue {
    margin-top: 4px;
  }

  [data-question-type="nutrition_input"] .paper-content h2 {
    font-size: 1rem;
  }

  [data-question-type="nutrition_input"][data-quiz-state="correct"],
  [data-question-type="nutrition_input"][data-quiz-state="wrong"] {
    grid-template-rows: minmax(0, 48%) minmax(0, 52%);
  }

  [data-question-type="nutrition_input"][data-quiz-state="correct"] .learning-cue,
  [data-question-type="nutrition_input"][data-quiz-state="wrong"] .learning-cue {
    display: none;
  }

  [data-question-type="nutrition_input"] .answer-hint {
    margin: 2px 0 4px;
  }

  .nutrition-input-grid label {
    min-height: 44px;
    grid-template-columns: 1fr 62px;
  }

  .nutrition-submit {
    min-height: 42px;
    margin-top: 5px;
  }

  .nutrition-result-grid div {
    padding: 4px 6px;
  }

  .section-hero {
    min-height: 250px;
  }
}

@media (max-width: 350px) {
  .quiz-visual {
    padding-right: 10px;
    padding-left: 50px;
  }

  .brand-lockup {
    font-size: 1.15rem;
  }

  .answer-grid {
    gap: 6px;
  }

  .answer-choice strong {
    font-size: 1.55rem;
  }

  .answer-choice span {
    font-size: 0.72rem;
  }

  .nutrition-strip {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .answer-choice,
  .primary-action,
  .next-action {
    transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
