/* 《盗墓笔记·下斗》：整个游戏在黑里，只有手电照到的地方是亮的。
   选中 = 被照亮；没选、没摸到、没轮到 = 在暗处。没有方块按钮：动作是字，主动作前面一根线。 */
:root {
  --night: #070605;
  --night-2: #100e0b;
  --beam: #f4e5c2;      /* 手电照到的字 */
  --beam-2: #d6c6a2;    /* 正文 */
  --dim: #8f8574;       /* 暗处的字 */
  --faint: #5a5348;
  --bronze: #86b49c;    /* 铜锈：好事、良品 */
  --gold: #d0aa5a;      /* 钱、珍品 */
  --blood: #cf5a40;     /* 伤、尸气、撤 */
  --paper: #cbb68b;     /* 笔记本 */
  --ink: #2b2219;
  --story: 'LXGW WenKai Screen', 'Kaiti SC', 'STKaiti', 'KaiTi', serif;
  --ui: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --glow: rgba(255, 222, 165, .5);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--beam-2); font-family: var(--ui); }
body { overscroll-behavior: none; }
#app { position: relative; max-width: 480px; height: 100dvh; margin: 0 auto; overflow: hidden; background: var(--night); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 1px solid var(--beam); outline-offset: 3px; }
img { display: block; }
[hidden] { display: none !important; }
.r-fan { --rc: #a39d90; } .r-liang { --rc: var(--bronze); } .r-zhen { --rc: var(--gold); } .r-jue { --rc: var(--blood); }

/* 离场：画面往里推、变黑 */
.cover, .screen, .page, .dive { transition: opacity .32s ease-in, transform .5s cubic-bezier(.5, 0, .8, .4); }
.leaving { opacity: 0; transform: scale(1.04); }
.screen, .page { animation: enter .4s ease-out; }
@keyframes enter { from { opacity: 0; } }

/* ───────── 主动作：一根线 + 字 ───────── */
.pull { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; column-gap: 16px; padding: 8px 0; text-align: left; color: var(--beam); }
.pull i { grid-row: 1 / span 2; display: block; width: 40px; height: 1px; background: currentColor; transition: width .55s cubic-bezier(.2, .9, .2, 1); }
.pull b { font-family: var(--story); font-size: 30px; font-weight: 700; letter-spacing: .38em; line-height: 1.15; transition: text-shadow .4s; }
.pull small { grid-column: 2; font-size: 12px; color: var(--dim); letter-spacing: .06em; margin-top: 4px; }
.pull:active i, .pull.lit i { width: 76px; }
.pull.lit b, .pull:active b { text-shadow: 0 0 22px var(--glow); }
.pull:disabled { color: var(--faint); }
.pull:disabled i { width: 22px; }
@media (hover: hover) { .pull:not(:disabled):hover i { width: 76px; } }

/* ───────── 封面：吴山居 ───────── */
.cover { position: absolute; inset: 0; overflow: hidden; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; }
.beam { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.beam-fallback { overflow: hidden; }
.beam-fallback img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.9) sepia(.15); }
.beam-fallback::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at var(--x, 50%) var(--y, 45%), transparent 0, rgba(0, 0, 0, .55) 28%, rgba(0, 0, 0, .93) 55%); }

.brand { position: absolute; right: 10px; top: calc(34px + var(--safe-t)); height: min(50dvh, 420px); margin: 0; pointer-events: none; --lit: 0; }
.brand img { height: 100%; width: auto; }
.brand .halo { position: absolute; inset: 0; opacity: .85; }
.brand .glow { position: absolute; inset: 0; filter: blur(9px); opacity: calc(var(--lit) * .75); }
.brand .ink { position: relative; opacity: calc(.6 + var(--lit) * .4); }

