:root {
  --paper: #fff3df;
  --paper-2: #fffaf2;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --ink: #17242a;
  --soft-ink: #354b54;
  --muted: #66777f;
  --line: rgba(23, 36, 42, 0.12);
  --line-strong: rgba(23, 36, 42, 0.22);
  --mint: #27c6a7;
  --mint-deep: #139c89;
  --peach: #ff6f61;
  --sun: #ffc83d;
  --lilac: #7c6bff;
  --sky: #2fafff;
  --rose: #ff4f8b;
  --shadow: 0 18px 46px rgba(30, 42, 48, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body {
  position: relative;
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(145deg, #fff3df 0%, #fffaf2 42%, #eaf8ff 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -18% -20% auto auto;
  z-index: -1;
  width: 72vw;
  height: 52vh;
  background:
    linear-gradient(135deg, rgba(255, 111, 97, 0.34), rgba(255, 200, 61, 0.28) 48%, rgba(47, 175, 255, 0.24));
  clip-path: polygon(18% 0, 100% 0, 86% 78%, 0 100%);
}

body::after {
  content: "";
  position: fixed;
  left: -18%;
  bottom: -18%;
  z-index: -1;
  width: 70vw;
  height: 42vh;
  background:
    linear-gradient(135deg, rgba(39, 198, 167, 0.22), rgba(124, 107, 255, 0.2));
  clip-path: polygon(0 18%, 100% 0, 78% 100%, 0 86%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100svh;
}

.topbar,
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px clamp(16px, 4vw, 42px);
  background: rgba(255, 250, 242, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--soft-ink);
  font-size: 15px;
  font-weight: 850;
}

.brand-mark {
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--peach), var(--lilac));
  border-radius: 50%;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(255, 111, 97, 0.24);
}

.top-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.top-progress-track {
  width: min(28vw, 180px);
  height: 6px;
  overflow: hidden;
  background: rgba(23, 36, 42, 0.1);
  border-radius: 99px;
}

.top-progress-track span,
.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--peach), var(--sun), var(--sky), var(--mint));
  border-radius: inherit;
  transition: width 260ms ease;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-start {
  position: relative;
  display: none;
  min-height: calc(100svh - 58px);
  overflow: hidden;
  padding: clamp(24px, 6vw, 68px) clamp(18px, 5vw, 64px);
}

.screen-start.active {
  display: grid;
  align-items: center;
}

