:root {
  --bg: #ffffff;
  --bg-subtle: #f7f7f5;
  --text: #1a2433;
  --text-sub: #5b6b7c;
  --accent: #1e3a5c;
  --accent-light: #eef1f5;
  --border: #dde3ea;
  --teal: #0e7d84;
  --orange: #e78a00;
  --success: #16a34a;
  --danger: #c62929;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.7;
}

button,
summary {
  font: inherit;
}

.hero {
  background: var(--accent);
  color: #fff;
  padding: 64px 24px 60px;
}

.hero.compact {
  padding-block: 42px;
}

.hero-inner {
  width: min(100%, 1040px);
  margin: 0 auto;
}

.eyebrow,
.kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  color: #8de0d9;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.16;
  font-weight: 900;
}

.hero p {
  margin: 18px 0 0;
  color: #dce7f4;
  font-weight: 700;
}

.wrap {
  width: min(100%, 1088px);
  margin: 0 auto;
  padding: 42px 24px 84px;
}

.mission-card {
  border: 2px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: clamp(24px, 4vw, 42px);
  box-shadow: 0 18px 48px rgb(30 58 92 / 8%);
}

.mission-head,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.mission-head {
  justify-content: flex-start;
}

.numchip {
  display: inline-flex;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.numchip.teal {
  background: var(--teal);
}

.numchip.orange {
  background: var(--orange);
}

.kicker {
  color: var(--teal);
}

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

.mission-head h2,
.status-row h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 32px);
  line-height: 1.3;
  font-weight: 900;
}

.rules-grid,
.gate-grid {
  display: grid;
  gap: 16px;
}

.rules-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 34px 0;
}

.rule,
.gate-card {
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg-subtle);
  padding: 22px;
}

.rule-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.rule h3,
.gate-card h3 {
  margin: 14px 0 4px;
  font-size: 17px;
  font-weight: 900;
}

.rule p,
.gate-card p,
.safety li {
  color: var(--text-sub);
}

.band-strip {
  display: flex;
  align-items: center;
  gap: 20px;
  border-radius: 14px;
  background: var(--accent-light);
  padding: 20px 24px;
}

.band-strip p {
  margin: 3px 0 0;
  color: var(--text-sub);
}

.lock-mark {
  flex: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

details {
  margin-top: 20px;
  border-left: 4px solid var(--orange);
  background: #fff7e8;
  padding: 14px 18px;
}

summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
}

details p {
  margin: 10px 0 0;
}

.safety {
  margin-top: 28px;
  border-radius: 16px;
  background: var(--bg-subtle);
  padding: 26px 30px;
}

.safety h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.safety ul {
  margin: 0;
  padding-left: 1.3em;
}

.progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 34px;
}

.progress span {
  border-radius: 9px;
  background: var(--accent-light);
  color: var(--text-sub);
  padding: 9px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.progress .done,
.progress.complete span {
  background: #e8f7ed;
  color: #116b31;
}

.progress .active {
  background: #fff0d7;
  color: #925600;
}

button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  padding: 13px 20px;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.result {
  margin: 26px 0;
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: var(--bg-subtle);
  padding: 24px;
}

.result p:last-child {
  margin-bottom: 0;
}

.result.error {
  border-color: #f1aaaa;
  background: #fff3f3;
}

.result.ok {
  border-color: #91d3d6;
  background: #f0fbfb;
}

.result.success {
  border: 3px solid var(--success);
  background: #effbf2;
  text-align: center;
}

.clear-label {
  display: inline-block;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.flag {
  margin: 14px auto;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(18px, 4vw, 28px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.next-clue {
  border-left: 4px solid var(--teal);
  padding-left: 12px;
  font-weight: 800;
}

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

.gate-card details {
  margin-bottom: 0;
}

.text-button {
  display: block;
  margin: 24px 0 0 auto;
  background: transparent;
  color: var(--text-sub);
  padding: 6px;
  font-size: 13px;
  text-decoration: underline;
}

code {
  border-radius: 5px;
  background: #e8edf3;
  padding: 0.1em 0.35em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 720px) {
  .hero {
    padding: 44px 20px;
  }

  .wrap {
    padding: 24px 14px 64px;
  }

  .rules-grid,
  .gate-grid {
    grid-template-columns: 1fr;
  }

  .mission-head,
  .status-row,
  .band-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-row button {
    width: 100%;
  }

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