:root {
  --bg: #eee3d2;
  --panel: #fffaf1;
  --ink: #241d18;
  --muted: #715f52;
  --accent: #b13b25;
  --accent-dark: #6f2119;
  --gold: #c9a94e;
  --green: #2c6155;
  --line: #d8c3a8;
  --soft: #f4eadb;
  --shadow: 0 18px 42px rgba(41, 25, 14, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    linear-gradient(180deg, #fbf4e8 0%, var(--bg) 100%);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
  padding: 28px;
  border-radius: 18px;
  color: #fff8ef;
  background:
    linear-gradient(135deg, rgba(69, 23, 17, 0.9), rgba(37, 60, 55, 0.84)),
    url("assets/huangchao/huangchao-chongtian.webp") center / cover;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  opacity: 0.82;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 4vw, 4.1rem);
  line-height: 1.08;
}

.hero-copy {
  max-width: 760px;
  margin-bottom: 0;
  line-height: 1.85;
  color: rgba(255, 248, 239, 0.92);
}

.ghost-button,
.primary-button,
.choice-button,
.tool-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  padding: 10px 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.ghost-button {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 248, 239, 0.36);
  color: #fff8ef;
  background: rgba(255, 248, 239, 0.12);
}

.primary-button,
.choice-button {
  color: #fff8ef;
  background: var(--accent);
}

.primary-button:disabled {
  color: #fff8ef;
  background: #c9b7a3;
  cursor: not-allowed;
}

.tool-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fffaf2;
}

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

.panel,
.card,
.choice-card,
.history-box,
.question-box,
.score-card,
.route-item {
  border: 1px solid rgba(169, 54, 39, 0.14);
  background: rgba(255, 250, 242, 0.96);
  box-shadow: var(--shadow);
}

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

.intro-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 18px;
}

.card,
.choice-card,
.score-card {
  border-radius: 8px;
  padding: 20px;
}

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

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fffdf7;
}

.bullet-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

.game-layout {
  display: grid;
  gap: 18px;
}

.top-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(190px, 1fr));
  gap: 12px;
}

.score-card {
  padding: 16px;
  box-shadow: none;
}

.score-card-note {
  display: grid;
  align-content: center;
}

.score-note {
  color: var(--accent-dark);
  font-weight: 800;
}

.score-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

.score-number {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent-dark);
  white-space: nowrap;
}

.score-number small {
  font-size: 0.62em;
}

.meter {
  height: 9px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #eadbc7;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--accent));
}

.kit {
  position: relative;
  justify-self: end;
}

.kit-panel {
  position: absolute;
  z-index: 3;
  top: 52px;
  right: 0;
  width: min(380px, calc(100vw - 42px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.kit-panel[hidden] {
  display: none;
}

.stage-title {
  margin-bottom: 14px;
  font-size: 28px;
}

.stage-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(169, 54, 39, 0.18);
  background: #eadbc7;
}

.route-map-shell {
  display: grid;
  gap: 10px;
}

.route-map-stage {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(169, 54, 39, 0.18);
  border-radius: 14px;
  background: #eadbc7;
}

.route-map-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.route-map-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.route-map-lines line {
  stroke: #b13b25;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  filter: drop-shadow(0 3px 3px rgba(89, 42, 22, 0.24));
  animation: route-line-in 0.68s ease-out forwards;
}

.route-map-lines line + line {
  animation-delay: 0.18s;
}

.route-map-place {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.route-map-scene {
  position: absolute;
  z-index: 2;
  left: var(--scene-x);
  top: var(--scene-y);
  width: clamp(76px, 13vw, 118px);
  height: auto;
  opacity: 0.92;
  filter: drop-shadow(0 9px 10px rgba(73, 36, 18, 0.18));
  transform: translate(-50%, -50%);
  animation: map-place-pop 0.55s ease-out both;
}

.route-map-dot {
  position: absolute;
  z-index: 6;
  left: var(--place-x);
  top: var(--place-y);
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 4px solid #fff8e4;
  border-radius: 50%;
  color: #fffaf2;
  font-weight: 900;
  background: var(--accent);
  box-shadow: 0 7px 13px rgba(93, 42, 20, 0.25);
  transform: translate(-50%, -50%);
  animation: map-place-pop 0.55s ease-out both;
}

.route-map-label {
  position: absolute;
  z-index: 6;
  left: var(--place-x);
  top: var(--place-y);
  border: 1px solid rgba(111, 33, 25, 0.14);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: 0 5px 10px rgba(73, 36, 18, 0.12);
  transform: translate(var(--label-dx), var(--label-dy));
  animation: map-label-pop 0.55s ease-out both;
}

.route-map-avatar {
  position: absolute;
  z-index: 4;
  left: var(--to-x);
  top: var(--to-y);
  width: clamp(58px, 11vw, 126px);
  max-width: 15%;
  height: auto;
  filter: drop-shadow(0 10px 12px rgba(73, 36, 18, 0.26));
  transform: translate(-50%, -92%) scale(1);
  transform-origin: 50% 88%;
  pointer-events: none;
}

.route-map-avatar.is-appearing {
  animation: marker-appear 0.75s cubic-bezier(0.2, 0.95, 0.24, 1.2) both;
}

.route-map-avatar.is-moving {
  animation: marker-travel 1.05s cubic-bezier(0.2, 0.8, 0.24, 1) both;
}

.route-map-current {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  border: 1px solid rgba(111, 33, 25, 0.16);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--accent-dark);
  background: rgba(255, 250, 242, 0.9);
  box-shadow: 0 8px 18px rgba(75, 42, 20, 0.1);
}

.route-map-current strong {
  font-size: 18px;
}

.route-map-current span {
  color: var(--ink);
  line-height: 1.5;
}

@keyframes marker-appear {
  0% {
    opacity: 0;
    transform: translate(-50%, -92%) scale(0.36);
  }
  62% {
    opacity: 1;
    transform: translate(-50%, -106%) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -92%) scale(1);
  }
}

@keyframes marker-travel {
  0% {
    left: var(--from-x);
    top: var(--from-y);
    opacity: 0.9;
    transform: translate(-50%, -92%) scale(0.9);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -110%) scale(1.05);
  }
  100% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 1;
    transform: translate(-50%, -92%) scale(1);
  }
}

