:root {
  color-scheme: dark;
  --bg: #11100f;
  --paper: #ebe5dc;
  --paper-soft: #d8d0c6;
  --ink: #f6f1e8;
  --muted: #aaa197;
  --line: rgba(246, 241, 232, 0.14);
  --panel: rgba(24, 23, 21, 0.84);
  --panel-solid: #191817;
  --accent: #b9965f;
  --accent-strong: #e3bf7a;
  --olive: #879071;
  --danger: #ce7162;
  --ok: #94aa7a;
  --radius: 8px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top left, rgba(185, 150, 95, 0.12), transparent 28rem),
    linear-gradient(135deg, #11100f, #25231f 58%, #d5c8b6 58%, #d5c8b6);
  color: var(--ink);
  letter-spacing: 0;
}

button {
  border: 0;
  font: inherit;
}

.app-shell {
  width: min(100%, 440px);
  min-height: 100svh;
  margin: 0 auto;
  background:
    linear-gradient(rgba(17, 16, 15, 0.82), rgba(17, 16, 15, 0.96)),
    url("./assets/hero-office.png") center / cover no-repeat;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.36);
  position: relative;
  overflow: hidden;
}

.home-shell {
  background:
    linear-gradient(180deg, rgba(17, 16, 15, 0.2) 0%, rgba(17, 16, 15, 0.72) 54%, rgba(17, 16, 15, 0.98) 100%),
    url("./assets/hero-office.png") center / cover no-repeat;
}

.home-screen,
.page-screen,
.game-screen {
  min-height: 100svh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
}

.home-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.top-mark {
  display: grid;
  gap: 6px;
  font-size: 15px;
  color: rgba(246, 241, 232, 0.82);
}

.top-mark strong {
  font-size: 17px;
  font-weight: 650;
}

.top-mark span {
  color: var(--accent-strong);
  font-size: 12px;
}

