/* ---------- Tokens: light, warm, near-black text ---------- */
:root {
  --bg: #fbf6ef;            /* warm cream */
  --bg-2: #f6ede1;
  --surface: #fffdf9;
  --surface-2: #fcf7f0;
  --ink: #1e1a16;           /* near-black for all main text */
  --ink-2: #3d3630;         /* English lines, descriptions */
  --ink-3: #6b6157;         /* hints, meta */
  --line: #eee3d5;
  --line-strong: #e0d1bd;
  --accent: #c7825d;        /* soft terracotta */
  --accent-deep: #9a5634;   /* accent used for text */
  --accent-soft: #f8eadf;
  --sage: #8a9168;
  --sage-soft: #eef0e2;
  --honey: #ddb26f;
  --honey-soft: #f8eeda;
  --danger: #b4412f;
  --danger-soft: #fbe9e4;
  --shadow: 0 1px 2px rgba(92, 64, 38, .05), 0 10px 30px -16px rgba(92, 64, 38, .2);
  --shadow-lift: 0 2px 4px rgba(92, 64, 38, .06), 0 18px 40px -18px rgba(92, 64, 38, .28);
  --radius: 22px;
  --radius-sm: 14px;
  --serif: "Fraunces", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; margin: 0; color: var(--ink); }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Bilingual pairs: Chinese on top, English underneath */
.zh { display: block; }
.en { display: block; font-family: var(--sans); font-size: .84em; font-weight: 400; color: var(--ink-2); letter-spacing: 0; line-height: 1.4; margin-top: 2px; }
p.en { margin-top: 6px; }

/* Very soft warm glows behind everything */
.backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.blob-1 { width: 440px; height: 440px; background: var(--accent-soft); top: -140px; right: -120px; }
.blob-2 { width: 380px; height: 380px; background: var(--honey-soft); bottom: -160px; left: -140px; }
.blob-3 { width: 260px; height: 260px; background: var(--sage-soft); top: 45%; left: 62%; opacity: .45; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.3) blur(14px);
  -webkit-backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-disc { fill: var(--accent); }
.brand-bowl { fill: #fffaf3; }
.brand-steam { fill: none; stroke: #fffaf3; stroke-width: 1.6; stroke-linecap: round; opacity: .9; }
.brand-text .zh { font-family: var(--serif); font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-text .en { font-size: 11.5px; margin-top: 0; letter-spacing: .02em; }

.steps { max-width: 760px; margin: 0 auto; padding: 0 16px 12px; }
.step-list { list-style: none; display: flex; justify-content: space-between; gap: 6px; margin: 0 0 10px; padding: 0; }
.step-list li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--ink-3); }
.step-dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-3);
  transition: all .3s ease;
}
.step-name .zh { font-size: 12px; font-weight: 700; line-height: 1.2; }
.step-name .en { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: inherit; margin-top: 0; }
.step-list li.is-done { color: var(--ink-2); }
.step-list li.is-done .step-dot { background: var(--sage); border-color: var(--sage); color: #fffdf9; }
.step-list li.is-current { color: var(--ink); }
.step-list li.is-current .step-dot { background: var(--accent); border-color: var(--accent); color: #fffdf9; transform: scale(1.1); box-shadow: 0 0 0 5px var(--accent-soft); }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress-bar { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--honey), var(--accent)); transition: width .5s cubic-bezier(.3,.7,.3,1); }

/* ---------- Layout ---------- */
.shell { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 16px 56px; outline: none; }
.foot { position: relative; z-index: 1; text-align: center; padding: 0 16px 28px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }

.view { animation: enter .45s cubic-bezier(.2,.7,.2,1) both; }
.view.back { animation-name: enter-back; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

/* ---------- Welcome ---------- */
.hero { text-align: center; padding: 24px 0 30px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); }
.hero h1 { font-size: clamp(32px, 6.4vw, 52px); margin: 22px 0 6px; font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--accent-deep); }
.hero-en { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 3vw, 22px); color: var(--ink-2); margin-bottom: 18px; }
.hero .lede { max-width: 560px; margin: 0 auto; font-size: 17px; color: var(--ink); }
.hero .lede.en { font-size: 14.5px; margin-top: 8px; }

