@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;700&family=Atkinson+Hyperlegible:wght@400;700&display=swap');

:root {
  --paper: #E4F0EA;
  --paper-deep: #CFE3D8;
  --ink: #1E2D29;
  --ink-soft: #4A5D57;
  --ticket: #FFFFFF;
  --leaf: #2F6E4F;
  --leaf-dark: #22543B;
  --chili: #B83A26;
  --line: #B9D2C5;
  --scale: 1;
  --font: 'Lexend', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --measure: 34rem;
}

html.legible { --font: 'Atkinson Hyperlegible', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif; }
html.size-lg { --scale: 1.15; }
html.size-xl { --scale: 1.32; }

* { box-sizing: border-box; }

html { font-size: calc(100% * var(--scale)); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--leaf-dark); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 1.1rem; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: 1.1rem 0 .6rem;
}
.top h1 { font-size: 1.6rem; line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.top .sub { margin: .15rem 0 0; color: var(--ink-soft); font-size: .9rem; }
.tools { display: flex; gap: .4rem; flex-shrink: 0; }

button, .btn {
  font: inherit; color: inherit; cursor: pointer;
  border: 2px solid var(--ink); background: var(--ticket);
  border-radius: 999px; padding: .5rem .95rem; min-height: 44px;
  text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
}
button.primary, .btn.primary { background: var(--leaf); border-color: var(--leaf); color: #fff; font-weight: 500; }
button.primary:hover, .btn.primary:hover { background: var(--leaf-dark); border-color: var(--leaf-dark); }
button.icon { padding: .45rem .7rem; }
button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Settings panel */
.settings { background: var(--ticket); border-radius: 14px; padding: 1rem; margin: .4rem 0 1rem; }
.settings[hidden] { display: none; }
.settings h2 { font-size: 1rem; margin: 0 0 .6rem; }
.settings .row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; align-items: center; }
.settings .row:last-child { margin-bottom: 0; }
.settings .row > span { min-width: 6.5rem; color: var(--ink-soft); font-size: .92rem; }

/* Blocks */
.block { margin: 1.4rem 0; }
.block > h2 { font-size: 1.2rem; margin: 0 0 .25rem; }
.block > .hint { margin: 0 0 .8rem; color: var(--ink-soft); font-size: .95rem; }

/* Dish rows: the menu number sits in a round stamp on the left */
.dishes { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.dish {
  width: 100%; text-align: left; border: 0; border-radius: 14px; background: var(--ticket);
  padding: .8rem .9rem; display: grid; grid-template-columns: 3.4rem 1fr auto; gap: .8rem; align-items: center;
}
.dish:hover { box-shadow: inset 0 0 0 2px var(--leaf); }
.stamp {
  width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 2px solid var(--ink);
  display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; line-height: 1;
}
.stamp.long { font-size: .85rem; }
.dish .name { font-weight: 500; display: block; }
.dish .zh { display: block; color: var(--ink-soft); font-size: .88rem; }
html.no-zh .zh { display: none; }
.dish .meta { display: block; color: var(--ink-soft); font-size: .88rem; }
.dish .price { font-weight: 500; white-space: nowrap; font-size: .95rem; }
.dish.sold { opacity: .55; }
.heat { color: var(--chili); font-weight: 500; font-size: .78rem; border: 1.5px solid var(--chili); border-radius: 999px; padding: 0 .45rem; margin-left: .35rem; vertical-align: 2px; white-space: nowrap; }
.badge { display: inline-block; font-size: .78rem; border-radius: 999px; padding: .05rem .5rem; margin-left: .3rem; vertical-align: 2px; }
.badge.chef { background: var(--paper-deep); color: var(--ink); }

/* Guided picker: one question at a time */
.picker { background: var(--ticket); border-radius: 18px; padding: 1.1rem; }
.picker .step-count { color: var(--ink-soft); font-size: .88rem; margin: 0 0 .2rem; }
.picker h3 { font-size: 1.15rem; margin: 0 0 .8rem; }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choices button { border-color: var(--line); }
.choices button:hover { border-color: var(--leaf); }
.picker .back { margin-top: .9rem; border: 0; padding-left: 0; text-decoration: underline; background: none; }
.picker .results-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .6rem; }
.picker .results-head h3 { margin: 0; }
.picker .dishes .dish { background: var(--paper); }
.empty { color: var(--ink-soft); }

/* Full menu sections */
details.section { background: var(--ticket); border-radius: 14px; margin-bottom: .5rem; }
details.section > summary {
  list-style: none; cursor: pointer; padding: .9rem 1rem; display: flex; justify-content: space-between; align-items: center; min-height: 52px;
  font-weight: 500;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary .count { color: var(--ink-soft); font-weight: 400; font-size: .9rem; }
details.section > summary .zh { color: var(--ink-soft); font-weight: 400; margin-left: .4rem; font-size: .9rem; }
details.section[open] > summary { border-bottom: 2px solid var(--paper); }
details.section .dishes { padding: .5rem; }
details.section .dish { background: var(--paper); }

.extras { display: grid; gap: .5rem; }
.extra { background: var(--paper-deep); border-radius: 14px; padding: .8rem 1rem; }
.extra strong { display: block; }

/* Grid view: sauce rows x protein columns */
.grid-wrap { overflow-x: auto; background: var(--ticket); border-radius: 14px; padding: .4rem; }
table.grid { border-collapse: separate; border-spacing: 4px; width: 100%; font-size: .92rem; }
table.grid th { text-align: left; font-weight: 500; padding: .3rem .4rem; white-space: nowrap; }
table.grid thead th { color: var(--ink-soft); font-weight: 400; text-transform: capitalize; }
table.grid td { padding: 0; }
table.grid td button {
  width: 100%; min-height: 44px; border-radius: 10px; border: 2px solid var(--line); padding: .3rem; justify-content: center; font-weight: 700;
}
table.grid td button:hover { border-color: var(--leaf); }
table.grid td.none { color: var(--line); text-align: center; }

/* Order ticket (bottom sheet) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(30, 45, 41, .45); display: grid; align-items: end; z-index: 20; }
.sheet-backdrop[hidden] { display: none; }
.sheet {
  background: var(--ticket); width: 100%; max-width: var(--measure); margin: 0 auto;
  border-radius: 20px 20px 0 0; padding: 1.3rem 1.2rem 1.6rem; max-height: 92vh; overflow-y: auto;
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .big-number {
  font-size: 4.2rem; line-height: 1; font-weight: 700; letter-spacing: -0.02em; margin: 0;
}
.sheet .big-number small { font-size: 1rem; font-weight: 400; color: var(--ink-soft); display: block; letter-spacing: 0; margin-bottom: .2rem; }
.sheet h2 { font-size: 1.3rem; margin: .5rem 0 .1rem; }
.sheet .desc { margin: .5rem 0 1rem; }
.sizes { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.say {
  background: var(--paper); border-radius: 14px; padding: .9rem 1rem; margin-bottom: 1rem; border: 2px dashed var(--leaf);
}
.say p { margin: 0; }
.say .line { font-size: 1.35rem; font-weight: 700; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.allergy { font-size: .88rem; color: var(--ink-soft); margin: 1rem 0 0; }

/* My list */
.mylist { position: sticky; bottom: 0; background: var(--ink); color: var(--paper); border-radius: 16px 16px 0 0; padding: .8rem 1rem; margin-top: 1.5rem; z-index: 5; }
.mylist[hidden] { display: none; }
.mylist .head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.mylist button, .mylist .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.mylist ol { margin: .6rem 0 .2rem; padding-left: 1.3rem; }
.mylist li { margin: .2rem 0; }
.mylist li button { min-height: 32px; padding: .1rem .6rem; font-size: .85rem; margin-left: .4rem; }

/* Focus mode: hides everything except the picker and the list */
html.focus .hide-in-focus { display: none; }

footer.info { color: var(--ink-soft); font-size: .9rem; padding: 1rem 0 3rem; }
footer.info p { margin: .3rem 0; }

.demo-note { background: var(--ink); color: var(--paper); font-size: .85rem; text-align: center; padding: .45rem 1rem; }
.demo-note a { color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
html.calm * { animation: none !important; transition: none !important; }

@media print {
  .demo-note, .tools, .settings, .mylist, .sheet-backdrop { display: none !important; }
}

.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; }
