/* 《人间回响》 —— 暖纸、金线、柔光。画面靠明亮的纸色和留白，不靠整屏压暗。 */
:root {
  --paper: #f8f1e4;
  --paper-2: #f0e5d0;
  --paper-3: #e6d6b8;
  --ink: #3b2e25;
  --ink-2: #6e5b4b;
  --ink-3: #9a8571;
  --gold: #b98636;
  --gold-2: #e2bb6c;
  --gold-3: #f6dfa6;
  --teal: #4d8689;
  --rose: #c96f5f;
  --hl: #d4675b;
  --joy: #e0a63c;
  --wis: #4f87ad;
  --bond: #c2719b;
  --money: #6d9a5a;
  --glass: rgba(251, 246, 236, 0.84);
  --glass-2: rgba(251, 246, 236, 0.94);
  --line: rgba(185, 134, 54, 0.32);
  --shadow: 0 18px 50px -18px rgba(90, 58, 24, 0.38), 0 2px 8px rgba(90, 58, 24, 0.08);
  --r: 16px;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --display: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  --brush: "Ma Shan Zheng", "ZCOOL XiaoWei", "Noto Serif SC", serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img { display: block; }
.muted { color: var(--ink-3); }

/* ---------------------------------------------------------- 背景 */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: radial-gradient(120% 90% at 50% 20%, #fff6e3, #ecdcbf); }
.bg-img { position: absolute; inset: -3%; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.6s ease; animation: kenburns 40s ease-in-out infinite alternate; }
.bg-img.on { opacity: 1; }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.09) translate(-1.2%, -0.8%); } }
.bg::after { /* 纸色柔边，不压暗 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 100% at 50% 45%, transparent 55%, rgba(248, 241, 228, 0.55) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.35 0 0 0 0 0.2 0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body.in-game .bg::after { background: radial-gradient(120% 100% at 50% 40%, rgba(248, 241, 228, 0.1) 30%, rgba(248, 241, 228, 0.62) 100%); }
#motes { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.mote { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 236, 180, 0.95), rgba(255, 210, 120, 0) 70%); animation: rise linear infinite; }
@keyframes rise { from { transform: translateY(0) translateX(0); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 0.8; } to { transform: translateY(-110vh) translateX(40px); opacity: 0; } }

/* ---------------------------------------------------------- 屏幕 */
.screen { position: fixed; inset: 0; z-index: 2; display: none; }
.screen.on { display: flex; animation: fadein 0.7s var(--ease); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.panel { background: var(--glass); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }

.primary, .ghost, .chip-btn {
  border-radius: 999px; padding: 11px 26px; font-weight: 600; letter-spacing: 0.08em; transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
}
.primary { color: #fffaf0; background: linear-gradient(180deg, #d2a250, #a87428); box-shadow: 0 6px 18px -6px rgba(150, 100, 30, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -8px rgba(150, 100, 30, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.primary:disabled { filter: grayscale(0.7); opacity: 0.55; transform: none; cursor: default; }
.ghost { border: 1px solid var(--line); background: rgba(255, 252, 245, 0.6); }
.ghost:hover { background: rgba(255, 252, 245, 0.95); }
.ghost:disabled { opacity: 0.4; cursor: default; }

/* ---------------------------------------------------------- 标题 */
#s-title { align-items: center; justify-content: center; }
.title-wrap { text-align: center; margin-top: -6vh; }
.logo { font-family: var(--brush); font-weight: 400; font-size: clamp(72px, 12vw, 168px); margin: 0; letter-spacing: 0.06em; line-height: 1; color: #fffaf0;
  text-shadow: 0 2px 0 rgba(150, 95, 25, 0.35), 0 0 30px rgba(255, 220, 150, 0.9), 0 0 80px rgba(255, 190, 100, 0.6), 0 8px 40px rgba(120, 70, 20, 0.45); }
.logo span { display: inline-block; animation: logoin 1.6s var(--ease) both; }
.logo span:nth-child(2) { animation-delay: 0.25s; }
@keyframes logoin { from { opacity: 0; transform: translateY(24px); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
.tagline { font-size: clamp(15px, 1.6vw, 20px); letter-spacing: 0.6em; color: #fff8ea; margin: 18px 0 38px; text-shadow: 0 1px 12px rgba(110, 60, 10, 0.7); animation: logoin 1.6s 0.6s var(--ease) both; }
.menu { display: flex; flex-direction: column; gap: 12px; align-items: center; animation: logoin 1.2s 0.9s var(--ease) both; }
.menu button { min-width: 240px; padding: 13px 30px; border-radius: 999px; font-size: 17px; letter-spacing: 0.2em; background: rgba(255, 250, 240, 0.78); border: 1px solid rgba(255, 255, 255, 0.7); box-shadow: 0 8px 26px -12px rgba(110, 70, 20, 0.6); backdrop-filter: blur(8px); transition: all 0.25s var(--ease); }
.menu button:hover { background: #fffaf0; transform: translateY(-2px) scale(1.02); }
.menu button.primary { background: linear-gradient(180deg, #d9ab58, #ac7a2c); color: #fffaf0; border-color: rgba(255, 230, 170, 0.8); }
.title-meta { margin-top: 26px; color: #fff8ea; font-size: 14px; letter-spacing: 0.15em; text-shadow: 0 1px 8px rgba(100, 60, 10, 0.8); }

/* ---------------------------------------------------------- 选国家 */
#s-setup, #s-tree, #s-album, #s-loom { align-items: center; justify-content: center; padding: 24px; }
.panel.setup, .panel.wide { width: min(1180px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.ph { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.ph h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 30px; letter-spacing: 0.2em; }
.ph .back { justify-self: start; padding: 8px 18px; }
.ph .right { justify-self: end; color: var(--ink-2); }
.pf { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); gap: 12px; }
.setup-body { overflow: auto; padding: 20px 22px; }
.sub { margin: 22px 0 10px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.15em; }
.lottery { display: flex; gap: 18px; align-items: center; padding: 18px 22px; border-radius: 14px; border: 1.5px solid var(--line); background: linear-gradient(110deg, rgba(255, 244, 214, 0.9), rgba(255, 252, 244, 0.7)); cursor: pointer; transition: all 0.25s; }
.lottery h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: 0.15em; }
.lottery p { margin: 0; color: var(--ink-2); font-size: 14px; }
.lottery.sel, .ccard.sel, .era.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(226, 187, 108, 0.45), 0 10px 30px -14px rgba(150, 100, 30, 0.6); }
.lot-orb { width: 54px; height: 54px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff7dc, #f0c66e 45%, #b47c2c); box-shadow: 0 0 24px rgba(240, 190, 90, 0.8); animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 38px rgba(240, 190, 90, 1); } }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ccard { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.7); cursor: pointer; transition: all 0.2s; }
.ccard:hover { background: #fffdf8; transform: translateY(-2px); }
.ccard b { display: block; font-size: 15px; margin-bottom: 4px; }
.ccard small { display: block; color: var(--ink-3); font-size: 11.5px; line-height: 1.55; }
.eras { display: flex; flex-wrap: wrap; gap: 10px; }
.era { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.7); cursor: pointer; }
.era.locked { opacity: 0.5; }

/* ---------------------------------------------------------- 游戏主界面 */
#s-game { flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 10px 20px; margin: 12px 16px 0; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 3; }
.tb-fam { font-size: 13px; color: var(--ink-2); letter-spacing: 0.1em; white-space: nowrap; }
.tb-fam b { color: var(--gold); font-weight: 600; }
.tb-age { display: flex; align-items: baseline; gap: 8px; }
.tb-age .n { font-family: var(--display); font-size: 34px; line-height: 1; color: var(--ink); }
.tb-age .u { font-size: 14px; color: var(--ink-2); }
.tb-sep { width: 1px; height: 26px; background: var(--line); }
.tb-item { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.tb-item b { color: var(--ink); font-weight: 600; }
.tb-sp { flex: 1; }
.tb-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.7); font-size: 16px; }
.tb-btn:hover { background: #fff; }
.echo { display: inline-flex; align-items: center; gap: 6px; }
.echo i { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff7dc, #f0c66e 50%, #b47c2c); box-shadow: 0 0 10px rgba(240, 190, 90, 0.9); }

.layout { flex: 1; display: grid; grid-template-columns: 300px 1fr 300px; gap: 16px; padding: 14px 16px 16px; min-height: 0; }
.col { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: var(--paper-3) transparent; }
.box { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.box h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.25em; color: var(--ink-3); font-weight: 600; display: flex; justify-content: space-between; }

.portrait { position: relative; padding: 0; overflow: hidden; }
.portrait .pimg { aspect-ratio: 1 / 0.86; background-size: cover; background-position: center 30%; background-color: #f3dfb6; transition: background-image 0.8s; }
.portrait .pinfo { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 16px 12px; background: linear-gradient(180deg, transparent, rgba(251, 246, 236, 0.92) 55%); }
.portrait .pname { font-family: var(--display); font-size: 26px; letter-spacing: 0.08em; }
.portrait .ptags { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.stats { display: grid; gap: 9px; }
.stat { display: grid; grid-template-columns: 38px 1fr 30px; align-items: center; gap: 8px; font-size: 13px; }
.stat .lb { color: var(--ink-2); }
.bar { height: 9px; border-radius: 9px; background: rgba(120, 90, 50, 0.12); overflow: hidden; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 9px; transition: width 0.9s var(--ease); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.stat .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.stat.hl i { background: linear-gradient(90deg, #e9958a, var(--hl)); }
.stat.joy i { background: linear-gradient(90deg, #f3cd78, var(--joy)); }
.stat.wis i { background: linear-gradient(90deg, #8fb8d4, var(--wis)); }
.stat.bond i { background: linear-gradient(90deg, #e2a3c2, var(--bond)); }
.stat.low .v { color: var(--hl); }
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sk { text-align: center; padding: 8px 4px 7px; border-radius: 10px; background: rgba(255, 252, 245, 0.65); border: 1px solid rgba(185, 134, 54, 0.18); }
.sk b { display: block; font-family: var(--display); font-size: 22px; line-height: 1.1; color: var(--gold); }
.sk span { font-size: 11.5px; color: var(--ink-2); }
.sk .xp { height: 3px; margin: 5px 6px 0; border-radius: 3px; background: rgba(120, 90, 50, 0.12); overflow: hidden; }
.sk .xp i { display: block; height: 100%; background: var(--gold-2); }
.people { display: flex; flex-direction: column; gap: 6px; }
.person { display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; font-size: 13px; }
.person .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 16px; color: #fff; }
.person .nm { line-height: 1.25; }
.person .nm small { display: block; color: var(--ink-3); font-size: 11px; }
.person .heart { font-size: 11px; color: var(--bond); font-variant-numeric: tabular-nums; }
.person.dead { opacity: 0.45; }

.wish { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px dashed rgba(185, 134, 54, 0.25); font-size: 13px; }
.wish:last-child { border: 0; }
.wish .ck { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--gold); margin-top: 1px; display: grid; place-items: center; font-size: 11px; color: #fff; }
.wish.done .ck { background: var(--gold); }
.wish.done .wn { color: var(--gold); }
.wish small { display: block; color: var(--ink-3); font-size: 11.5px; }
.heir-list { display: flex; flex-wrap: wrap; gap: 8px; }
.heir-mini { width: 46px; height: 46px; border-radius: 10px; background-size: cover; border: 1px solid var(--line); box-shadow: 0 3px 8px -4px rgba(90, 60, 20, 0.5); }
.log { display: flex; flex-direction: column-reverse; gap: 2px; max-height: 46vh; overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.log p { margin: 0; padding: 6px 0 6px 12px; font-size: 13px; line-height: 1.55; border-left: 2px solid rgba(185, 134, 54, 0.25); color: var(--ink-2); }
.log p em { font-style: normal; color: var(--ink-3); font-size: 11.5px; margin-right: 6px; }
.log p.mem { color: var(--gold); border-left-color: var(--gold); }
.log p.sad { color: #8b6a6a; }
.log p.wish, .log p.heir, .log p.combo { color: var(--teal); border-left-color: var(--teal); }

/* ---------------------------------------------------------- 中央舞台 */
.stage { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; position: relative; }
.stage-top { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.stage-cap { text-align: center; color: #fffaf0; text-shadow: 0 1px 2px rgba(80, 45, 10, 0.5), 0 0 24px rgba(90, 50, 10, 0.5); }
.stage-cap .big { font-family: var(--display); font-size: clamp(30px, 4vw, 52px); letter-spacing: 0.18em; }
.stage-cap .small { font-size: 15px; letter-spacing: 0.3em; margin-top: 6px; }

/* 事件卡 */
.evcard { width: min(860px, 100%); display: grid; grid-template-columns: 340px 1fr; overflow: hidden; border-radius: 20px; background: var(--glass-2); border: 1px solid var(--line); box-shadow: 0 30px 80px -30px rgba(90, 58, 24, 0.6); animation: cardin 0.7s var(--ease); max-height: 100%; }
@keyframes cardin { from { opacity: 0; transform: translateY(30px) scale(0.97); } to { opacity: 1; transform: none; } }
.evcard .art { background-size: cover; background-position: center; min-height: 360px; position: relative; background-color: #f0dcb3; }
.evcard .art::after { content: ""; position: absolute; inset: 0; box-shadow: inset -30px 0 40px -30px rgba(251, 246, 236, 0.9); }
.evcard .body { padding: 26px 30px 24px; display: flex; flex-direction: column; overflow: auto; }
.evcard .kicker { font-size: 12px; letter-spacing: 0.35em; color: var(--gold); }
.evcard h3 { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 4px 0 12px; letter-spacing: 0.08em; }
.evcard .txt p { margin: 0 0 10px; line-height: 1.85; font-size: 15.5px; color: var(--ink); white-space: pre-line; }
.choices { margin-top: auto; display: flex; flex-direction: column; gap: 9px; padding-top: 12px; }
.choice { text-align: left; padding: 12px 16px; border-radius: 12px; background: rgba(255, 252, 245, 0.95); border: 1px solid var(--line); transition: all 0.2s var(--ease); position: relative; }
.choice:hover { border-color: var(--gold); transform: translateX(4px); box-shadow: 0 8px 20px -12px rgba(150, 100, 30, 0.7); }
.choice b { font-weight: 600; font-size: 15px; }
.choice small { display: block; margin-top: 3px; color: var(--ink-3); font-size: 12.5px; }
.choice .k { position: absolute; right: 14px; top: 12px; font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.outcome { margin-top: auto; padding-top: 12px; animation: fadein 0.5s; }
.outcome .pick { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.outcome .otext { font-size: 16px; line-height: 1.85; color: var(--ink); padding: 12px 16px; border-radius: 12px; background: linear-gradient(110deg, rgba(255, 240, 205, 0.7), rgba(255, 252, 245, 0.5)); border-left: 3px solid var(--gold-2); }
.fxrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.fx { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 252, 245, 0.9); border: 1px solid rgba(185, 134, 54, 0.25); font-variant-numeric: tabular-nums; }
.fx.up { color: #4a7a3e; }
.fx.down { color: #b0503f; }
.fx.lvup { background: var(--gold-3); border-color: var(--gold-2); color: #7a5313; font-weight: 600; }

/* 手牌 */
.handbar { width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.time { display: flex; gap: 7px; align-items: center; padding: 8px 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; color: var(--ink-2); }
.orb { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffbe8, #f3cc76 45%, #c08a35); box-shadow: 0 0 12px rgba(240, 190, 90, 0.9); transition: all 0.4s var(--ease); }
.orb.used { background: rgba(120, 90, 50, 0.15); box-shadow: none; transform: scale(0.8); }
.hand { display: flex; gap: 14px; justify-content: center; align-items: flex-end; padding: 6px 4px 4px; width: 100%; }
.card { width: 168px; flex: none; border-radius: 16px; background: var(--paper); border: 1px solid rgba(185, 134, 54, 0.45); box-shadow: 0 14px 30px -14px rgba(90, 58, 24, 0.55), inset 0 0 0 4px rgba(255, 252, 245, 0.7); overflow: hidden; position: relative; transition: transform 0.35s var(--ease), box-shadow 0.35s, opacity 0.4s; cursor: pointer; animation: deal 0.6s var(--ease) both; }
@keyframes deal { from { opacity: 0; transform: translateY(60px) rotate(4deg); } to { opacity: 1; transform: none; } }
.card:hover:not(.played):not(.off) { transform: translateY(-14px) scale(1.04); box-shadow: 0 26px 40px -16px rgba(90, 58, 24, 0.6), 0 0 0 2px var(--gold-2), inset 0 0 0 4px rgba(255, 252, 245, 0.7); z-index: 2; }
.card .cart { height: 150px; background-size: cover; background-position: center; background-color: #ecd6ab; margin: 6px 6px 0; border-radius: 11px; position: relative; }
.card .cost { position: absolute; top: 8px; left: 8px; display: flex; gap: 3px; }
.card .cost i { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffbe8, #f3cc76 45%, #c08a35); box-shadow: 0 0 8px rgba(255, 220, 140, 0.9), 0 1px 2px rgba(0, 0, 0, 0.2); }
.card .habit { position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(77, 134, 137, 0.92); color: #fff; letter-spacing: 0.1em; }
.card .streak { position: absolute; bottom: 6px; right: 8px; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: rgba(251, 246, 236, 0.9); color: var(--teal); }
.card .cn { font-weight: 600; font-size: 16px; text-align: center; margin: 9px 8px 4px; letter-spacing: 0.1em; }
.card .ce { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 0 8px 12px; min-height: 36px; }
.card .ce span { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 252, 245, 0.9); border: 1px solid rgba(185, 134, 54, 0.2); color: var(--ink-2); }
.card .ce span.g { color: #4a7a3e; } .card .ce span.b { color: #b0503f; }
.hand.dealt .card { animation: none; }
.card.off { opacity: 0.45; filter: saturate(0.4); cursor: default; }
.card.played { cursor: default; transform: translateY(-8px); box-shadow: 0 0 0 2px var(--gold), 0 16px 30px -14px rgba(150, 100, 30, 0.7); }
.card.played::after { content: "已度过"; position: absolute; inset: 6px 6px auto 6px; height: 150px; display: grid; place-items: center; border-radius: 11px; background: rgba(251, 246, 236, 0.55); font-family: var(--display); font-size: 24px; letter-spacing: 0.3em; color: var(--gold); text-shadow: 0 0 10px #fff; }
.card .ctext { display: none; }
.played-note { width: min(720px, 100%); text-align: center; min-height: 26px; margin-bottom: 8px; font-size: 15px; color: #fffaf0; text-shadow: 0 1px 2px rgba(70, 40, 10, 0.6), 0 0 18px rgba(80, 45, 10, 0.6); }
.played-note span { display: inline-block; padding: 7px 18px; border-radius: 999px; background: rgba(80, 55, 25, 0.28); backdrop-filter: blur(6px); animation: fadein 0.4s; }
.actions { display: flex; gap: 10px; }
.infant-box { padding: 22px 30px; text-align: center; max-width: 460px; margin-bottom: 18px; }
.infant-box p { margin: 0 0 14px; line-height: 1.8; color: var(--ink-2); }

/* ---------------------------------------------------------- 浮层 */
#overlay { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(248, 241, 228, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#overlay.on { display: flex; animation: fadein 0.4s; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 26px 28px; background: var(--glass-2); border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 30px 80px -30px rgba(90, 58, 24, 0.6); animation: cardin 0.5s var(--ease); }
.modal h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 30px; letter-spacing: 0.12em; text-align: center; }
.modal .lead { text-align: center; color: var(--ink-2); margin: 0 0 18px; }
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.wopt { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.85); cursor: pointer; transition: all 0.2s; }
.wopt:hover { transform: translateY(-2px); }
.wopt.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(226, 187, 108, 0.45); background: #fff8e8; }
.wopt b { font-size: 17px; letter-spacing: 0.1em; }
.wopt small { display: block; color: var(--ink-2); margin-top: 4px; }
.wopt em { font-style: normal; font-size: 12px; color: var(--gold); }
.modal .row { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }

/* 记忆卡 */
.memcard { width: min(380px, 86vw); border-radius: 22px; overflow: hidden; background: var(--paper); box-shadow: 0 0 0 1px rgba(226, 187, 108, 0.9), 0 0 60px rgba(255, 210, 120, 0.8), 0 40px 80px -30px rgba(90, 58, 24, 0.7); animation: memin 0.9s var(--ease); position: relative; }
@keyframes memin { from { opacity: 0; transform: scale(0.7) rotate(-6deg); filter: blur(6px) brightness(1.6); } to { opacity: 1; transform: none; filter: none; } }
.memcard .mart { height: 300px; background-size: cover; background-position: center; margin: 10px 10px 0; border-radius: 14px; position: relative; overflow: hidden; }
.memcard .mart::after { content: ""; position: absolute; inset: -50%; background: linear-gradient(115deg, transparent 40%, rgba(255, 248, 220, 0.7) 50%, transparent 60%); animation: shine 2.2s 0.5s ease-in-out; transform: translateX(-100%); }
@keyframes shine { to { transform: translateX(100%); } }
.memcard .mk { text-align: center; font-size: 12px; letter-spacing: 0.45em; color: var(--gold); margin-top: 16px; }
.memcard .mn { text-align: center; font-family: var(--display); font-size: 32px; margin: 4px 0; letter-spacing: 0.12em; }
.memcard .mp { text-align: center; color: var(--ink-2); padding: 0 26px 22px; line-height: 1.8; font-size: 15px; }
.memcard .new { position: absolute; top: 18px; right: 18px; z-index: 2; padding: 3px 12px; border-radius: 999px; background: var(--rose); color: #fff; font-size: 12px; letter-spacing: 0.2em; }
.rar-2 { box-shadow: 0 0 0 1.5px #d9b46a, 0 0 70px rgba(255, 200, 120, 0.95), 0 40px 80px -30px rgba(90, 58, 24, 0.7); }
.rar-3 { box-shadow: 0 0 0 2px #f0cf86, 0 0 90px rgba(255, 190, 110, 1), 0 0 160px rgba(255, 160, 200, 0.5), 0 40px 80px -30px rgba(90, 58, 24, 0.7); }
.stars { text-align: center; color: var(--gold-2); letter-spacing: 0.3em; font-size: 14px; }

#toasts { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 22px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; animation: toast 3.6s var(--ease) both; max-width: 90vw; text-align: center; }
.toast.gold { background: linear-gradient(110deg, #fff3d2, #fffaf0); border-color: var(--gold-2); }
.toast.teal { border-color: var(--teal); color: #2f6062; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-14px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
#fxlayer { position: fixed; inset: 0; pointer-events: none; z-index: 25; }
.flt { position: absolute; font-weight: 700; font-size: 16px; padding: 2px 10px; border-radius: 999px; background: rgba(255, 252, 245, 0.92); box-shadow: 0 4px 12px -4px rgba(90, 58, 24, 0.5); animation: flt 1.6s var(--ease) forwards; white-space: nowrap; }
@keyframes flt { from { opacity: 0; transform: translate(-50%, 0) scale(0.7); } 15% { opacity: 1; transform: translate(-50%, -14px) scale(1.05); } to { opacity: 0; transform: translate(-50%, -80px) scale(1); } }

/* 年份过场 */
.yearfx { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; pointer-events: none; }
.yearfx div { text-align: center; color: #fffaf0; animation: yearfx 1.5s var(--ease) forwards; text-shadow: 0 2px 4px rgba(80, 45, 10, 0.4), 0 0 40px rgba(255, 200, 120, 0.9), 0 0 90px rgba(150, 90, 20, 0.5); }
.yearfx .a { font-family: var(--display); font-size: clamp(80px, 13vw, 170px); line-height: 1; }
.yearfx .b { font-size: 18px; letter-spacing: 0.5em; margin-top: 8px; }
@keyframes yearfx { 0% { opacity: 0; transform: scale(0.9); filter: blur(10px); } 25% { opacity: 1; transform: none; filter: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1.06); filter: blur(4px); } }

/* ---------------------------------------------------------- 离世 */
#s-death { align-items: center; justify-content: center; padding: 20px; }
#death { width: min(1100px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; align-items: center; }
.reel { position: relative; width: 100%; height: 70vh; display: grid; place-items: center; }
.reel-title { text-align: center; color: #fffaf0; text-shadow: 0 2px 4px rgba(70, 40, 10, 0.5), 0 0 40px rgba(110, 60, 10, 0.6); animation: logoin 1.6s var(--ease) both; }
.reel-title .nm { font-family: var(--display); font-size: clamp(44px, 7vw, 88px); letter-spacing: 0.15em; }
.reel-title .yr { font-size: 20px; letter-spacing: 0.4em; margin-top: 6px; }
.reel-card { position: absolute; width: 230px; border-radius: 14px; overflow: hidden; background: var(--paper); box-shadow: 0 0 40px rgba(255, 210, 140, 0.8), 0 20px 50px -20px rgba(80, 50, 20, 0.7); animation: reel 3s var(--ease) forwards; }
.reel-card .ra { height: 170px; background-size: cover; background-position: center; margin: 7px 7px 0; border-radius: 9px; }
.reel-card .rn { text-align: center; font-family: var(--display); font-size: 21px; padding: 8px 6px 2px; }
.reel-card .rp { text-align: center; font-size: 12.5px; color: var(--ink-2); padding: 0 12px 12px; line-height: 1.6; }
@keyframes reel { 0% { opacity: 0; transform: translate(var(--x0), 40px) scale(0.8) rotate(var(--r0)); } 20% { opacity: 1; transform: translate(var(--x1), 0) scale(1) rotate(var(--r1)); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x2), -120px) scale(0.85) rotate(var(--r1)); filter: blur(3px); } }
.skip { position: fixed; bottom: 24px; right: 24px; z-index: 5; }
.summary > * { min-width: 0; }
.summary { width: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; overflow: auto; animation: cardin 0.8s var(--ease); padding-bottom: 4px; }
.sum-l, .sum-r { padding: 24px 26px; }
.epi-name { font-family: var(--display); font-size: 42px; letter-spacing: 0.1em; line-height: 1.1; }
.epi-yr { color: var(--ink-2); letter-spacing: 0.25em; margin: 6px 0 14px; }
.epi { font-size: 17px; line-height: 1.9; padding: 14px 18px; border-left: 3px solid var(--gold-2); background: rgba(255, 244, 214, 0.55); border-radius: 0 12px 12px 0; }
.mem-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 4px; max-height: 172px; overflow: auto; }
.mem-strip div { flex: none; width: 66px; height: 66px; border-radius: 10px; background-size: cover; border: 1px solid var(--line); }
.score { display: grid; gap: 6px; margin: 6px 0 14px; }
.score div { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed rgba(185, 134, 54, 0.25); }
.score .tot { font-size: 19px; font-weight: 700; color: var(--gold); border: 0; padding-top: 8px; }
.heirs { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.heir { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.8); cursor: pointer; }
.heir.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(226, 187, 108, 0.45); }
.opt-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.opt { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.8); font-size: 13px; cursor: pointer; }
.opt.sel { background: var(--gold); color: #fff; border-color: var(--gold); }
.ach-new { padding: 8px 12px; border-radius: 10px; background: rgba(77, 134, 137, 0.1); color: #2f6062; margin-bottom: 6px; font-size: 13.5px; }

/* ---------------------------------------------------------- 长卷 / 图鉴 / 织机 */
.pbody { overflow: auto; padding: 18px 22px 24px; }
.tabs { display: flex; gap: 8px; justify-content: center; padding: 12px 0 0; }
.tabs button { padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.7); }
.tabs button.on { background: var(--gold); color: #fff; border-color: var(--gold); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mcell { border-radius: 14px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 8px 20px -14px rgba(90, 58, 24, 0.6); }
.mcell .ma { aspect-ratio: 1; background-size: cover; background-position: center; margin: 6px 6px 0; border-radius: 10px; }
.mcell .mt { text-align: center; padding: 8px 6px 2px; font-weight: 600; font-size: 14px; }
.mcell .ms { text-align: center; padding: 0 8px 10px; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; min-height: 32px; }
.mcell.locked .ma { filter: grayscale(1) blur(6px) brightness(1.2); opacity: 0.5; }
.mcell.locked .mt { color: var(--ink-3); }
.combo-list, .ach-list, .up-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.citem { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.8); font-size: 13.5px; }
.citem b { display: block; font-size: 15px; margin-bottom: 3px; }
.citem.locked { opacity: 0.5; }
.citem small { color: var(--ink-3); }
.upitem { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 252, 245, 0.85); }
.upitem b { font-size: 17px; letter-spacing: 0.1em; }
.upitem .lv { display: flex; gap: 5px; }
.upitem .lv i { width: 22px; height: 6px; border-radius: 6px; background: rgba(120, 90, 50, 0.14); }
.upitem .lv i.on { background: var(--gold-2); box-shadow: 0 0 8px rgba(226, 187, 108, 0.8); }
.upitem p { margin: 0; color: var(--ink-2); font-size: 13.5px; flex: 1; }
.tree-wrap { position: relative; min-height: 60vh; border-radius: 14px; overflow: hidden; background-size: cover; background-position: center; }
.tree-scroll { position: relative; display: flex; flex-direction: column-reverse; gap: 18px; padding: 30px 20px; align-items: center; }
.tnode { position: relative; width: min(520px, 100%); padding: 14px 18px 14px 70px; border-radius: 16px; background: rgba(251, 246, 236, 0.9); border: 1px solid var(--line); box-shadow: 0 0 30px rgba(255, 210, 130, 0.5), 0 12px 30px -16px rgba(40, 30, 10, 0.7); }
.tnode::before { content: ""; position: absolute; left: 20px; top: 50%; width: 34px; height: 34px; margin-top: -17px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffbe8, #f3cc76 45%, #c08a35); box-shadow: 0 0 22px rgba(255, 200, 100, 0.95); }
.tnode::after { content: ""; position: absolute; left: 36px; bottom: -19px; width: 2px; height: 18px; background: linear-gradient(var(--gold-2), transparent); }
.tnode:first-child::after { display: none; }
.tnode b { font-size: 17px; } .tnode small { color: var(--ink-3); margin-left: 8px; }
.tnode p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.fam-pick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }

.mobnav { display: none; }

/* ---------------------------------------------------------- 窄屏 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 260px 1fr; }
  .col.right { display: none; }
  .card { width: 148px; } .card .cart { height: 128px; } .card.played::after { height: 128px; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .topbar { margin: 8px 8px 0; padding: 8px 14px; gap: 10px; border-radius: 18px; flex-wrap: wrap; }
  .tb-fam, .tb-sep { display: none; }
  .tb-age .n { font-size: 26px; }
  .layout { grid-template-columns: 1fr; padding: 10px 8px 64px; }
  .col.left, .col.right { display: none; }
  .layout.tab-left .col.left, .layout.tab-right .col.right { display: flex; }
  .layout.tab-left .stage, .layout.tab-right .stage { display: none; }
  .evcard { grid-template-columns: 1fr; }
  .evcard .art { min-height: 180px; }
  .evcard .body { padding: 18px 18px 16px; }
  .evcard h3 { font-size: 26px; }
  .hand { flex-wrap: wrap; gap: 8px; }
  .card { width: calc(33.3% - 8px); min-width: 104px; }
  .card .cart { height: 92px; } .card.played::after { height: 92px; font-size: 18px; }
  .card .cn { font-size: 14px; }
  .card:hover:not(.played):not(.off) { transform: none; }
  .mobnav { display: flex; position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 6; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
  .mobnav button { flex: 1; padding: 12px 0; font-size: 14px; }
  .mobnav button.on { background: var(--gold); color: #fff; }
  .summary { grid-template-columns: 1fr; }
  .menu button { min-width: 220px; }
}
