:root {
  --night: #10262b;
  --awning: #285354;
  --awning-dark: #193b3f;
  --paper: #f2d8a8;
  --paper-soft: #e8c98f;
  --ember: #f47b3f;
  --ember-bright: #ff9a4f;
  --jade: #72d6b4;
  --burnt: #c74a3d;
  --ink: #173033;
  --shadow: rgba(5, 20, 23, 0.34);
  --serif: STKaiti, KaiTi, "Songti SC", SimSun, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--paper);
  background:
    radial-gradient(circle at 18% -5%, rgba(244, 123, 63, 0.18), transparent 34rem),
    linear-gradient(180deg, #17373c 0, var(--night) 42%, #0b1d21 100%);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, a { font: inherit; }

button { cursor: pointer; }

button:focus-visible, a:focus-visible {
  outline: 3px solid var(--jade);
  outline-offset: 3px;
}

.lantern-line {
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--paper-soft) 0 18px, var(--ember) 18px 100px, var(--jade) 100px 150px);
  opacity: .88;
}

.stall-shell {
  width: min(100%, 520px);
  min-height: calc(100vh - 6px);
  min-height: calc(100dvh - 6px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stall-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 180px;
  background: repeating-linear-gradient(90deg, rgba(242, 216, 168, .09) 0 42px, transparent 42px 84px);
  pointer-events: none;
}

.stall-head,
.ticket-strip,
.stall-foot { position: relative; z-index: 1; }

.stall-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-kicker,
.hand-note {
  margin: 0 0 4px;
  color: var(--jade);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .16em;
}

.stall-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .04em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .2);
}

.icon-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(242, 216, 168, .38);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(16, 38, 43, .55);
  font-size: 13px;
}

.ticket-strip {
  display: grid;
  grid-template-columns: 1.35fr .8fr .8fr;
  margin: 16px 0 18px;
  border-top: 1px solid rgba(242, 216, 168, .3);
  border-bottom: 1px dashed rgba(242, 216, 168, .46);
}

.ticket-strip > div {
  padding: 10px 8px 10px 0;
  min-width: 0;
}

.ticket-strip > div + div {
  padding-left: 12px;
  border-left: 1px dashed rgba(242, 216, 168, .3);
}

.ticket-strip span,
.game-top span,
.heat-label-row,
.order-target span {
  display: block;
  color: rgba(242, 216, 168, .72);
  font-size: 11px;
  letter-spacing: .08em;
}

.ticket-strip strong {
  display: block;
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.is-hidden { display: none !important; }

.welcome-copy h2,
.result-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 10vw, 54px);
  line-height: 1.13;
  letter-spacing: .02em;
}

.welcome-copy > p:last-child,
.result-summary {
  color: rgba(242, 216, 168, .78);
  font-size: 15px;
  line-height: 1.75;
}

.grill-preview {
  height: 170px;
  margin: 22px 4px 18px;
  border-radius: 24px 24px 10px 10px;
  background:
    linear-gradient(180deg, rgba(16, 38, 43, .1), rgba(9, 26, 29, .88)),
    repeating-linear-gradient(90deg, rgba(242, 216, 168, .08) 0 28px, transparent 28px 56px),
    var(--awning-dark);
  border: 1px solid rgba(242, 216, 168, .22);
  position: relative;
  overflow: hidden;
}

.preview-smoke span,
.smoke-layer i {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(242, 216, 168, .48);
  border-radius: 50%;
  animation: smoke 3.2s ease-in-out infinite;
}

.preview-smoke span:nth-child(1) { left: 24%; top: 58%; }
.preview-smoke span:nth-child(2) { left: 49%; top: 54%; animation-delay: .8s; }
.preview-smoke span:nth-child(3) { left: 70%; top: 61%; animation-delay: 1.6s; }

@keyframes smoke {
  0% { transform: translateY(8px) scale(.55); opacity: 0; }
  35% { opacity: .8; }
  100% { transform: translateY(-62px) scale(1.5); opacity: 0; }
}

.preview-skewer {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 78px;
  height: 5px;
  background: var(--paper-soft);
  transform: rotate(-3deg);
}

