:root {
  --bg: #140c08;
  --bg-2: #1e120c;
  --ink: #f6ead4;
  --muted: #c4b39a;
  --gold: #e8c36a;
  --gold-2: #f8e3a4;
  --fire: #ff6a2c;
  --fire-2: #ffb347;
  --good: #3dcc7a;
  --bad: #e85d4c;
  --line: rgba(232, 195, 106, 0.28);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #070504;
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  touch-action: manipulation;
  user-select: none;
}

body {
  display: flex;
  justify-content: center;
}

.app {
  position: relative;
  width: min(100vw, 430px);
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, #3a2012 0%, transparent 52%),
    radial-gradient(ellipse at 50% 110%, #4a1c0c 0%, transparent 46%),
    var(--bg);
  box-shadow: 0 0 0 1px #000;
}

.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px 16px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(28px + var(--safe-t)) 22px calc(28px + var(--safe-b));
  z-index: 1;
}

.screen[hidden] {
  display: none;
}

.screen.is-on {
  animation: fade-up 0.45s ease both;
}

.eyebrow,
.fineprint,
.timer-label,
.chair-line {
  letter-spacing: 0.18em;
}

.eyebrow {
  margin: 48px 0 10px;
  color: var(--gold);
  font-size: 12px;
}

.logo {
  margin: 0;
  font-size: clamp(42px, 12vw, 58px);
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, #b8862e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 28px rgba(232, 195, 106, 0.15);
}

.tagline,
.blurb,
.fineprint,
.stage-hint,
.result-dish {
  color: var(--muted);
  text-align: center;
}

.tagline {
  margin: 12px 0 0;
  font-size: 14px;
}

.fineprint {
  margin-top: 16px;
  font-size: 11px;
  opacity: 0.7;
}

.flame-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  height: 54px;
  margin: 36px 0 28px;
}

.flame {
  width: 16px;
  height: 34px;
  border-radius: 50% 50% 40% 40%;
  background: linear-gradient(180deg, #fff3c4, var(--fire-2) 40%, var(--fire));
  filter: blur(0.2px);
  animation: flicker 0.7s ease-in-out infinite;
}

.flame-mid {
  height: 46px;
  width: 20px;
  animation-delay: 0.15s;
}

.btn {
  appearance: none;
  border: 0;
  min-height: 56px;
  min-width: 220px;
  padding: 0 28px;
  border-radius: 999px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.14em;
  cursor: pointer;
}

.screen > .btn {
  margin-top: auto;
}

.btn-gold {
  color: #2a1608;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 8px 0 #8a6418, 0 14px 28px rgba(0, 0, 0, 0.35);
}

.btn-gold:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 #8a6418, 0 8px 16px rgba(0, 0, 0, 0.3);
}

.chair-line {
  margin: 8px 12px 20px;
  color: var(--gold-2);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.cloche-stage {
  position: relative;
  width: 240px;
  height: 250px;
  margin: 8px 0 18px;
}

.cloche {
  position: absolute;
  inset: 0;
  z-index: 2;
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s ease;
}

.cloche.is-up {
  transform: translateY(-120px);
  opacity: 0;
}

.cloche-dome {
  width: 168px;
  height: 118px;
  margin: 18px auto 0;
  border-radius: 84px 84px 18px 18px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 28%),
    linear-gradient(180deg, #f3e0a8, #b8943e 70%, #7a5a18);
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.35);
}

.cloche-dome::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: -10px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--gold));
}

.cloche-rim {
  width: 196px;
  height: 18px;
  margin: -6px auto 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f7e7b0, #9a7424);
}

.theme-card {
  position: absolute;
  left: 50%;
  top: 58px;
  width: 180px;
  transform: translateX(-50%) scale(0.86);
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease 0.15s, transform 0.5s ease 0.1s;
}