.home-copy {
  align-self: end;
  padding-bottom: 36px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

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

h1 {
  max-width: 100%;
  margin-bottom: 22px;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 740;
}

h2 {
  text-wrap: balance;
  margin-bottom: 18px;
  font-size: 28px;
  line-height: 1.18;
  font-weight: 720;
}

h3 {
  text-wrap: balance;
  margin-bottom: 10px;
  font-size: 24px;
}

.subtitle {
  margin-bottom: 8px;
  color: rgba(246, 241, 232, 0.78);
  font-size: 17px;
  line-height: 1.55;
}

.home-actions {
  display: grid;
  gap: 14px;
}

.primary-button,
.ghost-button {
  min-height: 52px;
  border-radius: var(--radius);
  padding: 0 18px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.primary-button {
  background: var(--accent);
  color: #16130e;
  font-weight: 760;
}

.primary-button:active,
.ghost-button:active,
.option-button:active,
.choice-button:active {
  transform: scale(0.985);
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button.compact {
  min-width: 132px;
}

.primary-button.wide,
.ghost-button.wide {
  width: 100%;
}

.ghost-button {
  background: rgba(246, 241, 232, 0.05);
  color: var(--ink);
  border: 1px solid var(--line);
}

.fineprint {
  margin: 0;
  color: rgba(246, 241, 232, 0.52);
  font-size: 12px;
  line-height: 1.5;
}

.page-screen,
.game-screen {
  display: grid;
  align-content: start;
  gap: 18px;
  background: rgba(17, 16, 15, 0.76);
  backdrop-filter: blur(10px);
}

.progress-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  background: rgba(246, 241, 232, 0.14);
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

.question-card,
.profile-report,
.event-card,
.result-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.question-card {
  padding: 22px;
}

.option-list,
.choice-list {
  display: grid;
  gap: 10px;
}

.option-button {
  display: grid;
  grid-template-columns: 1fr 16px;
  align-items: center;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid rgba(246, 241, 232, 0.12);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.option-button.is-selected {
  border-color: rgba(227, 191, 122, 0.72);
  background: rgba(185, 150, 95, 0.14);
}

.option-dot {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(246, 241, 232, 0.38);
  border-radius: 999px;
}

.option-button.is-selected .option-dot {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.bottom-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

.section-heading {
  padding-top: 6px;
}

.profile-report,
.result-panel {
  padding: 22px;
}

.profile-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--paper-soft);
}

.profile-line span,
.score-row span {
  border: 1px solid rgba(246, 241, 232, 0.12);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(246, 241, 232, 0.045);
  font-size: 13px;
}

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

.metric {
  min-height: 86px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(246, 241, 232, 0.1);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metric-priority {
  min-height: 98px;
  border-color: rgba(227, 191, 122, 0.34);
  background: rgba(185, 150, 95, 0.12);
}

.metric-priority strong {
  color: var(--accent-strong);
  font-size: 24px;
}

.cost-breakdown {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(246, 241, 232, 0.1);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.035);
}

.cost-title,
.cost-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}

.cost-title {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(246, 241, 232, 0.09);
}

.cost-title span,
.cost-row span {
  color: var(--muted);
  font-size: 13px;
}

.cost-title strong,
.cost-row strong {
  color: var(--paper-soft);
  font-size: 14px;
}

.cost-breakdown p {
  margin: 4px 0 0;
  color: rgba(246, 241, 232, 0.5);
  font-size: 12px;
  line-height: 1.55;
}

.stress-line {
  margin-top: 16px;
  color: rgba(246, 241, 232, 0.66);
  font-size: 14px;
  line-height: 1.6;
}

.stress-line.in-game {
  margin-top: 0;
  padding: 0 4px;
}

.status-bar {
  position: relative;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 17, 16, 0.9);
  backdrop-filter: blur(14px);
}

.status-chapter {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.status-chapter span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.status-chapter small {
  color: var(--muted);
  font-size: 12px;
}

.status-primary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 10px;
}

.status-primary div {
  min-height: 74px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(185, 150, 95, 0.13);
  border: 1px solid rgba(227, 191, 122, 0.26);
}

.status-primary span,
.pending-cash span {
  color: var(--muted);
  font-size: 12px;
}

.status-primary strong {
  color: var(--accent-strong);
  font-size: 26px;
  line-height: 1;
  white-space: nowrap;
}

.pending-cash {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed rgba(227, 191, 122, 0.35);
  border-radius: var(--radius);
  background: rgba(227, 191, 122, 0.06);
}

.pending-cash strong {
  color: var(--paper-soft);
  font-size: 16px;
}

.cashflow-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 2px;
}

.cashflow-mini span,
.cashflow-mini strong {
  min-width: 0;
  color: rgba(246, 241, 232, 0.58);
  font-size: 11px;
  line-height: 1.35;
}

.cashflow-mini strong {
  color: var(--paper-soft);
  font-weight: 760;
}

.status-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.status-stats span {
  color: rgba(246, 241, 232, 0.58);
  font-size: 11px;
  white-space: nowrap;
}

.event-card {
  padding: 22px;
}

