:root {
  color-scheme: dark;
  --ink: #11100f;
  --ink-soft: #1b1917;
  --paper: #f5eee2;
  --paper-muted: #cfc4b5;
  --red: #e64025;
  --red-dark: #b92a16;
  --gold: #f0b94b;
  --line: rgba(245, 238, 226, 0.16);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--paper);
  background:
    radial-gradient(circle at 8% 0%, rgba(230, 64, 37, 0.14), transparent 30rem),
    var(--ink);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--paper);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--red);
  border-radius: 50% 44% 48% 42%;
  transform: rotate(-5deg);
  box-shadow: 0 8px 22px rgba(230, 64, 37, 0.22);
}

.history-toggle,
.text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.history-toggle {
  min-height: 42px;
  padding: 8px 0;
  color: var(--paper-muted);
  font-size: 0.9rem;
}

.history-toggle span {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  margin-left: 8px;
  padding: 0 7px;
  color: var(--ink);
  background: var(--gold);
  border-radius: 999px;
  font-weight: 800;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.decision-shell {
  min-height: calc(100vh - 122px);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  overflow: hidden;
  background: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.decision-panel {
  padding: clamp(40px, 6vw, 76px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow,
.result-kicker {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(3.5rem, 7vw, 6.7rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.07em;
}

h1 span {
  color: var(--red);
}

.intro {
  margin: 24px 0 36px;
  color: var(--paper-muted);
  font-size: 1rem;
}

.choice-group {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.choice-group legend {
  margin-bottom: 10px;
  color: var(--paper-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.segmented {
  display: flex;
  gap: 8px;
}

.choice {
  min-height: 43px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.choice:hover {
  border-color: rgba(245, 238, 226, 0.44);
  transform: translateY(-1px);
}

.choice.is-active {
  color: var(--ink);
  border-color: var(--paper);
  background: var(--paper);
  font-weight: 750;
}

.decide-button,
.confirm-button,
.secondary-button {
  min-height: 54px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease;
}

.decide-button {
  width: 100%;
  margin-top: 10px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  border: 0;
  background: var(--red);
  box-shadow: 0 14px 34px rgba(230, 64, 37, 0.22);
}

.decide-button span:last-child {
  font-size: 1.5rem;
}

.decide-button:hover,
.confirm-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.decide-button:hover,
.confirm-button:hover {
  background: #f04a2f;
}

.visual-panel {
  position: relative;
  min-height: 660px;
  overflow: hidden;
}

.visual-panel img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 58% center;
}

.visual-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(27, 25, 23, 0.45), transparent 35%), linear-gradient(0deg, rgba(17, 16, 15, 0.55), transparent 40%);
}

.visual-note {
  position: absolute;
  left: 32px;
  bottom: 32px;
  display: grid;
  padding: 18px 22px;
  background: rgba(17, 16, 15, 0.82);
  border: 1px solid rgba(245, 238, 226, 0.18);
  border-radius: 18px;
  backdrop-filter: blur(12px);
}

.visual-note span,
.visual-note small {
  color: var(--paper-muted);
  font-size: 0.76rem;
}

.visual-note strong {
  color: var(--gold);
  font-size: 2.5rem;
  line-height: 1;
}

.round-stamp {
  position: absolute;
  top: 26px;
  right: 26px;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--red);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 47% 52% 48% 45%;
  transform: rotate(7deg);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.result-section,
.history-panel {
  margin-top: 26px;
  border-radius: 26px;
}

.result-section {
  padding: clamp(30px, 5vw, 58px);
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
  animation: result-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 40px;
  align-items: end;
}

.result-section h2,
.history-panel h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.result-reason {
  max-width: 580px;
  margin: 18px 0 0;
  color: #655c52;
  font-size: 1.05rem;
  line-height: 1.75;
}

.result-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid rgba(17, 16, 15, 0.16);
  border-bottom: 1px solid rgba(17, 16, 15, 0.16);
}

.result-facts div {
  padding: 18px 12px;
  text-align: center;
}

.result-facts div + div {
  border-left: 1px solid rgba(17, 16, 15, 0.16);
}

.result-facts dt {
  color: #766c61;
  font-size: 0.75rem;
}

.result-facts dd {
  margin: 5px 0 0;
  font-weight: 850;
}

.result-actions {
  margin-top: 32px;
  display: flex;
  gap: 12px;
}

.secondary-button,
.confirm-button {
  padding: 0 24px;
}

.secondary-button {
  color: var(--ink);
  border: 1px solid rgba(17, 16, 15, 0.25);
  background: transparent;
}

.confirm-button {
  color: white;
  border: 0;
  background: var(--red);
}

.confirmed-message {
  margin: 20px 0 0;
  color: var(--red-dark);
  font-weight: 800;
}

.history-panel {
  padding: clamp(26px, 4vw, 44px);
  background: #211f1c;
  border: 1px solid var(--line);
}

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

.history-panel h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.text-button {
  padding: 10px 0;
  color: var(--paper-muted);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.history-list {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  min-height: 58px;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.history-list span {
  color: var(--paper-muted);
  font-size: 0.85rem;
}

.history-empty {
  margin: 24px 0 0;
  color: var(--paper-muted);
}

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 44px;
  color: #81796f;
  font-size: 0.82rem;
  text-align: center;
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .decision-shell {
    grid-template-columns: 1fr;
  }

  .visual-panel {
    min-height: 360px;
  }

  .visual-wash {
    background: linear-gradient(0deg, rgba(27, 25, 23, 0.65), transparent 50%);
  }

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

@media (max-width: 560px) {
  .topbar,
  main,
  footer {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    min-height: 68px;
  }

  .decision-shell {
    border-radius: 22px;
  }

  .decision-panel {
    padding: 30px 20px 24px;
  }

  h1 {
    font-size: clamp(3.35rem, 18vw, 5rem);
  }

  .intro {
    margin: 18px 0 28px;
  }

  .visual-panel {
    min-height: 285px;
  }

  .visual-note {
    left: 18px;
    bottom: 18px;
  }

  .round-stamp {
    top: 16px;
    right: 16px;
    width: 70px;
    height: 70px;
    font-size: 0.95rem;
  }

  .segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .segmented-wrap {
    grid-template-columns: repeat(2, 1fr);
  }

  .choice {
    padding-inline: 10px;
    font-size: 0.875rem;
  }

  .result-section,
  .history-panel {
    border-radius: 22px;
  }

  .result-facts {
    grid-template-columns: 1fr;
  }

  .result-facts div {
    display: flex;
    justify-content: space-between;
    text-align: left;
  }

  .result-facts div + div {
    border-top: 1px solid rgba(17, 16, 15, 0.16);
    border-left: 0;
  }

  .result-facts dd {
    margin: 0;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .history-heading {
    align-items: start;
  }
}

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