.start-visual {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.constellation {
  width: min(72vw, 620px);
  max-height: 72svh;
  opacity: 0.46;
  filter: drop-shadow(0 24px 44px rgba(47, 175, 255, 0.12));
  transform: translateX(18vw);
  animation: settleIn 900ms ease both;
}

.ring {
  fill: none;
  stroke: rgba(47, 175, 255, 0.3);
  stroke-width: 1.5;
}

.ring-two {
  stroke: rgba(255, 111, 97, 0.36);
}

.ring-three {
  stroke: rgba(124, 107, 255, 0.34);
}

.star-line {
  fill: none;
  stroke: rgba(47, 175, 255, 0.34);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 5 12;
  animation: lineDrift 12s linear infinite;
}

.inner-line {
  stroke: rgba(255, 111, 97, 0.38);
  animation-duration: 15s;
}

.triangle-line {
  stroke: rgba(124, 107, 255, 0.36);
  animation-duration: 18s;
}

.nodes circle {
  fill: var(--surface-solid);
  stroke: var(--sky);
  stroke-width: 3;
}

.start-copy {
  position: relative;
  z-index: 2;
  width: min(430px, 100%);
}

.eyebrow,
.question-kicker,
.share-label {
  margin: 0 0 10px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

.start-copy h1 {
  margin: 0;
  font-size: clamp(44px, 9.6vw, 82px);
  line-height: 1.02;
  letter-spacing: 0;
  color: var(--ink);
  text-shadow: 8px 8px 0 rgba(255, 200, 61, 0.24);
}

.start-line {
  max-width: 360px;
  margin: 16px 0 22px;
  color: var(--soft-ink);
  font-size: clamp(16px, 2.1vw, 20px);
  line-height: 1.7;
}

.profile-form {
  display: grid;
  width: min(390px, 100%);
  gap: 10px;
}

.profile-form label,
.admin-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus {
  background: var(--surface-solid);
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(127, 178, 167, 0.16);
}

.primary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  gap: 10px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 850;
  letter-spacing: 0;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-action {
  color: #fff;
  background: linear-gradient(135deg, var(--peach), var(--rose));
  box-shadow: 0 14px 30px rgba(255, 79, 139, 0.24);
}

.primary-action:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #ff5d50, #f83f82);
  box-shadow: 0 16px 34px rgba(255, 79, 139, 0.3);
}

.primary-action:focus-visible,
.ghost-action:focus-visible,
.answer-grid button:focus-visible,
.result-list-item:focus-visible,
.ghost-link:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(127, 178, 167, 0.22);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.ghost-action,
.ghost-link {
  color: var(--soft-ink);
  background: rgba(255, 255, 255, 0.54);
  border-color: var(--line-strong);
}

.ghost-action:hover,
.ghost-link:hover {
  background: var(--surface-solid);
}

.compact {
  min-height: 42px;
  padding: 0 14px;
}

.fine-print {
  max-width: 360px;
  margin: 13px 0 0;
  color: rgba(95, 111, 107, 0.7);
  font-size: 12px;
  line-height: 1.65;
}

.screen-test {
  min-height: calc(100svh - 58px);
  padding: clamp(18px, 5vw, 48px) clamp(14px, 5vw, 48px);
}

.question-shell {
  width: min(760px, 100%);
  margin: 0 auto;
}

.question-meta,
.test-actions,
.share-top,
.share-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.question-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.progress-track {
  height: 7px;
  margin: 12px 0 18px;
  overflow: hidden;
  background: rgba(23, 36, 42, 0.1);
  border-radius: 99px;
}

.question-panel {
  padding: clamp(22px, 5vw, 38px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(23, 36, 42, 0.11);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: panelEnter 260ms ease both;
}

.question-panel h2 {
  min-height: 112px;
  margin: 0 0 24px;
  font-size: clamp(23px, 4vw, 34px);
  font-weight: 760;
  line-height: 1.42;
  letter-spacing: 0;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.answer-grid button {
  min-height: 64px;
  padding: 10px;
  color: var(--soft-ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 760;
  line-height: 1.25;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.answer-grid button:hover,
.answer-grid button.selected {
  transform: translateY(-1px);
  color: var(--ink);
  border-color: rgba(255, 111, 97, 0.46);
  background: #fff4ec;
}

.answer-grid button:nth-child(1) {
  border-left: 4px solid var(--sky);
}

.answer-grid button:nth-child(2) {
  border-left: 4px solid var(--mint);
}

.answer-grid button:nth-child(3) {
  border-left: 4px solid var(--sun);
}

.answer-grid button:nth-child(4) {
  border-left: 4px solid var(--peach);
}

.answer-grid button:nth-child(5) {
  border-left: 4px solid var(--rose);
}

.test-actions {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.screen-result {
  padding: clamp(22px, 5vw, 58px) clamp(14px, 5vw, 48px) 72px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 340px);
  gap: clamp(18px, 4vw, 36px);
  width: min(1060px, 100%);
  margin: 0 auto 22px;
  align-items: start;
}

.result-main h2 {
  margin: 0;
  font-size: clamp(32px, 5.2vw, 62px);
  line-height: 1.08;
  letter-spacing: 0;
}

.result-line {
  max-width: 560px;
  color: var(--soft-ink);
  font-size: 16px;
  line-height: 1.75;
}

.result-map {
  margin-top: 12px;
  width: min(470px, 100%);
}

.map-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.map-ring {
  fill: none;
  stroke: rgba(95, 111, 107, 0.11);
}

.map-axis,
.map-guide {
  stroke: rgba(95, 111, 107, 0.11);
  stroke-linecap: round;
}

.map-star {
  fill: none;
  stroke: rgba(47, 175, 255, 0.28);
  stroke-width: 2;
}

.map-polygon {
  fill: rgba(255, 111, 97, 0.14);
  stroke: var(--peach);
  stroke-width: 3;
}

.map-node {
  fill: var(--surface-solid);
  stroke: var(--sky);
  stroke-width: 2;
}

.map-node.top {
  fill: var(--peach);
  stroke: var(--rose);
}

.map-label {
  fill: var(--soft-ink);
  font-size: 13px;
  font-weight: 850;
  text-anchor: middle;
  dominant-baseline: middle;
}

.result-aside {
  display: grid;
  gap: 10px;
}

.code-block,
.calibration-note,
.top-type-item {
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(94, 92, 84, 0.06);
}

.code-block span,
.top-type-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.code-block strong {
  display: block;
  margin-top: 5px;
  font-size: 29px;
  letter-spacing: 0;
}

.top-types {
  display: grid;
  gap: 9px;
}

.top-type-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  font-weight: 850;
}

.type-bar {
  height: 7px;
  overflow: hidden;
  background: rgba(23, 36, 42, 0.1);
  border-radius: 99px;
}

.type-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--peach), var(--sun), var(--sky));
  border-radius: inherit;
}

.calibration-note {
  color: var(--soft-ink);
  font-size: 13px;
  line-height: 1.7;
}

.result-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.share-card {
  position: relative;
  width: min(680px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 5vw, 30px);
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 111, 97, 0.16), transparent 44%),
    linear-gradient(315deg, rgba(47, 175, 255, 0.16), transparent 42%),
    linear-gradient(45deg, rgba(255, 200, 61, 0.18), transparent 34%),
    var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.share-top,
