:root {
  --bg: #f6f5f0;
  --card: #ffffff;
  --accent: #8b1e2f;
  --text: #222222;
  --muted: #666666;
  --border: #e0ddd5;
  --callout-bg: #e3f0ec;
  --callout-border: #1e6b52;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Serif SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  max-width: 540px;
  margin: 0 auto;
  padding-bottom: 60px;
}
header {
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.container { padding: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
h1 { font-size: 26px; margin-bottom: 8px; }
h2 { font-size: 18px; margin-bottom: 10px; }
.subtitle { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 14px;
}
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafafa;
  font-size: 13px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
  font-size: 13px;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.stat-val { font-weight: bold; font-size: 14px; margin-top: 2px; }
.callout {
  background: var(--callout-bg);
  border-left: 4px solid var(--callout-border);
  padding: 10px 12px;
  font-size: 12px;
  color: #1b4332;
  margin: 12px 0;
}
.primary-btn {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 2px 5px rgba(139,30,47,0.22);
}
.primary-btn:hover { background: #701523; }
.secondary-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  margin-top: 8px;
}

.time-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.age-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.age-num { font-size: 28px; font-weight: bold; }
.progress-wrap {
  height: 4px;
  background: #ddd;
  width: 100%;
  margin-bottom: 8px;
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}
.controls { display: flex; gap: 4px; }
.ctrl-btn {
  flex: 1;
  padding: 7px 0;
  font-size: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  border-radius: 3px;
}
.ctrl-btn.active {
  background: #222;
  color: #fff;
  border-color: #222;
  font-weight: bold;
}

.scene-banner {
  height: 110px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid #ccc;
}
.scene-sky {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 22px;
}
.scene-figures {
  font-size: 26px;
  letter-spacing: 4px;
  z-index: 2;
}
.scene-ground {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: left;
}
.bar-bg {
  height: 5px;
  background: #eee;
  margin-top: 4px;
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }

.tag-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  background: #f0ece1;
  border: 1px solid #d8d2c5;
  border-radius: 12px;
  margin-right: 4px;
  margin-top: 4px;
  color: #554;
}

.log-item {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  display: flex;
  gap: 12px;
}
.log-age {
  font-size: 12px;
  color: var(--muted);
  min-width: 48px;
  font-weight: bold;
  padding-top: 2px;
}
.log-body { flex: 1; }
.log-data {
  margin-top: 5px;
  font-size: 12px;
  color: #444;
  background: #f4f4f0;
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 3px solid #999;
}

.lifemap-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.lifemap-cell {
  aspect-ratio: 1;
  border: 1px solid #e0ddd5;
  border-radius: 2px;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  background: #faf9f6;
}
.lifemap-cell.lived {
  background: #8b1e2f;
  color: #fff;
  border-color: #8b1e2f;
}
.lifemap-cell.current {
  background: #e09f3e;
  color: #fff;
  font-weight: bold;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal {
  background: #fff;
  max-width: 460px;
  width: 100%;
  border-radius: 8px;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid var(--border);
  background: #f9f9f9;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}
.choice-btn:hover:not(:disabled) { background: #f0ece1; border-color: var(--accent); }
.choice-btn:disabled { opacity: 0.45; cursor: not-allowed; }
textarea {
  width: 100%;
  height: 80px;
  padding: 8px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
}
