:root {
  --ink: #172033;
  --muted: #647184;
  --line: #dfe6ef;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --accent: #0e7ce8;
  --accent-soft: #e8f2fe;
  --good: #0e9f6e;
  --warn: #d97706;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px 112px;
}

.hero {
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 40px 36px;
}

.hero h1,
.results-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
}

.sub,
.sdesc,
.idesc,
.hint,
.modalcopy {
  color: var(--muted);
  font-size: 14px;
}

.hero .sub {
  max-width: 650px;
  margin: 10px 0 0;
  color: #b7c4d8;
}

.tag {
  display: inline-block;
  margin: 0 0 14px;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero .tag {
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  padding: 4px 14px;
}

.howto,
.section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.howto {
  margin-bottom: 28px;
  padding: 16px 20px;
  background: var(--accent-soft);
  border-color: #cfe4fb;
  color: #244b73;
  font-size: 14px;
}

.section {
  margin-bottom: 22px;
  padding: 28px 28px 20px;
}

.section h2,
.results-tools h2,
.auth-panel h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 700;
}

.sdesc {
  margin: 6px 0 18px;
}

.snum {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  vertical-align: 1px;
}

.item {
  border-top: 1px solid var(--line);
  padding: 16px 0 14px;
}

.item:first-of-type {
  border-top: 0;
}

.iname {
  font-size: 15px;
  font-weight: 650;
}

.idesc,
.hint {
  margin: 3px 0 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.chip:hover {
  border-color: var(--accent);
}

.chip.sel-0 {
  border-color: var(--good);
  background: var(--good);
  color: #fff;
}

.chip.sel-1 {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.chip.sel-2 {
  border-color: var(--warn);
  background: var(--warn);
  color: #fff;
}

.chip.sel-3 {
  border-color: var(--bad);
  background: var(--bad);
  color: #fff;
}

textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  outline: 0;
}

.note {
  margin: 0 0 16px;
  border: 1px solid #f3d9a4;
  border-radius: 8px;
  background: #fff8eb;
  color: #7a5510;
  font-size: 13.5px;
  padding: 14px 16px;
}

.conditional {
  display: none;
  margin-top: 14px;
  border: 1px solid #cfe4fb;
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 14px 16px;
}

.conditional.show {
  display: block;
}

.conditional label,
.openq label,
.auth-panel label {
  display: block;
  margin: 10px 0 5px;
  font-size: 13.5px;
  font-weight: 650;
}

.conditional label:first-child {
  margin-top: 0;
}

.openq {
  margin-bottom: 18px;
}

.required {
  color: var(--bad);
  font-size: 12px;
  font-weight: 700;
}

.footerbar {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 -4px 18px rgba(20, 30, 50, .06);
  padding: 12px 20px;
}

.btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 14.5px;
  font-weight: 650;
  padding: 11px 22px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-ghost {
  border: 1.5px solid var(--accent);
  background: #fff;
  color: var(--accent);
}

.progress,
.status {
  color: var(--muted);
  font-size: 13px;
}

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

.status.error {
  color: var(--bad);
}

#summaryModal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  overflow: auto;
  background: rgba(15, 23, 40, .55);
  padding: 30px 16px;
}

#summaryModal .panel {
  max-width: 760px;
  margin: 0 auto;
  border-radius: 8px;
  background: #fff;
  padding: 28px;
}

#summaryModal h3 {
  margin: 0 0 8px;
}

#summaryText {
  height: 340px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.modalbtns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.results-page {
  background: #fff;
}

.results-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

.results-head,
.results-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.results-head .tag {
  color: var(--accent);
}

.text-link {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.auth-panel {
  max-width: 560px;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

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

.submission {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.submission-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.submission h3 {
  margin: 0;
  font-size: 16px;
}

.submission time {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.summary-pre {
  overflow: auto;
  max-height: 360px;
  margin: 0;
  border-radius: 8px;
  background: #f6f8fb;
  color: #26364a;
  font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace;
  padding: 14px;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .wrap {
    padding: 24px 14px 150px;
  }

  .hero,
  .section {
    padding: 22px 18px;
  }

  .footerbar {
    align-items: stretch;
    flex-direction: column;
  }

  .progress,
  .status {
    text-align: center;
  }

  .results-head,
  .results-tools,
  .submission-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-row {
    grid-template-columns: 1fr;
  }
}
