:root {
  color-scheme: light;
  --bg: #f7fbff;
  --paper: rgba(255, 255, 255, 0.95);
  --paper-strong: #ffffff;
  --ink: #182033;
  --muted: #5f6680;
  --line: rgba(41, 56, 90, 0.14);
  --accent: #5b2cff;
  --accent-dark: #33129a;
  --accent-soft: rgba(91, 44, 255, 0.12);
  --stamp: #ff5d2f;
  --contrast: #06b6d4;
  --highlight: #ffe45c;
  --shadow: 0 24px 58px rgba(41, 56, 90, 0.14);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

body[data-major="business"] {
  --accent: #2563eb;
  --accent-dark: #173ea2;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --stamp: #f97316;
}

body[data-major="stem"] {
  --accent: #059669;
  --accent-dark: #03664a;
  --accent-soft: rgba(5, 150, 105, 0.12);
  --stamp: #7c3aed;
}

body[data-major="humanities"] {
  --accent: #db2777;
  --accent-dark: #97144f;
  --accent-soft: rgba(219, 39, 119, 0.12);
  --stamp: #0ea5e9;
}

body[data-major="media"] {
  --accent: #ea580c;
  --accent-dark: #9a3412;
  --accent-soft: rgba(234, 88, 12, 0.12);
  --stamp: #14b8a6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 228, 92, 0.4) 0 16%, transparent 16% 100%),
    linear-gradient(115deg, transparent 0 62%, rgba(6, 182, 212, 0.16) 62% 100%),
    linear-gradient(180deg, #fff9db 0%, #eff8ff 46%, var(--bg) 100%);
}

button,
input,
textarea {
  font: inherit;
}

.paper-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(24, 32, 51, 0.035) 0 1px, transparent 1px 36px),
    linear-gradient(180deg, rgba(24, 32, 51, 0.03) 0 1px, transparent 1px 36px);
  opacity: 0.58;
}

.app-shell {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.panel {
  display: none;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
    var(--paper);
  box-shadow: var(--shadow);
  padding: 34px;
  animation: fade-up 0.35s ease;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 228, 92, 0.16), transparent 34%),
    linear-gradient(135deg, transparent 0 72%, rgba(6, 182, 212, 0.12) 72% 100%);
}

.panel.active {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
}

.hero-copy,
.major-picker,
.question-card,
.result-card,
.share-box {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.16;
}