.preview-skewer i,
.skewer b {
  position: absolute;
  top: -17px;
  width: 42px;
  height: 42px;
  border-radius: 40% 45% 43% 38%;
  background: linear-gradient(135deg, #bd613d, #8f3f2f);
  box-shadow: inset 6px 4px 0 rgba(244, 123, 63, .28);
}

.preview-skewer i:nth-child(1) { left: 5%; }
.preview-skewer i:nth-child(2) { left: 29%; }
.preview-skewer i:nth-child(3) { left: 53%; }
.preview-skewer i:nth-child(4) { left: 77%; }

.preview-coals {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 22px;
  height: 12px;
  background: repeating-linear-gradient(90deg, var(--ember) 0 22px, #4a2c25 22px 30px);
  filter: blur(1px);
  opacity: .8;
}

.welcome-actions { margin-top: auto; }

.primary-button,
.secondary-button,
.control-button {
  border: 0;
  color: var(--ink);
  font-weight: 700;
  transition: transform .12s ease, filter .12s ease, background-color .12s ease;
}

.primary-button:active,
.secondary-button:active,
.control-button:active { transform: translateY(2px) scale(.99); }

.primary-button {
  width: 100%;
  min-height: 58px;
  border-radius: 16px 16px 22px 22px;
  background: var(--paper);
  box-shadow: 0 7px 0 #9b7448;
  font-family: var(--serif);
  font-size: 23px;
  letter-spacing: .08em;
}

.primary-button:hover { background: #fff0c8; }

.secondary-button {
  flex: 1 1 140px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid rgba(242, 216, 168, .42);
  border-radius: 13px;
  color: var(--paper);
  background: rgba(242, 216, 168, .08);
}

.secondary-button:hover { background: rgba(242, 216, 168, .16); }

.welcome-actions > p {
  margin: 13px 0 0;
  color: rgba(242, 216, 168, .55);
  font-size: 12px;
  text-align: center;
}

.game-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 0 2px 12px;
}

.game-top strong {
  display: block;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
}

.game-top small { margin-left: 3px; font-size: 13px; }
.score-block { text-align: right; }

.order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid rgba(242, 216, 168, .3);
  border-radius: 18px 4px 18px 4px;
  background: rgba(40, 83, 84, .72);
}

.order-card > div:first-child > span {
  color: var(--jade);
  font-size: 12px;
}

.order-card h2 {
  margin: 3px 0 0;
  font-family: var(--serif);
  font-size: 22px;
}

.order-target { text-align: right; }
.order-target strong { font-size: 18px; color: var(--ember-bright); }

.heat-panel { margin-top: 16px; }

.heat-label-row {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 7px;
}

.heat-track {
  height: 34px;
  position: relative;
  border: 1px solid rgba(242, 216, 168, .5);
  border-radius: 18px;
  background: linear-gradient(90deg, #6b8f8a, #d6b96f 55%, #9e3f37);
  overflow: visible;
}

.target-band {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 20%;
  border: 2px solid var(--jade);
  border-radius: 16px;
  background: rgba(114, 214, 180, .32);
  box-shadow: 0 0 16px rgba(114, 214, 180, .55);
}

.heat-fill {
  position: absolute;
  inset: 1px auto 1px 1px;
  width: 25%;
  border-radius: 16px 0 0 16px;
  background: rgba(255, 154, 79, .28);
}

.heat-needle {
  position: absolute;
  top: -9px;
  left: 25%;
  width: 2px;
  height: 50px;
  transform: translateX(-1px);
  background: var(--paper);
  box-shadow: 0 0 10px rgba(242, 216, 168, .8);
}

.heat-needle span {
  position: absolute;
  top: -7px;
  left: -6px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  background: var(--paper);
}

.heat-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: rgba(242, 216, 168, .62);
  font-size: 10px;
}

.heat-track.is-burnt { animation: shake .22s linear infinite; }
@keyframes shake { 50% { transform: translateX(2px); } }

.grill-stage {
  height: 154px;
  margin: 16px 0 14px;
  border-radius: 22px 22px 12px 12px;
  border: 1px solid rgba(242, 216, 168, .22);
  background:
    repeating-linear-gradient(90deg, rgba(242, 216, 168, .07) 0 26px, transparent 26px 52px),
    radial-gradient(ellipse at 50% 100%, rgba(244, 123, 63, .45), transparent 66%),
    var(--awning-dark);
  position: relative;
  overflow: hidden;
  transition: box-shadow .15s ease;
}

.grill-stage.is-hot { box-shadow: inset 0 -20px 40px rgba(244, 123, 63, .32); }

.grill-rack {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 65px;
  height: 8px;
  background: repeating-linear-gradient(90deg, #8c9a8c 0 7px, transparent 7px 18px);
}

.skewer {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 48px;
  height: 5px;
  background: var(--paper-soft);
  transform: rotate(-2deg);
}

.skewer b:nth-child(1) { left: 4%; }
.skewer b:nth-child(2) { left: 23%; }
.skewer b:nth-child(3) { left: 42%; }
.skewer b:nth-child(4) { left: 61%; }
.skewer b:nth-child(5) { left: 80%; }

.smoke-layer i:nth-child(1) { left: 26%; top: 64%; }
.smoke-layer i:nth-child(2) { left: 50%; top: 60%; animation-delay: 1s; }
.smoke-layer i:nth-child(3) { left: 72%; top: 67%; animation-delay: 1.8s; }

.coal-row {
  position: absolute;
  left: 11%;
  right: 11%;
  bottom: 17px;
  height: 15px;
  background: repeating-linear-gradient(90deg, var(--ember) 0 20px, #41251f 20px 28px);
  opacity: .75;
  filter: blur(.5px);
}

.game-controls {
  display: grid;
  grid-template-columns: 1.25fr 1fr .85fr;
  gap: 8px;
}

.control-button {
  min-height: 54px;
  border-radius: 14px 14px 10px 10px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 17px;
  box-shadow: 0 5px 0 rgba(4, 18, 20, .5);
  touch-action: none;
  user-select: none;
}

.heat-button { background: #a84432; }
.heat-button.is-pressed { background: var(--ember-bright); color: var(--ink); }
.fan-button { background: #367b67; }
.serve-button { background: var(--paper); color: var(--ink); }

.game-hint {
  min-height: 22px;
  margin: 10px 0 0;
  color: rgba(242, 216, 168, .78);
  font-size: 13px;
  text-align: center;
}

.result-head { margin-bottom: 14px; }
.result-head h2 { font-size: clamp(29px, 8vw, 42px); }

.receipt-wrap {
  position: relative;
  max-width: 360px;
  margin: 0 auto 14px;
  padding: 8px;
  background: rgba(242, 216, 168, .1);
  border-radius: 8px;
}

#receiptCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 14px 26px var(--shadow);
}

.result-stamp {
  position: absolute;
  right: 0;
  top: 26px;
  padding: 8px 14px;
  transform: rotate(10deg);
  border: 3px double var(--burnt);
  border-radius: 50%;
  color: var(--burnt);
  background: rgba(242, 216, 168, .9);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  display: none;
}

.result-stamp.is-visible { display: block; }

.result-summary { margin: 0 0 14px; text-align: center; }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: auto;
}

.result-actions .primary-button { flex: 1 1 100%; }

.copy-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--jade);
  font-size: 12px;
  text-align: center;
}

.stall-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed rgba(242, 216, 168, .28);
  color: rgba(242, 216, 168, .55);
  font-size: 11px;
}