.menu { position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 30px calc(30px + var(--safe-b)); background: linear-gradient(transparent, rgba(0, 0, 0, .5) 45%); }
.links { display: flex; flex-wrap: wrap; column-gap: 26px; margin-top: 22px; padding-left: 56px; }
.links button { font-family: var(--story); font-size: 17px; color: var(--beam-2); padding: 9px 0; letter-spacing: .06em; transition: color .3s, text-shadow .3s; }
.links button small { font-family: var(--ui); font-size: 11px; color: var(--dim); margin-left: 6px; letter-spacing: 0; }
.links button.lit { color: var(--beam); text-shadow: 0 0 18px var(--glow); }
.links button.armed { color: var(--blood); }
.ledger { margin: 10px 0 0 56px; font-size: 12px; color: var(--dim); letter-spacing: .05em; }

/* 开场：先黑，手电亮起、扫上去，题字和菜单再出来 */
.intro .brand { animation: rise 1.6s ease-out 1.9s backwards; }
.intro .menu > * { animation: rise 1s ease-out backwards; }
.intro .menu > :nth-child(1) { animation-delay: 2.6s; }
.intro .menu > :nth-child(2) { animation-delay: 2.85s; }
.intro .menu > :nth-child(3) { animation-delay: 3s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ───────── 页面通用 ───────── */
.screen { position: absolute; inset: 0; }
.page { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 60px; background: var(--night); }
.prep { padding-bottom: 150px; }
.head { position: sticky; top: 0; z-index: 3; display: flex; align-items: baseline; gap: 14px; padding: calc(16px + var(--safe-t)) 20px 16px; background: linear-gradient(var(--night) 72%, transparent); }
.head h2 { margin: 0; font-family: var(--story); font-size: 24px; font-weight: 700; letter-spacing: .14em; color: var(--beam); }
.head .count { margin-left: auto; font-size: 13px; color: var(--dim); }
.back { font-size: 14px; color: var(--dim); padding: 6px 4px 6px 0; }
.sec { padding: 6px 0 30px; }
.sec > h3 { margin: 0 20px 12px; font-family: var(--story); font-size: 15px; font-weight: 400; color: var(--dim); letter-spacing: .2em; }
.sec > h3 small { font-family: var(--ui); font-size: 12px; letter-spacing: .04em; margin-left: 10px; color: var(--faint); }
.empty-line { margin: 30px 24px; font-family: var(--story); font-size: 16px; color: var(--dim); line-height: 1.8; }

/* 下斗前：三座斗像三道土层叠着，挑中的那道被照亮、撑开 */
.tombs { display: flex; flex-direction: column; gap: 2px; }
.tomb { position: relative; display: block; width: 100%; height: 104px; overflow: hidden; text-align: left; transition: height .45s cubic-bezier(.2, .8, .2, 1); }
.tomb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.3) saturate(.45); transform: scale(1.04); transition: filter .5s, transform 1.2s; }
.tomb::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 75% 110% at 68% 30%, transparent 0, rgba(0, 0, 0, .25) 45%, rgba(0, 0, 0, .85) 100%), linear-gradient(transparent 40%, rgba(0, 0, 0, .75)); }
.tomb .tx { position: absolute; left: 20px; right: 20px; bottom: 14px; z-index: 1; display: flex; flex-direction: column; }
.tomb .tn { display: flex; align-items: baseline; gap: 12px; }
.tomb b { font-family: var(--story); font-size: 24px; font-weight: 700; letter-spacing: .06em; color: var(--dim); transition: color .4s; }
.tomb em { font-style: normal; font-size: 11px; letter-spacing: 2px; color: var(--gold); opacity: .7; }
.tomb em s { text-decoration: none; color: var(--faint); }
.tomb .tm { font-size: 12px; color: var(--faint); margin-top: 3px; transition: color .4s; }
.tomb .tb { font-family: var(--story); font-size: 14px; line-height: 1.6; color: var(--beam-2); max-height: 0; opacity: 0; overflow: hidden; transition: max-height .45s, opacity .45s, margin .45s; }
.tomb.on { height: 196px; }
.tomb.on img { filter: brightness(1) saturate(.95); transform: scale(1); }
.tomb.on b { color: var(--beam); text-shadow: 0 1px 12px #000; }
.tomb.on em { opacity: 1; }
.tomb.on .tm { color: var(--beam-2); }
.tomb.on .tb { max-height: 70px; opacity: 1; margin-top: 7px; }

/* 五个人站在暗处，照到谁谁跟你下去 */
.lineup { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.mate { position: relative; aspect-ratio: 1 / 2.45; overflow: hidden; }
.mate img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 16%; filter: brightness(.34) grayscale(.6) contrast(1.05); transition: filter .5s; }
.mate::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0, 0, 0, .9)); }
.mate b { position: absolute; left: 0; right: 0; bottom: 10px; z-index: 1; text-align: center; font-family: var(--story); font-size: 16px; font-weight: 700; color: var(--faint); transition: color .4s; }
.mate.seen img { filter: brightness(.5) grayscale(.35); }
.mate.seen b { color: var(--dim); }
.mate.on img { filter: brightness(1.05) contrast(1.02); }
.mate.on::before { content: ''; position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse 90% 45% at 50% 22%, rgba(255, 226, 170, .16), transparent 70%); pointer-events: none; }
.mate.on b { color: var(--beam); }
.mate-info { padding: 16px 20px 0; min-height: 132px; font-size: 14px; line-height: 1.7; color: var(--dim); }
.mate-info .nm { display: flex; align-items: baseline; gap: 10px; }
.mate-info .nm b { font-family: var(--story); font-size: 19px; color: var(--beam); }
.mate-info .nm span { font-size: 12px; color: var(--faint); }
.mate-info p { margin: 4px 0 6px; font-family: var(--story); font-size: 15px; color: var(--beam-2); }
.mate-info p.hint { color: var(--dim); }
.mate-info ul { margin: 0; padding: 0; list-style: none; }
.mate-info li { padding-left: 14px; position: relative; font-size: 13px; }
.mate-info li::before { content: ''; position: absolute; left: 0; top: .85em; width: 6px; height: 1px; background: var(--dim); }
.mate-info li.q { color: var(--gold); }

