:root {
  color-scheme: dark;
  --bg: #111310;
  --panel: #1b1e1a;
  --panel-strong: #242820;
  --line: #363b31;
  --text: #f3f0e8;
  --muted: #a9aa9e;
  --soft: #d7d0bf;
  --accent: #d4a94e;
  --accent-strong: #f1c45d;
  --danger: #d5654f;
  --good: #77b981;
  --blue: #6aa6b8;
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(212, 169, 78, 0.08), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(106, 166, 184, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.title-band {
  min-height: 168px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 22px;
}

.eyebrow,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--soft);
  font-size: 18px;
  line-height: 1.7;
}

.system-stamp {
  flex: 0 0 auto;
  min-width: 168px;
  border: 1px solid var(--line);
  background: rgba(27, 30, 26, 0.82);
  padding: 14px 16px;
  box-shadow: 0 12px 30px var(--shadow);
}

.system-stamp span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.system-stamp strong {
  display: block;
  margin-top: 6px;
  color: var(--accent-strong);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(260px, 340px);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 30, 26, 0.94);
  box-shadow: 0 16px 34px var(--shadow);
}

.identity-panel,
.stats-panel,
.story-panel,
.log-panel {
  padding: 18px;
}

.story-panel {
  min-height: 560px;
}

.avatar-wrap {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid #55472f;
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(212, 169, 78, 0.24), rgba(106, 166, 184, 0.12)),
    var(--panel-strong);
  color: var(--accent-strong);
  font-weight: 800;
}

.profile-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.profile-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.profile-row dt {
  color: var(--muted);
  font-size: 13px;
}

.profile-row dd {
  margin: 0;
  color: var(--text);
}

.chapter-strip {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.chapter-pill {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 13px;
}

.chapter-pill.active {
  border-color: rgba(212, 169, 78, 0.78);
  color: var(--accent-strong);
  background: rgba(212, 169, 78, 0.08);
}

.story-topline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.story-body {
  min-height: 180px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151714;
  color: var(--soft);
  line-height: 1.85;
}

.story-body p:last-child {
  margin-bottom: 0;
}

.choice-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.choice-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 15px;
  background: var(--panel-strong);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.choice-card:hover {
  border-color: var(--accent);
  background: #2b2e25;
}

.choice-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-strong);
}

.choice-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.primary-action {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 16px 18px;
  background: var(--accent);
  color: #171510;
  cursor: pointer;
  font-weight: 800;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.primary-action.compact {
  width: auto;
  min-width: 128px;
  padding: 12px 14px;
}

.name-entry,
.seed-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-strong);
}

.name-entry label,
.seed-entry label {
  display: block;
  margin-bottom: 10px;
  color: var(--soft);
  font-size: 14px;
}

.name-entry-row,
.seed-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.name-entry input,
.seed-entry input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #10120f;
  color: var(--text);
  outline: none;
}

.name-entry input:focus,
.seed-entry input:focus {
  border-color: var(--accent);
}

.name-entry p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.pressure-box {
  margin-top: 16px;
  min-height: 60px;
  border-left: 3px solid var(--danger);
  padding: 12px 14px;
  background: rgba(213, 101, 79, 0.08);
  color: #e8c6be;
  line-height: 1.7;
}

.pressure-box:empty {
  display: none;
}

.section-title {
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
}

.stats-list {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.stat-row {
  display: grid;
  gap: 7px;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.meter {
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #10120f;
}

.meter-fill {
  height: 100%;
  width: 50%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.meter-fill.bad {
  background: var(--danger);
}

.meter-fill.good {
  background: var(--good);
}

.meter-fill.cold {
  background: var(--blue);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  margin-bottom: 20px;
}

.achievement-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  margin-bottom: 20px;
  padding-right: 4px;
}

.achievement {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #151714;
}

.achievement.unlocked {
  border-color: rgba(212, 169, 78, 0.78);
  background: rgba(212, 169, 78, 0.08);
}

.achievement.locked {
  opacity: 0.48;
}

.achievement strong {
  display: block;
  color: var(--accent-strong);
  font-size: 13px;
}

.achievement span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  background: #151714;
  color: var(--soft);
  font-size: 12px;
}

.ledger {
  display: grid;
  gap: 8px;
  color: var(--soft);
  font-size: 13px;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.log-panel {
  margin-top: 16px;
}

.life-log {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
  padding-left: 20px;
  color: var(--soft);
  line-height: 1.7;
}

.life-log li::marker {
  color: var(--accent);
}

.pollution-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.pollution-modal[hidden] {
  display: none;
}

.pollution-dialog {
  width: min(520px, 100%);
  border: 1px solid rgba(213, 101, 79, 0.78);
  border-radius: 8px;
  padding: 22px;
  background: #171914;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
}

.pollution-dialog h2 {
  margin-bottom: 12px;
  color: var(--danger);
}

.pollution-dialog p {
  color: var(--soft);
  line-height: 1.8;
}

.pollution-dialog .primary-action {
  margin-top: 10px;
}

.achievement-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 34;
  width: min(360px, calc(100vw - 36px));
  border: 1px solid rgba(212, 169, 78, 0.82);
  border-radius: 8px;
  padding: 13px 14px;
  background: #171914;
  color: var(--soft);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  line-height: 1.6;
}

.achievement-toast strong {
  display: block;
  color: var(--accent-strong);
}

.achievement-toast[hidden] {
  display: none;
}

@media (max-width: 1080px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .story-panel {
    min-height: auto;
  }

  .life-log {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 12px;
  }

  .title-band {
    display: block;
    min-height: 0;
  }

  .system-stamp {
    margin-top: 18px;
  }

  h1 {
    font-size: 44px;
  }

  .subtitle {
    font-size: 16px;
  }

  .name-entry-row,
  .seed-entry-row {
    grid-template-columns: 1fr;
  }

  .primary-action.compact {
    width: 100%;
  }
}
