:root {
  color-scheme: light;
  --page: #e8ebe8;
  --panel: #f7f7f3;
  --surface: #ffffff;
  --surface-soft: #eff1ed;
  --ink: #1d211f;
  --muted: #69706b;
  --line: #d8ddd8;
  --line-strong: #b8c0b9;
  --accent: #3e6650;
  --accent-strong: #284b39;
  --accent-soft: #e0ebe3;
  --danger: #a33e32;
  --danger-soft: #f7e7e4;
  --warning: #8a641d;
  --warning-soft: #f6edd8;
  --info: #345f7a;
  --info-soft: #e2edf3;
  --shadow: 0 18px 50px rgba(25, 34, 29, 0.12);
  --radius: 6px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111513;
  --panel: #191e1b;
  --surface: #202622;
  --surface-soft: #252c27;
  --ink: #edf0ec;
  --muted: #a4aca6;
  --line: #39413b;
  --line-strong: #56615a;
  --accent: #8db79a;
  --accent-strong: #b9d7c0;
  --accent-soft: #293c31;
  --danger: #e58c82;
  --danger-soft: #442a27;
  --warning: #d9b56c;
  --warning-soft: #40351f;
  --info: #8bb9d0;
  --info-soft: #263a43;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  width: min(1440px, calc(100% - 32px));
  min-height: calc(100dvh - 32px);
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.context-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.visual-strip {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  background: #1d211f;
}

.visual-strip img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  object-position: 53% center;
  display: block;
}

.visual-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(17, 21, 19, 0.06), rgba(17, 21, 19, 0.68));
}

.brand-lockup {
  position: absolute;
  left: 22px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f5f6f2;
  font-size: 13px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 4px;
  background: rgba(24, 31, 27, 0.56);
  font-size: 11px;
}

.context-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 28px;
  padding: 26px 24px;
}

.section-label,
.question-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}

.context-content h1 {
  max-width: 310px;
  margin: 0;
  font-size: clamp(25px, 2vw, 31px);
  line-height: 1.18;
  font-weight: 780;
}

.context-copy {
  max-width: 290px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

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

.stage {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 8px;
  border-radius: var(--radius);
  color: var(--muted);
}

.stage.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 3px 12px rgba(35, 44, 39, 0.05);
}

.stage.is-complete .stage-number {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.stage-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 750;
}

.stage strong,
.stage small {
  display: block;
}

.stage strong {
  font-size: 13px;
}

.stage small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.selection-summary {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.text-button {
  border: 0;
  padding: 4px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.summary-chip {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.trust-note {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.trust-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.trust-note strong {
  color: var(--ink);
}

.trust-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: calc(100dvh - 34px);
  background: var(--panel);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 18px clamp(24px, 5vw, 70px);
  border-bottom: 1px solid var(--line);
}

.progress-copy {
  display: grid;
  min-width: min(330px, 60vw);
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 11.11%;
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.theme-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.theme-control input {
  position: relative;
  appearance: none;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.theme-control input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 150ms ease, background-color 150ms ease;
}

.theme-control input:checked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-control input:checked::before {
  background: var(--accent);
  transform: translateX(14px);
}

.question-view,
.result-view {
  width: min(820px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(42px, 7vh, 82px) 0 48px;
}

.question-heading {
  max-width: 680px;
}

.question-heading h2,
.result-heading h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.16;
  font-weight: 770;
}

.question-help,
.result-heading p,
.prompt-panel p {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

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

.choice {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 13px;
  align-items: start;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.choice:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.choice[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice-indicator {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 12px;
  font-weight: 800;
}

.is-multi .choice-indicator {
  border-radius: 4px;
}

.choice[aria-checked="true"] .choice-indicator {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.choice-title {
  display: block;
  font-size: 15px;
  font-weight: 720;
  line-height: 1.35;
}

.choice-description {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.action-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 82px;
  padding: 14px clamp(24px, 5vw, 70px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.primary-button,
.secondary-button,
.back-button,
.official-link {
  min-height: 44px;
  border-radius: 5px;
  padding: 0 19px;
  cursor: pointer;
  font-weight: 720;
  text-decoration: none;
}

.primary-button {
  border: 1px solid var(--accent-strong);
  background: var(--accent-strong);
  color: var(--surface);
}

.primary-button:disabled {
  border-color: var(--line);
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.secondary-button,
.back-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.back-button[hidden] {
  visibility: hidden;
  display: block;
}

.action-status {
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.result-view {
  padding-top: 42px;
}

.result-heading {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
}

.result-heading > div {
  max-width: 650px;
}

.result-count {
  flex: none;
  color: var(--muted);
  font-size: 13px;
}

.notice {
  display: grid;
  gap: 4px;
  margin: 26px 0;
  border-left: 4px solid var(--warning);
  border-radius: 3px;
  padding: 14px 16px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
  line-height: 1.5;
}

.result-list {
  display: grid;
  gap: 12px;
}

.contest-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
}

.match-score {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
}

.contest-copy {
  min-width: 0;
}

.contest-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.contest-topline h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.contest-tag {
  border-radius: 3px;
  padding: 4px 6px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 10px;
  font-weight: 750;
}

.contest-copy p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.contest-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 9px;
  color: var(--ink);
  font-size: 11px;
}

.official-link {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  padding-inline: 13px;
  color: var(--ink);
  font-size: 12px;
}

.prompt-panel {
  display: grid;
  gap: 17px;
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.prompt-panel h3 {
  margin: 0;
  font-size: 22px;
}

.prompt-panel textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
}

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

.copy-status {
  min-height: 20px;
  margin: 0;
  color: var(--accent);
  font-size: 12px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
    width: calc(100% - 16px);
    margin: 8px auto;
  }

  .context-content {
    padding-inline: 18px;
  }

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

@media (max-width: 720px) {
  .app-shell {
    display: block;
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .context-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .visual-strip,
  .visual-strip img {
    min-height: 138px;
    height: 138px;
  }

  .brand-lockup {
    left: 16px;
    bottom: 14px;
  }

  .context-content {
    gap: 18px;
    padding: 20px 16px;
  }

  .context-content h1 {
    max-width: none;
    font-size: 26px;
  }

  .context-copy,
  .selection-summary,
  .trust-note,
  .stage small {
    display: none;
  }

  .stage-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stage {
    display: flex;
    min-height: 42px;
    gap: 7px;
    padding: 5px;
  }

  .stage-number {
    width: 26px;
    height: 26px;
  }

  .stage strong {
    font-size: 11px;
  }

  .workspace {
    min-height: calc(100dvh - 250px);
  }

  .workspace-header {
    min-height: 64px;
    padding: 14px 16px;
  }

  .progress-copy {
    min-width: 190px;
  }

  .question-view,
  .result-view {
    width: calc(100% - 32px);
    padding: 34px 0 32px;
  }

  .question-heading h2,
  .result-heading h2 {
    font-size: 28px;
  }

  .choice-grid {
    margin-top: 26px;
  }

  .choice {
    min-height: 78px;
    padding: 14px;
  }

  .action-bar {
    position: sticky;
    bottom: 0;
    padding: 12px 16px;
    background: var(--panel);
  }

  .result-heading {
    display: block;
  }

  .result-count {
    display: block;
    margin-top: 12px;
  }

  .contest-card {
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 14px;
  }

  .match-score {
    width: 44px;
    height: 44px;
    font-size: 12px;
  }

  .official-link {
    grid-column: 1 / -1;
    width: 100%;
  }

  .prompt-actions > * {
    width: 100%;
  }
}

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