:root {
  color-scheme: dark;
  --bg: #0b0f0d;
  --panel: #111915;
  --panel-strong: #18231d;
  --line: #31463b;
  --line-soft: #223128;
  --text: #edf7f0;
  --muted: #a7b8ae;
  --soft: #d5e4da;
  --green: #8ddc9b;
  --amber: #f0bf73;
  --blue: #91b8ff;
  --bad: #f19a89;
  --ink: #08110c;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(15, 22, 19, 0.96), rgba(9, 13, 12, 0.98)),
    repeating-linear-gradient(90deg, rgba(141, 220, 155, 0.05) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(240, 191, 115, 0.035) 0 1px, transparent 1px 80px);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.flow-shell {
  min-height: 100vh;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand {
  min-width: 0;
  color: var(--soft);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  background: var(--green);
  color: var(--ink);
  font-size: 0.9rem;
}

.flow-card {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, black);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.progress-wrap {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 34%);
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 16, 14, 0.72);
}

.progress-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#step-kicker,
.eyebrow,
.summary-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 800;
}

#step-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #090e0c;
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

#progress-fill {
  display: block;
  width: 16.6%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
  transition: width 180ms ease;
}

.card-layout {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
}

.question-panel {
  min-width: 0;
  width: 100%;
  min-height: 0;
  padding: clamp(28px, 6vw, 72px);
  display: grid;
  place-items: center;
}

#flow-form {
  min-width: 0;
  width: min(680px, 100%);
  display: grid;
  gap: 20px;
}

h1,
p {
  margin: 0;
}

h1 {
  max-width: 16ch;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.body-copy {
  max-width: 58ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  overflow-wrap: break-word;
}

.field-zone {
  display: grid;
  gap: 14px;
}

.input-stack {
  display: grid;
  gap: 10px;
  color: var(--text);
}

.input-stack > span {
  font-weight: 800;
}

.input-stack small,
.mini-note {
  color: var(--muted);
  font-size: 0.92rem;
}

input {
  width: 100%;
  min-height: 58px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #080d0b;
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(145, 184, 255, 0.22);
}

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

.check-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0b110f;
  padding: 12px;
}

.check-row > span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(141, 220, 155, 0.14);
  color: var(--green);
  font-weight: 900;
}

.check-row.good {
  border-color: rgba(141, 220, 155, 0.38);
}

.check-row.bad {
  border-color: rgba(241, 154, 137, 0.58);
  background: rgba(54, 18, 15, 0.42);
}

.check-row.bad > span {
  background: rgba(241, 154, 137, 0.14);
  color: var(--bad);
}

.check-row.pending > span {
  background: rgba(240, 191, 115, 0.14);
  color: var(--amber);
}

.check-row p {
  color: var(--muted);
}

.action-check-row button {
  margin-top: 10px;
  justify-self: start;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-card {
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 10px;
  align-content: center;
  color: var(--text);
  background: #0a100e;
  text-align: left;
  cursor: pointer;
}

.choice-card span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 800;
}

.choice-card strong {
  font-size: 1.2rem;
}

.choice-card.selected,
.choice-card:hover {
  border-color: var(--green);
  background: #101b15;
}

.status-message {
  min-height: 1.4em;
  color: var(--bad);
  font-weight: 700;
}

.status-message.good {
  color: var(--green);
}

.status-message.info {
  color: var(--muted);
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.secondary-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  min-width: 156px;
  background: var(--green);
  color: var(--ink);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.secondary-button,
.ghost-button {
  border: 1px solid var(--line);
  background: #0a100e;
  color: var(--text);
}

a.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.danger-button {
  border-color: rgba(241, 154, 137, 0.68);
  background: rgba(71, 24, 20, 0.7);
  color: #ffd6cf;
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: var(--bad);
  background: rgba(112, 34, 29, 0.86);
  color: #fff2ef;
}

.ghost-button {
  min-height: 40px;
}

#reset-flow {
  border-color: rgba(241, 154, 137, 0.74);
  background: rgba(80, 24, 20, 0.82);
  color: #ffd6cf;
}

#reset-flow:hover,
#reset-flow:focus-visible {
  border-color: var(--bad);
  background: rgba(122, 34, 29, 0.92);
  color: #fff2ef;
}

.compact {
  min-height: 38px;
  padding: 0 12px;
}

.summary-panel {
  display: grid;
  gap: 12px;
}

.summary-panel > div,
.member-list li {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0a100e;
  padding: 12px;
}

.summary-panel strong {
  display: block;
  margin-top: 4px;
  word-break: break-word;
}

.team-code-block > div {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}

code {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--amber);
  background: #080d0b;
  overflow-wrap: anywhere;
}

.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.member-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.member-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.team-management-panel {
  display: grid;
  gap: 12px;
}

.team-management-panel p {
  color: var(--muted);
}

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

.confirm-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.confirm-panel[hidden],
.hidden {
  display: none;
}

@media (max-width: 860px) {
  .flow-shell {
    width: min(100vw - 20px, 720px);
    padding: 10px 0;
  }

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

  .card-layout {
    grid-template-columns: 1fr;
  }

  .question-panel {
    padding: 26px;
    align-items: start;
  }

  h1 {
    max-width: min(100%, 10.5ch);
    font-size: clamp(1.9rem, 7.4vw, 2.45rem);
    overflow-wrap: normal;
  }

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

@media (max-width: 520px) {
  .flow-shell {
    width: 100%;
    padding: 0;
  }

  .topbar {
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .flow-card {
    min-height: calc(100vh - 68px);
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 0;
  }

  .progress-wrap {
    gap: 12px;
    padding: 16px 22px;
  }

  .question-panel {
    padding: 22px 26px 12px;
  }

  #flow-form {
    gap: 14px;
  }

  .progress-copy,
  .action-row,
  .secondary-action-row,
  .team-management-actions,
  .team-code-block > div {
    align-items: stretch;
    flex-direction: column;
  }

  .action-row,
  .secondary-action-row,
  .team-management-actions {
    display: grid;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .topbar .ghost-button {
    width: auto;
    min-width: 116px;
  }
}
