:root {
  --bg: #100e0c;
  --bg2: #181410;
  --card: #1f1a15;
  --line: #3a3228;
  --text: #efe6d6;
  --muted: #9a8d7a;
  --accent: #d06a2e;
  --accent2: #e8b86a;
  --danger: #c4453c;
  --ok: #7d9a68;
  --chip: #2a241c;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body {
  min-height: 100dvh;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }

#app {
  width: min(430px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(208, 106, 46, 0.16), transparent 50%),
    linear-gradient(180deg, #16120e 0%, var(--bg) 40%);
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-t)) 14px calc(16px + var(--safe-b));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 10px;
}
.brand {
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--accent2);
  text-transform: none;
}
.daychip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 999px;
}
.beats {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.beats span {
  font-size: 11px;
  color: var(--muted);
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.beats span.on {
  color: var(--accent2);
  border-color: #5a4630;
  background: #2a2118;
}

.resbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.resbar .chip {
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--muted);
}
.resbar .chip b { color: var(--text); font-weight: 600; }
.resbar .chip.low { border-color: #6a2e28; color: #e09a90; }
.resbar .chip.low b { color: #ffd0c8; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.kicker {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
h1, h2 {
  font-weight: 650;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}
h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 20px; line-height: 1.35; }
.prose {
  font-size: 16px;
  line-height: 1.75;
  color: #f3eadc;
  flex: 1;
}
.prose p { margin: 0 0 0.8em; }
.prose p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; }
.tagline {
  color: var(--accent2);
  font-size: 15px;
  line-height: 1.65;
  margin: 8px 0 18px;
}

.grid {
  display: grid;
  gap: 10px;
}
.scene-btn, .act, .choice, .primary, .ghost, .adbtn {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 13px 14px;
  min-height: 48px;
  border: 1px solid var(--line);
}
.scene-btn, .act, .choice {
  background: #2a241c;
}
.scene-btn:active, .act:active, .choice:active, .primary:active {
  transform: translateY(1px);
}
.scene-btn strong, .act strong { display: block; font-size: 16px; margin-bottom: 4px; }
.scene-btn span, .act span, .sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.5; }
.choice { font-size: 15px; line-height: 1.5; }
.choice .hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent2);
}

.primary {
  background: var(--accent);
  color: #1a1008;
  font-weight: 700;
  text-align: center;
  border-color: #e0894a;
}
.ghost {
  text-align: center;
  background: transparent;
  color: var(--text);
}
.adbtn {
  text-align: center;
  font-size: 13px;
  color: var(--accent2);
  background: #2a2116;
  border-style: dashed;
}
.actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.statlist {
  display: grid;
  gap: 8px;
  margin: 8px 0 4px;
}
.statlist div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #2d271f;
}
.statlist b { font-weight: 600; }
.bar {
  height: 6px;
  background: #2c261e;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.gen {
  text-align: center;
  padding-top: 48px;
}
.dots::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "·"; }
  50% { content: "··"; }
  75% { content: "···"; }
}

.report dt { color: var(--muted); font-size: 12px; margin-top: 10px; }
.report dd { margin: 2px 0 0; font-size: 16px; }
.pct {
  margin: 16px 0 8px;
  font-size: 22px;
  color: var(--accent2);
}

.footnote {
  margin-top: 10px;
  font-size: 11px;
  color: #6f6658;
  text-align: center;
}

.hidden { display: none !important; }

body.mood-cold { --accent: #6a8ea8; --accent2: #b7c9d6; }
body.mood-rain { --accent: #4e8f86; --accent2: #9fd0c6; }
body.mood-zombie { --accent: #8a9a4e; --accent2: #c5d48a; }