.share-footer {
  color: rgba(95, 111, 107, 0.68);
  font-size: 12px;
  font-weight: 850;
}

.share-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: center;
  min-height: 220px;
}

.share-body h3 {
  margin: 0;
  font-size: clamp(34px, 7.4vw, 60px);
  line-height: 1.04;
  letter-spacing: 0;
}

.share-body p {
  max-width: 330px;
  color: var(--soft-ink);
  line-height: 1.75;
}

.share-mini-map {
  width: min(210px, 100%);
}

.hidden-code {
  color: rgba(95, 111, 107, 0.24);
  font-size: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(74, 84, 81, 0.24);
  backdrop-filter: blur(12px);
}

.modal-panel {
  width: min(330px, 100%);
  padding: 24px;
  text-align: center;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(84, 91, 88, 0.18);
  animation: modalPop 220ms ease both;
}

.modal-badge {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 13px;
  background:
    linear-gradient(90deg, transparent 44%, #fff 44% 56%, transparent 56%),
    linear-gradient(0deg, transparent 44%, #fff 44% 56%, transparent 56%),
    var(--peach);
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(255, 189, 169, 0.28);
}

.modal-panel h2 {
  margin: 0 0 9px;
  font-size: 23px;
}

.modal-panel p {
  margin: 0 0 18px;
  color: var(--soft-ink);
  line-height: 1.7;
}

.admin-page {
  background:
    linear-gradient(145deg, #fff3df 0%, #fffaf2 42%, #eaf8ff 100%);
}

.admin-link,
.ghost-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
}

.admin-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 48px) clamp(16px, 4vw, 36px) 72px;
}

.admin-heading h1 {
  max-width: 650px;
  margin: 0 0 20px;
  font-size: clamp(32px, 4.8vw, 56px);
  line-height: 1.08;
}

.admin-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.admin-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 330px) minmax(0, 1fr);
  gap: 14px;
}

.results-list,
.result-detail {
  min-height: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.results-list {
  overflow: hidden;
}

.result-list-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 13px 15px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.result-list-item:hover,
.result-list-item.active {
  background: rgba(255, 200, 61, 0.18);
}

.result-list-item strong {
  font-size: 16px;
}

.result-list-item span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.result-detail {
  padding: 16px;
  overflow-x: auto;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.detail-header h2 {
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 13px 0;
}

.detail-cell {
  padding: 12px;
  background: rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
}

.detail-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.detail-cell strong {
  display: block;
  margin-top: 4px;
  font-size: 19px;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

@keyframes settleIn {
  from {
    opacity: 0;
    transform: translateX(18vw) scale(0.97);
  }
}

@keyframes lineDrift {
  to {
    stroke-dashoffset: -84;
  }
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 54px;
    padding: 10px 14px;
  }

  .brand-lockup {
    font-size: 14px;
  }

  .brand-mark {
    width: 29px;
    height: 29px;
  }

  .top-progress {
    font-size: 12px;
  }

  .top-progress-track {
    display: none;
  }

  .screen-start,
  .screen-test,
  .screen-result {
    min-height: calc(100svh - 54px);
  }

  .screen-start {
    padding: 20px 16px 28px;
    align-items: start;
  }

  .screen-start.active {
    align-items: start;
  }

  .constellation {
    width: 118vw;
    max-height: 58svh;
    opacity: 0.36;
    transform: translate(24vw, 2svh);
  }

  .start-copy {
    padding-top: 26px;
  }

  .start-copy h1 {
    max-width: 280px;
  }

  .start-line {
    margin: 14px 0 20px;
  }

  .profile-form {
    width: 100%;
    gap: 9px;
  }

  .primary-action {
    width: 100%;
  }

  .question-panel {
    padding: 20px;
  }

  .question-panel h2 {
    min-height: 118px;
    margin-bottom: 20px;
    font-size: 23px;
  }

  .answer-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .answer-grid button {
    min-height: 50px;
    text-align: center;
  }

  .test-actions {
    align-items: center;
  }

  .test-actions .ghost-action {
    min-height: 40px;
    padding: 0 12px;
  }

  .result-layout,
  .share-body,
  .admin-workspace,
  .admin-controls {
    grid-template-columns: 1fr;
  }

  .result-map {
    width: min(330px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .result-actions .primary-action,
  .result-actions .ghost-action {
    flex: 1 1 130px;
  }

  .share-body {
    min-height: unset;
  }

  .share-mini-map {
    width: 178px;
    margin: 0 auto;
  }

  .share-footer {
    align-items: flex-end;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