.theme-card.is-show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.theme-emoji {
  display: block;
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.theme-name {
  margin: 10px 0 4px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.theme-dish,
.blurb {
  margin: 0;
  font-size: 14px;
}

.blurb {
  min-height: 40px;
  margin-bottom: 22px;
}

.cook {
  padding-top: calc(14px + var(--safe-t));
  padding-bottom: calc(12px + var(--safe-b));
}

.hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hud-timer,
.hud-theme {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.timer-label {
  font-size: 11px;
  color: var(--muted);
}

.timer-num {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 800;
  color: var(--gold-2);
}

.hud-timer.is-low .timer-num {
  color: var(--bad);
  animation: pulse 0.6s ease-in-out infinite;
}

.hud-theme {
  font-weight: 700;
  letter-spacing: 0.12em;
}

.stages {
  display: flex;
  gap: 8px;
  width: 100%;
  margin: 12px 0 8px;
  padding: 0;
  list-style: none;
}

.stages li {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.stages li.is-now {
  color: #2a1608;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 800;
}

.stages li.is-done {
  color: var(--good);
  border-color: rgba(61, 204, 122, 0.45);
}

.stage-title {
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.stage-hint {
  margin: 4px 0 10px;
  font-size: 13px;
  min-height: 36px;
}

.stage-root {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.board {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}

.ing {
  position: relative;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #2a1a12, #1a100c);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font: inherit;
  overflow: hidden;
}

.ing.is-need {
  box-shadow: inset 0 0 0 2px rgba(232, 195, 106, 0.7), 0 0 16px rgba(232, 195, 106, 0.12);
}

.ing.is-theme {
  box-shadow: inset 0 0 0 2px rgba(248, 227, 164, 0.95), 0 0 18px rgba(232, 195, 106, 0.2);
}

.ing.is-decoy {
  border-color: rgba(232, 93, 76, 0.5);
  background: linear-gradient(180deg, #2a1412, #1a0c0c);
}

.ing .tag {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--gold);
  color: #2a1608;
}

.ing.is-decoy .tag {
  background: var(--bad);
  color: #fff;
}

.ing.is-fresh {
  animation: pop 0.35s ease;
}

.ing.is-cut {
  pointer-events: none;
  transform: scale(0.92);
  opacity: 0.35;
}

.ing.is-cut::after {
  content: "";
  position: absolute;
  inset: 18% -10%;
  height: 3px;
  margin: auto;
  background: var(--gold-2);
  transform: rotate(-18deg);
}

.ing.is-wrong {
  animation: shake 0.35s ease;
  border-color: var(--bad);
}

.ing .emo {
  font-size: 36px;
  line-height: 1;
}

.ing .nm {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.progress {
  margin-top: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.wok-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
}

.wok {
  position: relative;
  width: min(72vw, 250px);
  height: min(72vw, 250px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #6b4330, #24140e 58%, #0c0705 78%);
  box-shadow:
    inset 0 -24px 36px rgba(0, 0, 0, 0.55),
    0 0 0 10px #2a1c12,
    0 0 40px rgba(255, 106, 44, 0.25);
}

.wok-food {
  position: absolute;
  inset: 28%;
  display: grid;
  place-items: center;
  font-size: 54px;
  transition: transform 0.18s ease;
}

.wok.is-toss .wok-food {
  transform: translateY(-18px) rotate(-8deg);
}

.flames {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -18px;
  height: 36px;
  border-radius: 40%;
  background: linear-gradient(180deg, transparent, rgba(255, 106, 44, 0.15), rgba(255, 179, 71, 0.55));
  filter: blur(1px);
  animation: flicker 0.45s linear infinite;
}

.heat {
  width: 100%;
  padding: 8px 0 4px;
}

.heat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.heat-track {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3d5cff 0%, #3dcc7a 38%, var(--gold) 62%, var(--fire) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.heat-zone {
  position: absolute;
  top: -5px;
  bottom: -5px;
  border: 2px solid #fff8;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.heat-needle {
  position: absolute;
  top: -8px;
  width: 4px;
  height: 44px;
  margin-left: -2px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 10px #fff;
}

.tap-heat {
  width: 100%;
  min-height: 72px;
  margin-top: 14px;
  border: 0;
  border-radius: 22px;
  color: #2a1608;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.16em;
  background: linear-gradient(180deg, #ffd27a, #ff8a3d);
  box-shadow: 0 7px 0 #9a4a12;
}

.tap-heat:active {
  transform: translateY(3px);
  box-shadow: 0 4px 0 #9a4a12;
}

.tap-heat:disabled {
  opacity: 0.5;
}

.tap-heat.is-hot {
  background: linear-gradient(180deg, #fff3c4, #ffd27a);
  box-shadow: 0 7px 0 #8a6418, 0 0 22px rgba(255, 210, 122, 0.45);
}

.judge-pop {
  min-height: 24px;
  margin: 8px 0 0;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--gold-2);
}

.plate-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}

.plate {
  position: relative;
  width: min(78vw, 280px);
  height: min(78vw, 280px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #fffaf0, #e8d8b8 54%, #c9b48a 70%, #f3e6c6 72%, #d8c49a);
  box-shadow:
    inset 0 0 0 14px rgba(255, 255, 255, 0.28),
    0 16px 28px rgba(0, 0, 0, 0.35);
}

.slot {
  position: absolute;
  width: 86px;
  height: 86px;
  border: 2px dashed rgba(80, 50, 20, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #5a3d1c;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.slot .emo {
  font-size: 26px;
  line-height: 1;
}

.slot .nm {
  font-size: 11px;
  font-weight: 700;
}

.slot.is-fill {
  border-style: solid;
  border-color: #8a6418;
  background: rgba(255, 248, 230, 0.9);
}

.slot.is-miss {
  animation: shake 0.32s ease;
  border-color: var(--bad);
}

.slot-c { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.slot-t { left: 50%; top: 10%; transform: translateX(-50%); }
.slot-r { right: 8%; bottom: 18%; }
.slot-l { left: 8%; bottom: 18%; }

.now-piece {
  margin-top: 16px;
  width: 100%;
  min-height: 64px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.result-kicker {
  margin: 20px 0 0;
  letter-spacing: 0.22em;
  color: var(--gold);
  font-size: 12px;
}

.result-banner {
  margin: 8px 0 0;
  font-size: 36px;
  letter-spacing: 0.14em;
}

.result-banner.is-win {
  color: var(--gold-2);
}

.result-banner.is-lose {
  color: #ffb3a8;
}

.result-dish {
  margin: 6px 0 0;
}

.result-quote {
  margin: 16px 18px 8px;
}

.score-list {
  width: 100%;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.score-list li {
  display: grid;
  grid-template-columns: 44px 1fr 36px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: #2a1c14;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--fire-2));
  transition: width 0.7s ease;
}

.total-line {
  margin: 8px 0 22px;
  font-size: 16px;
}

.total-line strong {
  font-size: 28px;
  color: var(--gold-2);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes flicker {
  0%, 100% { transform: scaleY(1) scaleX(1); opacity: 0.9; }
  50% { transform: scaleY(1.18) scaleX(0.9); opacity: 1; }
}

@keyframes pulse {
  50% { opacity: 0.55; }
}

@keyframes pop {
  from { transform: scale(0.86); }
  to { transform: scale(1); }
}

@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (max-height: 720px) {
  .eyebrow { margin-top: 24px; }
  .ing { min-height: 88px; }
  .wok,
  .plate {
    width: min(58vw, 210px);
    height: min(58vw, 210px);
  }
  .slot {
    width: 72px;
    height: 72px;
  }
  .logo { font-size: 40px; }
  .stage-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