@keyframes route-line-in {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes map-place-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.72);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes map-label-pop {
  0% {
    opacity: 0;
    transform: translate(var(--label-dx), calc(var(--label-dy) + 8px)) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: translate(var(--label-dx), var(--label-dy)) scale(1);
  }
}

.scene-text {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  border: 1px solid rgba(169, 54, 39, 0.12);
  border-radius: 10px;
  padding: 16px;
  line-height: 1.9;
  background: #fffaf4;
}

.source-table-wrap {
  overflow-x: auto;
  margin: 2px 0;
}

.source-table-wrap table {
  min-width: 760px;
  margin: 0;
  font-size: 14px;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}

.record-card h4 {
  margin: 0 0 9px;
  color: var(--accent-dark);
  font-size: 17px;
}

.record-field {
  display: grid;
  grid-template-columns: minmax(74px, 0.22fr) 1fr;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  line-height: 1.75;
}

.record-field strong {
  color: var(--muted);
}

.text-block,
.quote-block {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.scene-list {
  margin: 0;
  padding: 10px 0 10px 24px;
  line-height: 1.9;
}

.scene-list li + li {
  margin-top: 4px;
}

.scene-divider {
  margin: 4px 0;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--accent-dark);
  font-weight: 800;
  background: #f3e2d5;
}

.quote-block {
  border-left: 5px solid rgba(47, 104, 72, 0.45);
  padding-left: 14px;
  color: #244c38;
}

.question-box {
  margin: 18px 0;
  border-left: 7px solid #d8927f;
  border-radius: 8px;
  padding: 18px 20px;
  color: var(--accent-dark);
  font-size: 21px;
  font-weight: 900;
  background: #fffdf8;
}

.question-kicker {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.choice-card {
  display: grid;
  min-height: 168px;
  align-content: space-between;
  gap: 16px;
  box-shadow: none;
}

.choice-card.selected {
  outline: 3px solid rgba(169, 54, 39, 0.22);
  background: #fff6ec;
}

.choice-card.disabled {
  opacity: 0.62;
}

.choice-title {
  margin-bottom: 0;
  font-size: 20px;
}

.choice-letter {
  color: var(--green);
}

.feedback {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
  align-items: stretch;
}

.feedback-card {
  border: 1px solid rgba(47, 104, 72, 0.2);
  border-radius: 12px;
  padding: 18px;
  line-height: 1.9;
  background: #f1f4ea;
}

.feedback-card h3 {
  margin-bottom: 12px;
  color: var(--accent-dark);
}

.feedback-card p {
  margin-bottom: 0;
}

.feedback-card p + p {
  margin-top: 10px;
}

.card p {
  white-space: pre-line;
}

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

.tag {
  border-radius: 999px;
  padding: 6px 10px;
  color: #fffaf2;
  font-size: 13px;
  font-weight: 700;
  background: var(--green);
}

.score-delta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
  font-weight: 800;
  color: var(--accent-dark);
}

.history-box {
  border-radius: 12px;
  padding: 18px;
  background: #fffdf8;
}

.history-box h3 {
  color: var(--accent-dark);
}

.history-box p {
  white-space: pre-line;
  line-height: 1.9;
}

