:root {
  --bg: #f5ecdd; --card: #fffaf2; --ink: #2b1d17; --muted: #86736a;
  --accent: #d85c40; --accent-2: #ef8a4e; --accent-ink: #ffffff; --line: #e6d8c4;
  --tint: rgba(216, 92, 64, .10);
  --yes: #2f8f5b; --no: #b9483a;
  --shadow: 0 10px 30px rgba(120, 60, 30, .12);
  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1412; --card: #271e1a; --ink: #f6ebdd; --muted: #ad9a8d;
    --accent: #ea6748; --accent-2: #f39a5c; --accent-ink: #ffffff; --line: #3a2d27;
    --tint: rgba(234, 103, 72, .16);
    --yes: #3f9f6c; --no: #cf6050;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
main {
  max-width: 460px; margin: 0 auto; min-height: 100%;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px;
}
main.enter > * { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { main.enter > *, .hungry::before, .splash .mark { animation: none !important; } }

h1 { font: 800 30px/1.15 var(--round); margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 13px; margin: 0; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* ---- Brand ---- */
.mark {
  display: inline-block; width: 26px; height: 32px; flex: none; background: var(--accent);
  -webkit-mask: url(mark.png) center / contain no-repeat; mask: url(mark.png) center / contain no-repeat;
}
.word { font: 800 24px/1 var(--round); letter-spacing: -0.03em; color: var(--accent); }
.brand { display: flex; align-items: center; justify-content: center; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.home-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 14px; }
.home-hero .mark { width: 74px; height: 90px; }
.home-hero .word { font-size: 44px; }
.tagline { font: 600 15px/1 var(--round); color: var(--muted); letter-spacing: 0.02em; }
.splash { flex: 1; display: flex; align-items: center; justify-content: center; }
.splash .mark { width: 74px; height: 90px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; transform: scale(.94); } }

/* ---- Controls ---- */
button, input { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line); background: var(--card); border-radius: 16px;
  padding: 14px 16px; font-weight: 700; cursor: pointer; min-height: 54px;
  touch-action: manipulation; transition: transform .08s ease;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; }
button.primary, a.btn {
  background: linear-gradient(135deg, var(--accent-2), var(--accent) 65%); color: var(--accent-ink);
  border-color: transparent; box-shadow: 0 8px 20px rgba(216, 92, 64, .30);
}
button.big { font: 800 26px/1 var(--round); padding: 30px 16px; border-radius: 24px; }
button.yes { background: var(--yes); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(47, 143, 91, .28); }
button.no { background: var(--card); color: var(--no); border: 2px solid var(--no); }
button.link { border: 0; background: none; color: var(--muted); min-height: 44px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
a.btn { display: block; text-align: center; text-decoration: none; border-radius: 16px; padding: 16px; font-weight: 700; }
textarea, input[type=text] {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 16px;
  padding: 14px 16px; font: inherit; color: inherit; resize: none; outline: none;
}
input[type=text] { min-height: 54px; }
textarea:focus, input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--tint); }
::placeholder { color: var(--muted); opacity: .7; }

/* The big round "Hungry?" button */
.hungry {
  position: relative; align-self: center; width: 208px; height: 208px; min-height: 0; border-radius: 50%;
  border: 0; color: #fff; font: 800 34px/1 var(--round); letter-spacing: -0.02em;
  background: radial-gradient(circle at 32% 26%, var(--accent-2), var(--accent) 68%);
  box-shadow: 0 18px 40px rgba(216, 92, 64, .42), inset 0 -8px 18px rgba(0, 0, 0, .10), inset 0 4px 10px rgba(255, 255, 255, .22);
}
.hungry::before {
  content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 2px solid var(--accent);
  opacity: 0; animation: ring 2.4s ease-out infinite; pointer-events: none;
}
@keyframes ring { 0% { transform: scale(.9); opacity: .55; } 100% { transform: scale(1.18); opacity: 0; } }

