/* 颜色、字体只从 tokens.css 取。动效只给状态跳变、数据更新和身体反应。 */
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-ui); overflow: hidden; user-select: none; -webkit-user-select: none; }
#viewport { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: flex-start; background: var(--bg); }
#stage { position: relative; flex: none; width: 1440px; height: 900px; transform-origin: top left; overflow: hidden; }
#stage.shake { animation: shake 0.45s linear; }
@keyframes shake { 0%,100% { transform: translate(0,0) scale(var(--s)); } 20% { transform: translate(-6px,3px) scale(var(--s)); } 40% { transform: translate(5px,-4px) scale(var(--s)); } 60% { transform: translate(-4px,2px) scale(var(--s)); } 80% { transform: translate(3px,-2px) scale(var(--s)); } }
#env, #fx, #hud { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; }
#fx, #hud { pointer-events: none; }
#hud > * { pointer-events: auto; position: absolute; }
button { font-family: var(--font-ui); color: var(--ink); }

/* ---------- 环境里的呼吸 ---------- */
#env .breathe { animation: breathe 6s ease-in-out infinite; }
#env .breathe.b2 { animation-duration: 7.5s; animation-delay: -2s; }
#env .breathe.b3 { animation-duration: 9s; animation-delay: -4s; }
@keyframes breathe { 0%,100% { opacity: 0.75; } 50% { opacity: 1; } }
#env .flowline { animation: flow 2.4s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -38; } }
#env .shimmer { animation: shimmer 4s ease-in-out infinite; transform-origin: 445px 452px; }
@keyframes shimmer { 0%,100% { opacity: 0.15; transform: scale(0.92); } 50% { opacity: 0.4; transform: scale(1.04); } }
#env #gate.flash { animation: gate 0.6s ease-out; }
@keyframes gate { 0% { filter: drop-shadow(0 0 18px var(--mag)); } 100% { filter: none; } }
#env .slot { cursor: pointer; }
#env .slot.locked { cursor: default; }
#env .slot polygon { transition: stroke 0.15s, fill 0.15s; }
#env .slot.hot polygon { stroke: var(--teal); fill: rgba(46,230,166,0.10); stroke-dasharray: none; }
#env .slot.hot .plus { stroke: var(--teal); }
#env .slot.bad polygon { stroke: var(--mag); fill: rgba(255,61,138,0.10); }
#env .slot.bad .plus { stroke: var(--mag); }
#env .slot.hint polygon { animation: hint 1s ease-in-out infinite; }
@keyframes hint { 0%,100% { stroke-width: 1.2; } 50% { stroke-width: 4; } }