.mini-head { text-align: center; font-size: 15px; margin: 4px 0 14px; }
.mini-head .zh { font-size: 15px; }
.mini-head .en { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 22px; }
.trio-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; box-shadow: var(--shadow); transition: transform .25s ease, box-shadow .25s ease;
}
.trio-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.trio-card h3 { font-size: 18px; margin: 12px 0 8px; }
.trio-card h3 .en { font-size: 12.5px; font-weight: 600; }
.trio-card p { font-size: 14px; color: var(--ink); line-height: 1.55; }
.trio-card p .en { font-size: 12.5px; margin-top: 4px; }

.icon-badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; }
.icon-badge svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tone-campus { background: var(--sage-soft); color: #5f6644; }
.tone-takeaway { background: var(--accent-soft); color: var(--accent-deep); }
.tone-offcampus { background: var(--honey-soft); color: #8a6420; }
.tone-neutral { background: var(--bg-2); color: var(--ink-2); }

.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin: 0 0 24px; color: var(--ink-2); font-size: 13.5px; }
.facts span { display: inline-flex; align-items: center; gap: 7px; }
.facts svg { width: 17px; height: 17px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.consent { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 16px 18px; font-size: 14px; color: var(--ink); margin-bottom: 26px; }
.consent .en { font-size: 13px; }
.center { display: flex; justify-content: center; }

/* ---------- Section header ---------- */
.section-head { margin: 4px 0 24px; }
.section-kicker { display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; color: var(--accent-deep); }
.section-kicker .letter { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #fffdf9; font-family: var(--serif); font-size: 16px; }
.section-head h2 { font-size: clamp(28px, 5vw, 36px); margin: 14px 0 2px; font-weight: 700; }
.title-en { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--ink-2); margin-bottom: 10px; }
.section-head .intro { font-size: 16px; color: var(--ink); }
.section-head .intro .en { font-size: 14px; }

/* ---------- Question cards ---------- */
.q {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 24px; margin: 0 0 16px; box-shadow: var(--shadow);
  transition: border-color .25s ease, box-shadow .25s ease;
}
.q.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft), var(--shadow); }
.q-title { display: flex; gap: 12px; align-items: baseline; margin-bottom: 6px; }
.q-text .zh { font-family: var(--serif); font-size: 19px; font-weight: 700; line-height: 1.4; }
.q-text .en { font-size: 14.5px; margin-top: 3px; }
.q-num { flex: none; font-family: var(--sans); font-size: 12.5px; font-weight: 700; color: var(--ink-3); min-width: 22px; }
.q-hint { margin: 0 0 16px 34px; font-size: 13px; color: var(--ink-3); }
.q-error { display: none; margin: 12px 0 0 34px; font-size: 13.5px; font-weight: 600; color: var(--danger); }
.q.is-invalid .q-error { display: block; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
/* Float the legend so it sits inside the card instead of on the fieldset border */
legend { float: left; width: 100%; padding: 0; }
legend + * { clear: both; }

/* Option tiles (radio / checkbox) */
.options { display: grid; gap: 10px; margin-left: 34px; }
.options.cols-2 { grid-template-columns: repeat(2, 1fr); }
.options.cols-3 { grid-template-columns: repeat(3, 1fr); }
.options.cols-5 { grid-template-columns: repeat(5, 1fr); }
.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-face {
  display: flex; align-items: center; gap: 12px; height: 100%;
  padding: 12px 15px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.opt-face .zh { font-size: 15px; font-weight: 500; line-height: 1.4; }
.opt-face .en { font-size: 12.5px; }
.opt:hover .opt-face { border-color: var(--line-strong); background: var(--surface); transform: translateY(-1px); }
.opt input:focus-visible + .opt-face { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.opt input:checked + .opt-face { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 6px 18px -12px var(--accent); }

.tick {
  flex: none; width: 20px; height: 20px; display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); background: var(--surface); transition: all .18s ease;
}
.tick.round { border-radius: 50%; }
.tick.square { border-radius: 6px; }
.tick svg { width: 12px; height: 12px; fill: none; stroke: #fffdf9; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; transform: scale(0); transition: transform .2s cubic-bezier(.3,1.6,.5,1); }
.opt input:checked + .opt-face .tick { background: var(--accent); border-color: var(--accent); }
.opt input:checked + .opt-face .tick svg { transform: scale(1); }

/* Compact numeric chips for meal counts */
.options.chips .opt-face { justify-content: center; text-align: center; padding: 12px 6px; }
.options.chips .opt-face .zh { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.options.chips .opt-face .en { font-size: 11px; }
.options.chips .tick { display: none; }

/* Big choice cards with icons (campus / takeaway / off-campus) */
.options.cards .opt-face { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
.options.cards .opt-face .label-row { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.options.cards .opt-face .zh { font-size: 16px; font-weight: 700; }
.options.cards .icon-badge { width: 40px; height: 40px; border-radius: 12px; }
.options.cards .icon-badge svg { width: 22px; height: 22px; }

/* Top-three ranking tiles (buttons, not inputs) */
.rank-tile { width: 100%; text-align: left; cursor: pointer; }
.rank-tile:hover { border-color: var(--line-strong); background: var(--surface); transform: translateY(-1px); }
.rank-badge {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px dashed var(--line-strong); background: var(--surface);
  font-family: var(--serif); font-size: 14px; font-weight: 700; color: #fffdf9; transition: all .2s ease;
}
.rank-tile.is-picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 6px 18px -12px var(--accent); }
.rank-tile.is-picked .rank-badge { border: 0; background: var(--accent); animation: pop .3s cubic-bezier(.3,1.5,.5,1) both; }
.rank-tile.is-full { opacity: .5; }
.rank-tile.is-full:hover { transform: none; }

.other-input {
  display: none; margin: 10px 0 0 34px; width: calc(100% - 34px);
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong);
  background: var(--surface); outline: none; transition: border-color .2s ease;
}
.other-input.is-open { display: block; animation: enter .3s ease both; }
.other-input:focus { border-color: var(--accent); }
::placeholder { color: var(--ink-3); opacity: .85; }

/* Likert rows */
.likert-legend { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 1.5; }
.likert-legend i { font-style: normal; font-weight: 400; color: var(--ink-3); }
.likert-legend span:last-child { text-align: right; }
.likert-row { padding: 16px 0; border-top: 1px solid var(--line); }
.likert-row:first-of-type { border-top: 0; }
.likert-label { display: flex; gap: 12px; align-items: baseline; }
.likert-label .zh { font-size: 16px; font-weight: 700; transition: color .2s ease; }
.likert-label .en { font-size: 13.5px; }
.likert-row.is-invalid .likert-label .zh { color: var(--danger); }
.likert-sub { margin: 4px 0 0 34px; font-size: 13px; color: var(--ink-3); }
.likert-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.likert-scale.has-na { grid-template-columns: repeat(5, 1fr) .9fr; }
.likert-scale .na .opt-face { border-style: dashed; background: transparent; }
.likert-scale .na .n { font-family: var(--sans); font-size: 14px; font-weight: 700; color: var(--ink-2); }
.likert-scale .na input:checked + .opt-face { border-style: solid; background: var(--bg-2); border-color: var(--ink-3); box-shadow: none; }
.likert-scale .opt-face { flex-direction: column; justify-content: center; gap: 2px; padding: 10px 4px; text-align: center; }
.likert-scale .n { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.1; }
.likert-scale .w { font-size: 11.5px; font-weight: 500; color: var(--ink-2); line-height: 1.25; }
.likert-scale .w.en { font-size: 10px; font-weight: 400; color: var(--ink-3); margin-top: 0; }

textarea {
  display: block; width: calc(100% - 34px); margin-left: 34px; min-height: 140px; resize: vertical;
  padding: 14px 16px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong);
  background: var(--surface-2); line-height: 1.6; outline: none; transition: border-color .2s ease;
}
textarea:focus { border-color: var(--accent); background: var(--surface); }
.char-count { margin: 6px 0 0 34px; font-size: 12.5px; color: var(--ink-3); text-align: right; }

/* ---------- Buttons / nav ---------- */
.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 11px 24px; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer;
  text-align: left; transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn-text .zh { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.btn-text .en { font-size: 11.5px; color: inherit; opacity: .78; margin-top: 0; }
.btn svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.btn-primary { background: var(--ink); color: #fffaf3; box-shadow: 0 10px 24px -14px rgba(30, 26, 22, .7); }
.btn-primary:hover { transform: translateY(-2px); background: #2e2721; box-shadow: 0 16px 30px -14px rgba(30, 26, 22, .6); }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-primary:disabled { opacity: .65; cursor: progress; transform: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-ghost:hover svg { transform: translateX(-3px); }
.nav-meta { font-size: 13px; color: var(--ink-3); }

.banner { display: none; margin-top: 18px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: 14px; }
.banner .en { color: var(--danger); font-weight: 500; }
.banner.is-on { display: block; animation: enter .3s ease both; }

/* ---------- Thank you ---------- */
.thanks { text-align: center; padding: 40px 0 10px; }
.thanks-badge { width: 92px; height: 92px; margin: 0 auto 22px; border-radius: 50%; display: grid; place-items: center; background: var(--sage-soft); color: #5f6644; animation: pop .6s cubic-bezier(.3,1.5,.5,1) both; }
.thanks-badge svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .6s .3s ease forwards; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.thanks h2 { font-size: clamp(32px, 6vw, 44px); font-weight: 700; margin-bottom: 4px; }
.thanks .title-en { margin-bottom: 16px; }
.thanks p { color: var(--ink); max-width: 480px; margin: 0 auto; }
.thanks p.en { font-size: 14px; margin-top: 4px; }
.receipt { display: inline-block; margin-top: 24px; padding: 10px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.receipt b { color: var(--ink); font-family: ui-monospace, Consolas, monospace; font-weight: 600; letter-spacing: .04em; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .shell { padding-top: 22px; }
  .trio { grid-template-columns: 1fr; }
  .trio-card { display: grid; grid-template-columns: auto 1fr; gap: 0 14px; align-items: start; }
  .trio-card h3 { margin: 0 0 6px; }
  .trio-card .icon-badge { grid-row: span 2; }
  .q { padding: 18px 16px 20px; }
  .options, .q-hint, .q-error, .other-input, textarea, .char-count, .likert-sub { margin-left: 0; }
  .other-input, textarea { width: 100%; }
  .options.cols-2, .options.cols-3 { grid-template-columns: 1fr; }
  .options.cols-5 { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .options.chips .opt-face { padding: 10px 2px; }
  .options.chips .opt-face .zh { font-size: 14px; }
  .options.chips .opt-face .en { display: none; }
  .options.cards .opt-face { flex-direction: row; align-items: center; gap: 14px; padding: 12px 14px; }
  .options.cards .opt-face .label-row { width: auto; }
  .options.cards .opt-face .tick { display: none; }
  .likert-scale { gap: 5px; }
  .likert-scale .w { display: none; }
  .step-name { display: none; }
  .nav .btn { padding: 10px 18px; }
  .nav-meta { display: none; }
}

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