/* 备货：一张清单 */
.shop .kit { margin: 0 20px 6px; font-size: 13px; color: var(--dim); }
.gear { display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 12px; padding: 10px 12px 10px 20px; }
.gear + .gear { border-top: 1px solid rgba(244, 229, 194, .06); }
.gear .g { min-width: 0; }
.gear b { font-family: var(--story); font-size: 17px; font-weight: 400; color: var(--beam-2); }
.gear .d { font-size: 12px; color: var(--faint); margin-top: 1px; line-height: 1.45; }
.gear .p { font-size: 13px; color: var(--gold); opacity: .8; }
.gear.has b { color: var(--beam); }
.step { display: flex; align-items: center; }
.step button { width: 40px; height: 40px; font-size: 21px; line-height: 1; color: var(--beam-2); }
.step button:disabled { color: var(--faint); opacity: .5; }
.step span { min-width: 16px; text-align: center; font-family: var(--story); font-size: 18px; color: var(--dim); }
.gear.has .step span { color: var(--beam); }

.launch { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 40px 22px calc(16px + var(--safe-b)); background: linear-gradient(transparent, var(--night) 42%); pointer-events: none; }
.launch > * { pointer-events: auto; }
.launch .sum { min-width: 0; padding-bottom: 10px; }
.launch .l1 { font-family: var(--story); font-size: 16px; color: var(--beam); }
.launch .l1 span { margin-left: 10px; color: var(--beam-2); font-size: 14px; }
.launch .l2 { font-size: 12px; color: var(--dim); margin-top: 2px; }
.launch .pull b { font-size: 28px; }

