:root {
  --ink: #15232e;
  --muted: #5b6874;
  --paper: #fffdf7;
  --line: #d8e1df;
  --mint: #92d7c8;
  --mint-deep: #177969;
  --coral: #f06f61;
  --sun: #f4c86a;
  --sky: #e5f4ff;
  --leaf: #7ccf8a;
  --night: #17324d;
  --white: #ffffff;
  --shadow: 0 18px 40px rgba(21, 35, 46, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(180deg, #eaf7f6 0%, #fffdf7 42%, #f8ead6 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 24px;
  align-items: stretch;
  min-height: 330px;
}

.hero-copy,
.hero-art svg,
.status-band,
.level-card,
.master-panel,
.complete-panel {
  border: 2px solid rgba(21, 35, 46, 0.1);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
  background: var(--paper);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--mint-deep);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1;
}

h2 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.15;
}

h3 {
  margin: 0 0 6px;
  font-size: 19px;
}

.intro {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.ghost-action,
.download-action,
.choice-button,
.small-action {
  min-height: 44px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  padding: 10px 16px;
  font-weight: 700;
  color: var(--ink);
}

.download-action {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: var(--white);
}

.primary-action {
  background: var(--sun);
}

.ghost-action {
  background: var(--white);
}

.hero-art {
  min-height: 300px;
}

.hero-art svg {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: block;
}

.status-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--white);
}

.status-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.word-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  align-items: center;
}

.word-chip,
.empty-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 700;
}

.word-chip {
  color: var(--ink);
  background: var(--mint);
  border: 2px solid var(--mint-deep);
}

.empty-chip {
  color: var(--muted);
  background: #f2f5f4;
  border: 2px dashed #bac8c4;
}

.game-board {
  margin-top: 20px;
  padding: 0;
}

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

.level-card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: 16px;
  text-align: left;
  background: var(--white);
}

.level-card:nth-child(2n) {
  background: var(--sky);
}

.level-card:nth-child(3n) {
  background: #fff3dc;
}

.level-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--white);
  background: var(--night);
  font-weight: 800;
}

.level-card p {
  flex: 1;
  color: var(--muted);
  line-height: 1.42;
}

.level-card .question-count {
  flex: 0;
  margin: 0 0 12px;
  color: var(--mint-deep);
  font-size: 14px;
  font-weight: 800;
}

.level-card.locked {
  opacity: 0.62;
}

.level-card.done {
  border-color: var(--mint-deep);
}

.level-card button {
  align-self: flex-start;
}

.level-view,
.master-panel,
.complete-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 18px;
}

.level-main,
.master-main,
.complete-main {
  min-width: 0;
}

.level-side,
.master-side,
.complete-side {
  border-radius: 8px;
  padding: 16px;
  background: #f4fbfa;
  border: 2px solid var(--line);
}

.level-kicker {
  margin: 0 0 8px;
  color: var(--coral);
  font-weight: 800;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.question-meta span {
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--white);
}

.question-pips {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
}

.question-pip {
  width: 38px;
  height: 9px;
  border-radius: 8px;
  background: #d7e1df;
}

.question-pip.current {
  background: var(--sun);
}

.question-pip.done {
  background: var(--mint-deep);
}

.prompt {
  margin: 12px 0 18px;
  font-size: 20px;
  line-height: 1.45;
}

.source-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.choices,
.master-choices {
  display: grid;
  gap: 10px;
}

.choice-button {
  width: 100%;
  text-align: left;
  background: var(--white);
}

.choice-button:hover,
.choice-button.selected {
  background: var(--sun);
}

.choice-button.correct {
  background: var(--leaf);
}

.choice-button.wrong {
  background: #ffd3cb;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.small-action {
  background: var(--white);
}

.small-action.confirm {
  background: var(--mint);
}

.level-actions,
.master-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.feedback {
  min-height: 52px;
  margin-top: 16px;
  border-radius: 8px;
  padding: 12px;
  background: #f2f5f4;
  border: 2px solid transparent;
  line-height: 1.4;
}

.feedback.good {
  background: #e5f8ea;
  border-color: var(--leaf);
}

.feedback.try {
  background: #fff0d3;
  border-color: var(--sun);
}

.order-list {
  display: grid;
  gap: 10px;
}

.order-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.step-index {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--night);
  color: var(--white);
  font-weight: 800;
}

.move-buttons {
  display: flex;
  gap: 6px;
}

.icon-action {
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--sun);
  font-weight: 900;
}

.master-builder {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 50px;
  padding: 10px;
  border: 2px dashed #9dafaa;
  border-radius: 8px;
  background: #f7faf9;
}

.question-slot {
  min-width: 82px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 2px dashed #bdc9c5;
  color: var(--muted);
  background: var(--white);
  font-weight: 700;
}

.question-slot.filled {
  border-style: solid;
  border-color: var(--mint-deep);
  color: var(--ink);
  background: var(--mint);
}

.token-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.token-button {
  min-height: 40px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--sun);
  padding: 8px 12px;
  font-weight: 800;
}

.token-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.master-question {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: var(--night);
  color: var(--white);
}

.master-question strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

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

.badge {
  border-radius: 8px;
  padding: 6px 9px;
  background: var(--white);
  border: 2px solid var(--line);
  font-weight: 700;
}

.complete-panel,
.master-panel {
  padding: 20px;
  background: var(--white);
}

.certificate {
  margin-top: 16px;
  padding: 16px;
  border: 2px solid var(--sun);
  border-radius: 8px;
  background: #fff8e8;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .hero-panel,
  .level-view,
  .master-panel,
  .complete-panel {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 10px;
  }

  .hero-copy,
  .game-board,
  .complete-panel,
  .master-panel {
    padding: 16px;
  }

  h1 {
    font-size: 40px;
  }

  h2 {
    font-size: 24px;
  }

  .status-band,
  .order-row {
    grid-template-columns: 1fr;
  }

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

  .move-buttons {
    justify-content: flex-start;
  }
}
