/* ================= v31 polish ================= */

/* ---- control cluster: one Customization button ---- */
#custBtn { grid-column:1; grid-row:1; } #achBtn { grid-column:2; grid-row:1; } #arcBtn { grid-column:3; grid-row:1; }
#fxBtn { grid-column:2; grid-row:2; } #musicBtn { grid-column:3; grid-row:2; }
/* "check some of this music" sits under the whole cluster, arrow pointing up at the music button, so it never covers a button */
.nudge { right:0; left:auto; top:102px; width:min(220px, 100%); min-width:0; text-align:right; }
.nudge span { text-align:right; }
.top:has(#musicBtn.needs) { margin-bottom:84px; }
@media (prefers-reduced-motion:no-preference) { #custBtn .lu { animation:drip 2.6s ease-in-out infinite; } }
.fxm.cust { gap:14px; padding:12px; max-height:min(72vh, 600px); overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
.cust-sec { display:grid; gap:8px; min-width:0; }
.cust .shm-h { margin:0; padding:0 0 6px; }
.cust .hue { position:static; right:auto; top:auto; display:grid; grid-template-columns:repeat(auto-fill, 34px); justify-content:start; gap:8px; padding:0; border:0; background:none; box-shadow:none; }
.cust .hue[hidden] { display:grid; }
.cust-mode { width:100%; text-align:left; }
.cust-mode:hover, .cust-mode:focus-visible { border-color:var(--acc); color:var(--acc); }
.cust .shm-l { display:grid; gap:4px; }
#mode { animation:none; }

/* ---- Stop pills ---- */
.fx-pill.fx-off span { font-weight:700; letter-spacing:.5px; }

/* ---- back to top: always there, opens a jump list ---- */
#totop { opacity:1; transform:none; pointer-events:auto; }
#totop.open { background:var(--fg); color:var(--bg); }
.tt-menu { position:fixed; z-index:56; right:calc(28px + env(safe-area-inset-right)); bottom:calc(92px + env(safe-area-inset-bottom)); display:grid; gap:4px; min-width:190px; max-width:calc(100vw - 32px); max-height:calc(100dvh - 140px); overflow-y:auto; padding:8px; background:var(--panel); border:2px solid var(--ink); border-radius:var(--w1); box-shadow:5px 5px 0 var(--acc); transform-origin:100% 100%; animation:ttIn .14s steps(4, end) both; }
.tt-menu[hidden] { display:none; }
.tt-i { display:block; width:100%; padding:8px 12px; text-align:left; cursor:pointer; background:transparent; color:var(--fg); border:2px solid transparent; border-radius:var(--w1); font:700 16px/20px Mc, monospace; }
.tt-i:hover, .tt-i:focus-visible { border-color:var(--acc); color:var(--acc); }
.tt-top { margin-top:4px; border-top:2px dashed var(--line); border-radius:0 0 var(--w1) var(--w1); }
@keyframes ttIn { from { opacity:0; transform:translateY(8px) scale(.96); } }
@media (prefers-reduced-motion:reduce) { .tt-menu { animation:none; } }
@media (max-width:560px) { #totop { right:calc(16px + env(safe-area-inset-right)); bottom:calc(16px + env(safe-area-inset-bottom)); width:48px; height:48px; } .tt-menu { right:calc(16px + env(safe-area-inset-right)); bottom:calc(76px + env(safe-area-inset-bottom)); } }

/* ---- Blu-ray cases (desktop): the poster window is exactly 2:3, so the whole cover shows. nothing is cropped, nothing is black ---- */
.mi-bd { aspect-ratio:100 / 152.5; perspective:900px; }
.mi-box { --d:10.5cqw; }
.mi-card.bd .mi-art { background:linear-gradient(180deg, var(--bd-f1, #0b8ad8) 0, var(--bd-f2, #0073bd) 55%, var(--bd-f3, #00629f) 100%); border-radius:1.4cqw; }
.mi-card.bd .mi-win { left:4%; top:7.54%; width:92%; height:90.49%; background:#0b0b0e; border-radius:.6cqw; }
.mi-card.bd .mi-win img { object-fit:cover; object-position:center; filter:none; }
.mi-win::after { box-shadow:inset 0 0 0 1px rgba(0,0,0,.4); }
.mi-ban { position:absolute; left:0; right:0; top:0; height:7.54%; overflow:visible; z-index:2; display:flex; align-items:center; justify-content:space-between; padding:0 4.6%; color:#fff; pointer-events:none; }
.mi-ban b { font:700 max(6px, 4.2cqw)/1 Mc, monospace; letter-spacing:.06em; white-space:nowrap; text-shadow:0 1px 0 rgba(0,0,0,.25); }
.mi-logo { display:block; box-sizing:border-box; height:9.2cqw; aspect-ratio:1.89 / 1; padding:0; margin-top:.4cqw; background:none; pointer-events:none; filter:drop-shadow(.4cqw 0 0 #fff) drop-shadow(-.4cqw 0 0 #fff) drop-shadow(0 .4cqw 0 #fff) drop-shadow(0 -.4cqw 0 #fff) drop-shadow(0 .5cqw .7cqw rgba(0,0,0,.35)); } .mi-logo img { display:block; width:100%; height:100%; object-fit:contain; }
.mi-card.bd .mi-art::before { background:
    linear-gradient(112deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,.04) 22%, transparent 40%, transparent 74%, rgba(255,255,255,.07) 100%),
    linear-gradient(90deg, rgba(0,0,0,.34) 0, rgba(0,0,0,0) 2.4%, rgba(255,255,255,.22) 3%, transparent 4.2%); box-shadow:inset 0 0 0 1px rgba(255,255,255,.22), inset 0 0 12px rgba(0,0,0,.25); }
.mi-card.bd .mi-art::after { z-index:5; opacity:0; transition:opacity .25s; background:radial-gradient(circle at var(--gx, 50%) var(--gy, 40%), rgba(255,255,255,.34), rgba(255,255,255,.08) 38%, transparent 62%); mix-blend-mode:soft-light; }
.mi:hover .mi-card.bd .mi-art::after, .mi:focus-visible .mi-card.bd .mi-art::after { opacity:1; }
.mi-card.bd .mi-art:not(.nocover) .mi-t { display:none; }
.mi-card.bd .mi-art.nocover .mi-t { top:50%; }
.mi-fill .mi-win { background:repeating-linear-gradient(135deg, #12141c 0 8px, #0d0f16 8px 16px); }
.mi-sp { background-size:100% 100%; }
.mi-rt { background:linear-gradient(90deg, var(--bd-rt1, #0a74bb), var(--bd-rt2, #005a93) 70%, var(--bd-rt3, #004c7c)); }
@media (hover:hover) and (prefers-reduced-motion:no-preference) { .mi.mi-bd:not(.tilt):hover .mi-shadow { opacity:.5; transform:scaleX(1.12) translateY(3px); } }
.mi-bd .mi-box { will-change:transform; }

/* ---- plain posters (phones, tablets, touch): no 3D, whole poster visible ---- */
.mi-flat { aspect-ratio:2 / 3; perspective:none; cursor:pointer; }
.mi-card.flat { padding:0; overflow:hidden; background:#101010; border:2px solid var(--ink); border-radius:var(--w1); box-shadow:none; }
.mi:hover .mi-card.flat, .mi:focus-visible .mi-card.flat { background:#101010; }
.mi-card.flat .mi-art { border:0; border-radius:0; }
.mi-card.flat .mi-art img { object-fit:cover; object-position:center; }
.mi-card.flat .mi-art:not(.nocover) .mi-t { display:none; }
.mi-card.flat .mi-art.nocover .mi-t { position:static; opacity:1; padding:0 6px; background:none; text-align:center; }
.mi-card.flat.fav { box-shadow:0 0 0 2px var(--acc); }
.mi-flat.mi-fill .mi-art { background:repeating-linear-gradient(135deg, #12141c 0 8px, #0d0f16 8px 16px); }
.mi-flat .mi-q { font:700 16cqw/1 Mc, monospace; color:#3d4670; }
.mi-flat { container-type:inline-size; }
@media (max-width:899px), (hover:none), (pointer:coarse) {
  .mgrid { grid-template-columns:repeat(auto-fill, minmax(96px, 1fr)); gap:14px 12px; }
  .mi-flat { cursor:pointer; }
  html.showr .mi-flat .mi-r { display:block; }
}

/* ---- stats panel: one card style, one bar height, one type scale, nothing can overflow ---- */
.mstats-body { padding:16px; background:var(--panel); border:2px solid var(--ink); border-radius:var(--w1); box-shadow:5px 5px 0 var(--acc); }
.mstats-body .mst-chips { gap:8px; margin-bottom:14px; padding-bottom:14px; border-bottom:2px dashed var(--line); }
.mstats-body .mst-kpi { grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:10px; margin-bottom:16px; }
.mstats-body .mst-kpi .k { display:grid; align-content:center; gap:2px; min-width:0; min-height:64px; padding:10px 12px; background:var(--hover); border:2px solid var(--ink); border-top:5px solid var(--acc); border-radius:var(--w1); }
.mstats-body .mst-kpi .k b { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font:700 20px/24px Mc, monospace; }
.mstats-body .mst-kpi .k small { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font:16px/18px Mc, monospace; }
.mstats-body .mst-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:14px; align-items:stretch; }
.mstats-body .mst-c { display:flex; flex-direction:column; min-width:0; padding:0; overflow:hidden; background:var(--panel); border:2px solid var(--ink); border-radius:var(--w1); }
.mstats-body .mst-c > :not(h4) { margin-left:14px; margin-right:14px; min-width:0; }
.mstats-body .mst-c > :last-child { margin-bottom:14px; }
.mstats-body .mst-c h4 { display:flex; align-items:center; gap:8px; margin:0 0 12px; padding:8px 14px; background:var(--hover); border-bottom:2px solid var(--ink); font:700 16px/20px Mc, monospace; letter-spacing:1px; text-transform:uppercase; }
.mstats-body .mst-c h4::before { content:""; flex:none; width:10px; height:10px; background:var(--acc); border:2px solid var(--ink); }
.mstats-body .mst-grid > .mst-c:last-child:nth-child(odd) { grid-column:1 / -1; }
.mstats-body .sb-note { margin:-2px 14px 8px; font:16px/18px Mc, monospace; color:var(--mut); }
/* donut + legend */
.mstats-body .sdonut { flex-wrap:nowrap; justify-content:flex-start; align-items:center; gap:16px; }
.mstats-body .sdonut svg { flex:none; width:132px; height:132px; overflow:visible; }
.mstats-body .sd-n { font:400 20px/1 Dedi, Mc, monospace; transform:none; }
.mstats-body .sd-s { font:16px/1 Mc, monospace; transform:none; }
.mstats-body .slg { display:grid; gap:4px; flex:1; min-width:0; }
.mstats-body .slg li { display:grid; grid-template-columns:12px minmax(0, 1fr) auto 5ch; align-items:center; gap:8px; line-height:22px; }
.mstats-body .slg i { width:12px; height:12px; margin:0; }
.mstats-body .slg span { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:22px; }
.mstats-body .slg b, .mstats-body .slg small { text-align:right; white-space:nowrap; }
.mstats-body .slg small { color:var(--mut); }
/* horizontal bars */
.mstats-body .sbar { display:grid; grid-template-columns:minmax(0, 36%) minmax(36px, 1fr) max-content; align-items:center; gap:10px; margin:6px 14px; line-height:22px; }
.mstats-body .sb-l { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:22px; }
.mstats-body .sb-t { height:16px; border:2px solid var(--ink); border-radius:0; background:var(--hover); }
.mstats-body .sb-v { min-width:0; text-align:right; white-space:nowrap; font:700 16px/22px Mc, monospace; }
/* column charts */
.mstats-body .scols { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0, 1fr); align-items:end; gap:6px; height:auto; border:0; padding:0; }
.mstats-body .scol { display:flex; flex-direction:column; justify-content:flex-end; min-width:0; height:158px; }
.mstats-body .sc-n { height:20px; line-height:20px; text-align:center; overflow:hidden; white-space:nowrap; }
.mstats-body .sc-l { height:22px; margin:4px 0 0; line-height:22px; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:clip; }
.mstats-body .scols.dense .scol:nth-child(even) .sc-l { visibility:hidden; }
/* top lists */
.mstats-body .stop { margin-left:14px; margin-right:14px; }
.mstats-body .stop li { display:grid; grid-template-columns:12px minmax(0, 1fr) auto; grid-template-areas:"dot title score" "dot meta score"; align-items:center; column-gap:10px; row-gap:0; padding:6px 0; }
.mstats-body .stop li > i { grid-area:dot; width:12px; height:12px; }
.mstats-body .stop li > span { grid-area:title; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:22px; }
.mstats-body .stop li > small { grid-area:meta; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:18px; color:var(--mut); }
.mstats-body .stop li > b { grid-area:score; white-space:nowrap; }
@media (max-width:760px) { .mstats-body .mst-grid { grid-template-columns:minmax(0, 1fr); } .mstats-body .mst-kpi { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width:420px) { .mstats-body { padding:12px; } .mstats-body .sdonut { flex-direction:column; align-items:stretch; } .mstats-body .sdonut svg { align-self:center; } .mstats-body .mst-kpi .k b { font-size:18px; } .mstats-body .sbar { grid-template-columns:minmax(0, 32%) minmax(32px, 1fr) max-content; gap:8px; } }

/* ================= arcade on phones ================= */
.gm { padding:10px 10px 44px; justify-content:safe center; overflow:auto; overscroll-behavior:contain; -webkit-tap-highlight-color:transparent; }
html.gm-lock, html.gm-lock body { overflow:hidden !important; overscroll-behavior:none; }
.gm.touch { user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; touch-action:manipulation; }
.gm.booting .ng-pad { visibility:hidden; }
.ng-pad { display:none !important; }
.gm.touch .ng-pad { display:flex !important; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:8px 12px; width:100%; max-width:440px; padding:2px 4px; }
.ng-L, .ng-R { display:flex; align-items:center; gap:8px; min-width:0; }
.ng-R { margin-left:auto; justify-content:flex-end; }
.ng-L:empty { display:none; }
.ng-M { order:2; flex:1 0 100%; display:flex; justify-content:center; }
.ng-row { display:flex; gap:8px; }
.gm.touch .ng-pad button { min-width:52px; height:52px; padding:0 10px; font-size:15px; letter-spacing:.3px; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; touch-action:none; }
.gm.touch .ng-pad .big { min-width:64px; height:64px; }
.gm.touch .ng-pad .wide { min-width:92px; }
.gm.touch .ng-pad .sm { min-width:44px; height:36px; padding:0 10px; font-size:13px; }
.gm.touch .ng-pad .st { min-width:64px; height:34px; font-size:12px; }
.gm.touch .ng-dpad { grid-template-columns:repeat(3, 54px); grid-template-rows:repeat(3, 54px); }
.gm.touch .ng-dpad button { min-width:0; width:54px; height:54px; padding:0; }
.gm.touch .ng-btns { display:flex; align-items:center; gap:8px; }
.gm.touch .ng-btns button { width:auto; }
.gm.touch .ng-pad .tog.armed { border-color:var(--dk) var(--hi) var(--hi) var(--dk); box-shadow:inset 1px 1px var(--lo); background:#ffe9a8; }
.k-rhythm .ng-L, .k-rhythm .ng-R { flex:1; margin:0; }
.gm.touch .k-rhythm .ng-row { flex:1; }
.gm.touch .k-rhythm .lane { flex:1; min-width:0; height:96px; font-size:22px; border-bottom-width:6px; }
.gm.touch .k-rhythm .l0 { border-bottom-color:#d82818; } .gm.touch .k-rhythm .l1 { border-bottom-color:#f0c820; } .gm.touch .k-rhythm .l2 { border-bottom-color:#28a038; } .gm.touch .k-rhythm .l3 { border-bottom-color:#c4c4c0; }
.k-rhythm { gap:8px; }

/* landscape phones: the pad splits into thumb clusters either side of the screen */
.gm.land { flex-direction:row; justify-content:center; align-items:center; gap:10px; padding:6px 8px 40px; }
.gm.land .ng-pad { display:contents !important; }
.gm.land .ng-L { order:-1; flex-direction:column; } .gm.land .ng-R { order:1; flex-direction:column-reverse; margin:0; }
.gm.land .ng-M { display:none; }
.gm.land .ng-row { flex-direction:column; }
.gm.land.touch .ng-pad .lane { flex:none; width:96px; height:72px; }
.gm.land .ng-btns { flex-direction:column-reverse; }

/* touch-sized window chrome */
.gm.touch .ng-title { height:30px; padding:3px 3px 3px 4px; }
.gm.touch .ng-tb button { width:28px; height:22px; }
.gm.touch .ng-tb i { left:50%; top:50%; }
.gm.touch .ng-x i { margin:-4px 0 0 -4.5px; } .gm.touch .ng-min i { margin:0 0 0 -3px; left:50%; bottom:4px; } .gm.touch .ng-max i { margin:-4px 0 0 -4.5px; }
.gm.touch .ng-menu button { padding:7px 11px; }
.gm.touch .ng-drop { top:62px; } .gm.touch .ng-drop button { padding:10px 10px 10px 2px; }
.gm.touch .ng-lb { touch-action:pan-y; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.gm.touch .ng-lb li { padding:6px 6px; }
.gm.touch .ng-go { min-height:34px; }

/* game list on a narrow screen: a play bar instead of a hidden preview */
@media (max-width:560px) {
  .ng-list { grid-template-columns:minmax(0, 1fr); grid-template-rows:auto minmax(0, 1fr) auto; }
  .ng-prev { display:flex; grid-column:1; grid-row:3; flex-direction:row; align-items:center; gap:8px; padding:4px 6px; }
  .ng-pc, .ng-pd, .ng-pb { display:none; }
  .ng-pt { flex:1; min-width:0; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .ng-go { margin:0; min-width:76px; }
}
@media (pointer:coarse) { .ng-pad { display:none !important; } .gm.touch .ng-pad { display:flex !important; } .gm.land .ng-pad { display:contents !important; } }
@media (max-height:620px) { .gm.touch .ng-pad { display:flex !important; } .gm.land .ng-pad { display:contents !important; } }

/* ---- phone layout swap: ascii under "Lately, I'm feeling", gacha below Steam ---- */
.term.in-side { margin-top:var(--s4); }
.gacha.in-main { margin:0 0 var(--s6); padding:var(--s4); border:2px solid var(--ink); border-radius:var(--w1); background:var(--panel); }
.gacha.in-main + section, .gacha.in-main + .term { margin-top:0; }
