:root {
  color-scheme: dark;
  --bg: #070a0f;
  --panel: #0d1117;
  --panel-2: #111827;
  --text: #d7ffe5;
  --muted: #8aa39a;
  --line: rgba(103, 232, 249, 0.24);
  --green: #7ddc9b;
  --cyan: #67e8f9;
  --pink: #f472b6;
  --danger: #fb7185;
  font-family: "SF Mono", "Roboto Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, "PingFang SC", "Noto Sans Mono CJK SC", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(circle at top, rgba(103, 232, 249, 0.08), transparent 34%), var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(96px, env(safe-area-inset-bottom));
}

.terminal,
.admin {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(7, 10, 15, 0.96));
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.34);
  padding: 18px;
}

.boot {
  min-height: calc(100svh - 24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.term-line,
.identity span {
  display: block;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.warn {
  color: #fbbf24;
}

.ok {
  color: var(--green);
}

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  margin: 18px 0 10px;
  font-size: clamp(24px, 9vw, 44px);
  line-height: 1.08;
}

h2 {
  font-size: 18px;
  margin: 22px 0 12px;
}

.bootbar {
  height: 12px;
  border: 1px solid rgba(125, 220, 155, 0.3);
  margin: 18px 0;
  overflow: hidden;
}

.bootbar span {
  display: block;
  width: 72%;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--green), var(--green) 10px, transparent 10px, transparent 14px);
}

.stack,
.question-form {
  display: grid;
  gap: 12px;
}

.prompt {
  color: var(--cyan);
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 6px;
  background: #030712;
  color: var(--text);
  padding: 12px;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

button,
.primary,
.secondary,
.danger {
  min-height: 44px;
  border: 1px solid rgba(103, 232, 249, 0.25);
  border-radius: 6px;
  background: #111827;
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.primary {
  border-color: rgba(125, 220, 155, 0.7);
  background: rgba(16, 185, 129, 0.15);
  color: #c8ffe1;
}

.secondary {
  color: #c9d7d2;
}

.danger {
  border-color: rgba(251, 113, 133, 0.6);
  background: rgba(251, 113, 133, 0.12);
}

.option,
.check {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  min-height: 56px;
  background: rgba(17, 24, 39, 0.85);
}

.option:active,
.selected {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.14);
}

.checks,
.options,
.cards,
.mates {
  display: grid;
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(103, 232, 249, 0.25);
  border-radius: 6px;
  padding: 12px;
}

.check input {
  width: 20px;
  min-height: 20px;
}

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

.progress {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7, 10, 15, 0.86);
  backdrop-filter: blur(10px);
  padding: 10px 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.progress div {
  height: 6px;
  border: 1px solid rgba(103, 232, 249, 0.25);
}

.progress i {
  display: block;
  height: 100%;
  background: var(--cyan);
}

.identity {
  color: #bdd7cc;
  border-bottom: 1px dashed rgba(103, 232, 249, 0.18);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.suggestion,
.note {
  border-left: 3px solid var(--accent, var(--cyan));
  background: rgba(103, 232, 249, 0.07);
  padding: 12px;
  color: #cceee2;
}

.bottom-nav {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: stretch;
  padding: 10px 0 0;
}

.matcher {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #090d14;
  padding: 9px 12px;
  display: grid;
  gap: 2px;
}

.matcher span,
.matcher small {
  color: var(--muted);
  font-size: 12px;
}

.ascii {
  margin: 20px 0;
  color: var(--accent);
  font-size: clamp(36px, 13vw, 76px);
  font-weight: 800;
  line-height: 1;
}

.crew-name-zh {
  color: var(--accent);
  font-size: clamp(26px, 9vw, 52px);
  font-weight: 800;
  margin: -8px 0 16px;
}

.mate,
.person,
.mbti-card,
.crew-edit,
.qr-card,
.profile-grid article {
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  padding: 12px;
}

.mate span,
.mate small,
.person span,
.person small,
.profile-grid span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.qr-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin: 18px 0;
}

.qr-card h2 {
  margin-top: 0;
}

.qr-card img {
  display: block;
  width: 132px;
  height: 132px;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
}

.public-link {
  overflow-wrap: anywhere;
}

.public-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
}

.crew-badge {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--accent);
  white-space: nowrap;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.profile-grid b {
  display: block;
  margin-top: 6px;
  line-height: 1.55;
}

.admin {
  width: 100%;
}

.admin.narrow {
  max-width: 760px;
  margin: 0 auto;
}

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

.admin-head h1 {
  margin-top: 0;
}

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

.crew-panel {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.crew-panel h2 {
  color: var(--accent);
  margin-top: 0;
}

.metric {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.person form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.crew-edit {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 130px;
  gap: 8px;
}

.crew-edit textarea {
  grid-column: 1 / -1;
}

.participant-edit label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.participant-edit label:has(textarea) {
  grid-column: 1 / -1;
}

@media (max-width: 780px) {
  .shell {
    padding-inline: 10px;
  }

  .terminal,
  .admin {
    padding: 14px;
  }

  .bottom-nav {
    grid-template-columns: 1fr;
  }

  .admin-head,
  .admin-actions {
    display: grid;
  }

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

  .qr-card,
  .public-head,
  .profile-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .qr-card img {
    width: min(220px, 70vw);
    height: min(220px, 70vw);
    margin: 0 auto;
  }

  .crew-edit {
    grid-template-columns: 64px 1fr;
  }

  .crew-edit input:nth-of-type(3),
  .crew-edit input:nth-of-type(4) {
    grid-column: 1 / -1;
  }
}

@media print {
  body {
    background: #070a0f;
  }

  .bottom-nav,
  .actions {
    display: none;
  }

  .terminal {
    min-height: 100svh;
    border-color: var(--accent);
  }
}
