:root {
  color-scheme: light;
  --bg: #fff3df;
  --bg-2: #ffd9a0;
  --ink: #3b2216;
  --muted: #80553f;
  --card: rgba(255, 251, 244, 0.8);
  --line: rgba(104, 58, 37, 0.14);
  --accent: #f26b3a;
  --accent-strong: #db4022;
  --gold: #ffc83d;
  --green: #2f8f66;
  --shadow: 0 20px 60px rgba(108, 61, 37, 0.16);
  --bg-spot-1: rgba(255, 200, 61, 0.65);
  --bg-spot-2: rgba(242, 107, 58, 0.2);
  --orb: rgba(255, 255, 255, 0.28);
  --panel-surface:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 248, 236, 0.86) 100%);
  --secondary-surface: rgba(255, 255, 255, 0.76);
  --switcher-surface: rgba(255, 247, 236, 0.8);
  --stage-surface:
    radial-gradient(circle at top left, rgba(255, 208, 132, 0.34), transparent 36%),
    linear-gradient(180deg, rgba(255, 251, 244, 0.88) 0%, rgba(255, 239, 210, 0.82) 100%);
  --stage-overlay: rgba(255, 255, 255, 0.78);
  --stage-overlay-soft: rgba(255, 255, 255, 0.72);
  --reel-surface:
    linear-gradient(180deg, rgba(255, 220, 182, 0.3) 0%, rgba(255, 255, 255, 0.72) 35%, rgba(255, 221, 184, 0.34) 100%);
  --reel-surface-soft:
    linear-gradient(180deg, rgba(255, 220, 182, 0.18) 0%, rgba(255, 255, 255, 0.22) 35%, rgba(255, 221, 184, 0.18) 100%);
  --reel-fade-top: linear-gradient(180deg, rgba(255, 248, 236, 0.96) 0%, rgba(255, 248, 236, 0) 100%);
  --reel-fade-bottom: linear-gradient(0deg, rgba(255, 248, 236, 0.96) 0%, rgba(255, 248, 236, 0) 100%);
  --reel-item-surface: rgba(255, 255, 255, 0.62);
  --filter-surface:
    linear-gradient(180deg, rgba(255, 249, 241, 0.92) 0%, rgba(255, 244, 225, 0.84) 100%);
  --chip-surface: rgba(255, 255, 255, 0.86);
  --drawer-surface: rgba(255, 250, 242, 0.98);
  --drawer-backdrop: rgba(59, 34, 22, 0.28);
  --panel-border-strong: rgba(255, 255, 255, 0.45);
  --secondary-border: rgba(104, 58, 37, 0.12);
  --soft-border: rgba(104, 58, 37, 0.1);
  --soft-border-2: rgba(104, 58, 37, 0.08);
  --field-border: rgba(115, 76, 50, 0.14);
  --field-border-soft: rgba(115, 76, 50, 0.1);
  --accent-border: rgba(242, 107, 58, 0.18);
  --accent-border-strong: rgba(242, 107, 58, 0.2);
  --accent-glow: rgba(242, 107, 58, 0.12);
  --accent-shadow: rgba(219, 64, 34, 0.28);
  --accent-shadow-soft: rgba(242, 107, 58, 0.2);
  --ambient-shadow: rgba(110, 76, 44, 0.1);
  --ambient-shadow-soft: rgba(110, 76, 44, 0.06);
  --card-shadow-soft: rgba(100, 71, 50, 0.08);
  --drawer-shadow: rgba(59, 34, 22, 0.18);
  --sound-off-surface: rgba(255, 247, 240, 0.7);
  --status-ok-surface: rgba(47, 143, 102, 0.12);
  --status-spin-surface: rgba(242, 107, 58, 0.12);
  --control-solid: linear-gradient(135deg, #ff9b53 0%, #f26b3a 100%);
  --control-solid-strong: linear-gradient(135deg, #ff9550 0%, #f26b3a 100%);
  --focus-ring: 0 0 0 4px rgba(242, 107, 58, 0.12);
  --highlight-surface: linear-gradient(180deg, #fff0cc 0%, #ffe3a7 100%);
  --highlight-border: rgba(219, 64, 34, 0.16);
  --drawer-close-surface: rgba(255, 255, 255, 0.9);
  --editor-card-surface: rgba(255, 245, 229, 0.7);
  --menu-row-surface: rgba(255, 255, 255, 0.88);
  --field-surface: rgba(255, 255, 255, 0.95);
  --placeholder: rgba(128, 85, 63, 0.75);
  --empty-surface: rgba(255, 255, 255, 0.6);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--bg-spot-1), transparent 30%),
    radial-gradient(circle at right 20% bottom 10%, var(--bg-spot-2), transparent 28%),
    linear-gradient(160deg, var(--bg) 0%, #fff9ef 35%, var(--bg-2) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 16rem;
  height: 16rem;
  border-radius: 50%;
  background: var(--orb);
  filter: blur(8px);
  pointer-events: none;
}

body::before {
  top: 5%;
  right: 8%;
}

body::after {
  bottom: 3%;
  left: 4%;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 24px;
}

.hero {
  text-align: center;
  padding: 4px 0 12px;
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.hero h1,
.panel-top h2,
.result-board h3,
.filter-head h3 {
  margin: 0;
  font-family: "ZCOOL KuaiLe", cursive;
  font-weight: 400;
}

.hero h1 {
  font-size: clamp(1.8rem, 4.8vw, 2.8rem);
  line-height: 1.02;
  max-width: 9ch;
  margin-inline: auto;
}

.subtitle {
  max-width: 24rem;
  margin: 8px auto 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.action,
.mini-action {
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.action:hover,
.mini-action:hover {
  transform: translateY(-2px);
}

.action:active,
.mini-action:active {
  transform: translateY(1px) scale(0.98);
}

.action {
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 800;
}

.small-action {
  padding: 10px 18px;
}

.action-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 14px 30px var(--accent-shadow);
}

.action-secondary {
  color: var(--ink);
  background: var(--secondary-surface);
  border: 1px solid var(--secondary-border);
  box-shadow: 0 12px 24px var(--ambient-shadow);
}

.machine-panel {
  position: relative;
  padding: 20px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 32px;
  background: var(--panel-surface);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.panel-top,
.slot-header,
.result-board {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-top {
  margin-bottom: 12px;
}

.panel-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.panel-top h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--status-ok-surface);
  color: var(--green);
  font-weight: 800;
}

.sound-toggle {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--ink);
  background: var(--secondary-surface);
  border: 1px solid var(--secondary-border);
  box-shadow: 0 12px 24px var(--ambient-shadow);
}

.sound-toggle.off {
  color: var(--muted);
  background: var(--sound-off-surface);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.compact-grid {
  grid-template-columns: 1fr;
}

.meal-switcher {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 20px;
  background: var(--switcher-surface);
  border: 1px solid var(--soft-border-2);
}

.meal-tab {
  flex: 1;
  min-height: 46px;
  border-radius: 14px;
  font-weight: 800;
  color: var(--muted);
  background: transparent;
}

.meal-tab.active {
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 22px var(--accent-shadow-soft);
}

.hidden-panel {
  display: none;
}

.active-panel {
  display: block;
}

.result-board,
.filter-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
}

.mini-action {
  padding: 9px 14px;
  border-radius: 999px;
  color: white;
  background: var(--control-solid);
  box-shadow: 0 10px 18px var(--accent-shadow-soft);
}

.draw-stage {
  position: relative;
  min-height: 236px;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: var(--stage-surface);
}

.draw-stage-overlay {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 236px;
  padding: 16px;
}

.draw-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.active-meal-label {
  font-size: 1rem;
  font-weight: 900;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--stage-overlay);
  box-shadow: 0 10px 24px var(--card-shadow-soft);
}

.active-meal-tag {
  max-width: 24rem;
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  text-align: left;
  background: var(--stage-overlay-soft);
  backdrop-filter: blur(8px);
}

.background-slot-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.background-panel {
  position: absolute;
  inset: 0;
  padding: 10px;
}

.reel-window {
  position: relative;
  overflow: hidden;
  height: 210px;
  margin-top: 16px;
  border-radius: 20px;
  background: var(--reel-surface);
  border: 1px solid var(--soft-border-2);
}

.background-window {
  height: 100%;
  border-radius: 22px;
  background: var(--reel-surface-soft);
}

.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 62px;
  z-index: 2;
  pointer-events: none;
}