.stall-foot a { color: inherit; }

.privacy-page { padding: 0; }
.privacy-sheet {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 42px 22px 64px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.8;
  min-height: 100vh;
}
.privacy-sheet .brand-kicker { color: #8b442e; }
.privacy-sheet h1 { font-family: var(--serif); font-size: 38px; margin: 0 0 18px; }
.privacy-sheet h2 { font-family: var(--serif); font-size: 23px; margin: 28px 0 4px; }
.privacy-sheet a { color: #8b442e; font-weight: 700; }

.error-sheet { max-width: 560px; }
.error-code {
  margin: 36px 0 0;
  color: #8b442e;
  font-family: var(--serif);
  font-size: clamp(64px, 18vw, 96px);
  line-height: .9;
  letter-spacing: .04em;
}
.error-sheet h1 { margin-top: 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;
}

@media (min-width: 560px) {
  .stall-shell { padding-left: 28px; padding-right: 28px; }
  .game-controls { gap: 12px; }
}

@media (max-height: 740px) {
  .welcome-copy h2 { font-size: 38px; }
  .grill-preview { height: 130px; margin-top: 14px; }
  .grill-stage { height: 125px; margin: 12px 0 10px; }
  .control-button { min-height: 50px; }
  .stall-foot { margin-top: 10px; }
}

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