h1 {
  font-size: clamp(2.25rem, 5.4vw, 4.1rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.lead,
.major-inline,
.result-summary,
.score-list,
.share-box {
  color: var(--muted);
}

.lead {
  max-width: 620px;
  margin: 20px 0 0;
  font-size: 1.06rem;
  line-height: 1.9;
}

.bottom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.test-note {
  margin: 16px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.start-controls:not([hidden]) {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.consent-label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.consent-label input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.major-picker,
.question-card,
.result-card,
.share-box {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.16)),
    var(--paper-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.major-picker {
  padding: 24px;
  border-radius: 26px;
}

.major-picker h2 {
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

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

.major-card {
  padding: 16px 14px;
  border-radius: 18px;
  border: 1px solid rgba(41, 25, 19, 0.1);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.major-card:hover {
  transform: translateY(-1px);
  border-color: rgba(155, 44, 44, 0.28);
  box-shadow: 0 14px 26px rgba(99, 65, 48, 0.08);
}

.major-card[aria-pressed="true"] {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, var(--accent-soft), rgba(255, 228, 92, 0.18)),
    #fff;
}

.major-card strong {
  display: block;
  font-size: 1rem;
}

.major-card span {
  display: block;
  margin-top: 4px;
  line-height: 1.45;
  color: var(--muted);
  font-size: 0.92rem;
}

.primary-btn,
.ghost-btn {
  appearance: none;
  border: none;
  border-radius: 18px;
  min-height: 54px;
  padding: 0 22px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease;
}

.primary-btn {
  color: #fff;
  background: var(--accent-dark);
  box-shadow: 0 8px 18px var(--accent-soft);
}

.ghost-btn {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(41, 56, 90, 0.12);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

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

.major-inline {
  margin: 16px 0 0;
  line-height: 1.7;
}

.quiz-topbar {
  position: relative;
  z-index: 1;
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 12px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
}

.change-major {
  min-height: 44px;
  padding: 0 8px;
  color: var(--accent-dark);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.change-major:disabled {
  opacity: 0.55;
  cursor: default;
}

.progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(72, 43, 35, 0.12);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.question-list {
  margin-top: 16px;
}

.question-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(18px, 3vw, 36px);
  border-radius: 26px;
  border: 2px solid rgba(91, 44, 255, 0.12);
  background:
    linear-gradient(135deg, rgba(255, 228, 92, 0.15), transparent 38%),
    linear-gradient(315deg, rgba(6, 182, 212, 0.11), transparent 42%),
    rgba(255, 255, 255, 0.86);
}

.question-card.answered {
  border-color: rgba(6, 182, 212, 0.42);
}

.question-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.question-text {
  max-width: 880px;
  margin: 12px 0 0;
  font-size: clamp(1.125rem, 2.2vw, 1.75rem);
  font-weight: 900;
  line-height: 1.55;
  letter-spacing: 0;
}

.question-text:focus,
#result-title:focus {
  outline: none;
}

.option-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.option-card {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease;
}

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

.option-card:focus-within {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-letter {
  flex: 0 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
  font-size: 0.8rem;
}

.option-copy {
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.option-card.selected {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.82)),
    #fff;
}

.option-card.selected .option-letter {
  background: var(--accent-dark);
  color: #fff;
}

.question-nav {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.result-stamp-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

.result-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(136px, 18vw, 168px);
  min-width: 136px;
  min-height: 136px;
  padding: 16px;
  border-radius: 28px;
  border: 3px solid rgba(198, 91, 59, 0.44);
  color: var(--accent-dark);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.22)),
    rgba(255, 249, 241, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  font-family: "Archivo Black", "Noto Sans SC", sans-serif;
  font-size: clamp(1.12rem, 1.2vw + 0.95rem, 1.92rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
  transform: rotate(-4deg);
}

.result-summary {
  max-width: 560px;
  margin: 14px 0 0;
  line-height: 1.85;
}

.result-portrait {
  position: relative;
  aspect-ratio: 3 / 2;
  margin: 26px 0 0;
  overflow: hidden;
  border: 1px solid rgba(41, 25, 19, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow:
    0 18px 44px rgba(67, 35, 24, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.result-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.result-card {
  padding: 20px;
  border-radius: 22px;
}

.result-card-wide {
  grid-column: 1 / -1;
}

.result-card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.result-card p {
  margin: 0;
  line-height: 1.82;
}

.score-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.9;
}

.share-box {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 22px;
  line-height: 1.85;
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-topbar,
.admin-panel,
.metric-card,
.bar-card,
.question-card-admin {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.16)),
    var(--paper-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.admin-topbar,
.admin-panel {
  border-radius: 24px;
  padding: 22px;
}

.admin-actions,
.admin-login-form,
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-login-form {
  margin-top: 16px;
}

.admin-field {
  display: grid;
  gap: 8px;
  min-width: min(100%, 280px);
}

.admin-field input {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(41, 25, 19, 0.14);
  background: rgba(255, 255, 255, 0.82);
}

.admin-status {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.admin-help {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.admin-hidden {
  display: none !important;
}

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

.metric-card,
.bar-card,
.question-card-admin {
  border-radius: 20px;
  padding: 18px;
}

.metric-card h3,
.bar-card h3,
.question-card-admin h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.metric-value {
  font-family: "Archivo Black", "Noto Sans SC", sans-serif;
  font-size: 2.2rem;
  line-height: 1;
}

.metric-label {
  margin-top: 8px;
  color: var(--muted);
}

.bar-list,
.trend-list,
.question-option-list {
  display: grid;
  gap: 12px;
}

.bar-row,
.trend-row,
.question-option-row {
  display: grid;
  gap: 6px;
}

.bar-head,
.question-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bar-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(72, 43, 35, 0.12);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--stamp) 0%, var(--accent) 100%);
}

.admin-empty {
  color: var(--muted);
  padding: 12px 0;
}

.trend-list {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.trend-row {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
}

.trend-date {
  color: var(--muted);
  font-size: 0.9rem;
}

.trend-count {
  font-weight: 800;
}

.question-card-admin p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.7;
}

.question-card-admin small {
  color: var(--muted);
}

.question-meta {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.question-grid {
  display: grid;
  gap: 14px;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 940px) {
  .hero-grid,
  .result-grid,
  .metric-grid,
  .bar-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px 10px 28px;
  }

  .panel {
    padding: 22px 16px;
    border-radius: 24px;
  }

  .panel-hero {
    padding: 18px 14px;
  }

  .hero-grid {
    gap: 14px;
  }

  .hero-copy .eyebrow {
    margin-bottom: 5px;
  }

  .hero-copy .lead {
    margin-top: 8px;
    font-size: 0.94rem;
    line-height: 1.6;
  }

  .test-note {
    margin-top: 6px;
  }

  .major-picker {
    padding: 14px;
    border-radius: 16px;
  }

  .major-grid {
    gap: 8px;
    margin-top: 12px;
  }

  .major-card {
    padding: 10px;
    border-radius: 12px;
  }

  .major-card span {
    font-size: 0.8rem;
  }

  .result-head,
  .result-stamp-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .result-stamp {
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 20px;
    transform: none;
  }

  .bottom-actions {
    flex-direction: column;
  }

  .app-shell:has(.panel-quiz.active) {
    padding: 8px 8px max(10px, env(safe-area-inset-bottom));
  }

  .panel-quiz {
    padding: 6px 10px 12px;
    border-radius: 18px;
    animation: none;
  }

  .question-list {
    margin-top: 10px;
  }

  .question-card {
    padding: 12px;
    border-radius: 14px;
  }

  .question-text {
    margin-top: 8px;
  }

  .option-list {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 12px;
  }

  .option-card {
    min-height: 44px;
    padding: 7px 8px;
    border-radius: 10px;
  }

  .option-copy {
    font-size: 0.9375rem;
    line-height: 1.45;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
    min-height: 44px;
    padding-inline: 10px;
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel {
    animation: none;
  }

  .progress-fill {
    transition: none;
  }
}
