:root {
  --bg: #0b0d10;
  --panel: rgba(14, 17, 21, 0.86);
  --panel2: rgba(30, 34, 40, 0.75);
  --line: rgba(255, 255, 255, 0.1);
  --text: #e9e4d8;
  --muted: #9a958a;
  --gold: #d8b46a;
  --red: #e0483c;
  --orange: #e8913a;
  --green: #6fbf73;
  --blue: #5aa0e0;
  --serif: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; user-select: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; }
b { color: var(--gold); font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn { font-family: var(--sans); background: rgba(216, 180, 106, 0.12); color: var(--text); border: 1px solid rgba(216, 180, 106, 0.5); padding: 10px 22px; font-size: 15px; letter-spacing: 2px; cursor: pointer; border-radius: 2px; transition: all .2s; }
.btn:hover { background: rgba(216, 180, 106, 0.3); border-color: var(--gold); }
.btn.big { font-size: 18px; padding: 14px 40px; background: rgba(216, 180, 106, 0.22); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold); }
.btn.small { padding: 4px 10px; font-size: 12px; letter-spacing: 0; }
.btn.danger { border-color: rgba(224, 72, 60, 0.6); background: rgba(224, 72, 60, 0.15); }
.btn.on { border-color: rgba(216, 180, 106, 0.8); background: rgba(216, 180, 106, 0.18); color: #f0d79a; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.row-btns { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* ---------- 屏幕层 ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 28px 32px; backdrop-filter: blur(8px); box-shadow: 0 20px 80px rgba(0,0,0,.6); max-height: 92vh; overflow: auto; }
.panel h2 { font-family: var(--serif); font-weight: normal; font-size: 30px; margin: 0 0 14px; letter-spacing: 4px; color: var(--gold); }

/* ---------- 标题 ---------- */
#screen-title { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 30%, rgba(0,0,0,.55) 100%); }
.title-wrap { text-align: center; animation: fadeIn 2.5s ease; }
.title-sub { font-family: var(--serif); letter-spacing: 10px; color: rgba(255,255,255,.75); font-size: 18px; }
.title-main { font-family: var(--serif); font-size: 160px; margin: 0; letter-spacing: 30px; padding-left: 30px; font-weight: normal; color: #f4efe2; text-shadow: 0 0 40px rgba(0,0,0,.6), 0 4px 30px rgba(0,0,0,.8); line-height: 1.1; }
.title-tag { font-family: var(--serif); font-size: 28px; letter-spacing: 18px; color: var(--red); text-shadow: 0 0 20px rgba(0,0,0,.8); }
.title-en { letter-spacing: 8px; font-size: 12px; color: rgba(255,255,255,.55); margin-top: 8px; }
.title-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 46px; }
.title-btns .btn { min-width: 220px; background: rgba(0,0,0,.35); }
.title-warn { margin-top: 40px; color: rgba(255,255,255,.55); font-size: 12px; letter-spacing: 1px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 难度 ---------- */
.diff-panel { width: min(760px, 92vw); }
#diff-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.diff-card { border: 1px solid var(--line); padding: 18px; cursor: pointer; transition: all .2s; background: var(--panel2); }
.diff-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.diff-card h3 { font-family: var(--serif); font-weight: normal; font-size: 24px; margin: 0 0 8px; }
.diff-card .money { color: var(--gold); font-size: 20px; margin-bottom: 8px; }

/* ---------- 商店 ---------- */
#screen-shop { background: rgba(5,6,8,.72); }
.shop { width: min(1360px, 97vw); height: min(860px, 95vh); background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; backdrop-filter: blur(8px); }
.shop-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.shop-head h2 { font-family: var(--serif); font-weight: normal; margin: 0 0 4px; font-size: 26px; color: var(--gold); letter-spacing: 3px; }
.shop-head-title { flex: 1 1 260px; min-width: 0; }
.shop-head-side { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.shop-money { font-size: 18px; white-space: nowrap; }
.shop-money b { font-size: 26px; }
.shop-profile { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; }
.shop-profile-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.shop-profile input { width: 150px; min-width: 0; max-width: 100%; padding: 7px 10px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.shop-profile input:focus { outline: 1px solid var(--gold); }
#shop-profile-status { overflow-wrap: anywhere; font-size: 12px; }
@media (max-width: 600px), (max-height: 540px) {
  .shop-head { gap: 10px; }
  .shop-profile .muted { font-size: 11px; line-height: 1.4; }
  .shop-profile input { width: 110px; }
}
.shop-body { flex: 1; display: flex; min-height: 0; }
.shop-cats { width: 130px; border-right: 1px solid var(--line); padding: 10px 0; overflow: auto; }
.shop-cats div { padding: 12px 18px; cursor: pointer; color: var(--muted); border-left: 3px solid transparent; font-size: 15px; }
.shop-cats div.on, .shop-cats div:hover { color: var(--text); border-left-color: var(--gold); background: rgba(255,255,255,.04); }
.shop-items { flex: 1; overflow: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-content: start; }
.card { background: var(--panel2); border: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; transition: border-color .2s; }
.card.owned { border-color: rgba(216, 180, 106, 0.65); background: rgba(216,180,106,.08); }
.card .nm { font-size: 15px; font-weight: 600; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.card .meta .p { color: var(--gold); }
.card .ds { font-size: 12px; color: #bdb7aa; line-height: 1.55; flex: 1; }
.card .ctl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.card .ctl .q { min-width: 26px; text-align: center; font-size: 15px; }
.shop-side { width: 330px; border-left: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 16px; gap: 10px; min-height: 0; overflow-y: auto; }
.side-block { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.side-block.grow { flex: 1; overflow: auto; min-height: 60px; }
.side-title { font-size: 12px; letter-spacing: 2px; color: var(--muted); margin-bottom: 6px; }
.wbar { height: 10px; background: rgba(255,255,255,.08); position: relative; overflow: hidden; }
#shop-wfill { height: 100%; background: var(--green); transition: width .2s; }
#shop-list div { font-size: 13px; display: flex; justify-content: space-between; padding: 2px 0; color: #cfc9bc; }
#shop-warn div { font-size: 12px; color: var(--orange); padding: 2px 0; line-height: 1.5; }
#shop-warn div.ok { color: var(--green); }
#shop-warn { max-height: 22vh; overflow-y: auto; }
/* 矮屏幕（如 1366×768 笔记本）上也必须能点到“出发” */
.side-btns { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; position: sticky; bottom: 0; background: rgba(14, 17, 21, 0.97); padding-top: 6px; }
.side-btns .btn.big { flex: 1; padding: 12px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,.9); }
#hud-tl { position: absolute; left: 18px; top: 16px; line-height: 1.75; }
#hud-time { font-family: var(--serif); font-size: 22px; letter-spacing: 2px; }
#hud-wx, #hud-alt, #hud-next { font-size: 14px; }
#hud-alt b { font-size: 18px; }
#hud-next { color: var(--gold); }
#hud-top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: min(720px, 56vw); }
#compass { height: 30px; position: relative; overflow: hidden; border-bottom: 1px solid rgba(255,255,255,.25); mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
#compass-strip { position: absolute; top: 0; left: 0; height: 100%; white-space: nowrap; }
#compass-strip span { position: absolute; top: 4px; transform: translateX(-50%); font-size: 13px; color: rgba(255,255,255,.75); }
#compass-strip span.c { font-size: 16px; color: #fff; font-weight: 600; }
#compass-strip span.n { color: var(--red); }
#compass-strip span.wp { color: var(--gold); top: 16px; font-size: 11px; }
#compass-needle { position: absolute; left: 50%; bottom: 0; width: 2px; height: 8px; background: var(--gold); }
#progress { position: relative; height: 22px; margin-top: 8px; }
#progress .line { position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: rgba(255,255,255,.18); }
#progress .done { position: absolute; left: 0; top: 10px; height: 2px; background: var(--gold); }
#progress .dot { position: absolute; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: rgba(30,30,30,.9); border: 1px solid rgba(255,255,255,.4); transform: translateX(-50%); }
#progress .dot.minor { width: 6px; height: 6px; top: 8px; }
#progress .dot.on { background: var(--gold); border-color: var(--gold); }
#progress .me { position: absolute; top: 2px; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid #fff; transform: translateX(-50%); }
#hud-tr { position: absolute; right: 16px; top: 16px; text-align: center; }
#minimap { width: 200px; height: 200px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); background: rgba(10,14,12,.55); }
#minimap-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
#msgs { position: absolute; left: 18px; bottom: 330px; width: min(540px, 44vw); display: flex; flex-direction: column; gap: 6px; }
#msgs .m { background: linear-gradient(90deg, rgba(0,0,0,.65), rgba(0,0,0,0)); padding: 6px 12px; border-left: 3px solid rgba(255,255,255,.5); font-size: 14px; line-height: 1.5; animation: msgIn .3s ease; transition: opacity 1s; }
#msgs .m.warn { border-left-color: var(--orange); }
#msgs .m.danger { border-left-color: var(--red); color: #ffd8d0; }
#msgs .m.crit { border-left-color: var(--red); color: #fff; background: linear-gradient(90deg, rgba(150,20,10,.75), rgba(0,0,0,0)); font-weight: 600; }
#msgs .m.good { border-left-color: var(--green); }
@keyframes msgIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
#hud-bl { position: absolute; left: 18px; bottom: 16px; width: 320px; }
#chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
#chips span { font-size: 12px; padding: 2px 8px; border: 1px solid; border-radius: 2px; background: rgba(0,0,0,.45); }
#chips .warn { color: var(--orange); border-color: rgba(232,145,58,.6); }
#chips .bad { color: #ff8a7a; border-color: rgba(224,72,60,.7); }
#chips .crit { color: #fff; background: rgba(200,30,20,.75); border-color: var(--red); animation: pulse 1s infinite; }
#chips .good { color: var(--green); border-color: rgba(111,191,115,.6); }
@keyframes pulse { 50% { opacity: .55; } }
.bar { display: grid; grid-template-columns: 44px 1fr 56px; align-items: center; gap: 8px; height: 19px; }
.bar .lb { font-size: 12px; color: #d5cfc2; }
.bar .tr { height: 6px; background: rgba(255,255,255,.12); position: relative; overflow: hidden; }
.bar .fl { position: absolute; left: 0; top: 0; bottom: 0; transition: width .25s; }
.bar .gh { position: absolute; top: 0; bottom: 0; background: rgba(255,255,255,.18); }
.bar .vl { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.bar.low .lb, .bar.low .vl { color: #ff8a7a; animation: pulse 1s infinite; }
#hud-br { position: absolute; right: 16px; bottom: 14px; text-align: right; }
#load { font-size: 13px; line-height: 1.8; margin-bottom: 8px; }
#keys { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: flex-end; max-width: 360px; font-size: 11px; color: rgba(255,255,255,.6); }
#keys b { display: inline-block; min-width: 16px; padding: 0 4px; border: 1px solid rgba(255,255,255,.35); margin-right: 3px; color: #fff; font-weight: normal; text-align: center; }
#prompt { position: absolute; left: 50%; bottom: 140px; transform: translateX(-50%); font-size: 16px; background: rgba(0,0,0,.55); padding: 8px 18px; border: 1px solid rgba(255,255,255,.2); display: none; }
#prompt b { border: 1px solid var(--gold); padding: 0 6px; margin-right: 8px; }
#alert { position: absolute; left: 50%; top: 28%; transform: translateX(-50%); font-size: 26px; font-family: var(--serif); color: #fff; background: rgba(150,20,10,.7); padding: 10px 30px; letter-spacing: 3px; display: none; animation: pulse .5s infinite; }
#qte { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); text-align: center; display: none; }
#qte-text { font-size: 24px; font-weight: 600; color: #fff; margin-bottom: 10px; text-shadow: 0 0 10px #000; }
#qte-bar { width: 360px; height: 10px; background: rgba(255,255,255,.2); margin: 0 auto; }
#qte-fill { height: 100%; background: var(--red); width: 100%; }
#titlecard { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); text-align: center; opacity: 0; transition: opacity 1.4s; width: 80vw; }
#titlecard.show { opacity: 1; }
#titlecard .tc-sub { letter-spacing: 8px; color: rgba(255,255,255,.75); font-size: 14px; }
#titlecard .tc-name { font-family: var(--serif); font-size: 72px; letter-spacing: 12px; color: #fff; text-shadow: 0 2px 30px rgba(0,0,0,.8); }
#titlecard .tc-alt { color: var(--gold); letter-spacing: 6px; font-size: 18px; }
#titlecard .tc-desc { margin: 14px auto 0; max-width: 640px; font-size: 15px; line-height: 1.8; color: rgba(255,255,255,.85); }
#crosshair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: rgba(255,255,255,.6); }
#lockhint { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 14px; color: rgba(255,255,255,.7); background: rgba(0,0,0,.4); padding: 6px 14px; display: none; }

/* ---------- 屏幕特效 ---------- */
#fx-vignette, #fx-frost, #fx-blood, #fx-drops, #fx-flash, #fx-black { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#fx-vignette { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,.75) 100%); opacity: .6; }
#fx-frost { background: radial-gradient(ellipse at center, rgba(180,210,255,0) 40%, rgba(200,225,255,.55) 85%, rgba(235,245,255,.9) 100%); opacity: 0; mix-blend-mode: screen; }
#fx-blood { background: radial-gradient(ellipse at center, rgba(120,0,0,0) 35%, rgba(140,0,0,.7) 100%); opacity: 0; }
#fx-drops { opacity: 0; background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.18) 0 4px, transparent 6px), radial-gradient(circle at 70% 60%, rgba(255,255,255,.14) 0 6px, transparent 8px), radial-gradient(circle at 40% 80%, rgba(255,255,255,.12) 0 3px, transparent 5px), radial-gradient(circle at 85% 20%, rgba(255,255,255,.15) 0 5px, transparent 7px), radial-gradient(circle at 10% 70%, rgba(255,255,255,.12) 0 4px, transparent 6px); background-size: 420px 380px; }
#fx-flash { background: #fff; opacity: 0; }
#fx-black { background: #000; opacity: 0; transition: opacity 1.2s; z-index: 40; }

/* ---------- 弹窗 / 背包 / 地图 ---------- */
#modal { background: rgba(0,0,0,.45); z-index: 60; }
.modal-panel { width: min(640px, 92vw); }
#modal-body { line-height: 1.8; font-size: 15px; color: #d9d3c6; }
#modal-body p { margin: 0 0 10px; }
#modal-body .opt { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.keys-table { display: grid; grid-template-columns: 110px 1fr; gap: 6px 16px; font-size: 14px; }
.keys-table div:nth-child(odd) { color: var(--gold); }
#screen-inv, #screen-map { background: rgba(0,0,0,.5); }
.inv-panel { width: min(1180px, 96vw); height: min(780px, 92vh); display: flex; flex-direction: column; padding: 20px 26px; }
.inv-head { display: flex; justify-content: space-between; align-items: baseline; }
.inv-body { flex: 1; display: flex; gap: 22px; min-height: 0; }
.inv-stats { width: 360px; overflow: auto; font-size: 13px; line-height: 1.75; }
.inv-stats .st { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.inv-stats .st span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.inv-stats h4 { margin: 14px 0 6px; font-weight: normal; color: var(--gold); letter-spacing: 2px; }
.inv-stats .tip { color: var(--muted); font-size: 12px; }
.inv-items { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-content: start; }
.inv-items .card .ctl { justify-content: flex-start; flex-wrap: wrap; }
.inv-items .card.worn { border-color: rgba(111,191,115,.6); }
.inv-items .sec { grid-column: 1 / -1; color: var(--gold); letter-spacing: 3px; font-size: 13px; margin-top: 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.map-panel { width: min(1160px, 96vw); padding: 20px 26px; }
#bigmap, #profile { width: 100%; display: block; background: rgba(20, 24, 20, .6); border: 1px solid var(--line); margin-top: 10px; }

/* ---------- 结局 ---------- */
#screen-end { background: rgba(0,0,0,.82); z-index: 70; }
.end-wrap { text-align: center; max-width: 760px; padding: 20px; animation: fadeIn 2s ease; }
#end-kicker { letter-spacing: 10px; color: var(--muted); }
#end-title { font-family: var(--serif); font-size: 84px; font-weight: normal; margin: 6px 0; letter-spacing: 14px; }
#end-cause { font-size: 20px; color: var(--red); margin-bottom: 20px; font-family: var(--serif); letter-spacing: 3px; }
#end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
#end-stats div { background: var(--panel2); padding: 10px; border: 1px solid var(--line); }
#end-stats div span { display: block; font-size: 22px; color: var(--gold); }
#end-text { line-height: 1.9; color: #cfc9bc; font-size: 14px; }

/* ---------- 加载 ---------- */
#loading { background: #000; z-index: 80; }
.load-wrap { width: 420px; text-align: center; }
.load-title { font-family: var(--serif); font-size: 32px; letter-spacing: 8px; margin-bottom: 16px; }
.load-bar { height: 3px; background: rgba(255,255,255,.1); margin-bottom: 14px; }
#load-fill { height: 100%; width: 0; background: var(--gold); transition: width .2s; }

@media (max-width: 1150px) {
  #hud-tl { top: 84px; }
  #hud-top { width: min(560px, 70vw); }
  #hud-tr { top: 84px; }
  #minimap { width: 150px; height: 150px; }
}
.title-tag { margin-top: 6px; }
.title-en { margin-top: 14px; }

#wpmark { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); text-align: center; pointer-events: none; transition: opacity .3s; }
#wpmark .wp-ico { color: var(--gold); font-size: 20px; text-shadow: 0 0 8px rgba(0,0,0,.9), 0 0 2px #000; line-height: 1; }
#wpmark .wp-name { font-size: 13px; color: #fff; white-space: nowrap; margin-top: 2px; }
#wpmark .wp-dist { font-size: 12px; color: var(--gold); white-space: nowrap; }
#wpmark .wp-arrow { position: absolute; left: 50%; top: 50%; color: var(--gold); font-size: 22px; display: none; margin: -14px 0 0 -10px; text-shadow: 0 0 6px #000; }
#wpmark.edge .wp-arrow { display: block; }
#wpmark.edge .wp-ico { visibility: hidden; }
#hud-next .dir { display: inline-block; color: #fff; font-weight: 600; }
#hud-tl, #hud-bl, #hud-br { background: rgba(8, 10, 12, 0.38); padding: 10px 14px; border-radius: 3px; backdrop-filter: blur(2px); }
#hud-tl { left: 12px; top: 10px; }
#hud-bl { left: 12px; bottom: 10px; }
#hud-br { right: 12px; bottom: 10px; }
#compass, #progress { background: rgba(8, 10, 12, 0.25); }
#wpmark .wp-name, #wpmark .wp-dist { background: rgba(0,0,0,.35); padding: 0 6px; border-radius: 2px; }

.season-panel { width: min(1020px, 95vw); }
#season-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.season-card { border: 1px solid var(--line); padding: 16px; cursor: pointer; transition: all .2s; background: var(--panel2); position: relative; overflow: hidden; }
.season-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.season-card .big { font-family: var(--serif); font-size: 58px; line-height: 1; margin-bottom: 4px; }
.season-card .sub { color: var(--gold); margin-bottom: 8px; letter-spacing: 2px; }
.season-card .skulls { color: var(--red); letter-spacing: 3px; margin: 6px 0 8px; font-size: 13px; }
.season-card .stats { font-size: 12px; color: #cfc9bc; line-height: 1.7; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.season-card.spring .big { color: #f4a6c6; } .season-card.summer .big { color: #7ccf6a; } .season-card.autumn .big { color: #e8913a; } .season-card.winter .big { color: #bfe0ff; }
#stance { color: #fff; }
@media (max-width: 900px) { #season-list { grid-template-columns: repeat(2, 1fr); } }

/* =====================================================================
   触屏（手机 / 平板）——只在 <html class="touch"> 下生效，电脑端不受影响
   ===================================================================== */
#touch-ui, #rotate-hint, .t-close { display: none; }
html.touch { --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); -webkit-text-size-adjust: 100%; }
html.touch body { -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.touch button, html.touch .card, html.touch .season-card, html.touch .shop-cats div { touch-action: manipulation; }
html.touch .t-close { display: inline-block; margin-left: auto; }
html.touch .inv-head { gap: 12px; align-items: center; }

/* ---------- 控件层 ---------- */
html.touch #touch-ui { display: block; position: fixed; inset: 0; z-index: 20; touch-action: none; }
html.touch #touch-ui.off { display: none; }
#t-stick { position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.3); background: radial-gradient(circle, rgba(0,0,0,.04) 40%, rgba(0,0,0,.3)); opacity: .5; transition: opacity .25s; pointer-events: none; }
#t-stick.act { opacity: 1; transition: none; }
#t-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(233,228,216,.3); border: 1.5px solid rgba(255,255,255,.6); box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.tb { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #f1ece0; background: rgba(10,12,15,.45); border: 1px solid rgba(255,255,255,.3); text-shadow: 0 1px 2px rgba(0,0,0,.85); transition: background .12s, border-color .12s, opacity .2s, transform .08s; cursor: pointer; }
.tb.down { background: rgba(216,180,106,.5); transform: scale(.93); }
.tb.on { border-color: var(--gold); background: rgba(216,180,106,.3); color: #fff; box-shadow: 0 0 10px rgba(216,180,106,.35); }
.tb.dim { opacity: .35; }
.tb .lb { line-height: 1; white-space: nowrap; }
.tb .cp { font-size: 9px; opacity: .8; margin-top: 3px; font-family: var(--sans); letter-spacing: 1px; }
.tb .bd { position: absolute; top: -8px; right: -5px; font-size: 9px; line-height: 13px; padding: 0 4px; border-radius: 7px; background: rgba(0,0,0,.75); color: var(--gold); }
.tb .bd:empty { display: none; }

/* 右下：动作键（拇指弧形排布） */
#t-act .tb { border-radius: 50%; font-family: var(--serif); }
#t-act .tb .lb { font-size: 22px; }
#tb-jump { width: 74px; height: 74px; right: calc(18px + var(--sr)); bottom: calc(20px + var(--sb)); }
#tb-jump .lb { font-size: 28px; }
#tb-sprint { width: 56px; height: 56px; right: calc(104px + var(--sr)); bottom: calc(14px + var(--sb)); }
#tb-crouch { width: 54px; height: 54px; right: calc(96px + var(--sr)); bottom: calc(84px + var(--sb)); }
#tb-prone { width: 54px; height: 54px; right: calc(26px + var(--sr)); bottom: calc(106px + var(--sb)); }
#tb-faster, #tb-slower { width: 44px; height: 44px; }
#t-act #tb-faster .lb, #t-act #tb-slower .lb { font-size: 20px; }
#tb-faster { right: calc(160px + var(--sr)); bottom: calc(98px + var(--sb)); }
#tb-slower { right: calc(170px + var(--sr)); bottom: calc(40px + var(--sb)); }
.tb.hide { display: none; }
#touch-ui.qte #tb-jump { border-color: var(--red); background: rgba(200,40,30,.45); animation: tpulse .45s infinite; }
@keyframes tpulse { 50% { transform: scale(1.1); } }

/* 底部：常用操作 */
#t-quick { position: absolute; left: 50%; bottom: calc(8px + var(--sb)); transform: translateX(-50%); display: grid; grid-template-columns: repeat(5, 48px); gap: 6px 5px; }
#t-quick .tb, #t-sys .tb { position: relative; height: 36px; border-radius: 5px; font-size: 12px; }
#tb-poles .lb { font-size: 11px; letter-spacing: -0.5px; }

/* 右上：系统键 */
#t-sys { position: absolute; top: calc(8px + var(--st)); right: calc(8px + var(--sr)); display: flex; gap: 6px; }
#t-sys .tb { width: 44px; height: 32px; }
#tb-pause .lb { font-family: var(--serif); font-size: 14px; }
#tb-fullscreen .lb { display: flex; align-items: center; justify-content: center; }
.fs-ico { width: 18px; height: 18px; display: block; }

/* 互动：替代电脑端的“E 互动”提示 */
#t-use { display: none; left: 50%; bottom: calc(96px + var(--sb)); transform: translateX(-50%); flex-direction: row; gap: 8px; padding: 9px 18px; border-radius: 22px; border-color: var(--gold); background: rgba(24,18,8,.62); font-size: 14px; max-width: 52vw; }
#t-use.show { display: flex; }
#t-use.down { transform: translateX(-50%) scale(.95); }
#t-use .cp { font-size: 14px; margin: 0; color: var(--gold); font-weight: 600; opacity: 1; }
#t-use .lb { overflow: hidden; text-overflow: ellipsis; }

/* 竖屏提示 */
@media (orientation: portrait) and (max-width: 600px) {
  html.touch #rotate-hint { display: flex; position: fixed; inset: 0; z-index: 300; background: #0b0d10; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-family: var(--serif); font-size: 22px; letter-spacing: 4px; text-align: center; }
  #rotate-hint .ico { font-size: 54px; color: var(--gold); animation: trot 2.4s ease-in-out infinite; }
  #rotate-hint .muted { font-family: var(--sans); letter-spacing: 2px; }
}
@keyframes trot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

/* ---------- HUD 紧凑布局 ---------- */
html.touch #hud-br, html.touch #prompt, html.touch #lockhint { display: none !important; }
html.touch #hud-left { position: absolute; left: calc(8px + var(--sl)); top: calc(6px + var(--st)); width: min(36vw, 330px); display: flex; flex-direction: column; gap: 4px; }
html.touch #hud-tl, html.touch #hud-bl { position: static; width: auto; padding: 5px 9px; }
html.touch #hud-tl { line-height: 1.45; }
html.touch #hud-time { font-size: 15px; }
html.touch #hud-wx, html.touch #hud-alt, html.touch #hud-next { font-size: 11px; }
html.touch #hud-alt b { font-size: 13px; }
html.touch #bars { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
html.touch .bar { grid-template-columns: 26px 1fr 30px; height: 13px; gap: 4px; }
html.touch .bar .lb, html.touch .bar .vl { font-size: 10px; }
html.touch .bar .tr { height: 4px; }
html.touch #chips { margin-bottom: 4px; gap: 3px; }
html.touch #chips:empty { display: none; }
html.touch #chips span { font-size: 10px; padding: 0 5px; }
html.touch #hud-top { width: 28vw; top: calc(6px + var(--st)); }
html.touch #compass { height: 24px; }
html.touch #compass-strip span { font-size: 11px; top: 3px; }
html.touch #compass-strip span.c { font-size: 13px; }
html.touch #compass-strip span.wp { top: 13px; font-size: 9px; }
html.touch #progress { height: 16px; margin-top: 4px; }
html.touch #progress .line, html.touch #progress .done { top: 7px; }
html.touch #progress .dot { top: 3px; }
html.touch #progress .dot.minor { top: 5px; }
html.touch #progress .me { top: 0; }
html.touch #hud-tr { top: calc(46px + var(--st)); right: calc(8px + var(--sr)); }
html.touch #minimap { width: 92px; height: 92px; }
html.touch #minimap-note { font-size: 9px; max-width: 110px; }
html.touch #msgs { left: calc(36vw + 18px + var(--sl)); right: calc(112px + var(--sr)); top: calc(56px + var(--st)); bottom: auto; width: auto; gap: 4px; }
html.touch #msgs .m { font-size: 12px; padding: 4px 10px; line-height: 1.45; }
html.touch #msgs .m:nth-last-child(n+4) { display: none; }
html.touch #hud:has(#titlecard.show) #msgs { opacity: .2; }
html.touch #msgs { transition: opacity .6s; }
html.touch #titlecard { top: 24%; width: 60vw; }
html.touch #titlecard .tc-sub { font-size: 11px; letter-spacing: 5px; }
html.touch #titlecard .tc-name { font-size: 40px; letter-spacing: 8px; }
html.touch #titlecard .tc-alt { font-size: 13px; letter-spacing: 4px; }
html.touch #titlecard .tc-desc { font-size: 12px; line-height: 1.6; margin-top: 8px; }
html.touch #alert { font-size: 18px; top: 32%; padding: 8px 20px; white-space: nowrap; }
html.touch #qte { top: 50%; }
html.touch #qte-text { font-size: 18px; }
html.touch #qte-bar { width: 260px; }
html.touch #wpmark .wp-name { font-size: 11px; }
html.touch #wpmark .wp-dist { font-size: 10px; }

/* ---------- 菜单：手机横屏（矮屏）压缩 ---------- */
@media (max-height: 540px) {
  html.touch .screen { overflow-y: auto; align-items: flex-start; padding: 6px 0; }
  html.touch .screen > * { margin: auto; }
  html.touch .btn { padding: 8px 16px; font-size: 14px; letter-spacing: 1px; }
  html.touch .btn.big { padding: 10px 26px; font-size: 16px; }
  html.touch .btn.small { padding: 5px 10px; font-size: 12px; }
  html.touch .title-sub { font-size: 12px; letter-spacing: 6px; }
  html.touch .title-main { font-size: 19vh; letter-spacing: 4vh; padding-left: 4vh; }
  html.touch .title-tag { font-size: 18px; letter-spacing: 12px; }
  html.touch .title-en { margin-top: 6px; font-size: 10px; }
  html.touch .title-btns { display: grid; grid-template-columns: repeat(2, auto); justify-content: center; gap: 8px; margin-top: 16px; }
  html.touch .title-btns .btn { min-width: 170px; }
  html.touch .title-warn { margin-top: 12px; font-size: 10px; }
  html.touch .panel { padding: 14px 18px; max-height: 96vh; }
  html.touch .panel h2 { font-size: 22px; margin-bottom: 8px; letter-spacing: 3px; }
  html.touch .season-panel { width: 96vw; }
  html.touch #season-list { gap: 8px; grid-template-columns: repeat(4, 1fr); }
  html.touch .season-card { padding: 10px 12px; }
  html.touch .season-card .big { font-size: 34px; }
  html.touch .season-card .sub { margin-bottom: 2px; font-size: 13px; }
  html.touch .season-card .skulls { margin: 2px 0 4px; }
  html.touch .season-card .muted { font-size: 11px; line-height: 1.5; }
  html.touch .season-card .stats { font-size: 10px; line-height: 1.6; }
  html.touch .shop { width: 98vw; height: 96vh; }
  html.touch .shop-head { padding: 8px 14px; }
  html.touch .shop-head h2 { font-size: 19px; }
  html.touch .shop-head .muted { font-size: 11px; line-height: 1.45; }
  html.touch .shop-money { font-size: 13px; }
  html.touch .shop-money b { font-size: 20px; }
  html.touch .shop-cats { width: 78px; padding: 4px 0; }
  html.touch .shop-cats div { padding: 9px 10px; font-size: 13px; }
  html.touch .shop-items { padding: 8px; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  html.touch .card { padding: 8px 10px; gap: 4px; }
  html.touch .card .nm { font-size: 14px; }
  html.touch .shop-side { width: 228px; padding: 8px 10px; gap: 6px; }
  html.touch .side-block { padding-bottom: 6px; }
  html.touch .side-btns .btn { padding: 8px 10px; }
  html.touch .side-btns .btn.big { padding: 10px; }
  html.touch .inv-panel { width: 98vw; height: 96vh; padding: 10px 14px; }
  html.touch .inv-body { gap: 12px; }
  html.touch .inv-stats { width: 230px; font-size: 12px; line-height: 1.6; }
  html.touch .inv-items { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 8px; }
  html.touch .map-panel { width: 98vw; padding: 10px 14px; }
  html.touch .modal-panel { width: min(640px, 90vw); }
  html.touch #modal-body { font-size: 14px; line-height: 1.65; }
  html.touch .keys-table { font-size: 12px; grid-template-columns: 112px 1fr; gap: 4px 12px; }
  html.touch #end-title { font-size: 46px; letter-spacing: 8px; }
  html.touch #end-cause { font-size: 16px; margin-bottom: 10px; }
  html.touch #end-stats { margin: 10px 0; gap: 6px; }
  html.touch #end-stats div span { font-size: 18px; }
  html.touch #end-text { font-size: 12px; line-height: 1.7; }
  html.touch .load-wrap { width: 70vw; }
}

/* ---------- 背包布局优化：中窄屏上下堆叠，矮屏保持侧栏 ---------- */
@media (max-width: 760px) and (min-height: 421px) {
  .inv-body { flex-direction: column; gap: 14px; }
  .inv-stats { width: 100%; }
  .inv-items { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 760px) and (max-height: 420px) {
  .inv-stats { width: 250px; }
}
