@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Fredoka:wght@400;500;600;700&family=Nunito+Sans:wght@400;700;900&display=swap");

: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: "Fredoka", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  font-family: "Nunito Sans", "Fredoka", system-ui, sans-serif;
}

.copy-reveal {
  display: inline-block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: inherit;
}

.copy-reveal:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--berry);
  outline-offset: 3px;
}

.block-copy-reveal {
  display: block;
  width: 100%;
}

.inline-copy-reveal {
  vertical-align: top;
}

.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;
  font-family: "Baloo 2", system-ui, sans-serif;
  line-height: 1.08;
}

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

.headline-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 750;
}

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,
.setup-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;
}

.ingredient-name-button {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.ingredient-name-button .translation {
  font-size: 0.9rem;
}

.ingredient-name-button.is-open .translation {
  max-height: 32px;
  margin-top: 3px;
}

.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);
}

.accent-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.accent-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 850;
}

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

.blank-input,
.full-sentence-input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 850;
}

.blank-input {
  width: 7.5ch;
  padding: 8px 10px;
  text-align: center;
}

.item-blank-input {
  width: 16ch;
}

.shortage-blank {
  min-width: 10ch;
  text-align: center;
}

.full-sentence-input {
  width: min(100%, 420px);
  padding: 8px 12px;
}

.blank-input:focus,
.full-sentence-input:focus {
  border-color: var(--berry);
  outline: none;
}

.sentence-word,
.sentence-punctuation,
.answer-token {
  font-weight: 850;
}

.word-chip.is-incorrect,
.blank-input.is-incorrect,
.full-sentence-input.is-incorrect,
.answer-token.is-incorrect {
  border-color: var(--rose);
  color: #b3261e;
}

.word-chip.is-incorrect,
.blank-input.is-incorrect,
.full-sentence-input.is-incorrect {
  background: #fff0ed;
}

.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,
.copy-reveal.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;
}

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

.bakery-name-panel {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.bakery-name-panel h3 {
  margin: 0;
}

.name-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.name-mode-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 750;
}

.bakery-name-field {
  display: grid;
  gap: 8px;
  max-width: 360px;
  color: var(--ink);
  font-weight: 850;
}

.bakery-name-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--flour);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 850;
}

.generated-name-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.generated-name {
  display: block;
  color: var(--berry);
  font-size: 1.25rem;
  font-weight: 900;
}

.generated-meaning {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}

.baker-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.baker-choice legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  font-weight: 850;
}

.baker-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  cursor: pointer;
  font-weight: 850;
}

.baker-card:has(input:checked) {
  border-color: var(--berry);
  background: #fff0ed;
}

.baker-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.baker-card img {
  width: min(100%, 150px);
  height: 150px;
  object-fit: contain;
}

.day-choice {
  display: grid;
  gap: 8px;
  max-width: 220px;
  margin-top: 20px;
  color: var(--ink);
  font-weight: 850;
}

.day-choice input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--flour);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 850;
}

.bakery-name-field input:focus,
.day-choice input:focus {
  border-color: var(--berry);
  outline: none;
}

.price-input {
  width: 68px;
}

.baker-comment {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.baker-comment img {
  width: 86px;
  height: 86px;
  object-fit: contain;
}

.baker-comment strong {
  display: block;
  margin-bottom: 4px;
  color: var(--berry);
}

.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;
  }

  .baker-choice {
    grid-template-columns: 1fr;
  }

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