:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #63716b;
  --paper: #fffdf7;
  --line: #d9d3c4;
  --table: #f1efe5;
  --teal: #1d8177;
  --teal-dark: #0f5e57;
  --coral: #d95d4f;
  --gold: #d79a2b;
  --green: #608b3f;
  --shadow: 0 16px 36px rgba(46, 40, 28, 0.12);
  font-family:
    "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 32, 29, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 32, 29, 0.035) 1px, transparent 1px),
    var(--table);
  background-size: 28px 28px;
}

button {
  font: inherit;
}

.game-shell {
  width: min(1220px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  padding: 18px 0;
}

.hero-strip,
.mission-panel,
.builder-grid,
.feedback-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
}

.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.designer {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--teal-dark);
  padding: 0 14px;
  font-weight: 900;
  text-decoration: none;
}

.home-link:hover {
  border-color: var(--teal);
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.icon-button,
.small-button,
.goal-option,
.food-card,
.plate-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  font-size: 1.35rem;
}

.small-button {
  min-height: 40px;
  padding: 0 15px;
  font-weight: 900;
}

.small-button.ghost {
  background: transparent;
}

.small-button.next {
  background: var(--teal);
  color: #fff;
}

.small-button:disabled,
.goal-option:disabled,
.food-card:disabled,
.plate-chip:disabled {
  cursor: default;
  opacity: 0.65;
}

.mission-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  gap: 14px;
  padding: 14px;
}

.scene-card,
.goal-card,
.pantry-panel,
.plate-panel,
.score-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  padding: 14px;
}

.card-kind {
  width: fit-content;
  margin: 0 0 10px;
  border: 1px solid #28251f;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f1d482;
  font-size: 0.84rem;
  font-weight: 900;
}

#scenarioTitle {
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1.1;
}

#scenarioText,
#feedbackText {
  color: var(--muted);
  line-height: 1.65;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  border-radius: 999px;
  background: #e7efe7;
  color: #355b3d;
  padding: 4px 9px;
  font-size: 0.82rem;
  font-weight: 800;
}

.goal-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.goal-option {
  min-height: 62px;
  padding: 9px;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.25;
}

.goal-option.active {
  border-color: var(--teal-dark);
  background: var(--teal);
  color: #fff;
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(330px, 1.2fr) minmax(300px, 0.88fr) minmax(260px, 0.72fr);
  gap: 14px;
  padding: 14px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

#pickCounter,
.total-score span {
  color: var(--muted);
  font-weight: 800;
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.food-card {
  min-height: 126px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 11px;
  text-align: left;
}

.food-card:hover,
.goal-option:hover,
.plate-chip:hover,
.small-button:hover,
.icon-button:hover {
  border-color: var(--teal);
}

.food-card.selected {
  border-color: var(--teal-dark);
  background: #eef7f2;
  box-shadow: inset 0 0 0 2px rgba(29, 129, 119, 0.18);
}

.food-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid #28251f;
  border-radius: 50%;
  background: #f1d482;
  font-size: 0.9rem;
  font-weight: 900;
}

.food-card strong {
  font-size: 1rem;
  line-height: 1.25;
}

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

.plate-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.plate-zone {
  min-height: 300px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed #c9bfaa;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fffdf7 0 58%, #f3ead7 59% 100%);
  padding: 34px;
  text-align: center;
}

.plate-zone p {
  max-width: 230px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.plate-chip {
  min-height: 42px;
  padding: 8px 12px;
  border-color: #28251f;
  background: #fffdf7;
  font-weight: 900;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.radar-list {
  display: grid;
  gap: 12px;
}

.radar-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3ded0;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.risk .bar i {
  background: var(--coral);
}

.total-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.total-score strong {
  font-size: 2.2rem;
}

.feedback-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
  gap: 16px;
  padding: 16px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  padding: 0 4px 6px;
  font-size: 0.9rem;
  font-weight: 800;
}

.site-footer a {
  color: var(--teal-dark);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

#roundLog {
  display: grid;
  gap: 8px;
  max-height: 160px;
  margin: 0;
  padding-left: 20px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1060px) {
  .builder-grid,
  .mission-panel,
  .feedback-panel {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .game-shell {
    width: min(100vw - 20px, 560px);
    padding: 10px 0;
  }

  .hero-strip {
    align-items: start;
    padding: 14px;
  }

  .hero-actions {
    flex-direction: column-reverse;
    align-items: end;
  }

  .goal-options,
  .food-grid {
    grid-template-columns: 1fr 1fr;
  }

  .plate-zone {
    min-height: 240px;
    border-radius: 8px;
  }
}