/* ---------- 面板通用 ---------- */
.panel { position: absolute; background: linear-gradient(180deg, rgba(18,26,38,0.94), rgba(10,15,23,0.94)); border: 1px solid var(--line); border-radius: var(--radius); box-sizing: border-box; box-shadow: 0 6px 24px rgba(0,0,0,0.45), inset 0 1px 0 rgba(220,230,240,0.05); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.label { font-size: 11px; color: var(--dim); letter-spacing: 2px; font-weight: 700; }
.fi { display: block; width: 28px; height: 28px; }
.chip { display: inline-flex; align-items: center; gap: 1px; margin-right: 8px; }
.chip b { font-size: 13px; font-weight: 600; color: var(--ink); }
.btn { background: linear-gradient(180deg, rgba(18,26,38,0.94), rgba(10,15,23,0.94)); border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer; padding: 0; }
.btn:hover { border-color: var(--dim); }

/* ---------- 顶部左：波次 ---------- */
#wave { left: 330px; top: 12px; width: 318px; height: 106px; padding: 9px 16px; }
#wave .meal { font-size: 11px; color: var(--dim); letter-spacing: 2px; font-family: var(--font-num); font-weight: 600; }
#wave .row { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
#wave .n { font-family: var(--font-display); font-size: 30px; line-height: 1.05; }
#wave .of { font-family: var(--font-num); font-size: 16px; color: var(--dim); }
#wave .dish { margin-left: auto; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
#wave .pv { display: flex; align-items: center; gap: 8px; margin-top: 4px; height: 28px; }
#wave .pv .lbl { font-size: 11px; color: var(--dim); white-space: nowrap; }
#wave .pv .chips { display: flex; align-items: center; overflow: hidden; }
#wave .pv .fi { width: 24px; height: 24px; }
#wave .bar { position: absolute; left: 16px; right: 16px; bottom: 8px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
#wave .bar i { display: block; height: 100%; width: 0; background: var(--teal); transition: width 0.3s; }

/* ---------- 顶部中：宿主与舒适度 ---------- */
#hostbox { left: 664px; top: 4px; width: 112px; height: 150px; pointer-events: none !important; }
#hostmount { width: 112px; height: 112px; }
#comfort { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 2px; }
#comfort .label { margin-right: 4px; font-size: 10px; letter-spacing: 1px; }
#comfort .d { width: 20px; height: 18px; fill: var(--line-2); transition: fill 0.3s; }
#comfort .d.on { fill: var(--coral); filter: drop-shadow(0 0 5px var(--coral)); }
#comfort .d.lost { animation: lost 0.7s ease-out; }
@keyframes lost { 0% { fill: var(--mag); transform: scale(1.8); } 100% { transform: scale(1); } }

/* ---------- 顶部右：资源、肝、倍速、暂停 ---------- */
#res { left: 918px; top: 22px; display: flex; gap: 6px; }
#res .r { display: flex; align-items: center; gap: 8px; width: 96px; height: 52px; padding: 0 10px; box-sizing: border-box; background: rgba(10,15,23,0.7); border: 1px solid var(--line); border-radius: var(--radius); }
#res .r svg { width: 24px; height: 24px; flex: none; }
#res .r .v { font-size: 22px; font-weight: 600; line-height: 1; }
#res .r .t { font-size: 10px; color: var(--dim); margin-top: 3px; }
#res .r.bump .v { animation: bump 0.25s ease-out; }
@keyframes bump { 0% { transform: scale(1.35); color: var(--teal); } 100% { transform: scale(1); } }
#liver { left: 1226px; top: 16px; width: 64px; text-align: center; }
#liver svg { width: 54px; height: 54px; display: block; margin: 0 auto; }
#liver .t { font-size: 11px; color: var(--dim); font-weight: 700; margin-top: -2px; }
#liver.full .arc { stroke: var(--amber); }
#liver.crash .arc { stroke: var(--mag); }
#liver.ping svg { animation: ping 0.35s ease-out; }
@keyframes ping { 0% { transform: scale(1.18); filter: drop-shadow(0 0 8px var(--amber)); } 100% { transform: scale(1); } }
#speed { left: 1302px; top: 24px; width: 50px; height: 44px; }
#speed .num { font-size: 16px; font-weight: 700; color: var(--dim); }
#speed.on { border-color: var(--cyan); }
#speed.on .num { color: var(--cyan); }
#pausebtn { left: 1362px; top: 24px; width: 50px; height: 44px; }
#pausebtn svg { width: 22px; height: 22px; display: block; margin: 0 auto; }

/* ---------- 底部左：吸收率 ---------- */
#meter { left: 24px; top: 784px; width: 240px; height: 96px; padding: 10px 16px; }
#meter .big { position: absolute; right: 16px; top: 6px; font-size: 30px; font-weight: 600; }
#meter .big small { font-size: 14px; color: var(--dim); margin-left: 2px; }
#meter .track { position: absolute; left: 16px; right: 16px; top: 52px; height: 6px; background: var(--line); border-radius: 3px; }
#meter .track i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--cyan), var(--teal)); border-radius: 3px; transition: width 0.3s; }
#meter .track em { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--amber); margin-left: -1px; }
#meter .track .st { position: absolute; top: 11px; transform: translateX(-50%); font-size: 10px; color: var(--amber); }
#meter .leak { position: absolute; left: 16px; bottom: 8px; font-size: 11px; color: var(--dim); }
#meter .leak .num { color: var(--coral); font-size: 13px; font-weight: 600; }
#meter.warn { border-color: var(--mag); }
#meter.warn .big { color: var(--coral); }

/* ---------- 底部中：塔栏 ---------- */
#dock { left: 276px; top: 784px; width: 800px; height: 96px; display: flex; gap: 6px; padding: 9px 10px; }
.tile { position: relative; flex: none; width: 92px; height: 76px; background: #0E1622; border: 1px solid var(--line); border-radius: var(--radius); box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; padding-top: 4px; transition: border-color 0.15s, background 0.15s; }
.tile:hover { border-color: var(--line-2); background: #121C2A; }
.tile.sel { background: #152131; border-color: var(--tile); box-shadow: inset 0 0 0 1px var(--tile), 0 0 14px -4px var(--tile); }
.tile.poor { opacity: 0.45; }
.tile.locked { opacity: 0.35; cursor: default; }
.tile.hint { animation: tilehint 1s ease-in-out infinite; }
@keyframes tilehint { 0%,100% { box-shadow: 0 0 0 0 var(--tile); } 50% { box-shadow: 0 0 0 3px var(--tile), 0 0 22px var(--tile); } }
.tile .k { position: absolute; left: 6px; top: 3px; font-size: 10px; color: var(--dim); }
.tile > svg { width: 38px; height: 38px; flex: none; }
.tile .nm { font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap; margin-top: 1px; }
.tile .c { position: absolute; right: 6px; top: 3px; display: flex; align-items: center; gap: 1px; font-size: 14px; font-weight: 600; color: var(--coral); }
.tile .c svg { width: 13px; height: 13px; }
.tile .lock, .skill .lock { position: absolute; right: 6px; bottom: 6px; width: 13px; height: 13px; }

/* ---------- 底部右：技能与开波 ---------- */
.skill { top: 784px; width: 98px; height: 96px; text-align: center; cursor: pointer; --cd: 0; }
#sk1 { left: 1086px; }
#sk2 { left: 1192px; }
.skill .k { position: absolute; left: 7px; top: 4px; font-size: 10px; color: var(--dim); }
.skill .ring { width: 44px; height: 44px; margin: 8px auto 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: conic-gradient(rgba(5,8,15,0.85) calc(var(--cd) * 360deg), transparent 0); box-shadow: inset 0 0 0 2px var(--line-2); }
.skill .ring svg { width: 34px; height: 34px; }
.skill .nm { font-size: 12px; font-weight: 700; margin-top: 3px; }
.skill .cst { display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--dim); margin-top: 1px; }
.skill .cst svg { width: 13px; height: 13px; }
#sk1 { --kc: var(--cyan); }
#sk2 { --kc: var(--teal); }
.skill.flash { animation: ready 0.7s ease-out; }
@keyframes ready { 0% { box-shadow: 0 0 0 0 var(--kc), 0 0 30px var(--kc); } 100% { box-shadow: 0 0 0 10px transparent, 0 0 16px -6px var(--kc); } }
#sk1:not(.off):not(.locked) { border-color: var(--cyan); box-shadow: 0 0 16px -6px var(--cyan); }
#sk2:not(.off):not(.locked) { border-color: var(--teal); box-shadow: 0 0 16px -6px var(--teal); }
.skill.off { cursor: default; }
.skill.off .ring svg, .skill.off .nm { opacity: 0.45; }
.skill.poor .cst { color: var(--coral); }
.skill.active .ring { box-shadow: inset 0 0 0 2px var(--cyan), 0 0 18px var(--cyan); }
.skill.crash { border-color: var(--mag) !important; }
.skill.locked { opacity: 0.35; cursor: default; }
#next { left: 1298px; top: 784px; width: 118px; height: 96px; text-align: center; cursor: pointer; }
#next .t { font-size: 11px; color: var(--dim); margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
#next .cd { font-size: 26px; font-weight: 600; line-height: 1.35; }
#next .go { font-size: 11px; color: var(--teal); }
#next:hover { border-color: var(--teal); }
#next.wave { cursor: default; }
#next.wave .cd { color: var(--dim); font-family: var(--font-ui); font-size: 18px; font-weight: 700; line-height: 1.9; }
#next.wave:hover { border-color: var(--line); }
#next.ready { border-color: var(--teal); background: linear-gradient(180deg, rgba(46,230,166,0.18), rgba(10,15,23,0.94)); }
#next.ready .cd { color: var(--teal); font-family: var(--font-display); font-size: 30px; }
#next.soon .cd { color: var(--amber); }
#next.hint { animation: nexthint 1s ease-in-out infinite; }
@keyframes nexthint { 0%,100% { box-shadow: 0 0 0 0 var(--teal); } 50% { box-shadow: 0 0 0 3px var(--teal), 0 0 26px var(--teal); } }

/* 按下去有反馈 */
.tile, .skill, #next, .btn, #tip button, .modal button { transition: transform 0.08s, border-color 0.15s, background 0.15s; }
.tile:not(.locked):active, .skill:not(.off):not(.locked):active, #next:not(.wave):active, .btn:active, #tip button:not(:disabled):active, .modal button:active { transform: scale(0.95); }
#fade { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 100; }
#fade.on { opacity: 1; pointer-events: auto; }

/* ---------- 选中塔的面板、塔栏悬停提示 ---------- */
#tip, #dtip { display: none; width: 264px; padding: 10px 14px 12px; border-color: var(--tc); z-index: 5; }
#tip.show, #dtip.show { display: block; }
#dtip { top: 646px; width: 220px; pointer-events: none !important; }
#tip .h, #dtip .h { display: flex; align-items: baseline; gap: 8px; }
#tip .h b, #dtip .h b { font-size: 17px; }
#tip .lv { font-size: 15px; font-weight: 700; color: var(--tc); }
#tip .lat, #dtip .lat { margin-left: auto; font-size: 10px; color: var(--dim); letter-spacing: 1px; }
#tip .tg, #dtip .tg { display: flex; align-items: center; gap: 4px; margin: 8px 0 4px; min-height: 26px; }
.tg .fi { width: 26px; height: 26px; }
.tg .x { font-size: 11px; color: var(--dim); text-decoration: line-through; text-decoration-color: var(--teal); }
.tg .aura { width: 22px; height: 22px; border-radius: 50%; border: 1px dashed var(--mag); background: rgba(255,61,138,0.15); }
#tip .st, #dtip .st { font-size: 12px; color: #9FB2C4; }
#tip .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
#tip button { height: 30px; border-radius: 4px; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 2px; }
#tip button svg { width: 13px; height: 13px; }
#tip .up { background: var(--teal); color: var(--bg); border: 0; }
#tip .lac { background: transparent; color: var(--ink); border: 1px solid var(--coral); }
#tip .rep { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
#tip button:disabled { opacity: 0.4; cursor: default; }
#tip .sell { background: transparent; color: var(--dim); border: 1px solid var(--line-2); }
#tip .sell:hover { color: var(--ink); }

/* ---------- 波次横幅 ---------- */
#banner { left: 0; right: 0; top: 176px; text-align: center; pointer-events: none !important; opacity: 0; transform: translateY(-10px) scale(1.12); transition: opacity 0.25s, transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
#banner.show { opacity: 1; transform: none; }
#banner .n { font-family: var(--font-display); font-size: 52px; letter-spacing: 6px; text-shadow: 0 0 24px rgba(53,208,255,0.55), 0 3px 0 rgba(5,8,15,0.9); }
#banner .d { font-size: 20px; font-weight: 700; margin-top: 2px; text-shadow: 0 2px 6px rgba(5,8,15,0.9); }
#banner .chips { display: flex; justify-content: center; margin-top: 8px; }
#banner .chip b { font-size: 16px; text-shadow: 0 2px 6px rgba(5,8,15,0.9); }
#banner .fi { width: 34px; height: 34px; }
#banner.last .n { color: var(--amber); text-shadow: 0 0 24px rgba(255,179,71,0.6), 0 3px 0 rgba(5,8,15,0.9); }
#banner.done .n, #banner.clean .n { font-size: 40px; }
#banner.map .d { font-family: var(--font-display); font-size: 26px; letter-spacing: 8px; color: var(--dim); }
#banner.clean .n { color: var(--teal); text-shadow: 0 0 24px rgba(46,230,166,0.6), 0 3px 0 rgba(5,8,15,0.9); }

/* ---------- 暂停菜单与结算 ---------- */
.modal { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(5,8,15,0.72); z-index: 10; }
.modal.show { display: flex; animation: fade 0.25s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal.show .card { animation: pop 0.38s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(0.94); } }
.modal .card { position: relative; width: 480px; padding: 30px 36px; text-align: center; }
.modal .big { font-family: var(--font-display); font-size: 42px; letter-spacing: 6px; }
.modal .sub { font-size: 12px; color: var(--dim); letter-spacing: 4px; }
.modal button { height: 46px; border-radius: 6px; font-size: 15px; font-weight: 700; cursor: pointer; background: transparent; border: 1px solid var(--line-2); }
.modal button:hover { border-color: var(--dim); }
.modal button.pri { background: var(--teal); color: var(--bg); border: 0; }
.modal .col { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
#overlay .card { width: 540px; }
#overlay .card.win { border-color: var(--teal); box-shadow: 0 0 60px -20px var(--teal); }
#overlay .card.fail { border-color: var(--mag); box-shadow: 0 0 60px -20px var(--mag); }
#overlay .stars { display: flex; justify-content: center; gap: 22px; margin: 14px 0 4px; }
#overlay .goal { width: 110px; display: flex; flex-direction: column; align-items: center; }
#overlay .goal em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--dim); margin-top: 2px; }
#overlay .goal small { height: 16px; margin-top: 2px; font-family: var(--font-num); font-size: 12px; color: var(--coral); display: flex; gap: 2px; }
#overlay .goal small .d { width: 14px; height: 13px; fill: var(--mag); }
#overlay .goal.got em { color: var(--ink); }
#overlay .star { display: inline-block; font-size: 52px; line-height: 1; color: var(--line-2); transition: color 0.2s; }
#overlay .star.on { color: var(--amber); text-shadow: 0 0 18px var(--amber); animation: star 0.4s ease-out; }
#overlay .leaks { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--dim); }
#overlay .leaks > span:first-child { margin-right: 6px; }
#overlay .leaks .fi { width: 30px; height: 30px; }
#overlay .leaks .chip b { color: var(--coral); }
#wave .hardtag { margin-left: 8px; padding: 1px 6px; border-radius: 3px; background: var(--mag); color: var(--bg); font-family: var(--font-ui); letter-spacing: 1px; }
#wave.hard { border-color: var(--mag); }
#banner.boss .n { color: var(--mag); text-shadow: 0 0 24px rgba(255,61,138,0.7), 0 3px 0 rgba(5,8,15,0.9); }
#banner.boss .fi { width: 64px; height: 64px; }
@keyframes star { 0% { transform: scale(2.2) rotate(-20deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
#overlay .endless { margin: 14px 0 4px; font-family: var(--font-num); }
#overlay .endless .num { font-size: 60px; font-weight: 700; color: var(--amber); }
#overlay .endless small { font-size: 18px; color: var(--dim); margin-left: 4px; }
#overlay .endless em { display: block; font-style: normal; font-size: 13px; color: var(--teal); letter-spacing: 3px; }
#overlay .stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px 16px; background: rgba(5,8,15,0.5); border: 1px solid var(--line); border-radius: var(--radius); }
#overlay .pct { font-size: 34px; font-weight: 600; }
#overlay .pct small { font-size: 12px; color: var(--dim); margin-left: 4px; font-family: var(--font-ui); }
#overlay .kinds { display: flex; gap: 10px; font-size: 12px; color: var(--dim); }
#overlay .kinds span { display: flex; align-items: center; gap: 3px; }
#overlay .kinds svg { width: 16px; height: 16px; }
#overlay .kinds b { font-size: 15px; color: var(--ink); }
#overlay .kinds .lk b { color: var(--coral); }
#overlay .hearts { display: flex; gap: 3px; }
#overlay .hearts .d { width: 18px; height: 16px; fill: var(--line-2); }
#overlay .hearts .d.on { fill: var(--coral); }
#overlay .row { display: flex; gap: 10px; margin-top: 22px; }
#overlay .row button { flex: 1; }
