:root {
  --paper: #f8f5ef;
  --mist: #e8eee9;
  --ink: #1e2523;
  --muted: #64706b;
  --line: #cad8d0;
  --green: #173d33;
  --teal: #14706e;
  --blue: #365d7e;
  --coral: #d65f4b;
  --gold: #c59b3a;
  --white: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
}

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

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  color: var(--green);
  letter-spacing: 0;
}

h1 {
  margin-top: 8px;
  font-size: 36px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 13px;
  background: var(--green);
  color: var(--white);
  font-weight: 800;
  cursor: pointer;
}

button.ghost {
  background: var(--mist);
  color: var(--green);
}

.scoreboard,
.mission-grid,
.grid,
.phase-board {
  display: grid;
  gap: 12px;
}

.scoreboard {
  grid-template-columns: 160px 1fr 160px minmax(260px, 1.35fr);
  margin-bottom: 12px;
}

.score,
.progress,
.phase-board article,
.mission-grid article,
.panel section,
.output {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.score,
.progress {
  padding: 14px;
}

.score.primary {
  background: var(--green);
  color: var(--white);
}

.score span,
.progress span,
.phase-board span,
.mission-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score.primary span {
  color: rgba(255, 255, 255, 0.72);
}

.score strong,
.progress strong,
.phase-board strong,
.mission-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--green);
  font-size: 18px;
}

.score.primary strong {
  color: var(--white);
}

.progress > div:first-child {
  display: flex;
  justify-content: space-between;
}

.track {
  height: 12px;
  margin-top: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--mist);
}

.fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 180ms ease;
}

.phase-board {
  grid-template-columns: 1fr 44px 1fr;
  align-items: stretch;
  margin-bottom: 12px;
}

.phase-board article,
.mission-grid article {
  padding: 16px;
}

.phase-board b {
  display: grid;
  place-items: center;
  color: var(--green);
  font-size: 28px;
}

.mission-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.mission-grid article {
  min-height: 118px;
}

.grid {
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
  align-items: start;
}

.panel {
  display: grid;
  gap: 14px;
}

.panel section,
.output {
  padding: 18px;
}

.row,
.scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fbfaf6;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.45;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--teal);
}

.scores {
  padding: 14px;
  border-radius: 8px;
  background: var(--mist);
}

.output {
  position: sticky;
  top: 18px;
  min-height: calc(100vh - 36px);
}

.output-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

#count {
  color: var(--muted);
  font-size: 12px;
}

pre {
  margin: 0;
  padding-top: 14px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
}

@media (max-width: 980px) {
  .hero,
  .grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .scoreboard,
  .mission-grid {
    grid-template-columns: 1fr 1fr;
  }

  .phase-board {
    grid-template-columns: 1fr;
  }

  .phase-board b {
    display: none;
  }

  .output {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  h1 {
    font-size: 30px;
  }

  .scoreboard,
  .mission-grid,
  .row,
  .scores {
    grid-template-columns: 1fr;
  }

  .actions button {
    flex: 1 1 100%;
  }
}
