*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}
html,body{margin:0;height:100%;overflow:hidden;background:#0b0f2a;color:#eef;font:16px -apple-system,system-ui,sans-serif;touch-action:none;overscroll-behavior:none}
#cv{position:fixed;inset:0;width:100%;height:100%;display:block}
#top{position:fixed;top:0;left:0;right:0;display:flex;justify-content:space-between;padding:calc(10px + env(safe-area-inset-top)) 14px 6px;pointer-events:none;background:linear-gradient(#0b0f2acc,#0b0f2a00)}
.stat{display:flex;flex-direction:column;align-items:center;min-width:70px}
.stat b{font-size:24px;font-variant-numeric:tabular-nums}.stat span{font-size:11px;opacity:.65;text-transform:uppercase;letter-spacing:.08em}
#btnMute{pointer-events:auto;background:rgba(255,255,255,.08);border:0;border-radius:12px;width:40px;height:40px;font-size:18px;color:#fff;align-self:center;padding:0;flex:0 0 40px}
#treat{position:fixed;left:16px;right:16px;top:calc(66px + env(safe-area-inset-top));height:18px;border-radius:9px;background:#ffffff14;overflow:hidden;pointer-events:none}
#treatFill{position:absolute;left:0;top:0;bottom:0;width:100%;background:linear-gradient(90deg,#ffb36b,#ffe08a);border-radius:9px;transform-origin:left center;will-change:transform}
#treat.low #treatFill{background:linear-gradient(90deg,#9aa6ff,#c9b8ff)}
#treatTxt{position:absolute;left:0;right:0;top:0;line-height:18px;text-align:center;font-size:11px;font-weight:700;color:#2a1a0a;letter-spacing:.04em}
#treat.low #treatTxt{color:#1a1640}
#look{position:fixed;left:0;right:0;top:calc(90px + env(safe-area-inset-top));text-align:center;font-size:12px;color:#ffe9a8;pointer-events:none;min-height:16px}
#ghost{position:fixed;left:16px;right:16px;top:calc(108px + env(safe-area-inset-top));text-align:center;font-size:13px;color:#9fd4ff;pointer-events:none}
#hint{position:fixed;left:50%;bottom:calc(110px + env(safe-area-inset-bottom));white-space:nowrap;transform:translateX(-50%);padding:11px 18px;border-radius:24px;background:#ffffff18;border:1px solid #ffffff2a;font-weight:700;font-size:15px;pointer-events:none;transition:opacity .3s}
#sheet,#board{position:fixed;left:0;right:0;bottom:0;padding:18px 18px calc(18px + env(safe-area-inset-bottom));background:#0e1333f2;border-top:1px solid #ffffff1f;border-radius:20px 20px 0 0;display:flex;flex-direction:column;gap:10px}
#board{top:12%;overflow:auto}
#endBig{text-align:center}#endBig b{font-size:54px;line-height:1;font-variant-numeric:tabular-nums}#endBig span{display:block;opacity:.75}
#endLine{text-align:center;font-weight:600;min-height:20px}
#endStars{text-align:center;font-size:14px;color:#ffe08a;min-height:18px}
#endTop{text-align:center;font-size:14px;opacity:.85;min-height:18px}
#endNote{text-align:center;font-size:12px;opacity:.6;min-height:14px}
button{font:inherit;font-weight:700;border:0;border-radius:14px;padding:15px;color:#fff;cursor:pointer;touch-action:manipulation}
button:active{opacity:.75}
.primary{background:linear-gradient(90deg,#ff9f6b,#ff7fb8);font-size:17px}
.secondary{background:#3b5bff}
.ghost{background:#ffffff14;flex:1}
.row{display:flex;gap:10px}
#boardList{margin:0;padding-left:28px;font-variant-numeric:tabular-nums}#boardList li{padding:6px 0;border-bottom:1px solid #ffffff12}
#boardMe{text-align:center;opacity:.8}
#toast{position:fixed;left:16px;right:16px;top:calc(120px + env(safe-area-inset-top));padding:12px 14px;border-radius:12px;background:#222a55;text-align:center;z-index:9}
[hidden]{display:none!important}
#endBreak{display:flex;flex-direction:column;gap:3px;font-size:13px;margin:2px 4px}
#endBreak .row{display:flex;align-items:center;gap:6px}
#endBreak .lab{flex:0 0 46%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#endBreak .bar{flex:1;height:8px;border-radius:4px;background:rgba(255,255,255,.1);overflow:hidden}
#endBreak .bar i{display:block;height:100%;background:linear-gradient(90deg,#7fe3ff,#ffd36b);transform-origin:left}
#endBreak .pct{flex:0 0 38px;text-align:right;font-weight:700}
#endBest{text-align:center;font-size:13px;color:#9ff0ff;min-height:16px}
#endNear{text-align:center;font-size:14px;font-weight:700;color:#ff9fd0;min-height:16px}
#endHint{text-align:center;font-size:13px;opacity:.9;min-height:16px;font-style:italic}
/* v3 layout fixes */
:root{--vh:100dvh}
.stat{flex:1 1 0;min-width:0}
.stat b{font-size:22px;white-space:nowrap}
#sheet{max-height:calc(var(--vh) - env(safe-area-inset-top) - 8px);overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y;overscroll-behavior:contain;gap:8px}
#sheet>*{flex-shrink:0}
#board{top:calc(env(safe-area-inset-top) + 8px);max-height:calc(var(--vh) - env(safe-area-inset-top) - 8px);touch-action:pan-y}
#endBreak .lab{white-space:normal;overflow:visible;flex:0 0 52%;line-height:1.2}
body.ended #top,body.ended #treat,body.ended #look,body.ended #ghost,body.ended #hint{opacity:0;transition:opacity .25s}
@media (max-height:700px){#sheet{padding-top:12px;gap:6px}#endBig b{font-size:42px}#sheet button{padding:12px}#endTop{display:none}}

#endLead{display:flex;align-items:center;gap:10px;background:#ffffff10;border-radius:14px;padding:8px 10px;margin-bottom:6px}
#endLead:empty{display:none}
#endLead .gpup{width:44px;height:auto;flex:none;opacity:.8}
#endLead b{display:block;font-size:16px;color:#bfe3ff}
#endLead span{display:block;font-size:13px;color:#ff9fd0;margin-top:2px}
button.big{font-size:19px;padding:16px 10px;width:100%}
button.small{font-size:14px;padding:9px 10px;opacity:.9}
.split{display:flex;gap:8px}.split[hidden]{display:none}
.split button{flex:1;font-size:15px;padding:14px 8px;margin:0}

.lvb{display:inline-block;font-size:11px;font-weight:700;padding:1px 6px;border-radius:8px;background:#6b5bff55;color:#d9d2ff;vertical-align:1px}
#lvTag{font-size:12px;color:#d9d2ff}

.split{flex-wrap:wrap}.split #btnShare{flex-basis:100%}