/* ---- Swiping ---- */
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .25s ease; }
.card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  padding: 30px 22px; text-align: center; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 320px; box-shadow: var(--shadow); overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.card .emoji { width: 96px; height: 96px; border-radius: 50%; background: var(--tint); display: flex; align-items: center; justify-content: center; font-size: 48px; }
.card .name { font: 800 30px/1.12 var(--round); letter-spacing: -0.02em; }
.stamp {
  position: absolute; top: 26px; padding: 4px 12px; border: 3px solid; border-radius: 10px;
  font: 800 22px/1.2 var(--round); letter-spacing: .06em; opacity: 0; pointer-events: none;
}
.stamp.y { left: 18px; color: var(--yes); transform: rotate(-14deg); }
.stamp.n { right: 18px; color: var(--no); transform: rotate(14deg); }
.tag {
  display: inline-block; align-self: center; padding: 4px 12px; border-radius: 999px;
  background: var(--tint); font-size: 13px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .06em;
}
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; font-weight: 600; }
.chip.on { background: var(--no); color: #fff; border-color: transparent; text-decoration: line-through; }

/* ---- Result ---- */
.hero {
  border-radius: 28px; padding: 26px 20px; text-align: center; color: #fff;
  background: linear-gradient(140deg, var(--accent-2), var(--accent) 60%); box-shadow: 0 14px 34px rgba(216, 92, 64, .35);
  display: flex; flex-direction: column; gap: 6px;
}
.hero .kicker { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; opacity: .9; }
.hero .winner { color: #fff; }
.hero .sub { font-size: 15px; opacity: .92; }
.winner { font: 800 36px/1.1 var(--round); letter-spacing: -0.02em; }
.figure { font: 800 64px/1 var(--round); letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }

.notice { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 16px; padding: 14px 16px; font-size: 15px; }
.err { color: var(--no); font-weight: 600; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 6px 16px; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
ul.list li:last-child { border-bottom: 0; }
ul.list li.off .n { color: var(--muted); text-decoration: line-through; }
ul.list small { color: var(--muted); display: block; }
ul.list button { min-height: 40px; padding: 6px 14px; font-size: 14px; flex: none; border-radius: 999px; }

/* ---- Games ---- */
.pad { min-height: 300px; border-radius: 28px; display: flex; align-items: center; justify-content: center;
  font: 800 30px/1 var(--round); user-select: none; -webkit-user-select: none; touch-action: manipulation; box-shadow: var(--shadow); }
.track { position: relative; height: 44px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); margin-bottom: 24px; }
.track .mid { position: absolute; left: 50%; top: -8px; bottom: -8px; width: 2px; background: var(--ink); }
.track .dot { position: absolute; top: 7px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); }

/* ---- Extras ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px);
  max-width: min(88vw, 420px); padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 15px; font-weight: 600; text-align: center; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 20;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; }
.tile .num { font: 800 36px/1.1 var(--round); color: var(--accent); font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); }

/* Importing order history */
.chip.sel { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.small { font-size: 13px; }
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
ol.steps li { counter-increment: step; position: relative; padding: 14px 16px 14px 58px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; font-size: 16px; line-height: 1.35; }
ol.steps li::before { content: counter(step); position: absolute; left: 14px; top: 12px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 800 16px/30px var(--round); text-align: center; }
.filebtn { display: flex; align-items: center; justify-content: center; min-height: 54px; padding: 12px 16px; border-radius: 16px; border: 2px dashed var(--accent); color: var(--accent); font-weight: 700; cursor: pointer; background: var(--tint); }
.filebtn.dis { opacity: .5; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { position: relative; width: 64px; height: 96px; min-height: 0; padding: 0; border-radius: 10px; overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font: 700 16px/22px var(--round); text-align: center; }
label.pick { display: flex; align-items: center; gap: 12px; flex: 1; min-height: 44px; cursor: pointer; }
label.pick input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); }

button.link.inl { display: inline; min-height: 0; padding: 0; font-size: inherit; font-weight: 600; width: auto; }
p.small.center { text-align: center; }