/* ───────── 斗里 ───────── */
.dive { position: absolute; inset: 0; display: flex; flex-direction: column; background: #000; }
.dive .bg { position: absolute; left: 0; right: 0; top: 0; height: 66%; z-index: 0; }
.dive .bg .beam { position: absolute; }

.bar { position: relative; z-index: 2; padding: calc(10px + var(--safe-t)) 14px 0 18px; text-shadow: 0 1px 10px rgba(0, 0, 0, .9); }
.bar .l1 { display: flex; align-items: baseline; gap: 8px; }
.where { min-width: 0; white-space: nowrap; }
.where b { font-family: var(--story); font-size: 19px; font-weight: 700; letter-spacing: .06em; color: var(--beam); }
.where span { font-family: var(--story); font-size: 13px; color: var(--beam-2); margin-left: 8px; }
.bar nav { margin-left: auto; display: flex; }
.bar nav button { font-family: var(--story); font-size: 15px; color: var(--beam-2); padding: 8px 7px; }
.bar nav button i { font-style: normal; font-family: var(--ui); font-size: 11px; color: var(--gold); margin-left: 3px; }
.meters { display: flex; gap: 18px; margin-top: 4px; }
.meter { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--beam-2); }
.meter .k { font-family: var(--story); font-size: 13px; flex: none; }
.meter .track { flex: 1; height: 1px; background: rgba(244, 229, 194, .16); position: relative; }
.meter .track i { position: absolute; left: 0; top: -1px; height: 3px; transition: width .7s, background .6s; }
.meter b { font-weight: 400; min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; color: var(--beam); }
.meter.light .track i { background: var(--beam); box-shadow: 0 0 8px var(--glow); }
.meter.light.low .track i { background: var(--blood); box-shadow: none; }
.meter.light.low b { color: var(--blood); }
.meter.qi .track i { background: linear-gradient(90deg, var(--bronze), #a3863e 55%, var(--blood)); background-size: 260px 100%; }
.meter.qi.hot b { color: var(--blood); }

.team { position: relative; z-index: 2; display: flex; gap: 16px; padding: 10px 18px 4px; text-shadow: 0 1px 8px #000; }
.mem { display: flex; align-items: center; gap: 7px; min-width: 0; }
.mem .av { position: relative; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; box-shadow: 0 0 0 1px rgba(244, 229, 194, .35); }
.mem .av img { width: 100%; height: 100%; object-fit: cover; }
.mem .nm { font-family: var(--story); font-size: 13px; line-height: 1.2; color: var(--beam); }
.pips { display: flex; gap: 2px; margin-top: 4px; }
.pips i { width: 7px; height: 3px; background: var(--blood); }
.pips i.e { background: rgba(244, 229, 194, .16); }
.mem.down .av, .mem.away .av { filter: grayscale(1) brightness(.45); }
.mem.away .av { box-shadow: 0 0 0 1px rgba(244, 229, 194, .2); }
.mem.held .av { box-shadow: 0 0 0 1.5px var(--blood); }
.mem .st { font-size: 11px; color: var(--blood); margin-top: 1px; }
.mem.hit { animation: hit .5s; }
@keyframes hit { 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }

.enemy { position: relative; z-index: 2; margin: 8px 0 0; display: flex; gap: 12px; align-items: center; padding: 8px 18px 8px 14px; background: linear-gradient(90deg, rgba(60, 12, 6, .82), rgba(30, 8, 4, .4) 70%, transparent); }
.enemy img { width: 52px; height: 52px; object-fit: cover; object-position: 50% 25%; flex: none; box-shadow: 0 0 0 1px rgba(207, 90, 64, .5); }
.enemy .e { flex: 1; min-width: 0; }
.enemy .en { display: flex; align-items: baseline; gap: 8px; }
.enemy b { font-family: var(--story); font-size: 17px; color: #f2c9b6; }
.enemy .en span { font-size: 11px; color: #c99a89; }
.enemy .hp { height: 2px; margin: 5px 0 5px; background: rgba(244, 229, 194, .12); }
.enemy .hp i { display: block; height: 100%; background: var(--blood); transition: width .4s; box-shadow: 0 0 6px rgba(207, 90, 64, .7); }
.enemy .in { font-family: var(--story); font-size: 14px; color: #ecb39f; }
.enemy .wk { font-size: 11px; color: var(--bronze); margin-top: 2px; }

/* 正文：往上滚的字沉进黑里，上面留给手电照的那块画 */
.feed { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 22px 16px; -webkit-mask-image: linear-gradient(transparent 0, transparent 22%, rgba(0, 0, 0, .4) 34%, #000 50%); mask-image: linear-gradient(transparent 0, transparent 22%, rgba(0, 0, 0, .4) 34%, #000 50%); }
.feed > :first-child { margin-top: auto; }
.feed.reading { -webkit-mask-image: linear-gradient(transparent 0, #000 8%); mask-image: linear-gradient(transparent 0, #000 8%); }
.room { margin: 26px 0 12px; display: flex; flex-direction: column; }
.room span { font-family: var(--story); font-size: 13px; color: var(--dim); letter-spacing: .14em; display: flex; align-items: center; gap: 10px; }
.room span::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(244, 229, 194, .2), transparent); }
.room b { font-family: var(--story); font-size: 23px; font-weight: 700; letter-spacing: .08em; color: var(--beam); margin-top: 2px; }
.p { font-family: var(--story); font-size: 17px; line-height: 1.9; margin: 0 0 12px; color: var(--beam-2); text-wrap: pretty; text-shadow: 0 0 12px #000; }
.say { display: flex; gap: 11px; margin: 0 0 12px; align-items: flex-start; }
.say .av { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: none; margin-top: 4px; box-shadow: 0 0 0 1px rgba(244, 229, 194, .3); }
.say .av img { width: 100%; height: 100%; object-fit: cover; }
.say .b { min-width: 0; }
.say .who { font-size: 11px; color: var(--dim); letter-spacing: .1em; }
.say .line { font-family: var(--story); font-size: 17px; line-height: 1.8; color: var(--beam); }
.say.me { flex-direction: row-reverse; text-align: right; }
.you { margin: 22px 0 12px; display: flex; justify-content: flex-end; }
.you span { max-width: 82%; font-family: var(--story); font-size: 15px; line-height: 1.55; color: var(--gold); display: flex; gap: 10px; align-items: baseline; text-align: left; }
.you span::before { content: ''; flex: none; width: 18px; height: 1px; background: currentColor; opacity: .7; transform: translateY(-4px); }
.you.free span { color: var(--beam); }
.evs { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: -2px 0 14px; }
.ev { font-size: 12px; line-height: 1.5; color: var(--dim); display: inline-flex; align-items: baseline; gap: 6px; }
.ev::before { content: ''; flex: none; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; transform: translateY(-1px); }
.ev.roll { color: var(--beam-2); }
.ev.roll em { font-style: normal; color: var(--bronze); }
.ev.roll.bad em { color: var(--blood); }
.ev.hurt { color: #e98d74; }
.ev.heal { color: var(--bronze); }
.ev.note { color: var(--paper); font-family: var(--story); font-size: 13px; }
.ev.sys { color: var(--faint); }
.loot { display: flex; gap: 14px; align-items: center; margin: 4px 0 16px; animation: lootin .9s ease-out; }
.loot .im { position: relative; width: 64px; height: 64px; flex: none; background: #000; }
.loot .im::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 35%, transparent 40%, rgba(0, 0, 0, .55)); }
.loot img { width: 100%; height: 100%; object-fit: cover; }
.loot b { font-family: var(--story); font-size: 18px; color: var(--beam); }
.loot .r { font-size: 12px; margin-top: 2px; color: var(--rc); }
@keyframes lootin { from { opacity: 0; filter: brightness(.2); } 40% { opacity: 1; } }
.wait { font-family: var(--story); color: var(--dim); font-size: 15px; margin: 4px 0 12px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.warn { font-size: 12px; color: var(--blood); margin: 0 0 12px; }

.dock { position: relative; z-index: 3; max-height: 52dvh; display: flex; flex-direction: column; padding: 4px 12px calc(8px + var(--safe-b)); background: linear-gradient(rgba(0, 0, 0, 0), #000 16px); }
.opts { overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.opt { position: relative; display: grid; grid-template-columns: 30px 1fr auto; column-gap: 12px; align-items: center; width: 100%; min-height: 48px; padding: 7px 8px; text-align: left; }
.opt::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 65% 140% at 18% 50%, rgba(255, 226, 170, .15), transparent 72%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.opt:active::before, .opt.lit::before { opacity: 1; }
@media (hover: hover) { .opt:hover::before { opacity: .6; } }
.opt .av, .opt .ic { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; }
.opt .av { box-shadow: 0 0 0 1px rgba(244, 229, 194, .22); }
.opt .av img { width: 100%; height: 100%; object-fit: cover; }
.opt .ic { display: grid; place-items: center; font-family: var(--story); font-size: 15px; color: var(--dim); box-shadow: inset 0 0 0 1px rgba(244, 229, 194, .2); }
.opt .x { min-width: 0; display: flex; flex-direction: column; }
.opt .lb { font-family: var(--story); font-size: 16px; line-height: 1.35; color: var(--beam); }
.opt .sb { font-size: 11px; color: var(--faint); margin-top: 2px; }
.opt .c { font-family: var(--story); font-size: 19px; color: var(--gold); font-variant-numeric: tabular-nums; }
.opt .c small { font-size: 11px; margin-left: 1px; }
.opt .c.safe { color: var(--bronze); }
.opt .c.long { color: var(--blood); }
.opt.lit .lb { text-shadow: 0 0 16px var(--glow); }
.ways { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(244, 229, 194, .07); }
.opt.move .ic { color: var(--beam-2); box-shadow: inset 0 0 0 1px rgba(244, 229, 194, .25); }
.opt.move .lb { color: var(--beam-2); }
.opt.retreat .ic { color: var(--blood); box-shadow: inset 0 0 0 1px rgba(207, 90, 64, .45); }
.opt.retreat .lb { color: #eb9d86; }
.optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 4px; }
.optgrid .opt { grid-template-columns: 28px 1fr auto; column-gap: 9px; padding: 7px 4px; }
.optgrid .opt .lb { font-size: 15px; }
.gearrow { display: flex; gap: 4px 18px; flex-wrap: wrap; padding: 8px 8px 2px; }
.use { font-family: var(--story); font-size: 14px; color: var(--beam-2); padding: 6px 0; border-bottom: 1px dashed rgba(244, 229, 194, .25); }
.use small { font-family: var(--ui); font-size: 11px; color: var(--faint); margin-left: 6px; }
.improv { display: flex; align-items: center; gap: 10px; margin: 6px 8px 0; border-bottom: 1px solid rgba(244, 229, 194, .2); transition: border-color .3s; }
.improv:focus-within { border-color: rgba(244, 229, 194, .55); }
.improv input { flex: 1; min-width: 0; height: 44px; padding: 0; border: 0; background: none; color: var(--beam); font-family: var(--story); font-size: 16px; outline: none; }
.improv input::placeholder { color: var(--faint); }
.improv button { font-family: var(--story); font-size: 17px; color: var(--beam); padding: 8px 2px 8px 10px; }
.improv button:disabled, .improv input:disabled { opacity: .35; }
.dock.busy .opts, .dock.busy .gearrow { pointer-events: none; }
.dock.busy .opt:not(.lit), .dock.busy .gearrow { opacity: .28; transition: opacity .3s; }

.endbox { padding: 6px 8px 0; }
.endbox h4 { margin: 4px 0 12px; font-family: var(--story); font-size: 24px; letter-spacing: .14em; color: var(--beam); }
.endbox.dead h4 { color: #eb9d86; }
.endbox .items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 10px; margin-bottom: 12px; max-height: 30dvh; overflow-y: auto; }
.endbox .it { text-align: center; font-family: var(--story); font-size: 12px; }
.endbox .it .im { display: block; aspect-ratio: 1; background: #000; }
.endbox .it img { width: 100%; height: 100%; object-fit: cover; }
.endbox .it div { margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--rc); }
.endbox .it small { display: block; font-family: var(--ui); font-size: 10px; color: var(--beam-2); }
.endbox .it.sold img { filter: brightness(.45) grayscale(.5); }
.endbox .it.sold small { color: var(--gold); }
.endbox .sum { font-size: 13px; color: var(--dim); margin: 0 0 8px; line-height: 1.7; }
.endbox .sum b { color: var(--gold); font-weight: 400; }
.endbox .acts { display: flex; align-items: center; justify-content: space-between; }
.endbox .acts .pull b { font-size: 24px; letter-spacing: .25em; }
.link { font-family: var(--story); font-size: 16px; color: var(--beam-2); padding: 10px 0; border-bottom: 1px solid rgba(244, 229, 194, .25); }

/* ───────── 抽屉：地图 / 笔记 / 背包 / 怎么玩 ───────── */
.sheet-wrap { position: absolute; inset: 0; z-index: 10; background: rgba(0, 0, 0, .66); display: flex; align-items: flex-end; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: 100%; max-height: 86dvh; overflow-y: auto; background: var(--night-2); padding: 16px 20px calc(22px + var(--safe-b)); animation: up .3s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -1px 0 rgba(244, 229, 194, .1), 0 -30px 60px rgba(0, 0, 0, .6); }
@keyframes up { from { transform: translateY(40px); opacity: .3; } }
.sheet h3 { margin: 0 0 14px; font-family: var(--story); font-size: 21px; font-weight: 700; letter-spacing: .08em; color: var(--beam); display: flex; align-items: baseline; }
.sheet h3 small { font-family: var(--ui); font-size: 12px; color: var(--dim); margin-left: 10px; font-weight: 400; letter-spacing: 0; }
.sheet h3 .x { margin-left: auto; font-family: var(--ui); font-size: 13px; font-weight: 400; color: var(--dim); padding: 6px 0 6px 12px; letter-spacing: 0; }
.map svg { width: 100%; height: auto; }
.map .lg { font-size: 12px; color: var(--faint); margin: 8px 0 0; line-height: 1.7; }
/* 吴邪的本子：手电照着的一页纸，中间亮四周暗 */
.notebook { position: relative; color: var(--ink); padding: 14px 18px 18px; font-family: var(--story); font-size: 16px; line-height: 30px;
  background:
    repeating-linear-gradient(transparent 0 29px, rgba(43, 34, 25, .17) 29px 30px) 0 13px,
    radial-gradient(ellipse 85% 75% at 42% 30%, #dcc9a0 0, #c3ad80 45%, #8d7752 85%, #5e4d34 100%); }
.notebook p { margin: 0; }
.notebook .l { font-size: 12px; color: #6f5f45; margin-right: 8px; }
.notebook .empty { color: #6f5f45; }
.notebook.log { margin: 0 16px; }
.notebook .entry .d { font-family: var(--ui); font-size: 11px; color: #6f5f45; line-height: 30px; }
.notebook .entry p { margin-bottom: 0; }
.notebook .entry + .entry { margin-top: 0; }
.bag-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 10px; }
.bag-list .it { text-align: center; font-family: var(--story); font-size: 12px; color: var(--rc); }
.bag-list .im { display: block; aspect-ratio: 1; background: #000; }
.bag-list img { width: 100%; height: 100%; object-fit: cover; }
.bag-list .it div { margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gear-line { font-size: 13px; color: var(--dim); margin: 16px 0 0; line-height: 1.8; }
.rules { margin: 0 0 18px; }
.rules dt { font-family: var(--story); font-size: 17px; color: var(--beam); margin-top: 12px; }
.rules dd { margin: 2px 0 0; font-size: 14px; line-height: 1.7; color: var(--dim); }
.sheet .pull { margin-top: 4px; }

/* ───────── 博古架 ───────── */
.cabinet { background: #0b0806; }
.shelf-sec { padding: 4px 0 30px; }
.shelf-sec h3 { margin: 0 20px 12px; font-family: var(--story); font-size: 18px; font-weight: 700; letter-spacing: .1em; color: var(--beam-2); display: flex; align-items: baseline; }
.shelf-sec h3 small { margin-left: auto; font-family: var(--ui); font-size: 12px; font-weight: 400; color: var(--dim); letter-spacing: 0; }
/* 红木框：格子之间的木条；每格是凹进去的黑 */
.shelf { margin: 0 14px; display: grid; grid-template-columns: repeat(6, 1fr); --u: calc((min(100vw, 480px) - 28px - 14px - 5 * 5px) / 6); grid-template-rows: repeat(7, var(--u)); gap: 5px; padding: 7px;
  grid-template-areas: "a a a b b b" "a a a b b b" "a a a c c d" "e e f c c d" "e e f g g g" "h h h g g g" "h h h i j j";
  background: linear-gradient(160deg, #3a2417, #24160e 40%, #2f1d12 70%, #1c110a); box-shadow: inset 0 0 0 1px rgba(255, 210, 160, .08), 0 10px 30px rgba(0, 0, 0, .6); }
.shelf.one { grid-template-areas: none; grid-template-columns: 1fr; grid-template-rows: auto; width: 46%; margin-left: 14px; }
.shelf.one .cell { aspect-ratio: 1; grid-column: 1 / -1; }
.cell { position: relative; overflow: hidden; background: #030202; box-shadow: inset 0 6px 14px rgba(0, 0, 0, .95), inset 0 0 0 1px rgba(0, 0, 0, .8); }
.cell img { position: absolute; inset: 8% 8% 18%; width: 84%; height: 74%; object-fit: contain; filter: grayscale(1) brightness(.1) blur(1px); opacity: .7; }
.cell .nm { position: absolute; left: 4px; right: 4px; bottom: 5px; text-align: center; font-family: var(--story); font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .cnt { position: absolute; right: 6px; top: 5px; font-size: 10px; color: var(--dim); }
.cell.got::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 224, 168, .2), transparent 75%); }
.cell.got img { filter: none; opacity: 1; mix-blend-mode: lighten; }
.cell.got .nm { color: var(--rc); }
.cell.got:active img { transform: scale(1.04); transition: transform .2s; }
.detail .show { position: relative; width: min(72vw, 300px); aspect-ratio: 1; margin: 0 auto 14px; background: #000; }
.detail .show img { width: 100%; height: 100%; object-fit: cover; }
.detail .show::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 38%, transparent 45%, rgba(16, 14, 11, .9) 100%); }
.detail h3 small { color: var(--rc); }
.detail .meta { font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.detail .d { font-family: var(--story); font-size: 16px; line-height: 1.85; color: var(--beam-2); margin: 0 0 14px; }
.detail .notebook .from { font-size: 13px; color: #5e4f39; }
.detail .notebook .story { white-space: pre-line; font-size: 15px; }

#toast { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); z-index: 50; max-width: 86vw; padding: 9px 16px; background: rgba(16, 14, 11, .95); color: var(--beam); font-family: var(--story); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s; box-shadow: 0 0 0 1px rgba(244, 229, 194, .15); }
#toast.on { opacity: 1; }

/* 开局过场：主视觉垫着，等第一段正文 */
.descent { position: absolute; inset: 0; z-index: 20; background: #000; transition: opacity .9s; overflow: hidden; }
.descent img { width: 100%; height: 100%; object-fit: cover; animation: sink 14s ease-out forwards; }
@keyframes sink { from { transform: scale(1.14) translateY(-4%); } to { transform: scale(1) translateY(0); } }
.descent .cap { position: absolute; left: 0; right: 0; top: 15%; text-align: center; }
.descent b { display: block; font-family: var(--story); font-size: 34px; letter-spacing: .24em; color: var(--beam); text-shadow: 0 2px 24px #000; }
.descent span { display: block; margin-top: 12px; font-family: var(--story); font-size: 14px; color: var(--beam-2); letter-spacing: .12em; text-shadow: 0 1px 10px #000; }
.descent.out { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
