:root { --cy: #38f2ff; --vi: #9a6bff; --ink: #e8f8ff; --dim: #7f9bb8; --panel: rgba(8, 14, 30, .72); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #04060d; color: var(--ink); font: 14px/1.45 "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif; }
#viewport, #viewport canvas { position: fixed; inset: 0; display: block; }
kbd { display: inline-block; min-width: 1.6em; padding: 0 .45em; margin: 0 .15em; border: 1px solid rgba(56, 242, 255, .55); border-radius: 5px; background: rgba(56, 242, 255, .08); color: #bff8ff; font: 600 11px/1.6 "Segoe UI", sans-serif; text-align: center; box-shadow: 0 0 8px rgba(56, 242, 255, .25); }
.dim { color: var(--dim); }

#hud { position: fixed; inset: 0; pointer-events: none; }
.brand { position: absolute; left: 22px; top: 18px; display: flex; gap: 12px; align-items: baseline; }
.brand b { font: 800 22px "Segoe UI", sans-serif; letter-spacing: .14em; color: #bff8ff; text-shadow: 0 0 12px var(--cy), 0 0 30px rgba(56, 242, 255, .6); }
.brand span { color: var(--dim); font-size: 13px; }
/* 画质按钮：在音乐按钮左侧 */
#quality-btn { position: absolute; right: 128px; top: 16px; padding: 6px 12px; border-radius: 18px; border: 1px solid rgba(56, 242, 255, .45); background: rgba(8, 10, 26, .7); color: #cfefff; font: 600 13px "Microsoft YaHei", sans-serif; cursor: pointer; pointer-events: auto; }
#quality-btn b { color: var(--cy); }
/* 背景音乐按钮：开启时四根小柱跳动 */
#music-btn { position: absolute; right: 18px; top: 16px; display: flex; align-items: flex-end; gap: 3px; padding: 6px 12px; border-radius: 18px; border: 1px solid rgba(255, 106, 213, .45); background: rgba(8, 10, 26, .7); color: #ffd6f4; font: 600 13px "Microsoft YaHei", sans-serif; cursor: pointer; pointer-events: auto; transition: .2s; }
#music-btn i { width: 3px; height: 6px; border-radius: 2px; background: #ff6ad5; opacity: .5; }
#music-btn.on { border-color: #ff6ad5; box-shadow: 0 0 18px rgba(255, 106, 213, .55); }
#music-btn.on i { opacity: 1; animation: eq .54s ease-in-out infinite alternate; }
#music-btn.on i:nth-child(2) { animation-delay: -.2s; } #music-btn.on i:nth-child(3) { animation-delay: -.4s; } #music-btn.on i:nth-child(4) { animation-delay: -.1s; }
@keyframes eq { from { height: 4px; } to { height: 14px; } }

#cross { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 1.5px solid rgba(180, 240, 255, .35); border-radius: 50%; transition: .15s; }
#cross i { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #dff; box-shadow: 0 0 6px #6ff; }
#cross.on { width: 34px; height: 34px; margin: -17px 0 0 -17px; border-color: var(--cy); box-shadow: 0 0 14px var(--cy), inset 0 0 10px rgba(56, 242, 255, .5); }

#tip { position: absolute; left: calc(50% + 30px); top: calc(50% + 18px); min-width: 180px; max-width: 320px; padding: 10px 12px; border: 1px solid rgba(56, 242, 255, .35); border-radius: 10px; background: var(--panel); backdrop-filter: blur(8px); opacity: 0; transform: translateY(4px); transition: .15s; box-shadow: 0 0 24px rgba(56, 242, 255, .15); }
#tip.show { opacity: 1; transform: none; }
#tip .n { font-weight: 700; color: #dffcff; }
#tip .n small { margin-left: 6px; color: var(--dim); font-weight: 400; }
#tip .info { margin-top: 3px; color: #b8d6ea; font-size: 12.5px; }
#tip .act { margin-top: 6px; color: #9fefff; font-size: 12px; }
.chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.chips i { font-style: normal; padding: 0 6px; border-radius: 9px; background: rgba(56, 242, 255, .12); border: 1px solid rgba(56, 242, 255, .25); font-size: 11.5px; }
.chips i.s { background: rgba(255, 210, 120, .12); border-color: rgba(255, 210, 120, .35); }

#toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%) scale(.96); padding: 10px 22px; border-radius: 30px; border: 1px solid var(--c, var(--cy)); background: rgba(6, 10, 22, .78); color: #fff; font-size: 17px; font-weight: 600; letter-spacing: .04em; text-shadow: 0 0 10px var(--c, var(--cy)); box-shadow: 0 0 28px color-mix(in srgb, var(--c, #38f2ff) 55%, transparent), inset 0 0 18px color-mix(in srgb, var(--c, #38f2ff) 20%, transparent); opacity: 0; transition: opacity .25s, transform .25s; white-space: nowrap; }
#toast.show { opacity: 1; transform: translateX(-50%) scale(1); }

#log { position: absolute; right: 18px; top: 62px; width: 330px; display: flex; flex-direction: column; gap: 8px; }
#log .card { padding: 9px 12px 10px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); border-left: 3px solid var(--c); background: var(--panel); backdrop-filter: blur(8px); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 30%, transparent); animation: in .35s ease-out; }
#log .card:nth-child(n+4) { opacity: .62; }
#log .t { font-weight: 700; color: #fff; display: flex; justify-content: space-between; gap: 8px; }
#log .t span { color: var(--dim); font-weight: 400; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
#log .eq { margin-top: 3px; font: 600 13.5px "Cambria Math", "Segoe UI", serif; color: color-mix(in srgb, var(--c) 70%, white); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent); }
#log .obs { margin-top: 2px; color: #b8d6ea; font-size: 12.5px; }
@keyframes in { from { opacity: 0; transform: translateX(20px); } }

.hand { position: absolute; bottom: 40px; width: 250px; padding: 10px 13px; border-radius: 12px; border: 1px solid rgba(120, 160, 255, .25); background: var(--panel); backdrop-filter: blur(8px); transition: .2s; }
#hand-l { left: 12px; } #hand-r { right: 12px; }
.hand.active { border-color: var(--cy); box-shadow: 0 0 22px rgba(56, 242, 255, .35); }
.hand .hn { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 12px; }
.hand .hn b { color: #e8fbff; font-size: 14px; }
.hand .hn em { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 10px currentColor; border: 1px solid rgba(255, 255, 255, .4); }
.hand .info { margin: 4px 0 2px; font-size: 12.5px; color: #c7e2f3; }
.hand .keys { font-size: 11.5px; color: var(--dim); }

.keybar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); color: var(--dim); font-size: 12px; white-space: nowrap; }
#loading { position: absolute; left: 50%; bottom: 26%; transform: translateX(-50%); color: #9ff; text-shadow: 0 0 10px var(--cy); opacity: 0; transition: .3s; }
#loading.show { opacity: 1; }

#guide { position: fixed; left: 18px; top: 60px; bottom: 96px; width: 390px; display: flex; flex-direction: column; padding: 12px 6px 12px 16px; border-radius: 12px; border: 1px solid rgba(154, 107, 255, .45); background: rgba(8, 12, 28, .9); backdrop-filter: blur(10px); box-shadow: 0 0 24px rgba(154, 107, 255, .25); opacity: 0; transform: translateX(-10px); transition: .2s; pointer-events: none; }
#guide.show { opacity: 1; transform: none; pointer-events: auto; }
.ghead { display: flex; justify-content: space-between; align-items: flex-start; padding-right: 8px; }
#guide h3 { margin: 0 0 8px; color: #e3d6ff; text-shadow: 0 0 10px var(--vi); }
#guide h3 small { display: block; color: var(--dim); font-weight: 400; font-size: 12px; text-shadow: none; margin-top: 2px; }
#guide-close { cursor: pointer; border: 1px solid rgba(154, 107, 255, .5); background: transparent; color: #d8c8ff; border-radius: 7px; width: 28px; height: 28px; font-size: 16px; }
#guide ol { flex: 1; overflow-y: auto; margin: 0; padding: 0 10px 0 22px; font-size: 12.5px; color: #c3d3e8; scrollbar-width: thin; scrollbar-color: rgba(154, 107, 255, .6) transparent; }
#guide li { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(154, 107, 255, .15); }
#guide li b { display: block; color: #dffcff; font-size: 13.5px; }
#guide li span { display: block; margin: 2px 0 5px; }
#guide li button { cursor: pointer; padding: 3px 10px; border-radius: 14px; border: 1px solid rgba(56, 242, 255, .5); background: rgba(56, 242, 255, .1); color: #bff8ff; font: inherit; font-size: 12px; transition: .15s; }
#guide li button:hover { background: rgba(56, 242, 255, .25); box-shadow: 0 0 12px rgba(56, 242, 255, .5); }

#demo-bar { position: fixed; left: 50%; top: 58px; transform: translate(-50%, -8px); min-width: 460px; max-width: 78vw; padding: 10px 18px 12px; border-radius: 14px; border: 1px solid rgba(154, 107, 255, .6); background: rgba(8, 10, 26, .82); backdrop-filter: blur(10px); box-shadow: 0 0 30px rgba(154, 107, 255, .35); opacity: 0; pointer-events: none; transition: .25s; }
#demo-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#demo-bar .title { color: #d9c9ff; font-weight: 800; letter-spacing: .06em; text-shadow: 0 0 10px var(--vi); }
#demo-bar .title::before { content: '● 自动演示 · '; color: #ff5fa0; font-weight: 600; }
#demo-bar .row { margin-top: 4px; display: flex; gap: 10px; align-items: baseline; }
#demo-bar .step { flex: none; padding: 0 8px; border-radius: 9px; background: rgba(56, 242, 255, .15); color: #9ff3ff; font: 700 12px "Segoe UI", sans-serif; }
#demo-bar .txt { color: #eaf8ff; font-size: 15px; }
#demo-stop { position: absolute; right: 10px; top: 8px; cursor: pointer; padding: 2px 10px; border-radius: 12px; border: 1px solid rgba(255, 120, 160, .5); background: rgba(255, 80, 140, .12); color: #ffc8dc; font: inherit; font-size: 12px; }

#inspect { position: fixed; right: 18px; top: 50%; transform: translateY(-50%) translateX(10px); width: 300px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(56, 242, 255, .45); background: rgba(6, 10, 24, .85); backdrop-filter: blur(10px); box-shadow: 0 0 30px rgba(56, 242, 255, .2); opacity: 0; transition: .2s; pointer-events: none; }
#inspect.show { opacity: 1; transform: translateY(-50%); }
#inspect .n { font-size: 16px; font-weight: 800; color: #dffcff; text-shadow: 0 0 10px var(--cy); }
#inspect .r { margin-top: 4px; color: #bfe6ff; }
#inspect .r b { color: #8ff3ff; font-family: "Segoe UI", sans-serif; }
#inspect .info { margin-top: 6px; font-size: 12.5px; color: #c7e2f3; }
#inspect .cat { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(56, 242, 255, .2); font-size: 12.5px; color: #c3d3e8; }
#inspect .cat b { color: #e8fbff; }
#inspect .cat p { margin: 4px 0; }
#inspect .keys { margin-top: 10px; font-size: 11.5px; color: var(--dim); }
body:has(#inspect.show) #viewport::after { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 50%, transparent 25%, rgba(2, 4, 12, .65) 75%); pointer-events: none; }
#demo-btn { margin-top: 8px; width: 100%; cursor: pointer; padding: 10px; border-radius: 9px; border: 1px solid rgba(154, 107, 255, .6); background: rgba(154, 107, 255, .12); color: #e3d6ff; font: inherit; font-weight: 600; }
#demo-btn:hover { box-shadow: 0 0 18px rgba(154, 107, 255, .5); }

#drawer { position: fixed; inset: 6vh 8vw; padding: 18px 22px; border-radius: 16px; border: 1px solid rgba(56, 242, 255, .4); background: rgba(6, 10, 22, .9); backdrop-filter: blur(14px); box-shadow: 0 0 60px rgba(56, 242, 255, .2); overflow: auto; opacity: 0; pointer-events: none; transform: scale(.98); transition: .2s; }
#drawer.show { opacity: 1; pointer-events: auto; transform: none; }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.dhead h2 { margin: 0; color: #bff8ff; text-shadow: 0 0 12px var(--cy); }
#drawer h4 { margin: 18px 0 8px; color: #9fefff; }
#drawer h4 small { color: var(--dim); font-weight: 400; margin-left: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.grid.lib { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
#drawer button, #start-btn { cursor: pointer; padding: 8px 10px; border-radius: 9px; border: 1px solid rgba(56, 242, 255, .35); background: rgba(56, 242, 255, .06); color: #dffcff; font: inherit; text-align: left; transition: .15s; }
#drawer button:hover { background: rgba(56, 242, 255, .16); box-shadow: 0 0 14px rgba(56, 242, 255, .35); }
#drawer button b { display: block; color: #8ff3ff; font: 700 13px "Segoe UI", sans-serif; }
.dhead button { margin-left: 8px; }

#start { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(8, 18, 40, .55), rgba(2, 4, 10, .92)); transition: opacity .4s; }
#start.hide { opacity: 0; pointer-events: none; }
#start .panel { width: min(620px, 92vw); padding: 30px 34px; border-radius: 18px; border: 1px solid rgba(56, 242, 255, .45); background: rgba(6, 10, 24, .8); backdrop-filter: blur(12px); box-shadow: 0 0 80px rgba(56, 242, 255, .2), inset 0 0 40px rgba(154, 107, 255, .08); }
.eyebrow { margin: 0; color: #9a8cff; letter-spacing: .25em; font-size: 11px; }
#start h1 { margin: 6px 0 4px; font: 900 54px "Segoe UI", sans-serif; letter-spacing: .12em; color: #dffcff; text-shadow: 0 0 18px var(--cy), 0 0 50px rgba(56, 242, 255, .7); }
.sub { color: #b4cde2; }
.ctl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 16px 0; color: #c8dced; }
.hint { color: var(--dim); font-size: 12.5px; }
#start-btn { margin-top: 10px; width: 100%; text-align: center; font-size: 17px; font-weight: 700; padding: 12px; border-color: var(--cy); background: linear-gradient(90deg, rgba(56, 242, 255, .18), rgba(154, 107, 255, .18)); box-shadow: 0 0 24px rgba(56, 242, 255, .35); }
#start-btn:disabled { opacity: .5; cursor: wait; }
body.locked #cross { opacity: 1; }
body:has(#demo-bar.show) #log { top: 128px; }
body:has(#demo-bar.show) #tip { display: none; }
body:has(#inspect.show) #tip, body:has(#inspect.show) #cross { display: none; }
#guide li.sec { list-style: none; margin: 6px 0 8px -16px; padding: 0 0 4px; border-bottom: 1px solid rgba(154, 107, 255, .35); color: #9ff3ff; font-weight: 800; letter-spacing: .05em; }
#guide li.sec.fun { color: #ff9be8; text-shadow: 0 0 10px rgba(255, 80, 200, .6); }
