* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--color-black);
  font-family: var(--font-body);
  background:
    linear-gradient(180deg, #fffaf0 0%, #ffffff 34rem),
    var(--color-white);
  letter-spacing: 0;
}

@supports (min-height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

:focus-visible {
  outline: 3px solid var(--color-brand-500);
  outline-offset: 3px;
}

.mission-topbar,
.mission-shell {
  width: min(100% - clamp(1rem, 4vw, 2rem), 74rem);
  margin: 0 auto;
}

.mission-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand-link {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-link img {
  flex: 0 0 auto;
  border: 2px solid var(--color-black);
  border-radius: 50%;
}

.topbar-tag,
.section-kicker,
.caption-label,
.state-select span,
.copy-box span,
.group-title,
.source-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.topbar-tag,
.section-kicker {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 2px solid var(--color-black);
  border-radius: 999px;
  background: #f5f264;
  padding: 0.38rem 0.62rem;
}

.mission-shell {
  display: grid;
  gap: clamp(1rem, 3vw, 1.5rem);
  padding: 0.5rem 0 3rem;
}

.mission-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 28rem);
  gap: clamp(1rem, 3vw, 1.5rem);
  align-items: start;
}

.mission-copy,
.mission-tool,
.art-preview {
  border: 2px solid var(--color-black);
  border-radius: 8px;
  background: var(--color-white);
  box-shadow: 4px 4px 0 var(--color-black);
}

.mission-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 2rem);
}

.mission-copy h1,
.tool-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.mission-copy h1 {
  max-width: 14ch;
  font-size: clamp(2.35rem, 7vw, 5rem);
  line-height: 1.07;
}

.mission-copy h1 span {
  display: block;
  white-space: nowrap;
}

.tool-head h2 {
  line-height: 0.95;
}

.mission-lead {
  max-width: 54ch;
  margin: 0;
  color: var(--color-neutral-900);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 700;
  line-height: 1.35;
}

.mission-actions,
.tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.button {
  appearance: none;
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-black);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  color: var(--color-black);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 2px 2px 0 var(--color-black);
}

.button-primary {
  background: var(--color-brand-400);
}

.button-secondary {
  background: #79f2d0;
}

.button-ghost,
.button-copy {
  background: var(--color-white);
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.caption-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  border: 2px solid var(--color-black);
  border-radius: 8px;
  background: #121318;
  padding: 0.9rem;
  color: var(--color-white);
}

.caption-panel p {
  margin: 0.25rem 0 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.caption-label {
  color: #f5f264;
}

.feedback {
  min-height: 1.25rem;
  margin: 0;
  color: var(--color-neutral-700);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.tool-feedback {
  min-height: 1.2rem;
  margin: -0.35rem 0 0;
  color: var(--color-neutral-700);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.3;
}

.art-preview {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  background: var(--color-brand-400);
}

.art-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: contain;
}

.mission-tool {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.25rem);
}

.tool-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.tool-head h2 {
  margin-top: 0.6rem;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
}

.source-note {
  margin: 0;
  color: var(--color-neutral-700);
  text-align: right;
}

.tool-controls {
  display: grid;
  grid-template-columns: minmax(12rem, 0.8fr) minmax(0, 1.2fr);
  gap: 0.75rem;
  align-items: end;
}

.state-select,
.copy-box {
  display: grid;
  min-width: 0;
  gap: 0.4rem;
}

select,
textarea {
  width: 100%;
  border: 2px solid var(--color-black);
  border-radius: 8px;
  background: var(--color-white);
  color: var(--color-black);
  font: inherit;
  font-weight: 800;
}

select {
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
}

textarea {
  min-height: 8.5rem;
  padding: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
}

.state-list {
  display: grid;
  gap: 0.9rem;
}

.state-panel {
  display: grid;
  gap: 0.85rem;
  border: 2px solid var(--color-black);
  border-radius: 8px;
  background: #fffaf0;
  padding: 0.9rem;
}

.state-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.state-panel h3 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.state-count {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--color-black);
  border-radius: 999px;
  background: #79f2d0;
  padding: 0.28rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.group-list {
  display: grid;
  gap: 0.75rem;
}

.group-block {
  display: grid;
  gap: 0.45rem;
}

.group-title {
  color: var(--color-neutral-700);
}

.handle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.handle {
  appearance: none;
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border: 1.5px solid var(--color-black);
  border-radius: 999px;
  background: var(--color-white);
  padding: 0.42rem 0.58rem;
  color: inherit;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.handle:hover {
  background: var(--color-brand-100);
}

.handle.is-active {
  background: var(--color-brand-400);
}

.handle-actions {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 0.32rem;
  border: 1.5px solid var(--color-black);
  border-radius: 999px;
  background: #121318;
  padding: 0.22rem;
}

.handle-action {
  appearance: none;
  min-height: 1.8rem;
  border: 0;
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-black);
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
  padding: 0.42rem 0.58rem;
  white-space: nowrap;
}

.handle-action:hover {
  background: #f5f264;
}

.empty-state {
  margin: 0;
  border: 2px solid var(--color-black);
  border-radius: 8px;
  padding: 1rem;
  background: #fff2f2;
  font-weight: 800;
}

@media (max-width: 860px) {
  .mission-hero,
  .tool-controls {
    grid-template-columns: 1fr;
  }

  .mission-copy {
    order: 2;
  }

  .art-preview {
    order: 1;
    max-width: min(100%, 26rem);
    justify-self: center;
  }

  .caption-panel,
  .tool-head,
  .state-panel__head {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .tool-head,
  .state-panel__head {
    flex-direction: column;
  }

  .source-note {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .mission-topbar {
    align-items: flex-start;
  }

  .brand-link span {
    max-width: 12rem;
  }

  .mission-actions,
  .tool-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .mission-copy h1 {
    font-size: clamp(2rem, 9.8vw, 2.7rem);
    line-height: 1.1;
  }

  .handle {
    font-size: 0.78rem;
  }

  .handle-actions {
    width: 100%;
  }

  .handle-action {
    flex: 1 1 0;
  }
}
