:root {
  color-scheme: light;
  --cream: #fff8ea;
  --flour: #fffdf7;
  --butter: #ffe8a8;
  --rose: #f8b7a6;
  --berry: #9d4d5f;
  --mint: #b9dccb;
  --ink: #3f2f2f;
  --muted: #746363;
  --line: #ead8c4;
  --shadow: 0 18px 45px rgba(97, 65, 45, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 232, 168, 0.3), rgba(185, 220, 203, 0.24)),
    var(--cream);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--berry);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.05rem;
}

.body-copy,
.hint,
.warning,
.feedback {
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 10px;
  margin: 0;
}

.stats div,
.cost-strip,
.tray,
.queue-pill {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.82);
}

.stats div {
  min-width: 88px;
  padding: 12px 14px;
  border-radius: 8px;
}

dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  font-size: 1.25rem;
  font-weight: 850;
}

.view {
  animation: fadeIn 180ms ease-out;
}

.hidden {
  display: none !important;
}

.grid-view,
.game-view {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
  padding: 22px;
}

.planning-panel,
.customer-panel,
.final-panel {
  min-height: 420px;
}

.bake-list,
.serve-buttons,
.recipe-grid,
.inventory-list,
.reveal-list,
.side-stack {
  display: grid;
  gap: 12px;
}

.bake-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.item-name {
  display: block;
  font-weight: 850;
}

.item-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.recipe-preview {
  margin-top: 6px;
}

.recipe-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recipe-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 154px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.recipe-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  justify-self: center;
}

.recipe-card span {
  font-weight: 850;
}

.recipe-card small {
  color: var(--muted);
  line-height: 1.35;
}

.bake-item-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bake-item-info {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.bake-item-info img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 900;
}

.qty-input {
  width: 58px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--flour);
  text-align: center;
}

.cost-strip,
.tray {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
}

.primary-button,
.secondary-button,
.item-button,
.reveal-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 850;
}

.primary-button {
  width: 100%;
  margin-top: 14px;
  background: var(--berry);
  color: white;
}

.secondary-button {
  background: #fff6dc;
  border-color: var(--line);
  color: var(--ink);
}

.customer-header,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.queue-pill {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--berry);
  font-weight: 850;
}

.speech-bubble {
  position: relative;
  margin: 28px 0 18px;
  padding: 24px;
  border: 2px solid #eec3aa;
  border-radius: 8px;
  background: #fff1d5;
  font-size: 1.45rem;
  font-weight: 850;
  line-height: 1.3;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  left: 32px;
  bottom: -14px;
  width: 24px;
  height: 24px;
  border-right: 2px solid #eec3aa;
  border-bottom: 2px solid #eec3aa;
  background: #fff1d5;
  transform: rotate(45deg);
}

.serve-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.item-button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 10px;
  background: var(--flour);
  border-color: var(--line);
  color: var(--ink);
}

.item-button-image {
  width: min(100%, 126px);
  height: min(100%, 126px);
  object-fit: contain;
  pointer-events: none;
}

.item-button:hover,
.item-button:focus-visible,
.reveal-button:hover,
.reveal-button:focus-visible {
  border-color: var(--berry);
  outline: none;
}

.item-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.action-row {
  margin-top: 14px;
}

.action-row .primary-button {
  width: auto;
  min-width: 160px;
  margin-top: 0;
}

.feedback {
  min-height: 48px;
  margin: 18px 0 0;
  font-weight: 750;
}

.dialogue-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.sentence-builder,
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sentence-builder {
  min-height: 56px;
  align-items: center;
  margin: 14px 0 12px;
  padding: 10px;
  border: 1px dashed #dfc6ac;
  border-radius: 8px;
  background: var(--flour);
}

.sentence-placeholder {
  color: var(--muted);
  font-weight: 700;
}

.word-chip {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 850;
}

.word-chip:hover,
.word-chip:focus-visible {
  border-color: var(--berry);
  outline: none;
}

.word-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.selected-word {
  background: var(--butter);
}

.inventory-item,
.reveal-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  padding: 12px;
}

.inventory-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.inventory-item.is-negative {
  border-color: var(--rose);
  color: var(--berry);
}

.reveal-button {
  width: 100%;
  color: var(--ink);
  text-align: left;
}

.reveal-main {
  display: block;
}

.translation {
  display: block;
  max-height: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 650;
  transition: max-height 180ms ease;
}

.reveal-button.is-open .translation {
  max-height: 70px;
  margin-top: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.summary-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.final-panel {
  width: min(720px, 100%);
  margin: 0 auto;
}

.final-text {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .topbar,
  .grid-view,
  .game-view {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats,
  .serve-buttons,
  .recipe-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .panel {
    padding: 18px;
  }

  .bake-row,
  .bake-item-row {
    grid-template-columns: 1fr;
  }

  .speech-bubble {
    font-size: 1.15rem;
  }
}