.reel-window::before {
  top: 0;
  background: var(--reel-fade-top);
}

.reel-window::after {
  bottom: 0;
  background: var(--reel-fade-bottom);
}

.reel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 78px 14px;
  transform: translateY(0);
}

.reel-item {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 16px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--reel-item-surface);
  border: 1px solid var(--field-border-soft);
  box-shadow: 0 10px 24px var(--card-shadow-soft);
}

.background-panel.active .reel-item.focus {
  background: var(--highlight-surface);
  border-color: var(--highlight-border);
}

.result-tag {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.result-board {
  margin-top: 18px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.result-board-top {
  margin-top: 0;
  margin-bottom: 12px;
}

.result-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-cta {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--accent-strong);
  background: var(--secondary-surface);
  border: 1px solid var(--accent-border);
  box-shadow: 0 10px 24px var(--card-shadow-soft);
}

.filter-panel {
  margin-top: 12px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--soft-border);
  background: var(--filter-surface);
}

.filter-headline,
.drawer-head,
.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-headline h3,
.drawer-head h3 {
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  margin: 0;
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-chip,
.budget-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--chip-surface);
  border: 1px solid var(--field-border-soft);
  box-shadow: 0 10px 22px var(--ambient-shadow-soft);
  font-weight: 700;
}

