:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #5d6964;
  --paper: #f6f8f4;
  --white: #ffffff;
  --mint: #27a96b;
  --mint-dark: #137047;
  --mint-soft: #dff5e8;
  --coral: #ee7258;
  --yellow: #f3c74f;
  --blue: #4b83c3;
  --line: #cfd9d3;
  --shadow: 0 10px 30px rgba(23, 33, 29, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

.site-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px max(20px, calc((100vw - 1180px) / 2));
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--mint-dark);
  border-radius: 6px;
  font-size: 22px;
  font-weight: 800;
}

.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 18px; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; }

.header-progress { display: flex; align-items: baseline; gap: 6px; }
.header-progress strong { color: var(--mint-dark); font-size: 22px; }
.header-progress span { color: var(--muted); font-size: 13px; }

.view-tabs {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  justify-content: center;
  min-height: 48px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.view-tabs a {
  position: relative;
  min-width: 130px;
  padding: 13px 18px 11px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.view-tabs a[aria-current="page"] { color: var(--mint-dark); }
.view-tabs a[aria-current="page"]::after {
  position: absolute;
  right: 18px;
  bottom: 0;
  left: 18px;
  height: 3px;
  background: var(--mint);
  content: "";
}

[data-review-count]:not(:empty) {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  place-items: center;
  color: var(--white);
  background: var(--coral);
  border-radius: 50%;
  font-size: 11px;
}

.loading-state { padding: 80px 20px; text-align: center; color: var(--muted); }

.scenario-band {
  position: relative;
  min-height: clamp(300px, 42vw, 500px);
  display: flex;
  align-items: flex-end;
  background-position: center;
  background-size: cover;
}

.scenario-band__shade {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 15, 0.46);
}

.scenario-band__content {
  position: relative;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 42px 24px 36px;
  color: var(--white);
}

.scenario-band h1 {
  max-width: 760px;
  margin: 8px 0 14px;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--mint-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.scenario-band .eyebrow { color: #baf8d2; }

.scenario-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.scenario-switch button {
  padding: 8px 12px;
  color: var(--white);
  background: rgba(10, 18, 15, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 6px;
  cursor: pointer;
}
.scenario-switch button[aria-pressed="true"] { color: var(--ink); background: var(--white); }

.task-step { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.task-step progress { width: 150px; height: 7px; accent-color: var(--yellow); }

.workshop {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 30px 24px 56px;
}

.craft-guide {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
}
.craft-guide h2 { margin: 3px 0 0; font-size: 22px; line-height: 1.25; }
.craft-guide > span { flex: 0 0 auto; color: var(--muted); font-size: 13px; font-weight: 700; }
.craft-guide.is-complete { background: var(--mint-soft); border-left-color: var(--mint); }

.slots {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 30px minmax(150px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.slot {
  min-height: 72px;
  padding: 12px;
  color: var(--muted);
  background: var(--white);
  border: 2px dashed #aebdb5;
  border-radius: 8px;
  cursor: pointer;
}
.slot.is-filled { color: var(--ink); border: 2px solid var(--mint); font-weight: 750; }
.plus { text-align: center; font-size: 26px; color: var(--muted); }

.craft-button, .task-controls button, .review-actions button, .review-feedback button {
  min-height: 48px;
  padding: 10px 18px;
  color: var(--white);
  background: var(--mint-dark);
  border: 0;
  border-radius: 6px;
  font-weight: 750;
  cursor: pointer;
}
.craft-button:disabled { color: #75827c; background: #dce3df; cursor: default; }

.result-zone {
  min-height: 104px;
  margin: 18px 0 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: #edf1ee;
  border-left: 5px solid #9dab9f;
}
.result-zone p { margin: 0; color: var(--muted); }
.result-zone.is-success { background: var(--mint-soft); border-color: var(--mint); }
.result-zone.is-miss { background: #fff0ec; border-color: var(--coral); }
.result-zone.is-hint { background: #fff7da; border-color: var(--yellow); }
.goal-note, .step-done-note, .side-result-note { max-width: 340px; font-weight: 700; }
.side-result-note { color: #8b3e2d; }

.ingredient-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.ingredient-heading h2 { margin: 0 0 14px; font-size: 20px; }
.ingredient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}
.ingredient {
  min-height: 86px;
  padding: 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(23, 33, 29, 0.05);
}
.ingredient--phrase, .ingredient--sentence { border-top-color: var(--coral); }
.ingredient--noun, .ingredient--place { border-top-color: var(--mint); }
.ingredient--chunk { border-top-color: var(--yellow); }
.ingredient.is-selected { border-color: var(--ink); background: #f0f4f1; transform: translateY(-2px); }
.ingredient__text, .ingredient__meaning { display: block; overflow-wrap: anywhere; }
.ingredient__text { font-weight: 800; }
.ingredient__meaning { margin-top: 5px; color: var(--muted); font-size: 12px; }

.task-controls { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.task-controls button:first-child { color: var(--ink); background: var(--white); border: 1px solid var(--line); }

.result-card {
  position: relative;
  min-width: 230px;
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.result-card__text, .result-card__meaning, .result-card__detail { display: block; overflow-wrap: anywhere; }
.result-card__text { font-size: 19px; font-weight: 800; }
.result-card__meaning { margin-top: 3px; color: var(--muted); font-size: 13px; }
.result-card__detail { grid-column: 1 / -1; color: var(--mint-dark); font-size: 12px; font-weight: 700; }
.audio-button {
  width: 40px;
  height: 40px;
  color: var(--white);
  background: var(--blue);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.page-heading, .review-stage, .collection-grid {
  width: min(1000px, 100%);
  margin-right: auto;
  margin-left: auto;
}
.page-heading { padding: 54px 24px 24px; }
.page-heading h1 { margin: 4px 0 8px; font-size: 42px; letter-spacing: 0; }
.page-heading p:last-child { margin: 0; color: var(--muted); }
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding: 8px 24px 60px; }

.review-stage { min-height: 330px; padding: 28px 24px 70px; }
.review-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.review-stage h2 { max-width: 720px; margin: 18px 0 24px; font-size: 30px; }
.review-stage form { max-width: 720px; }
.review-stage label { display: block; margin-bottom: 7px; font-weight: 750; }
.review-stage input { width: 100%; min-height: 56px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 6px; font-size: 18px; }
.review-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.review-actions .text-button { color: var(--mint-dark); background: transparent; }
.review-feedback { max-width: 720px; display: grid; gap: 8px; padding: 20px; border-left: 5px solid var(--line); }
.review-feedback.is-correct { background: var(--mint-soft); border-color: var(--mint); }
.review-feedback.is-wrong { background: #fff0ec; border-color: var(--coral); }
.feedback-title { font-size: 20px; font-weight: 800; }
.feedback-answer { margin-bottom: 10px; }

.empty-state { grid-column: 1 / -1; padding: 36px 0; border-top: 1px solid var(--line); }
.empty-state a, .primary-link { color: var(--mint-dark); font-weight: 750; }

.text-button, .import-label {
  padding: 0;
  color: var(--mint-dark);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
}
.import-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.site-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 30px 20px;
  color: var(--muted);
  background: var(--white);
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.site-footer a { color: var(--mint-dark); }

.toast {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 16px;
  color: var(--white);
  background: var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.static-page { background: var(--white); }
.prose { width: min(760px, 100%); margin: 0 auto; padding: 64px 24px; }
.prose h1 { margin: 5px 0 24px; font-size: 42px; line-height: 1.08; letter-spacing: 0; }
.prose h2 { margin-top: 34px; font-size: 24px; }
.prose p { color: #3f4b46; }

@media (max-width: 700px) {
  .site-header { min-height: 60px; padding: 8px 14px; }
  .brand__mark { width: 38px; height: 38px; }
  .header-progress span { display: none; }
  .view-tabs { top: 0; overflow-x: auto; justify-content: stretch; }
  .view-tabs a { min-width: 0; flex: 1; padding-right: 8px; padding-left: 8px; font-size: 13px; }
  .scenario-band { min-height: 330px; background-position: center; }
  .scenario-band__content { padding: 30px 18px 24px; }
  .scenario-band h1 { font-size: 38px; }
  .workshop { padding: 20px 14px 40px; }
  .craft-guide { align-items: stretch; flex-direction: column; gap: 8px; padding: 14px; }
  .slots { grid-template-columns: 1fr 22px 1fr; }
  .slot { min-width: 0; min-height: 66px; overflow-wrap: anywhere; font-size: 14px; }
  .craft-button { grid-column: 1 / -1; width: 100%; }
  .result-zone { align-items: stretch; flex-direction: column; padding: 14px; }
  .result-card { width: 100%; min-width: 0; }
  .ingredient-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ingredient { min-width: 0; }
  .task-controls button { flex: 1; padding: 9px 10px; font-size: 13px; }
  .page-heading { padding-top: 36px; }
  .page-heading h1, .prose h1 { font-size: 34px; }
  .review-stage h2 { font-size: 26px; }
  .site-footer { padding-bottom: 82px; }
}

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