:root {
  --bg: #f6f4ef;
  --ink: #1c2024;
  --muted: #68737d;
  --line: rgba(28, 32, 36, 0.12);
  --accent: #0f766e;
  --amber: #c97a22;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
}

button,
a {
  font: inherit;
}

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

.life-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.life-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 18px;
  align-items: center;
}

.back-link {
  color: var(--accent);
  font-weight: 720;
}

.life-header p {
  margin: 0 0 4px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

.life-header h1 {
  margin: 0;
  font-size: 2.35rem;
  line-height: 1;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 760;
}

.panel {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(16, 20, 23, 0.08);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.panel-heading span {
  color: var(--amber);
  font-weight: 820;
}

.panel-heading strong {
  color: var(--accent);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.result-actions button {
  min-height: 36px;
  padding: 0 12px;
  background: #13201e;
  color: #f7c66b;
}

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

.scenario-card {
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--ink);
  text-align: left;
}

.scenario-card.active {
  border-color: rgba(15, 118, 110, 0.55);
  background: #eff8f6;
}

.scenario-card strong,
.scenario-card small {
  display: block;
}

.scenario-card strong {
  font-size: 1.1rem;
}

.scenario-card small {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.choice-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.choice-row > span {
  font-weight: 800;
}

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

.segmented button {
  border: 1px solid rgba(15, 118, 110, 0.24);
  background: #fff;
  color: var(--accent);
}

.segmented button.active {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

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

.stat-row {
  display: grid;
  grid-template-columns: 1fr 42px 52px 42px;
  gap: 8px;
  align-items: center;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.stat-row span {
  font-weight: 760;
}

.stat-row strong {
  text-align: center;
  font-size: 1.2rem;
}

.stat-row button {
  min-height: 38px;
  padding: 0;
  background: #13201e;
  color: #f7c66b;
}

.start-button {
  width: 100%;
  margin-top: 18px;
}

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

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary[hidden] {
  display: none;
}

.summary-card {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.summary-card span,
.summary-card strong {
  display: block;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-card strong {
  margin-top: 8px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.timeline li {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.timeline .age {
  color: var(--accent);
  font-weight: 840;
}

.timeline .text {
  line-height: 1.75;
}

.timeline .meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline .ending {
  border-color: rgba(201, 122, 34, 0.5);
  background: #fff7e8;
}

@media (max-width: 980px) {
  .scenario-list,
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .life-header,
  .stats {
    grid-template-columns: 1fr;
  }

  .scenario-list,
  .summary,
  .choice-row {
    grid-template-columns: 1fr;
  }

  .timeline li {
    grid-template-columns: 1fr;
  }
}