.filter-chip input {
  accent-color: var(--accent-strong);
}

.filter-chip.is-selected {
  color: white;
  background: var(--control-solid-strong);
  border-color: var(--accent-border-strong);
  box-shadow: 0 12px 24px var(--accent-shadow-soft);
}

.budget-filter input {
  width: 72px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.budget-filter em {
  font-style: normal;
  color: var(--muted);
}

.filter-tip {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  padding-inline: 2px;
}

.hidden {
  display: none !important;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--drawer-backdrop);
  backdrop-filter: blur(4px);
  z-index: 19;
}

.editor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 100vw);
  height: 100vh;
  padding: 24px 20px 28px;
  background: var(--drawer-surface);
  box-shadow: -20px 0 50px var(--drawer-shadow);
  overflow: auto;
  z-index: 20;
}

.drawer-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 1.4rem;
  color: var(--ink);
  background: var(--drawer-close-surface);
  border: 1px solid var(--secondary-border);
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.editor-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  background: var(--editor-card-surface);
  border: 1px solid var(--field-border-soft);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-title {
  font-weight: 800;
}

.mini-editor-action,
.row-remove {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 800;
  color: white;
  background: var(--control-solid);
  box-shadow: 0 10px 18px var(--accent-glow);
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.menu-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 88px 88px 52px;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: var(--menu-row-surface);
  border: 1px solid var(--field-border-soft);
}

.menu-field,
.menu-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--field-surface);
  outline: none;
}

.menu-field:focus,
.menu-select:focus {
  border-color: var(--accent-border-strong);
  box-shadow: var(--focus-ring);
}

.menu-field::placeholder {
  color: var(--placeholder);
}

.row-remove {
  padding: 0;
  font-size: 1rem;
}

.empty-row-note {
  padding: 16px;
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: var(--empty-surface);
}

.custom-tip {
  margin: 14px 0 0;
  color: var(--muted);
}

.result-board h3 {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
}

#summary-copy {
  margin: 0;
  max-width: 26rem;
  color: var(--muted);
  line-height: 1.42;
  text-align: left;
}

