/* 《魔门当铺·来路不明》界面样式：墨紫漆木 + 宣纸面板 + 鎏金描边 */
:root {
  --ink: #14101a; --ink2: #1f1626; --purple: #2a1838; --purple2: #3d2350; --purple3: #5b3474;
  --blood: #8e1b2b; --red: #c43a3a; --moon: #e0524a;
  --gold: #d9a441; --gold2: #f2d27a; --gold-d: #8a5a1c;
  --jade: #3fae8f; --jade2: #7fd6b5;
  --paper: #efe2c4; --paper2: #d8c49a; --bone: #e9dfcc;
  --text: #e9dfcc; --muted: #a8949a;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --kai: "STKaiti", "KaiTi", "AR PL UKai CN", "Kaiti SC", var(--serif);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b080e; color: var(--text); font-family: var(--serif); }
button { font-family: inherit; }
img { user-select: none; -webkit-user-drag: none; }

#stage {
  position: absolute; width: 1280px; height: 760px; transform-origin: 0 0; overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(142, 27, 43, .25), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(91, 52, 116, .35), transparent 60%),
    var(--ink);
}
.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.good { color: var(--jade2); }
.bad { color: var(--moon); }
.warn { color: var(--gold2); }

/* ───── 纸面与按钮 ───── */
.paper {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .25), transparent 30%),
    radial-gradient(ellipse at 50% 120%, rgba(138, 90, 28, .25), transparent 70%),
    var(--paper);
  color: #2a1a14;
  border: 2px solid var(--gold-d);
  box-shadow: inset 0 0 0 1px rgba(242, 210, 122, .6), inset 0 0 30px rgba(138, 90, 28, .25), 0 6px 24px rgba(0, 0, 0, .5);
  border-radius: 4px;
}
.paper .muted { color: #7a6450; }
.paper .good { color: #1f7a5f; }
.paper .bad { color: var(--blood); }
.paper .warn { color: #8a5a1c; }
.paper h3, .paper h4 { color: var(--blood); }

.btn {
  display: inline-flex; align-items: center; gap: 4px; justify-content: center;
  padding: 7px 16px; font-size: 14px; letter-spacing: 1px; cursor: pointer;
  color: var(--gold2); background: linear-gradient(180deg, #4a1f2e, #2a1020);
  border: 1px solid var(--gold-d); border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(242, 210, 122, .25), 0 2px 4px rgba(0, 0, 0, .4);
  transition: filter .15s, transform .1s;
}
.btn:hover:not(:disabled) { filter: brightness(1.25); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--red), var(--blood)); color: #fff4d6; border-color: var(--gold); }
.btn.danger { background: linear-gradient(180deg, #5e0f1c, #2a0810); color: #ffb0a0; }
.btn.ghost { background: transparent; box-shadow: none; color: inherit; border-color: rgba(217, 164, 65, .5); }
.btn.big { padding: 12px 28px; font-size: 18px; letter-spacing: 3px; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.tiny { padding: 2px 7px; font-size: 12px; letter-spacing: 0; }
.btn .ic { width: 18px; height: 18px; }
.ic { width: 20px; height: 20px; vertical-align: middle; }

.tag { display: inline-block; padding: 1px 6px; margin: 2px 3px 0 0; font-size: 11px; border-radius: 2px; background: rgba(91, 52, 116, .5); color: var(--bone); }
.tag.contra { background: #1f5c7c; color: #cfefff; }
.tag.stolen { background: var(--blood); color: #ffe0d0; }
.tag.fake { background: #5e0f1c; color: #ffb0a0; }
.tag.real { background: #1f5c4c; color: #c8f5e4; }
.chip { display: inline-block; padding: 1px 8px; font-size: 12px; border-radius: 10px; background: rgba(255, 255, 255, .08); }
.chip.ok { background: rgba(63, 174, 143, .25); color: var(--jade2); }
.chip.warn { background: rgba(217, 164, 65, .2); color: var(--gold2); }
.chip.bad { background: rgba(196, 58, 58, .3); color: #ffb0a0; }

.meter { display: inline-block; width: 70px; height: 8px; background: rgba(0, 0, 0, .5); border: 1px solid rgba(224, 82, 74, .5); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #8e1b2b, var(--moon)); }
.meter.gold { border-color: rgba(217, 164, 65, .6); }
.meter.gold i { background: linear-gradient(90deg, var(--gold-d), var(--gold2)); }
.meter.wide { width: 100%; margin: 6px 0; height: 10px; }

/* ───── 标题 ───── */
#title-screen { background: var(--ink); }
.title-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.title-box { position: absolute; left: 0; right: 0; top: 110px; text-align: center; text-shadow: 0 2px 12px #000, 0 0 30px rgba(142, 27, 43, .8); }
.title-box h1 { margin: 0; font-family: var(--kai); font-size: 96px; letter-spacing: 24px; color: var(--gold2);
  background: linear-gradient(180deg, #fff4d6, var(--gold) 60%, var(--gold-d)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .9)); }
.title-box h2 { margin: 0 0 24px; font-family: var(--kai); font-size: 30px; letter-spacing: 14px; color: var(--moon); }
.title-box p { font-size: 16px; line-height: 1.9; color: var(--bone); }
.title-btns { margin-top: 260px; display: flex; gap: 20px; justify-content: center; }

/* ───── 主界面布局 ───── */
#topbar {
  position: absolute; left: 0; top: 0; width: 1280px; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: linear-gradient(180deg, #2a1020, #1a0c16); border-bottom: 2px solid var(--gold-d);
  box-shadow: 0 2px 0 rgba(242, 210, 122, .2), 0 4px 16px rgba(0, 0, 0, .6); font-size: 13px; z-index: 5;
}
.tb-day { display: flex; align-items: center; gap: 6px; font-family: var(--kai); }
.tb-day b { font-size: 20px; color: var(--gold2); }
.tb-day span { color: var(--muted); }
.tb-cell { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.tb-spacer { flex: 1; }
.tb-day b { white-space: nowrap; }
.tb-cal { white-space: nowrap; }
.tb-cell.big b { font-size: 20px; color: var(--jade2); }
.tb-cell.market { flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--gold2); font-style: italic; min-width: 0; }

#scene { position: absolute; left: 0; top: 52px; width: 700px; height: 430px; overflow: hidden; border-right: 2px solid var(--gold-d); }
#scene .bg, #scene .fg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
#scene .fg { z-index: 2; pointer-events: none; }
#portrait { position: absolute; left: 50%; bottom: -10px; height: 400px; transform: translateX(-50%); z-index: 1; filter: drop-shadow(0 0 18px rgba(0, 0, 0, .7)); }
#portrait.enter { animation: enter .45s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateX(-50%) translateY(16px); } }
#nameplate {
  position: absolute; left: 14px; top: 14px; z-index: 3; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 330px;
  padding: 6px 12px; background: rgba(20, 16, 26, .82); border: 1px solid var(--gold-d); border-radius: 3px;
}
#nameplate b { font-size: 17px; color: var(--gold2); font-family: var(--kai); }
#nameplate span { font-size: 12px; color: var(--muted); }
#speech {
  position: absolute; right: 14px; top: 14px; z-index: 3; width: 290px; padding: 12px 14px; line-height: 1.7; font-size: 14px;
  background: var(--paper); color: #2a1a14; border: 2px solid var(--gold-d); border-radius: 4px;
  box-shadow: inset 0 0 20px rgba(138, 90, 28, .25), 0 4px 16px rgba(0, 0, 0, .5);
}
#speech:empty { display: none; }

#counter-panel { position: absolute; left: 8px; top: 490px; width: 684px; height: 262px; padding: 14px 18px; display: flex; gap: 16px; }
.cp-col { flex: 1; min-width: 0; font-size: 14px; line-height: 1.7; overflow: auto; }
.cp-col h3 { margin: 0 0 4px; font-family: var(--kai); font-size: 22px; }
.cp-col p { margin: 4px 0; }
.cp-actions { width: 170px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.cp-item { display: flex; gap: 16px; align-items: flex-start; }
.cp-sel { display: flex; gap: 12px; align-items: center; margin-top: 8px; padding: 8px; background: rgba(138, 90, 28, .15); border-radius: 4px; }
.cat { color: var(--blood); font-size: 17px; }
.patience { color: var(--blood); letter-spacing: 2px; font-size: 12px; margin-left: 6px; }

#side { position: absolute; left: 702px; top: 52px; width: 578px; height: 404px; display: flex; flex-direction: column; }
#tabs { display: flex; height: 36px; background: #1a0c16; border-bottom: 1px solid var(--gold-d); }
.tab { flex: 1; background: none; border: 0; border-right: 1px solid rgba(138, 90, 28, .4); color: var(--muted); font-size: 15px; letter-spacing: 4px; cursor: pointer; font-family: var(--kai); }
.tab.on { color: var(--gold2); background: linear-gradient(180deg, rgba(196, 58, 58, .35), transparent); box-shadow: inset 0 -2px 0 var(--gold); }
#tab-body { flex: 1; overflow: auto; padding: 10px 12px; }
#tab-body h4 { margin: 12px 0 6px; color: var(--gold2); font-family: var(--kai); font-size: 16px; }

#storage { position: absolute; left: 702px; top: 456px; width: 578px; height: 304px; padding: 6px 12px; border-top: 2px solid var(--gold-d); background: linear-gradient(180deg, #24152c, #1a0f20); overflow: auto; }
.st-head { display: flex; align-items: center; gap: 10px; height: 30px; font-size: 13px; }
.st-head > b { font-family: var(--kai); font-size: 17px; color: var(--gold2); }
.st-sel { display: flex; align-items: center; gap: 6px; flex: 1; }
.st-head .muted { flex: 1; }
.st-body { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.st-side { display: flex; flex-direction: column; gap: 4px; }
.trash { margin-left: auto; width: 34px; height: 26px; line-height: 24px; text-align: center; border: 1px dashed var(--red); color: var(--red); border-radius: 3px; font-family: var(--kai); }
.trash.hot { background: var(--blood); color: #fff; }

/* ───── 格子与物品 ───── */
.grid-wrap { display: inline-block; }
.grid-label { font-size: 12px; color: var(--muted); margin: 2px 0; }
.paper .grid-label { color: #7a6450; }
.grid {
  position: relative; background-color: rgba(10, 6, 14, .55);
  background-image: linear-gradient(rgba(217, 164, 65, .16) 1px, transparent 1px), linear-gradient(90deg, rgba(217, 164, 65, .16) 1px, transparent 1px);
  border: 1px solid rgba(217, 164, 65, .45); box-shadow: inset 0 0 12px rgba(0, 0, 0, .6); box-sizing: content-box;
}
.grid-wrap.out .grid { border-color: rgba(127, 214, 181, .5); }
.grid-wrap.mod .grid { border-color: rgba(143, 211, 255, .55); background-color: rgba(31, 92, 124, .25); }
.grid-wrap.hidden .grid { border-style: dashed; }
.paper .grid { background-color: rgba(42, 26, 20, .78); }

.item { position: absolute; cursor: grab; border-radius: 3px; touch-action: none; }
.item:hover { background: rgba(242, 210, 122, .14); box-shadow: inset 0 0 0 1px rgba(242, 210, 122, .5); }
.item.sel { background: rgba(196, 58, 58, .25); box-shadow: inset 0 0 0 2px var(--gold2), 0 0 10px rgba(242, 210, 122, .5); }
.item.q-top { box-shadow: inset 0 0 10px rgba(242, 210, 122, .45); }
.item.locked { cursor: help; }
.item.preview { position: relative !important; cursor: default; flex: none; }
.item.dragging { opacity: .3; }
.item img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.item .fallback { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 10px; text-align: center; color: var(--muted); padding: 2px; }
.item .badge { position: absolute; width: 14px; height: 14px; pointer-events: none; }
.b-tl { left: 1px; top: 1px; }
.b-tr { right: 1px; top: 1px; }
.item .stamp { position: absolute; right: 1px; bottom: 1px; font-size: 10px; line-height: 13px; padding: 0 2px; color: #fff; background: var(--blood); border-radius: 2px; pointer-events: none; }
.item .num { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; text-align: center; color: #cfefff; text-shadow: 0 0 3px #000, 0 0 2px #000; pointer-events: none; }
.item .bar { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; background: rgba(0, 0, 0, .6); pointer-events: none; }
.item .bar i { display: block; height: 100%; background: var(--jade2); }
.item .bar.power i { background: #b48be0; }
.drop-hint { position: absolute; pointer-events: none; z-index: 4; border-radius: 3px; }
.drop-hint.ok { background: rgba(63, 174, 143, .35); box-shadow: inset 0 0 0 2px var(--jade2); }
.drop-hint.bad { background: rgba(196, 58, 58, .35); box-shadow: inset 0 0 0 2px var(--moon); }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: .9; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .7)); }
.drag-ghost img { width: 100%; height: 100%; }

/* ───── 侧栏内容 ───── */
.display-tab { display: flex; gap: 14px; align-items: flex-start; }
.display-tab > div:first-child { flex: none; max-width: 250px; }
.forecast { flex: 1; padding: 10px 14px; font-size: 13px; }
.forecast h4 { margin: 0 0 6px !important; color: var(--blood) !important; }
.fc-sec { margin: 8px 0 3px; padding-bottom: 2px; border-bottom: 1px solid rgba(138, 90, 28, .4); font-weight: bold; }
.fc-row { display: flex; justify-content: space-between; padding: 1px 0; }
.fc-warn { margin-top: 6px; padding: 4px 8px; background: rgba(142, 27, 43, .15); color: var(--blood); font-size: 12px; border-left: 3px solid var(--blood); }

.machine { margin-bottom: 10px; padding: 8px 10px; background: rgba(42, 24, 56, .55); border: 1px solid rgba(217, 164, 65, .35); border-radius: 4px; }
.machine.off { opacity: .55; }
.machine.array { background: rgba(61, 35, 80, .6); border-color: rgba(180, 139, 224, .5); }
.m-head { display: flex; align-items: center; gap: 10px; }
.m-icon { width: 56px; height: 56px; flex: none; }
.m-title { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.m-title b { font-size: 16px; color: var(--gold2); font-family: var(--kai); }
.m-title .ic { width: 15px; height: 15px; }
.m-ctrl { display: flex; gap: 3px; }
.m-grids { display: flex; gap: 14px; align-items: flex-start; margin: 4px 0 4px 66px; }
.m-extra { margin-left: 66px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.m-desc { margin: 2px 0 0 66px; }

.broker-head { display: flex; gap: 12px; align-items: center; padding: 6px; background: rgba(0, 0, 0, .25); border-radius: 4px; }
.broker-head img { width: 80px; height: 96px; object-fit: cover; object-position: top; flex: none; }
.broker-head p { margin: 0; font-size: 13px; line-height: 1.7; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-bottom: 1px solid rgba(217, 164, 65, .12); font-size: 13px; }
.shop-row img { width: 30px; height: 30px; object-fit: contain; }
.shop-row b { min-width: 70px; }
.shop-row .muted { flex: 1; }
.shop-row .grow { font-size: 12px; }

.rep-cols { display: flex; gap: 10px; }
.rep-col { flex: 1; text-align: center; font-size: 13px; }
.rep-col img { width: 40px; height: 40px; display: block; margin: 0 auto 2px; }
.rep-bar { position: relative; height: 120px; width: 22px; margin: 6px auto; background: rgba(0, 0, 0, .45); border: 1px solid rgba(217, 164, 65, .4); }
.rep-bar i { position: absolute; left: 0; right: 0; opacity: .85; }
.rep-bar .mid { position: absolute; left: -4px; right: -4px; top: 50%; border-top: 1px solid var(--gold); }
.rep-v { font-size: 16px; color: var(--gold2); }
.rep-col p { text-align: left; line-height: 1.5; }
.heat-box { margin-top: 6px; padding: 8px 10px; background: rgba(142, 27, 43, .2); border: 1px solid rgba(224, 82, 74, .4); border-radius: 4px; font-size: 13px; }
.heat-box p { margin: 2px 0 0; }

.ledger-top { display: flex; gap: 14px; padding: 8px 12px; font-size: 13px; }
.ledger-top > div { flex: 1; }
.ledger-top h4 { margin: 0 0 4px !important; display: flex; align-items: center; gap: 4px; }
.ledger-top p { margin: 2px 0; }
.days { width: 100%; margin: 8px 0; border-collapse: collapse; font-size: 12px; }
.days th, .days td { padding: 2px 6px; text-align: right; border-bottom: 1px solid rgba(217, 164, 65, .15); }
.days th:first-child, .days td:first-child { text-align: left; }
.log { list-style: none; margin: 0; padding: 0; font-size: 12px; line-height: 1.6; }
.log li.gain { color: var(--jade2); }
.log li.loss, .log li.bad { color: #ff9a8a; }
.log li.gold, .log li.warn { color: var(--gold2); }
.log li.ok { color: var(--jade2); }

/* ───── 弹窗 ───── */
#modal-layer { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(8, 4, 10, .7); }
#modal-layer.on { display: flex; }
.modal { position: relative; max-width: 1100px; max-height: 720px; overflow: auto; padding: 18px 24px; font-size: 14px; line-height: 1.7; animation: pop .2s ease-out; }
.modal::before, .modal::after { content: ""; position: absolute; width: 40px; height: 40px; background: url(../assets/ui/corner.svg) no-repeat; background-size: contain; pointer-events: none; }
.modal::before { left: 3px; top: 3px; }
.modal::after { right: 3px; bottom: 3px; transform: rotate(180deg); }
@keyframes pop { from { transform: scale(.96); } }
.modal h3 { margin: 0 0 10px; font-family: var(--kai); font-size: 24px; display: flex; align-items: center; gap: 6px; }
.modal h3 .ic { width: 28px; height: 28px; }
.modal hr { border: 0; border-top: 1px solid rgba(138, 90, 28, .4); margin: 8px 0; }
.h-btns { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 12px; }

.m-haggle { width: 720px; }
.haggle { display: flex; gap: 20px; }
.h-left { width: 260px; font-size: 13px; }
.h-left h4 { margin: 6px 0 0; font-size: 18px; }
.h-left p { margin: 4px 0; }
.h-item { display: flex; justify-content: center; align-items: center; min-height: 130px; padding: 8px; background: rgba(42, 26, 20, .85); border-radius: 4px; }
.h-item .item { transform: scale(1.6); transform-origin: center; }
.h-right { flex: 1; }
.h-who { font-weight: bold; color: var(--blood); margin-bottom: 4px; }
.tip-row { display: flex; justify-content: space-between; font-size: 13px; padding: 1px 0; }
.h-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.h-slider { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; }
.h-slider input { flex: 1; accent-color: var(--blood); }
.h-slider b { font-size: 22px; color: var(--blood); min-width: 60px; text-align: right; }
.odds { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #ccc; }
.odds i { display: block; height: 100%; transition: width .15s; }
.odds .a { background: #2f8f72; } .odds .c { background: #c9a04a; } .odds .l { background: var(--blood); }
.odds-txt { display: flex; justify-content: space-between; font-size: 12px; margin-top: 2px; }
.h-result { margin: 16px 0; padding: 12px; font-size: 16px; text-align: center; background: rgba(138, 90, 28, .12); border-radius: 4px; }
.h-result.good { color: #1f7a5f; } .h-result.bad { color: var(--blood); }

.m-appraise { width: 820px; }
.appraise { display: flex; gap: 20px; }
.manual { width: 340px; padding: 10px 14px; background: #f6edd6; border: 1px solid var(--paper2); box-shadow: 2px 2px 8px rgba(0, 0, 0, .2); transform: rotate(-1deg); }
.manual h4 { margin: 0 0 6px; }
.manual .ref { width: 160px; height: 160px; margin: 0 auto; }
.manual ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.manual li b { color: var(--blood); margin-right: 6px; }
.viewer { flex: 1; }
.ap-view { position: relative; width: 300px; height: 300px; margin: 0 auto; background: radial-gradient(circle, #3a2a3a, #1a1020); border-radius: 6px; cursor: none; overflow: hidden; }
.ap-view > svg { width: 300px; height: 300px; }
.lens { position: absolute; width: 200px; height: 200px; left: 50px; top: 50px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.lens-in { position: absolute; left: 25px; top: 25px; width: 150px; height: 150px; border-radius: 50%; overflow: hidden; background: #1a1020; }
.lens-in > div { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.lens-in svg { width: 100%; height: 100%; }
.ap-talk { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 6px 10px; font-size: 13px; background: rgba(142, 27, 43, .1); border-left: 3px solid var(--blood); }
.ap-talk b { margin-left: 4px; color: var(--blood); }
.lens > img { position: absolute; inset: 0; width: 200px; height: 200px; }

.m-report { width: 620px; }
.report { display: flex; flex-direction: column; gap: 4px; }
.rp-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-left: 3px solid rgba(138, 90, 28, .4); background: rgba(138, 90, 28, .08); font-size: 13px; }
.rp-row img { width: 30px; height: 30px; }
.rp-row b { width: 80px; flex: none; color: #4a2a1a; }
.rp-row.ok { border-color: #2f8f72; }
.rp-row.warn { border-color: #c9a04a; }
.rp-row.bad { border-color: var(--blood); color: var(--blood); }

.m-npc { width: 640px; }
.npc-talk { display: flex; gap: 16px; }
.npc-talk > img { width: 190px; height: 228px; object-fit: cover; object-position: top; flex: none; background: radial-gradient(circle at 50% 40%, rgba(142, 27, 43, .3), transparent 70%); }
.npc-talk > div { flex: 1; }

.m-locs { width: 900px; }
.locs { display: flex; gap: 14px; }
.loc { flex: 1; cursor: pointer; padding: 8px; border: 1px solid var(--paper2); border-radius: 4px; transition: transform .15s, box-shadow .15s; }
.loc:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0, 0, 0, .3); border-color: var(--blood); }
.loc img { width: 100%; border-radius: 3px; display: block; }
.loc b { display: block; margin-top: 6px; font-size: 17px; font-family: var(--kai); color: var(--blood); }
.loc p { margin: 2px 0; }

.m-scav { width: 980px; }
.scav { display: flex; gap: 16px; }
.scav-bg { position: relative; width: 600px; flex: none; }
.scav-bg img { width: 600px; border-radius: 4px; display: block; }
.scav-stats { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 12px; padding: 4px 12px; background: rgba(20, 16, 26, .85); color: var(--bone); border-radius: 3px; font-size: 14px; }
.scav-stats .good { color: var(--jade2); } .scav-stats .bad { color: var(--moon); }
.scav-side { flex: 1; }
.hand { display: flex; padding: 6px; background: rgba(42, 26, 20, .78); border-radius: 3px; width: fit-content; }
.scav-side .log { margin-top: 8px; min-height: 110px; color: #2a1a14; }
.scav-side .log li.ok { color: #1f7a5f; } .scav-side .log li.bad { color: var(--blood); } .scav-side .log li.warn { color: #8a5a1c; }

.m-setup { width: 1060px; }
.cards { display: flex; gap: 10px; }
.cards.starts { flex-wrap: wrap; }
.cards.starts .card { flex: 1 1 30%; }
.card { flex: 1; padding: 8px 12px; border: 1px solid var(--paper2); border-radius: 4px; cursor: pointer; background: rgba(255, 255, 255, .25); }
.card:hover { border-color: var(--blood); }
.card.on { border: 2px solid var(--blood); background: rgba(196, 58, 58, .1); box-shadow: 0 0 0 2px rgba(242, 210, 122, .6); }
.card b { font-size: 17px; font-family: var(--kai); color: var(--blood); }
.card p { margin: 3px 0; line-height: 1.5; }
.card .tag { vertical-align: middle; margin-left: 6px; }

.m-ending { width: 640px; text-align: center; }
.ending .seal { width: 90px; height: 90px; }
.ending h2 { margin: 4px 0; font-family: var(--kai); font-size: 40px; letter-spacing: 8px; color: var(--blood); }
.ending.win h2 { color: var(--gold-d); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin: 14px 0; text-align: left; font-size: 13px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted rgba(138, 90, 28, .5); }
.stats div:nth-last-child(-n+2) { grid-column: span 2; }

/* ───── 人物与故事 ───── */
.tag.gold { background: var(--gold-d); color: #fff4d6; }
.mood-hostile { color: #ff7a6a; } .mood-cold { color: #c9a0a0; } .mood-neutral { color: var(--bone); }
.mood-warm { color: var(--jade2); } .mood-close { color: var(--gold2); }
.tag.mood-hostile { background: #5e0f1c; color: #ffb0a0; } .tag.mood-cold { background: #4a3040; color: #e0c0c0; }
.tag.mood-warm { background: #1f5c4c; color: #c8f5e4; } .tag.mood-close { background: var(--gold-d); color: #fff4d6; }
.paper .mood-neutral { color: #4a3a2a; } .paper .mood-warm { color: #1f7a5f; } .paper .mood-close { color: #8a5a1c; } .paper .mood-hostile, .paper .mood-cold { color: var(--blood); }

.people { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.pcard { display: flex; gap: 8px; padding: 6px; cursor: pointer; background: rgba(42, 24, 56, .55); border: 1px solid rgba(217, 164, 65, .25); border-radius: 4px; }
.pcard:hover { border-color: var(--gold); background: rgba(61, 35, 80, .7); }
.pcard.dead, .pcard.gone, .pcard.jailed { opacity: .55; filter: grayscale(.6); }
.pc-face { width: 46px; height: 46px; flex: none; overflow: hidden; border-radius: 50%; border: 1px solid var(--gold-d); background: radial-gradient(circle, #3d2350, #1a0f20); }
.pc-face img { width: 120px; margin: -14px 0 0 -37px; }
.pc-info { flex: 1; min-width: 0; font-size: 13px; }
.pc-info .tag { margin-left: 4px; }
.pc-aff { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 2px 0; }
.aff-bar { flex: 1; height: 5px; background: rgba(0, 0, 0, .5); position: relative; border-radius: 3px; overflow: hidden; }
.aff-bar i { position: absolute; top: 0; bottom: 0; }
.aff-bar i.pos { left: 50%; background: var(--jade2); } .aff-bar i.neg { right: 50%; background: var(--moon); }
.pc-last { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.m-story { width: 860px; }
.story { display: flex; gap: 18px; }
.st-portrait { width: 250px; flex: none; align-self: flex-start; background: radial-gradient(ellipse at 50% 35%, rgba(142, 27, 43, .35), transparent 70%), #2a1838; border: 1px solid var(--gold-d); border-radius: 4px; overflow: hidden; }
.st-portrait img { width: 250px; display: block; }
.st-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; }
.st-body > p { margin: 4px 0; }
.st-body h3 { flex-wrap: wrap; }
.st-body h3 .muted { font-size: 14px; margin-left: 8px; font-family: var(--serif); }
.st-body h3 .tag { font-family: var(--serif); }
.st-text p { margin: 0 0 8px; font-size: 15px; line-height: 1.85; text-indent: 0; }
.st-item { align-self: flex-start; display: flex; align-items: center; gap: 10px; margin: 6px 0; padding: 6px 10px; background: rgba(42, 26, 20, .82); border-radius: 4px; color: var(--bone); }
.st-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.st-choice { width: 100%; justify-content: space-between; text-align: left; padding: 8px 14px; }
.st-choice small { color: var(--paper2); font-size: 12px; opacity: .85; margin-left: 12px; }
.st-choice:disabled small { color: #ffb0a0; }
.st-delta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; }
.st-sum { padding: 6px 10px; background: rgba(138, 90, 28, .12); border-left: 3px solid var(--gold-d); }
.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 2px solid rgba(138, 90, 28, .4); max-height: 260px; overflow: auto; font-size: 13px; }
.timeline li { margin: 0 0 4px; }
.timeline li .muted { margin-right: 8px; }
.timeline li .good, .timeline li .bad { margin-left: 6px; font-size: 12px; }
.timeline li.life { color: #5b3474; font-style: italic; }

/* ───── 时局、加料、送礼 ───── */
.tb-cal { font-size: 11px; line-height: 1.3; }
.tb-cal em { color: var(--gold2); font-style: normal; }
.tb-cell.war { padding: 2px 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.tb-cell.war.st1 { background: rgba(217, 164, 65, .2); } .tb-cell.war.st2 { background: rgba(196, 58, 58, .3); }
.tb-cell.war.st3 { background: rgba(196, 58, 58, .5); } .tb-cell.war.st4 { background: var(--blood); color: #fff; animation: warpulse 2s infinite; }
@keyframes warpulse { 50% { box-shadow: 0 0 10px var(--moon); } }
.world-head { display: flex; gap: 14px; padding: 8px 12px; font-size: 13px; }
.world-head > div:first-child { flex: 1.4; }
.world-head h4 { margin: 0 0 4px !important; display: flex; align-items: center; gap: 4px; }
.world-head p { margin: 3px 0; }
.stage { color: var(--blood); } .stage.st4 { color: #fff; background: var(--blood); padding: 0 6px; border-radius: 3px; }
.stage-track { position: relative; height: 22px; margin: 6px 0 2px; border-bottom: 6px solid rgba(42, 26, 20, .25); }
.stage-track i { position: absolute; left: 0; bottom: -6px; height: 6px; background: linear-gradient(90deg, #c9a04a, var(--blood)); }
.stage-track span { position: absolute; top: 0; transform: translateX(-10%); font-size: 11px; color: #9a8670; }
.stage-track span.on { color: var(--blood); font-weight: bold; }
.rels { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.rel-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.rel-row .meter { flex: 1; margin: 0; height: 7px; }
.rel-row b { width: 22px; text-align: right; }
.world-cols { display: flex; gap: 14px; margin-top: 4px; }
.world-cols > div { flex: 1; font-size: 13px; }
.world-cols p { margin: 3px 0; }
.quotes { width: 100%; border-collapse: collapse; font-size: 12px; }
.quotes td { padding: 1px 6px; border-bottom: 1px solid rgba(217, 164, 65, .12); }
.quotes td:last-child { text-align: right; }
.world-tab .log li.bad { color: #ff9a8a; }
.tag.laced, .laced-txt { color: #e6c8ff; } .tag.laced { background: #4a2366; }
.laced-dot { position: absolute; left: 2px; bottom: 2px; width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle, #e6c8ff, #7a3fa0); box-shadow: 0 0 6px #b48be0; pointer-events: none; }
.item .bar.rot i { background: linear-gradient(90deg, #6b7d5a, #c9a04a); }
.p-traits { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; margin: 4px 0 !important; }
.paper .laced-txt { color: #5b3474; font-weight: bold; }
.p-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.m-gift, .m-lace { width: 640px; }
.gift-list, .lace-list { max-height: 440px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.gift-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; cursor: pointer; border: 1px solid transparent; border-radius: 4px; }
.gift-row:hover { border-color: var(--blood); background: rgba(196, 58, 58, .08); }
.gift-row > span:nth-child(2) { flex: 1; }
.item.mini { transform: scale(.75); transform-origin: left center; margin-right: -10px; background: rgba(42, 26, 20, .8); }
.lace-row { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-bottom: 1px solid rgba(138, 90, 28, .3); }
.lace-row > div:nth-child(2) { flex: 1; } .lace-row p { margin: 2px 0; }
.lace-ic { width: 44px; }
.cp-actions .btn small { opacity: .8; font-size: 11px; }

/* ───── 作伪与鉴定 ───── */
.item .stamp.dressed { background: #8a5a1c; }
.tb-cell.power { padding: 2px 8px; border-radius: 10px; background: rgba(217, 164, 65, .15); color: var(--gold2); }
.techs { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-bottom: 8px; padding: 6px 8px; background: rgba(0, 0, 0, .25); border-radius: 4px; font-size: 12px; }
.tech { display: inline-flex; align-items: center; gap: 3px; opacity: .55; }
.tech.on { opacity: 1; color: var(--gold2); }
.tech img { width: 18px; height: 18px; }
.tech b { margin-left: 2px; }
.h-claim { display: flex; gap: 8px; margin-bottom: 8px; }
.h-claim label { flex: 1; padding: 6px 10px; border: 1px solid var(--paper2); border-radius: 4px; cursor: pointer; font-weight: bold; }
.h-claim label small { display: block; font-weight: normal; font-size: 11px; color: #7a6450; }
.h-claim label.on { border: 2px solid var(--blood); background: rgba(196, 58, 58, .1); }
.power-parts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }

.warnbox { margin: 4px 0 8px; padding: 6px 10px; background: rgba(196, 58, 58, .15); border-left: 3px solid var(--blood); font-size: 13px; line-height: 1.6; }
.warnbox .ic { width: 18px; height: 18px; }
.tb-cell.tipchip { padding: 2px 8px; border-radius: 10px; background: var(--blood); color: #fff; animation: warpulse 1.6s infinite; }
.cat small { font-size: 12px; }

/* ───── 流派 ───── */
.tb-cell.vit { gap: 3px; }
.tb-cell.vit .meter { width: 44px; }
.meter.st i { background: linear-gradient(90deg, #8e1b2b, #e8902f); }
.meter.sp i { background: linear-gradient(90deg, #1f5c7c, #8fd3ff); }
.badge.b-bl { left: 1px; bottom: 1px; top: auto; } .badge.b-br { right: 1px; bottom: 1px; top: auto; }
.intel { margin-top: 6px; padding: 5px 8px; font-size: 13px; background: rgba(42, 24, 56, .12); border-left: 3px solid #5b3474; }
.intel .ic { width: 18px; height: 18px; }
.intel-acts { display: inline-flex; gap: 4px; margin-left: 6px; }
.merit-row { padding: 4px 6px; border-bottom: 1px solid rgba(217, 164, 65, .12); font-size: 13px; }
.merit-row b { margin-right: 8px; }
.merit-goods { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.merit-goods img { width: 16px; height: 16px; margin-right: 2px; }
.m-market { width: 1000px; }
.mk-head { position: relative; height: 150px; overflow: hidden; border-radius: 4px; }
.mk-head > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.6); }
.mk-who { position: relative; display: flex; gap: 12px; padding: 10px; color: var(--bone); }
.mk-who > img { width: 100px; height: 120px; object-fit: cover; object-position: top; }
.mk-who h3 { color: var(--gold2) !important; }
.mk-who p { margin: 2px 0; }
.mk-tabs { display: flex; margin: 8px 0 4px; border-bottom: 1px solid var(--paper2); }
.mk-tabs .tab { color: #7a6450; flex: none; padding: 4px 16px; }
.mk-tabs .tab.on { color: var(--blood); }
.mk-cols { display: flex; gap: 16px; max-height: 330px; overflow: auto; }
.mk-cols > div { flex: 1; }
.mk-cols .shop-row { color: #2a1a14; gap: 6px; }
.mk-cols .shop-row b { min-width: 56px; white-space: nowrap; }
.mk-cols .shop-row .muted { flex: 1; white-space: nowrap; }

/* ───── 浮层 ───── */
#tooltip {
  position: fixed; z-index: 2000; display: none; width: 240px; padding: 10px 12px; pointer-events: none; font-size: 13px; line-height: 1.55;
  font-family: var(--serif); color: var(--bone); background: rgba(20, 16, 26, .96); border: 1px solid var(--gold-d); border-radius: 4px; box-shadow: 0 6px 20px rgba(0, 0, 0, .6);
}
#tooltip h4, .h-left h4 { margin: 0; font-size: 16px; color: var(--gold2); font-family: var(--kai); }
.h-left h4 { color: var(--blood); }
.tip-sub { font-size: 12px; color: var(--muted); }
.tip-val { margin: 4px 0; display: flex; align-items: center; gap: 4px; }
.tip-val .ic { width: 16px; height: 16px; }
#tooltip p, .h-left p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.h-left p { color: #7a6450; }
.tags { margin-top: 2px; }
#toast {
  position: fixed; left: 50%; top: 70px; z-index: 3000; transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  padding: 10px 22px; font-family: var(--serif); font-size: 15px; color: #fff4d6; background: rgba(42, 16, 32, .95); border: 1px solid var(--gold); border-radius: 4px;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { border-color: var(--moon); color: #ffcabc; }
#toast.good { border-color: var(--jade2); color: #d0f5e8; }

* { scrollbar-width: thin; scrollbar-color: rgba(217, 164, 65, .35) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(217, 164, 65, .35); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ───────────── 交易盘 ───────────── */
.trade { display: flex; gap: 14px; align-items: flex-start; }
.trade .grid-label { font-size: 11px; }
.grid .item.focus { outline: 2px solid var(--gold2); outline-offset: -2px; }
.grid .item.take::after { content: "收"; position: absolute; right: 1px; bottom: 1px; padding: 0 3px; font-size: 11px; line-height: 15px; color: #fff; background: #1f7a5f; border-radius: 3px; }
.grid .item.locked[data-act] { cursor: pointer; }
.cp-actions:has(.btn.small) { overflow: auto; justify-content: flex-start; gap: 6px; }
.m-deal { width: 760px; }
.deal { display: flex; gap: 18px; }
.d-col { flex: 1; min-width: 0; }
.d-col h4 { margin: 0 0 4px; }
.d-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; border-bottom: 1px dashed rgba(138, 90, 28, .3); }
.d-row > span:nth-child(2) { flex: 1; }
.d-row small { margin-left: 4px; }
.d-claim { display: flex; gap: 4px; }
.d-claim label { padding: 1px 6px; font-size: 11px; border: 1px solid var(--paper2); border-radius: 3px; cursor: pointer; }
.d-claim label.on { border-color: var(--blood); background: rgba(196, 58, 58, .12); font-weight: bold; }

/* ───────────── 修为、人物、派系 ───────────── */
.tb-cell.dao { cursor: pointer; line-height: 1.1; }
.tb-cell.dao small { opacity: .7; font-size: 10px; }
.p-lever { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; padding: 4px 6px; background: rgba(91, 52, 116, .12); border-radius: 4px; }
.clique-tab { padding: 4px 2px; }
.clique { display: flex; gap: 10px; padding: 6px; margin-bottom: 6px; border: 1px solid rgba(217, 164, 65, .25); border-radius: 4px; }
.clique.joined { border-color: var(--gold2); background: rgba(217, 164, 65, .08); }
.clique img { width: 54px; height: 64px; object-fit: cover; object-position: 50% 15%; border-radius: 3px; }
.cq-body { flex: 1; min-width: 0; font-size: 13px; }
.cq-body p { margin: 2px 0; }
.cq-body .meter { width: 70px; }
.opp { padding: 6px 8px; margin-bottom: 6px; background: rgba(42, 26, 20, .5); border-left: 3px solid var(--gold-d); border-radius: 3px; font-size: 13px; }
.opp p { margin: 2px 0 4px; }