.branch-card {
  border: 1px solid rgba(47, 104, 72, 0.22);
  border-radius: 12px;
  padding: 18px;
  background: #eef2e8;
}

.branch-facts {
  display: grid;
  gap: 10px;
  line-height: 1.9;
}

.branch-facts p {
  margin: 0;
  border-bottom: 1px dashed rgba(47, 104, 72, 0.18);
  padding-bottom: 10px;
}

.branch-card .choices-grid {
  margin-top: 16px;
}

.summary-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  border-radius: 14px;
  padding: 22px;
  color: #fff9f0;
  background:
    linear-gradient(135deg, rgba(85, 31, 22, 0.96), rgba(38, 73, 63, 0.92)),
    url("assets/huangchao/huangchao-q3-changan-retreat.webp") center / cover;
}

.summary-hero h2 {
  margin-bottom: 10px;
  font-size: clamp(1.9rem, 4vw, 3.1rem);
}

.summary-hero p {
  max-width: 720px;
  margin-bottom: 0;
  line-height: 1.8;
  color: rgba(255, 249, 240, 0.9);
}

.summary-kicker {
  margin-bottom: 6px;
  color: rgba(255, 231, 175, 0.92);
  font-size: 14px;
  font-weight: 800;
}

.summary-score-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  gap: 10px;
}

.score-pill {
  display: grid;
  min-width: 118px;
  border: 1px solid rgba(255, 248, 239, 0.22);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 248, 239, 0.13);
}

.score-pill span {
  font-size: 13px;
  font-weight: 800;
  opacity: 0.82;
}

.score-pill strong {
  margin-top: 2px;
  font-size: 42px;
  line-height: 1;
}

.score-pill small {
  color: rgba(255, 248, 239, 0.78);
}

.score-pill.secondary {
  background: rgba(44, 97, 85, 0.44);
}

.summary-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.summary-card {
  border: 1px solid rgba(47, 104, 72, 0.18);
  border-radius: 8px;
  padding: 18px;
  background: #fffdf8;
}

.summary-card-label {
  display: inline-flex;
  margin-bottom: 10px;
  border-radius: 999px;
  padding: 5px 10px;
  color: #fffaf2;
  font-size: 13px;
  font-weight: 800;
  background: var(--green);
}

.summary-card h3,
.summary-insight h3,
.summary-path-head h3 {
  margin-bottom: 10px;
  color: var(--accent-dark);
}

.summary-card ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.82;
}

.summary-insight {
  border: 1px solid rgba(169, 54, 39, 0.14);
  border-radius: 12px;
  padding: 18px 20px;
  background: #f8efe2;
}

.summary-insight p {
  margin: 0;
  white-space: pre-line;
  line-height: 1.85;
}

.summary-insight p + p {
  margin-top: 10px;
  border-top: 1px dashed rgba(169, 54, 39, 0.22);
  padding-top: 10px;
}

.summary-path-head {
  margin-top: 20px;
}

.route-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.route-list.refined {
  counter-reset: route;
  gap: 10px;
}

.route-item {
  position: relative;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: none;
}

.route-list.refined .route-item {
  border-left: 5px solid rgba(169, 54, 39, 0.58);
  background: #fffdf8;
}

.route-item:not(:last-child)::after {
  content: "↓";
  display: block;
  margin: 8px 0 -3px 8px;
  color: var(--accent-dark);
  font-weight: 900;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1220px);
    padding-top: 12px;
  }

  .hero,
  .top-bar,
  .intro-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    display: grid;
    padding: 22px;
  }

  .score-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

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

  .summary-hero,
  .summary-map {
    grid-template-columns: 1fr;
  }

  .summary-hero {
    padding: 18px;
  }

  .summary-score-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-pill strong {
    font-size: 34px;
  }

  .score-card {
    padding: 10px 12px;
  }

  .score-label {
    margin-bottom: 4px;
    font-size: 13px;
  }

  .score-number {
    font-size: 22px;
  }

  .route-map-avatar {
    width: clamp(44px, 14vw, 68px);
    max-width: 16%;
  }

  .route-map-scene {
    width: clamp(54px, 15vw, 76px);
  }

  .route-map-dot {
    width: 26px;
    height: 26px;
    border-width: 3px;
    font-size: 13px;
  }

  .route-map-label {
    padding: 2px 6px;
    font-size: 12px;
  }

  .route-map-lines line {
    stroke-width: 8;
  }

  .route-map-current {
    padding: 7px 9px;
  }

  .route-map-current strong {
    width: 100%;
    font-size: 15px;
  }

  .route-map-current span {
    font-size: 13px;
  }

  .meter {
    height: 6px;
    margin-top: 8px;
  }

  .kit {
    justify-self: stretch;
  }

  .kit-panel {
    left: 0;
    right: auto;
  }
}