@media (max-width: 900px) {
  .slot-grid {
    grid-template-columns: 1fr;
  }

  .draw-stage-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .menu-row {
    grid-template-columns: 1fr;
  }

  .result-board,
  .panel-top,
  .filter-headline,
  .drawer-head,
  .drawer-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-board {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .panel-tools {
    justify-content: flex-start;
  }

  #summary-copy {
    text-align: left;
  }
}

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

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1b1816;
    --bg-2: #2a221d;
    --ink: #f3e8dc;
    --muted: #c6b09a;
    --card: rgba(36, 31, 28, 0.82);
    --line: rgba(255, 230, 204, 0.1);
    --accent: #ff8c57;
    --accent-strong: #ff6b3d;
    --green: #61c48d;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
    --bg-spot-1: rgba(255, 155, 84, 0.18);
    --bg-spot-2: rgba(255, 107, 61, 0.1);
    --orb: rgba(255, 255, 255, 0.05);
    --panel-surface:
      linear-gradient(180deg, rgba(30, 26, 24, 0.92) 0%, rgba(24, 21, 19, 0.96) 100%);
    --secondary-surface: rgba(48, 41, 37, 0.88);
    --switcher-surface: rgba(43, 36, 32, 0.92);
    --stage-surface:
      radial-gradient(circle at top left, rgba(255, 138, 79, 0.16), transparent 36%),
      linear-gradient(180deg, rgba(33, 28, 25, 0.94) 0%, rgba(24, 21, 19, 0.96) 100%);
    --stage-overlay: rgba(43, 37, 33, 0.88);
    --stage-overlay-soft: rgba(43, 37, 33, 0.78);
    --reel-surface:
      linear-gradient(180deg, rgba(255, 169, 112, 0.08) 0%, rgba(36, 31, 28, 0.5) 35%, rgba(255, 169, 112, 0.08) 100%);
    --reel-surface-soft:
      linear-gradient(180deg, rgba(255, 169, 112, 0.04) 0%, rgba(44, 38, 34, 0.26) 35%, rgba(255, 169, 112, 0.04) 100%);
    --reel-fade-top: linear-gradient(180deg, rgba(24, 21, 19, 0.96) 0%, rgba(24, 21, 19, 0) 100%);
    --reel-fade-bottom: linear-gradient(0deg, rgba(24, 21, 19, 0.96) 0%, rgba(24, 21, 19, 0) 100%);
    --reel-item-surface: rgba(59, 50, 45, 0.74);
    --filter-surface:
      linear-gradient(180deg, rgba(34, 29, 26, 0.92) 0%, rgba(28, 24, 22, 0.96) 100%);
    --chip-surface: rgba(46, 40, 36, 0.9);
    --drawer-surface: rgba(24, 21, 19, 0.98);
    --drawer-backdrop: rgba(0, 0, 0, 0.46);
    --panel-border-strong: rgba(255, 230, 204, 0.08);
    --secondary-border: rgba(255, 230, 204, 0.1);
    --soft-border: rgba(255, 230, 204, 0.08);
    --soft-border-2: rgba(255, 230, 204, 0.06);
    --field-border: rgba(255, 230, 204, 0.12);
    --field-border-soft: rgba(255, 230, 204, 0.08);
    --accent-border: rgba(255, 140, 87, 0.22);
    --accent-border-strong: rgba(255, 140, 87, 0.34);
    --accent-glow: rgba(255, 107, 61, 0.18);
    --accent-shadow: rgba(255, 107, 61, 0.26);
    --accent-shadow-soft: rgba(255, 107, 61, 0.2);
    --ambient-shadow: rgba(0, 0, 0, 0.22);
    --ambient-shadow-soft: rgba(0, 0, 0, 0.16);
    --card-shadow-soft: rgba(0, 0, 0, 0.18);
    --drawer-shadow: rgba(0, 0, 0, 0.34);
    --sound-off-surface: rgba(38, 33, 30, 0.92);
    --status-ok-surface: rgba(97, 196, 141, 0.14);
    --status-spin-surface: rgba(255, 107, 61, 0.14);
    --control-solid: linear-gradient(135deg, #ff9a63 0%, #ff6b3d 100%);
    --control-solid-strong: linear-gradient(135deg, #ff9a63 0%, #ff6b3d 100%);
    --focus-ring: 0 0 0 4px rgba(255, 140, 87, 0.18);
    --highlight-surface: linear-gradient(180deg, rgba(255, 176, 110, 0.34) 0%, rgba(255, 130, 74, 0.2) 100%);
    --highlight-border: rgba(255, 140, 87, 0.32);
    --drawer-close-surface: rgba(48, 41, 37, 0.9);
    --editor-card-surface: rgba(40, 34, 31, 0.86);
    --menu-row-surface: rgba(50, 43, 38, 0.9);
    --field-surface: rgba(41, 35, 32, 0.96);
    --placeholder: rgba(198, 176, 154, 0.72);
    --empty-surface: rgba(46, 40, 36, 0.76);
  }

  body {
    background:
      radial-gradient(circle at top left, var(--bg-spot-1), transparent 30%),
      radial-gradient(circle at right 20% bottom 10%, var(--bg-spot-2), transparent 28%),
      linear-gradient(160deg, var(--bg) 0%, #151210 35%, var(--bg-2) 100%);
  }

  .action-secondary,
  .sound-toggle,
  .result-cta,
  .drawer-close,
  .menu-field,
  .menu-select {
    color: var(--ink);
  }
}
