/* 人间重开 · H5 主站
   配色与小程序同源：米色纸面、朱砂主色、宋体感标题 */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #F5EFE3;
  color: #3B352E;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.app {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: #FBF6EC;
  box-shadow: 0 0 24px rgba(120, 90, 50, 0.12);
  display: flex;
  flex-direction: column;
}

.screen { display: flex; flex-direction: column; min-height: 100vh; }
.screen[hidden] { display: none; }

/* —— 顶栏 —— */
.topbar {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #F2E6D4;
  background: #FFFCF6;
}
.topbar-logo { font-size: 17px; font-weight: 700; letter-spacing: 2px; color: #B04A32; }

.page-body { padding: 16px 16px 32px; }

/* —— 出生登记 —— */
.birth-head { padding: 26px 4px 16px; text-align: center; }
.birth-kicker { font-size: 12px; color: #A2937E; letter-spacing: 4px; }
.birth-title { font-size: 26px; font-weight: 700; margin-top: 6px; color: #2E2A24; }

.birth-card {
  background: #FFFDF8;
  border: 1px solid #EFE3CE;
  border-radius: 12px;
  padding: 16px 14px;
  box-shadow: 0 6px 16px rgba(150, 120, 70, 0.08);
}
.birth-row { display: flex; justify-content: space-between; padding: 7px 2px; border-bottom: 1px dashed #F0E4CF; font-size: 14px; }
.birth-row:last-child { border-bottom: none; }
.birth-row .k { color: #A2937E; flex-shrink: 0; margin-right: 12px; }
.birth-row .v { text-align: right; color: #3B352E; flex: 1; }
.birth-row .v.dim { color: #8A7963; font-size: 13px; }

.birth-note { margin: 14px 6px; font-size: 12px; color: #A2937E; line-height: 1.7; }

.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.btn-main {
  background: linear-gradient(135deg, #D9603F, #C64A2E);
  color: #fff; border: none; border-radius: 24px;
  font-size: 17px; font-weight: 600; padding: 12px 0; cursor: pointer;
}
.btn-ghost {
  background: transparent; color: #8A7963;
  border: 1px solid #EADCC6; border-radius: 24px;
  font-size: 15px; padding: 11px 0; cursor: pointer;
}
.btn-main:active, .btn-ghost:active { opacity: 0.85; }

.past-lives { margin-top: 26px; }
.past-title { font-size: 12px; color: #A2937E; padding: 4px; }
.past-item { display: flex; justify-content: space-between; padding: 9px 4px; border-bottom: 1px dashed #F0E4CF; font-size: 13px; color: #6B5F4E; }
.past-item .r { color: #A2937E; }

/* —— 人生页 —— */
.hud { padding: 12px 16px 10px; background: linear-gradient(180deg, #FFFCF6, #FDF6EA); border-bottom: 1px solid #F2E6D4; }
.hud-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who-name { font-size: 18px; font-weight: 700; color: #2E2A24; }
.who-meta { font-size: 11px; color: #A2937E; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wealth { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.money { font-size: 15px; font-weight: 700; color: #B04A32; }
.job { font-size: 11px; color: #A2937E; }

.stats { display: flex; gap: 8px; margin-top: 10px; }
.stat { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.stat-label { font-size: 11px; color: #A2937E; display: flex; justify-content: space-between; }
.bar { height: 5px; background: #F0E4CF; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.bar-fill.hp { background: #C97B5A; }
.bar-fill.ppy { background: #D8A24A; }
.bar-fill.sm { background: #7E9CC4; }
.bar-fill.so { background: #8FAE8B; }

/* —— 合影条：永远一行，可横向拖 —— */
.cast-wrap { position: relative; padding: 8px 12px 6px; background: linear-gradient(180deg, #FFFCF6, #FDF6EA); border-bottom: 1px solid #F2E6D4; }
.cast { overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; }
.cast::-webkit-scrollbar { display: none; }
.cast-inner { display: inline-flex; align-items: flex-end; justify-content: center; min-width: 100%; padding: 2px 20px 2px 3px; }
.cast-wrap::after {
  content: ''; position: absolute; right: 0; top: 6px; bottom: 3px; width: 22px;
  pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, rgba(253,246,234,0) 0%, rgba(253,246,234,0.9) 55%, #FDF6EA 100%);
}
.cast-item { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; margin: 0 4px; cursor: pointer; }
.cast-stage { position: relative; }
.cast-stage .fig { position: absolute; left: 0; top: 0; }
.cast-badge {
  position: absolute; right: -6px; top: -7px;
  min-width: 14px; height: 14px; line-height: 14px;
  border-radius: 7px; text-align: center;
  font-size: 9px; color: #fff; box-shadow: 0 0 0 1.5px #FDF8EF;
}
.cast-label { margin-top: 2px; font-size: 10px; color: #8A7963; max-width: 52px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cast-label.cast-dead { color: #B3A594; }
.cast-more-box {
  width: 28px; height: 28px; line-height: 24px; margin: 3px 0 5px;
  border: 1px dashed #D8C7AC; border-radius: 50%;
  text-align: center; font-size: 10px; color: #A2937E;
}
.bubble {
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%);
  max-width: 300px; padding: 8px 18px;
  background: #FFF6E3; border: 1px solid #EFDCBC; border-radius: 18px;
  font-size: 13px; color: #7A5A2A; box-shadow: 0 4px 10px rgba(150,120,70,0.15);
  z-index: 30;
}

/* —— 年表 —— */
.feed { flex: 1; overflow-y: auto; padding: 12px 12px 90px; }
.card-item { display: flex; gap: 10px; margin-bottom: 12px; }
.node { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; padding-top: 3px; }
.node-age {
  width: 34px; height: 34px; border-radius: 50%;
  background: #FFFDF8; border: 1px solid #E8D8BF;
  font-size: 11px; color: #6B5F4E; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.card-body { flex: 1; min-width: 0; background: #FFFDF8; border-radius: 10px; padding: 10px 12px; box-shadow: 0 2px 8px rgba(150,120,70,0.06); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.card-year { font-size: 11px; color: #A2937E; }
.card-tag { font-size: 11px; padding: 1px 8px; border-radius: 8px; }
.tag-good .card-tag, .card-tag.t-good { background: #EAF2E4; color: #5E7B4F; }
.tag-bad .card-tag, .card-tag.t-bad { background: #F7E7DC; color: #B05A3A; }
.tag-death .card-tag, .card-tag.t-death { background: #EFEAE2; color: #7A6A55; }
.tag-choice .card-tag, .card-tag.t-choice { background: #EAE4F2; color: #7B5FA0; }
.tag-thought .card-tag, .card-tag.t-thought { background: #F2ECE0; color: #A08B62; }
.tag-obituary .card-tag { background: #EFEAE2; color: #8A7963; }
.tag-info .card-tag, .card-tag.t-info { background: #E7EDF2; color: #55708C; }
.card-tag.t-neutral, .tag-neutral .card-tag { background: #F2ECE0; color: #A2937E; }
.card-line { font-size: 14px; line-height: 1.7; color: #3B352E; }
.card-line + .card-line { margin-top: 4px; }
.card-thought { margin-top: 6px; font-size: 13px; color: #9A8460; font-style: italic; }
.card-mech { margin-top: 6px; font-size: 12px; color: #A2937E; background: #FAF3E6; border-radius: 6px; padding: 4px 8px; }

/* —— 控制条 —— */
.controls {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 252, 246, 0.94); border-top: 1px solid #F2E6D4;
  backdrop-filter: blur(6px); z-index: 20;
}
.speeds { display: flex; gap: 6px; }
.speed {
  background: #FFFDF8; border: 1px solid #EADCC6; color: #8A7963;
  border-radius: 14px; font-size: 12px; padding: 5px 10px; cursor: pointer;
}
.speed.active { background: #D9603F; border-color: #D9603F; color: #fff; }
.auto-btn {
  background: #2E2A24; color: #FDF6EA; border: none; border-radius: 18px;
  font-size: 13px; padding: 8px 16px; cursor: pointer;
}
.auto-btn.on { background: #B04A32; }

/* —— 弹窗 —— */
.mask {
  position: fixed; inset: 0; background: rgba(40, 32, 24, 0.5);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.mask[hidden] { display: none; }
.modal {
  width: 100%; max-width: 430px;
  background: #FFFDF8; border-radius: 18px 18px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
}
.modal-kicker { font-size: 12px; color: #B04A32; letter-spacing: 2px; }
.modal-title { font-size: 19px; font-weight: 700; color: #2E2A24; }
.modal-desc { font-size: 14px; color: #6B5F4E; line-height: 1.7; }
.modal-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.opt-btn {
  background: #FBF6EC; border: 1px solid #EADCC6; border-radius: 12px;
  font-size: 15px; color: #3B352E; padding: 12px 14px; text-align: left; cursor: pointer; line-height: 1.5;
}
.opt-btn:active { background: #F5E9D6; }
.ms-input {
  width: 100%; border: 1px solid #EADCC6; border-radius: 10px;
  background: #FBF6EC; padding: 10px; font-size: 14px; color: #3B352E;
  resize: none; font-family: inherit;
}

/* —— 终局 —— */
.ending-head { text-align: center; padding: 30px 4px 8px; }
.ending-rare { font-size: 12px; color: #B08A3C; letter-spacing: 3px; }
.ending-title { font-size: 28px; font-weight: 700; color: #2E2A24; margin-top: 8px; }
.ending-desc { font-size: 14px; color: #6B5F4E; margin-top: 8px; line-height: 1.7; }

.card { background: #FFFDF8; border: 1px solid #EFE3CE; border-radius: 12px; padding: 14px; margin-top: 14px; }
.stat-lines { font-size: 14px; line-height: 1.9; color: #3B352E; }
.map { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 10px; }
.map i { width: 10px; height: 10px; border-radius: 2px; display: block; }
.map-note { font-size: 11px; color: #A2937E; margin-top: 8px; }

.m1 { background: #E8DFCE; } .m2 { background: #E3D3B2; } .m3 { background: #E4C88F; }
.m4 { background: #D9B06A; } .m5 { background: #C98F45; }

.hl-title { font-size: 13px; color: #A2937E; margin-bottom: 8px; letter-spacing: 2px; }
.hl-item { font-size: 14px; line-height: 1.8; color: #4A4336; padding: 4px 0; border-bottom: 1px dashed #F0E4CF; }
.hl-item:last-child { border-bottom: none; }
.hl-item .hl-age { color: #B04A32; font-weight: 600; margin-right: 8px; }

.share-canvas { width: 100%; border-radius: 12px; margin-top: 14px; box-shadow: 0 6px 16px rgba(150,120,70,0.12); display: block; }
