:root {
  --blue: #2f7bff;
  --orange: #ff7a2a;
  --ink: #0b1220;
  --glass: rgba(10, 16, 28, 0.72);
  --glass2: rgba(10, 16, 28, 0.5);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef3fb;
  --muted: #9fb0c6;
  --yellow: #ffe14d;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --display: "Arial Black", Impact, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1220; color: var(--text); font-family: var(--font); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: #0b1220; z-index: 50; color: var(--muted); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.12); border-top-color: var(--orange); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#scorebar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: stretch; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; backdrop-filter: blur(8px); box-shadow: 0 8px 30px rgba(0,0,0,0.35); }
#scorebar .side { display: flex; align-items: center; gap: 12px; padding: 6px 16px; }
#scorebar .tn { font-weight: 800; font-size: 15px; padding: 3px 10px; border-radius: 6px; background: var(--c); color: #fff; letter-spacing: 1px; }
#scorebar .sc { font-family: var(--display); font-size: 30px; min-width: 28px; text-align: center; }
#scorebar .mid { padding: 6px 16px; text-align: center; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 150px; }
#scorebar .pt { font-size: 12px; color: var(--muted); }
#scorebar .poss { font-size: 13px; font-weight: 700; margin-top: 2px; }
#scorebar .poss.l { color: #8fb8ff; }
#scorebar .poss.r { color: #ffb07a; }
#scorebar.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { transform: translateX(-50%) scale(1); } 20% { transform: translateX(-50%) scale(1.18); box-shadow: 0 0 40px rgba(255,225,77,0.7); } 100% { transform: translateX(-50%) scale(1); } }

#stall { position: absolute; top: 86px; left: 50%; transform: translateX(-50%) scale(0.9); opacity: 0; transition: opacity .2s, transform .2s; text-align: center; }
#stall.show { opacity: 1; transform: translateX(-50%) scale(1); }
#stall-l { font-size: 12px; letter-spacing: 2px; color: var(--muted); }
#stall-n { font-family: var(--display); font-size: 54px; line-height: 1; color: #fff; text-shadow: 0 4px 16px rgba(0,0,0,0.6); }
#stall.danger #stall-n { color: #ff4d4d; animation: pulse .5s ease infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }

#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100px; height: 100px; }
#crosshair svg { overflow: visible; }
#crosshair .track { fill: none; stroke: rgba(255,255,255,0.0); stroke-width: 5; transition: stroke .2s; }
#crosshair.charging .track { stroke: rgba(255,255,255,0.18); }
#crosshair .ring { fill: none; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 276; stroke-dashoffset: 276; transform: rotate(-90deg); transform-origin: 50% 50%; filter: drop-shadow(0 0 6px rgba(0,0,0,0.5)); }
#crosshair .dot { fill: #fff; }
#crosshair .ticks { stroke: rgba(255,255,255,0.75); stroke-width: 2; }
#throw-label { position: absolute; top: 106px; left: 50%; transform: translateX(-50%); white-space: nowrap; text-align: center; font-size: 13px; text-shadow: 0 2px 6px rgba(0,0,0,0.8); }
#throw-label b { font-size: 15px; color: var(--yellow); }

#labels { position: absolute; inset: 0; }
.lbl { position: absolute; left: 0; top: 0; font-size: 12px; font-weight: 800; white-space: nowrap; padding: 2px 7px; border-radius: 10px; background: rgba(0,0,0,0.55); color: #fff; will-change: transform; }
.lbl.opt i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.lbl.opt.open i { background: #3ddc84; box-shadow: 0 0 8px #3ddc84; }
.lbl.opt.mid i { background: #ffd24d; }
.lbl.opt.tight i { background: #ff5b5b; }
.lbl.bubble { background: var(--yellow); color: #111; font-size: 14px; }
.lbl.mark { background: rgba(255,90,90,0.8); }
.lbl.marker { background: rgba(255,60,60,0.9); font-size: 10px; letter-spacing: 1px; }

#disc-ind { position: absolute; left: 0; top: 0; font-size: 26px; color: #fff; text-shadow: 0 0 10px rgba(0,0,0,0.8); }

#toast { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%) scale(0.9); text-align: center; opacity: 0; transition: opacity .25s, transform .25s; }
#toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#toast .t-sub { font-family: var(--display); font-style: italic; letter-spacing: 3px; color: var(--yellow); font-size: 18px; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
#toast .t-main { font-size: 26px; font-weight: 800; text-shadow: 0 3px 14px rgba(0,0,0,0.8); margin-top: 4px; }

#hint { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); font-size: 14px; color: #e8eef8; background: var(--glass2); padding: 7px 14px; border-radius: 20px; white-space: nowrap; }
#hint:empty { display: none; }
#hint b { color: var(--yellow); }

#card { position: absolute; left: 18px; bottom: 18px; width: 290px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
#card .row { display: flex; align-items: baseline; gap: 10px; }
#card-n { font-family: var(--display); font-size: 24px; }
#card-r { color: var(--muted); font-size: 13px; }
.stamina { height: 6px; background: rgba(255,255,255,0.12); border-radius: 3px; margin: 8px 0; overflow: hidden; }
#stamina-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #3ddc84, #b6f36b); transition: width .15s; }
#stamina-fill.low { background: #ff5b5b; }
#card .keys { font-size: 11px; color: var(--muted); line-height: 1.5; }

#minimap { position: absolute; right: 18px; bottom: 18px; width: 300px; height: 120px; border-radius: 10px; background: var(--glass2); border: 1px solid var(--line); }

/* ---------- 菜单 ---------- */
#menu { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; padding: 28px; background: linear-gradient(90deg, rgba(6,10,20,0.88) 0%, rgba(6,10,20,0.55) 45%, rgba(6,10,20,0) 75%); overflow-y: auto; }
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0,0,0,0.45); }
.panel.main { width: min(640px, 100%); max-height: calc(100vh - 56px); overflow-y: auto; }
.brand .kicker { font-family: var(--display); font-style: italic; letter-spacing: 4px; color: var(--orange); font-size: 13px; }
.brand h1 { font-family: var(--display); font-size: 44px; margin: 4px 0 6px; font-style: italic; letter-spacing: 1px; }
.brand h1 span { color: var(--yellow); }
.brand p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.sec { margin-top: 14px; }
.sec > label { display: block; font-size: 12px; letter-spacing: 1px; color: var(--muted); margin-bottom: 7px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text); transition: all .15s; }
.card b { display: block; font-size: 16px; margin-bottom: 5px; }
.card span { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.card:hover { background: rgba(255,255,255,0.08); }
.card.on { border-color: var(--yellow); background: rgba(255,225,77,0.1); box-shadow: inset 0 0 0 1px var(--yellow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); color: var(--text); font-size: 13px; }
.chips button:hover { background: rgba(255,255,255,0.1); }
.chips button.on { background: var(--yellow); color: #111; border-color: var(--yellow); font-weight: 700; }
.toggles { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tg { display: flex; align-items: center; gap: 8px; color: var(--text) !important; font-size: 13px !important; letter-spacing: 0 !important; margin: 0 !important; }
.sl { display: flex; align-items: center; gap: 8px; color: var(--text); }
.sl input { flex: 1; }
input[type=checkbox] { accent-color: #ffe14d; width: 16px; height: 16px; }
input[type=range] { accent-color: #ffe14d; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.actions.col { flex-direction: column; }
.primary { padding: 12px 26px; border-radius: 10px; border: 0; background: linear-gradient(135deg, #ffd34d, #ff8a2a); color: #1a1205; font-weight: 900; font-size: 16px; letter-spacing: 1px; box-shadow: 0 8px 24px rgba(255,138,42,0.35); }
.primary:hover { filter: brightness(1.08); }
.ghost { padding: 12px 18px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); color: var(--text); font-size: 14px; }
.ghost:hover { background: rgba(255,255,255,0.12); }
.demo-tag { position: fixed; right: 18px; bottom: 16px; font-size: 12px; color: rgba(255,255,255,0.7); background: rgba(0,0,0,0.35); padding: 5px 10px; border-radius: 12px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(4,8,16,0.6); padding: 20px; }
.modal .panel { width: min(980px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal .panel.small { width: min(520px, 100%); }
.modal h2 { margin: 0 0 12px; font-size: 24px; }
.modal h3 { margin: 14px 0 6px; font-size: 15px; color: var(--yellow); }
.modal ul { margin: 0; padding-left: 18px; line-height: 1.75; font-size: 13.5px; color: #d9e2ef; }
.modal .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.modal ul.keys { list-style: none; padding: 0; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin-right: 3px; border-radius: 5px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); border-bottom-width: 2px; font-family: inherit; font-size: 12px; text-align: center; }
.g { color: #3ddc84; } .y { color: #ffd24d; } .r { color: #ff5b5b; }
#go-title { font-family: var(--display); font-size: 40px; font-style: italic; }
#go-score { font-family: var(--display); font-size: 26px; margin-bottom: 12px; }
#go-stats table { width: 100%; border-collapse: collapse; font-size: 14px; }
#go-stats th, #go-stats td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; }
#go-stats td:first-child { text-align: left; color: var(--muted); }
#go-stats .me { margin-top: 12px; font-size: 13px; color: var(--yellow); }

@media (max-width: 760px) {
  #menu { padding: 16px; background: rgba(6,10,20,0.75); }
  .cards, .grid2, .modal .cols { grid-template-columns: 1fr; }
  .brand h1 { font-size: 34px; }
  #minimap { width: 200px; height: 80px; }
  #card { width: 220px; }
  #hint { white-space: normal; width: calc(100% - 32px); text-align: center; bottom: 110px; }
}