.segment-time {
  display: inline-flex;
  width: fit-content;
  margin: -4px 0 16px;
  padding: 6px 10px;
  border: 1px solid rgba(227, 191, 122, 0.28);
  border-radius: 999px;
  background: rgba(185, 150, 95, 0.09);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.story-lines {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.story-lines p {
  margin: 0;
  color: rgba(246, 241, 232, 0.82);
  font-size: 16px;
  line-height: 1.65;
  animation: storyIn 520ms ease both;
  animation-delay: calc(var(--i) * 70ms);
}

.event-notice {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 20px 0;
  padding: 15px;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(185, 150, 95, 0.1);
}

.event-notice span {
  color: var(--muted);
  font-size: 13px;
}

.event-notice strong {
  font-size: 24px;
}

.choice-button {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid rgba(246, 241, 232, 0.13);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.052);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.choice-button span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(227, 191, 122, 0.46);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 13px;
}

.choice-button strong {
  font-size: 15px;
  line-height: 1.45;
}

.choice-result,
.entry-result {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.entry-gate {
  align-self: start;
}

.entry-amount {
  padding: 18px 0 4px;
  color: var(--accent-strong);
  font-size: 46px;
  font-weight: 790;
  line-height: 1;
}

.survival-shift {
  display: grid;
  gap: 8px;
  margin: 10px 0 20px;
  padding: 15px;
  border: 1px solid rgba(227, 191, 122, 0.3);
  border-radius: var(--radius);
  background: rgba(185, 150, 95, 0.1);
}

.survival-shift span {
  color: var(--muted);
  font-size: 13px;
}

.survival-shift strong {
  color: var(--ink);
  font-size: 24px;
}

.entry-result > span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.result-narrative {
  display: grid;
  gap: 6px;
}

.result-narrative p,
.result-panel p {
  margin: 0;
  color: rgba(246, 241, 232, 0.78);
  font-size: 15px;
  line-height: 1.7;
}

.delta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.delta-list span {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  animation: deltaPop 520ms ease both;
}

.delta-list .is-positive {
  background: rgba(148, 170, 122, 0.14);
  color: #c8dda9;
}

.delta-list .is-negative {
  background: rgba(206, 113, 98, 0.14);
  color: #e5a39a;
}

.positive-cashflow {
  padding: 12px 14px;
  border: 1px solid rgba(148, 170, 122, 0.34);
  border-radius: var(--radius);
  background: rgba(148, 170, 122, 0.13);
  color: #d3e7b7;
  font-size: 14px;
  line-height: 1.55;
}

.result-screen {
  gap: 14px;
}

.cashflow-panel {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.cashflow-panel div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  padding: 12px 14px;
  border: 1px solid rgba(246, 241, 232, 0.1);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.04);
}

.cashflow-panel span {
  color: var(--muted);
  font-size: 13px;
}

.cashflow-panel strong {
  color: var(--paper-soft);
  font-size: 17px;
}

.cashflow-panel .is-positive {
  border-color: rgba(148, 170, 122, 0.34);
  background: rgba(148, 170, 122, 0.12);
}

.cashflow-panel .is-positive strong {
  color: #d3e7b7;
}

.cashflow-panel .is-negative {
  border-color: rgba(206, 113, 98, 0.24);
  background: rgba(206, 113, 98, 0.08);
}

.cashflow-panel .is-negative strong {
  color: #e5a39a;
}

.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(246, 241, 232, 0.1);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.04);
}

.timeline-item span {
  color: var(--accent-strong);
  font-size: 12px;
}

.timeline-item strong {
  font-size: 14px;
}

.cashflow-mini span b {
  display: block;
  color: var(--paper-soft);
  font-size: 13px;
  font-weight: 500;
  margin-top: 3px;
}
.cashflow-mini > strong {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  font-size: 12px;
}
.cashflow-mini .cashflow-positive { color: #c8dda9; }
.entry-gate .primary-button { margin-top: 20px; }
.entry-gate .positive-cashflow { margin-top: 16px; }
.result-panel > .positive-cashflow { margin-top: 16px; }
.report-ledger { margin-top: 18px; }
.report-ledger > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.report-ledger span { color: var(--muted); }
.report-ledger strong { text-align: right; }
.result-panel .quality-note { margin-top: 20px; }
.result-panel .ending-variant { color: var(--accent-strong); margin-bottom: 14px; }
.result-panel .report-note { margin-top: 12px; font-size: 12px; }
.replay-section { padding-top: 12px; }
.replay-section h3 { font-size: 18px; }
.timeline-item { padding-top: 10px; padding-bottom: 10px; }
.result-panel h3 { font-size: 25px; line-height: 1.4; }
button:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
@media (max-width: 360px) {
  h1 { font-size: 30px; }
  h2 { font-size: 25px; }
  .status-primary strong { font-size: 21px; }
  .status-primary div { padding: 9px; }
  .profile-report, .result-panel, .event-card { padding: 17px; }
  .cashflow-panel div { flex-wrap: wrap; gap: 6px; }
  .entry-amount { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@keyframes storyIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes deltaPop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 700px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100svh - 48px);
    border-radius: 18px;
  }

  .home-screen,
  .page-screen,
  .game-screen {
    min-height: calc(100svh - 48px);
  }
}
