/* ===== launcher home (1.png), game page (2.png), pause menu (3.png) ===== */
#app { z-index: 10; opacity: 0; }
#app.enter { opacity: 1; transition: opacity .6s; }
html.playing #app { visibility: hidden; transition: visibility 0s .6s; }

/* shared small glass controls (rim highlight) */
.icon-btn, .now-playing, .user-chip, .detail-back, .panel-close { position: relative; background: rgba(70, 70, 78, .34); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), var(--shadow-m); }
.icon-btn::before, .now-playing::before, .user-chip::before, .detail-back::before, .panel-close::before, .btn-bracket::before, .mbtn.on::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .06) 35%, rgba(255, 255, 255, .04) 62%, rgba(255, 255, 255, .34));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask-composite: exclude;
}
.no-blur .icon-btn, .no-blur .now-playing, .no-blur .user-chip, .no-blur .detail-back, .no-blur .panel-close { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(50, 50, 56, .95); }

.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) clamp(14px, 3vw, 34px) 0; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.enter .topbar { animation: dropIn .8s var(--ease) .1s both; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-14px); } }
.top-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.wordmark { font-weight: 600; letter-spacing: .01em; font-size: 16px; color: var(--label); opacity: .9; }
.icon-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; transition: transform .3s var(--spring), background .2s; }
.icon-btn:hover { background: rgba(110, 110, 120, .42); } .icon-btn:active { transform: scale(.92); }
.icon-btn.bell::after { content: ''; width: 22px; height: 22px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9a6 6 0 1112 0c0 6 2.5 7 2.5 7h-17S6 15 6 9z'/%3E%3Cpath d='M10 20a2 2 0 004 0'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9a6 6 0 1112 0c0 6 2.5 7 2.5 7h-17S6 15 6 9z'/%3E%3Cpath d='M10 20a2 2 0 004 0'/%3E%3C/svg%3E") center/contain no-repeat; }
.badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; animation: pop .45s var(--spring); z-index: 1; }
@keyframes pop { from { transform: scale(0); } }
.now-playing { display: inline-flex; align-items: center; gap: 8px; max-width: 190px; padding: 9px 16px 9px 12px; border-radius: 999px; border: 0; font-weight: 600; font-size: 14px; animation: pop .45s var(--spring); }
.now-playing span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-chip { display: flex; align-items: center; gap: 12px; border: 0; padding: 5px 5px 5px 18px; border-radius: 999px; transition: transform .3s var(--spring), opacity .4s, background .2s; }
.user-chip:hover { background: rgba(110, 110, 120, .42); } .user-chip:active { transform: scale(.97); }
html[data-view="detail"] .user-chip { opacity: 0; pointer-events: none; }
.uc-text { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.uc-text b { font-size: 15px; font-weight: 600; max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-text span { font-size: 13px; color: var(--label2); font-weight: 500; font-variant-numeric: tabular-nums; }
.uc-xp { display: block; width: 84px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .2); overflow: hidden; margin-top: 2px; }
.uc-xp u { display: block; height: 100%; transform-origin: 0 50%; background: #fff; transition: transform .8s var(--ease); }
.user-chip .avatar { box-shadow: none; }

/* ---- browse ---- */
#browse { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 2.4vh, 26px); padding: 64px 0 70px; transition: opacity .5s var(--ease), transform .7s var(--ease); }
#browse.away { opacity: 0; transform: scale(1.06); pointer-events: none; }
.game-head { text-align: center; min-height: 64px; transition: opacity .2s, transform .3s var(--ease); padding: 0 16px; max-width: 94vw; }
.game-head.swap { opacity: 0; transform: translateY(8px); }
.gh-name { font-size: clamp(26px, 4.6vh, 42px); font-weight: 700; letter-spacing: -.025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-sub { color: var(--label2); font-size: 15px; margin-top: 4px; }
.enter .game-head { animation: fadeUp .9s var(--ease) .35s backwards; }

.carousel { position: relative; width: 100%; height: clamp(220px, 42vh, 400px); perspective: 1200px; outline: none; touch-action: pan-y; --tile: clamp(72px, 13vmin, 122px); cursor: grab; }
.carousel:active { cursor: grabbing; }
.tile { position: absolute; left: 50%; top: 50%; width: var(--tile); height: var(--tile); margin: calc(var(--tile) / -2) 0 0 calc(var(--tile) / -2); padding: 0; border: 0; background: transparent; border-radius: 23%; transition: transform .7s var(--ease), opacity .45s, filter .45s, box-shadow .5s; will-change: transform; -webkit-user-drag: none; box-shadow: 0 14px 30px rgba(0, 0, 0, .4); }
.tile img, .tile-letter { width: 100%; height: 100%; border-radius: 23%; object-fit: cover; display: grid; place-items: center; font-size: calc(var(--tile) * .5); font-weight: 700; background: linear-gradient(135deg, var(--c), #1c1c1e); pointer-events: none; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .25); }
.tile-shine { display: none; }
/* PS5-style focus: plain white ring around the selected tile */
.tile.sel { box-shadow: 0 0 0 3px rgba(255, 255, 255, .95), 0 0 0 7px rgba(255, 255, 255, .16), 0 28px 60px rgba(0, 0, 0, .55); }
.tile:not(.sel):hover { filter: brightness(1.2) !important; }
.tile-run { position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%); display: none; padding: 3px 10px 3px 8px; border-radius: 99px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 7px; font-style: normal; font-weight: 600; letter-spacing: .06em; white-space: nowrap; }
.tile-run::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: var(--good); vertical-align: 1px; }
.tile.running .tile-run { display: block; }
.enter .tile { animation: tileIn .9s var(--ease) backwards; animation-delay: calc(var(--n) * 70ms + 250ms); }
@keyframes tileIn { from { opacity: 0; translate: 0 60px; scale: .6; } }

/* floating glass dock (iOS 26 tab bar) */
.menu { position: relative; display: flex; gap: 4px; padding: 7px; border-radius: 999px; max-width: 94vw; background: rgba(70, 70, 78, .32); margin-bottom: 14px; }
.enter .menu { animation: dockIn .9s var(--ease) .55s backwards; }
@keyframes dockIn { from { opacity: 0; transform: translateY(24px) scale(.94); } }
.mbtn { position: relative; width: clamp(48px, 6.4vmin, 60px); aspect-ratio: 1; border: 0; border-radius: 50%; display: grid; place-items: center; font-size: clamp(22px, 3vmin, 26px); background: transparent; color: var(--label); transition: transform .35s var(--spring), background .2s; }
.mbtn:hover, .mbtn:focus-visible { background: rgba(255, 255, 255, .17); outline: none; transform: scale(1.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.mbtn:active { transform: scale(.92); }
.mlabel { position: absolute; bottom: calc(100% + 18px); left: 50%; transform: translate(-50%, 6px); font-size: 13px; font-weight: 600; white-space: nowrap; padding: 5px 12px; border-radius: 99px; background: rgba(40, 40, 46, .75); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s var(--ease); }
.mbtn:hover .mlabel, .mbtn:focus-visible .mlabel { opacity: 1; transform: translate(-50%, 0); }
.mbadge { position: absolute; top: 0; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; font-style: normal; display: grid; place-items: center; animation: pop .45s var(--spring); }

.clock { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; pointer-events: none; display: flex; flex-direction: column; gap: 2px; }
#clockTime { font-size: clamp(20px, 3.2vmin, 28px); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: .02em; color: rgba(255, 255, 255, .9); }
.clock small { color: var(--label3); font-size: 12px; letter-spacing: .02em; }
.clock { transition: opacity .4s var(--ease); } html.panel-open .clock { opacity: 0; }
.enter .clock { animation: fadeUp 1s var(--ease) 1s backwards; }

/* ---- game page ---- */
.detail { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .45s var(--ease); padding: 70px 0 30px; overflow: auto; }
.detail.in { opacity: 1; pointer-events: auto; } .detail.leaving { opacity: 0; transition-duration: .3s; }
.detail-back { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: clamp(16px, 3vw, 34px); width: 50px; height: 50px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 22px; z-index: 3; transition: transform .3s var(--spring), background .2s; }
.detail-back:hover { background: rgba(110, 110, 120, .42); transform: translateX(3px); } .detail-back:active { transform: scale(.92); }
.detail-main { display: grid; grid-template-columns: minmax(200px, 40%) 1fr; gap: clamp(22px, 6vw, 80px); width: min(1080px, 92vw); align-items: center; }
.detail-art { position: relative; display: grid; place-items: center; padding: 6%; }
.detail-icon { width: min(100%, 40vh, 330px); aspect-ratio: 1; border-radius: 23%; box-shadow: 0 30px 70px rgba(0, 0, 0, .55), 0 0 0 .5px rgba(255, 255, 255, .3); }
.detail-icon img, .detail-icon .tile-letter { width: 100%; height: 100%; border-radius: 23%; object-fit: cover; display: grid; place-items: center; font-size: 110px; font-weight: 700; background: linear-gradient(135deg, var(--c), #1c1c1e); }
.slash { position: absolute; top: -4%; bottom: -4%; width: 1px; background: linear-gradient(transparent, rgba(255, 255, 255, .5), transparent); transform: skewX(-14deg) scaleY(0); transition: transform .9s var(--ease) .2s; }
.slash.l { left: 0; } .slash.r { right: 0; transition-delay: .35s; }
.detail.in .slash { transform: skewX(-14deg) scaleY(1); }
.detail-info > * { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .7s var(--ease); }
.detail.in .detail-info > * { opacity: 1; transform: none; }
.detail.in .detail-info > :nth-child(1) { transition-delay: .15s; } .detail.in .detail-info > :nth-child(2) { transition-delay: .25s; } .detail.in .detail-info > :nth-child(3) { transition-delay: .35s; } .detail.in .detail-info > :nth-child(4) { transition-delay: .45s; }
.detail-title { font-size: clamp(32px, 6vw, 60px); font-weight: 700; line-height: 1.08; letter-spacing: -.03em; display: flex; align-items: baseline; flex-wrap: wrap; }
.detail-title .sep { color: var(--label3); margin: 0 .3em; font-style: normal; font-weight: 300; }
.detail-title small { font-size: .36em; font-weight: 500; color: var(--label2); letter-spacing: 0; }
.detail-desc { margin-top: 16px; max-width: 46ch; color: rgba(255, 255, 255, .72); line-height: 1.6; font-size: clamp(15px, 1.8vw, 18px); }
.detail-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.detail-actions { display: flex; gap: 12px; margin-top: clamp(20px, 4vh, 38px); flex-wrap: wrap; }
.btn-bracket { position: relative; display: inline-flex; align-items: center; gap: 12px; padding: 15px 28px 15px 22px; font-size: 16px; letter-spacing: .08em; border: 0; border-radius: 999px; color: var(--label); background: rgba(70, 70, 78, .34); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), var(--shadow-m); transition: transform .3s var(--spring), background .2s; }
.btn-bracket b { font-weight: 700; }
.btn-bracket:hover { background: rgba(110, 110, 120, .42); } .btn-bracket:active { transform: scale(.95); }
.btn-bracket.primary { background: rgba(255, 255, 255, .92); color: #000; }
.btn-bracket.primary:hover { background: #fff; }
.btn-bracket.primary::before { display: none; }
.btn-bracket .br { width: 13px; height: 13px; border-top: 2.5px solid currentColor; border-left: 2.5px solid currentColor; border-radius: 4px 0 0 0; opacity: .7; }
.btn-bracket .br.alt { border-left: 0; border-right: 2.5px solid currentColor; border-radius: 0 4px 0 0; }
.btn-bracket:focus-visible { outline-offset: 4px; }

/* ---- running game + pause menu ---- */
#player { position: fixed; inset: 0; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .5s var(--ease); background: #000; }
#player.show { opacity: 1; pointer-events: auto; } #player.away { opacity: 0; pointer-events: none; transition-duration: .3s; }
#player::before { content: ''; position: absolute; inset: 0; background: #0b0b10; opacity: 0; transition: opacity .5s; }
#player.paused::before, #player.loading::before { opacity: 1; }
.pl-bg { position: absolute; inset: -12%; background-size: cover; background-position: center; filter: blur(70px) saturate(1.5) brightness(.6); opacity: 0; transition: opacity .6s; transform: scale(1.2); }
#player.paused .pl-bg, #player.loading .pl-bg { opacity: 1; }
.pl-stage { position: absolute; inset: 0; transform-origin: 100% 50%; transition: transform .65s var(--ease), border-radius .5s var(--ease), box-shadow .5s, opacity .5s; }
#player.loading .pl-stage { opacity: 0; }
#player.paused .pl-stage { transform: scale(var(--pm-scale, .8)); border-radius: 30px; box-shadow: 0 0 0 .5px rgba(255, 255, 255, .3), 0 40px 90px rgba(0, 0, 0, .6); }
.pl-frame { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #000; }
.pl-iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
#player[data-scale="16:9"] .pl-frame, #player[data-scale="4:3"] .pl-frame, #player[data-scale="1:1"] .pl-frame { inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 14px; }
#player[data-scale="16:9"] .pl-frame { width: min(100vw, 177.78dvh); height: min(100dvh, 56.25vw); }
#player[data-scale="4:3"] .pl-frame { width: min(100vw, 133.33dvh); height: min(100dvh, 75vw); }
#player[data-scale="1:1"] .pl-frame { width: min(100vw, 100dvh); height: min(100vw, 100dvh); }
.pl-shield { position: absolute; inset: 0; display: none; background: rgba(0, 0, 0, .22); cursor: pointer; border-radius: inherit; }
#player.paused .pl-shield { display: block; }
.pl-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; opacity: 0; pointer-events: none; transition: opacity .5s; }
#player.loading .pl-loading { opacity: 1; animation: loadIn .8s var(--ease); }
@keyframes loadIn { from { transform: scale(1.25); opacity: 0; } }
.pl-load-icon { width: clamp(96px, 20vmin, 160px); aspect-ratio: 1; border-radius: 23%; background-size: cover; background-position: center; background-color: var(--c); box-shadow: 0 30px 70px rgba(0, 0, 0, .55), 0 0 0 .5px rgba(255, 255, 255, .3); }
.pl-load-name { font-size: clamp(20px, 3.4vmin, 28px); font-weight: 600; letter-spacing: -.02em; }
.pl-load-bar { width: clamp(140px, 26vmin, 220px); height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.pl-load-bar i { display: block; height: 100%; width: 40%; border-radius: 3px; background: #fff; animation: loadbar 1.2s var(--ease) infinite; }
@keyframes loadbar { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
.pl-menu { position: absolute; left: 12px; top: 12px; bottom: 12px; width: 300px; max-width: 88vw; display: flex; flex-direction: column; gap: 22px; padding: calc(24px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 36px; background: rgba(60, 60, 68, .4); transform: translateX(-112%); transition: transform .65s var(--ease); z-index: 2; }
#player.paused .pl-menu { transform: none; }
.pm-game { display: flex; align-items: center; gap: 12px; padding: 0 8px; } .pm-game img { width: 50px; height: 50px; border-radius: 23%; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); } .pm-game b { display: block; font-size: 17px; font-weight: 600; } .pm-game small { color: var(--good); font-weight: 600; font-size: 12px; }
.pm-list { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.pm-item { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 0; border-radius: 22px; background: none; color: var(--label); font-size: clamp(18px, 2.4vh, 22px); font-weight: 600; text-align: left; opacity: 0; transform: translateX(-18px); transition: background .2s, transform .4s var(--ease), opacity .4s; }
#player.paused .pm-item { opacity: 1; transform: none; } #player.paused .pm-item:nth-child(1) { transition-delay: .12s, 0s, .12s; } #player.paused .pm-item:nth-child(2) { transition-delay: .17s, 0s, .17s; } #player.paused .pm-item:nth-child(3) { transition-delay: .22s, 0s, .22s; } #player.paused .pm-item:nth-child(4) { transition-delay: .27s, 0s, .27s; }
.pm-item:hover, .pm-item:focus-visible { background: rgba(255, 255, 255, .17); outline: none; transition-delay: 0s !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.pm-item:disabled { opacity: .3 !important; pointer-events: none; }
.pm-user { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 26px; border: 0; background: rgba(255, 255, 255, .1); transition: background .2s, transform .25s var(--spring); } .pm-user:hover { background: rgba(255, 255, 255, .17); } .pm-user:active { transform: scale(.97); }
.pm-user b { display: block; font-weight: 600; } .pm-user small { color: var(--label2); font-weight: 500; }
.pl-handle { display: none; position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; width: 44px; height: 44px; border-radius: 50%; place-items: center; background: rgba(0, 0, 0, .4); border: 0; color: #fff; opacity: .55; z-index: 3; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: opacity .2s, transform .2s; }
@media (pointer: coarse) { .pl-handle { display: grid; } }
.pl-handle:active { opacity: 1; transform: scale(.9); }
#player.paused .pl-handle, #player.loading .pl-handle { display: none; }
.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 18px; border-radius: 20px; background: var(--fill); border: 0; text-align: left; transition: transform .25s var(--spring), background .2s; }
.slot:hover { background: var(--fill2); } .slot:active { transform: scale(.98); } .slot small { color: var(--label2); }
.cfg { display: flex; flex-direction: column; gap: 14px; }
.cfg-row { display: grid; grid-template-columns: 1fr minmax(140px, 190px); gap: 14px; align-items: center; } .cfg-row b { display: block; font-weight: 600; } .cfg-row small { color: var(--label2); }
.cfg-row .switch { justify-self: end; }

@media (max-width: 760px) {
  .detail-main { grid-template-columns: 1fr; text-align: center; gap: 4px; } .detail-art { padding: 2%; } .detail-icon { width: min(52vw, 30vh); }
  .detail-title { justify-content: center; } .detail-desc { margin-left: auto; margin-right: auto; } .detail-chips, .detail-actions { justify-content: center; }
  .slash { top: 0; bottom: 0; } .detail { align-items: start; padding-top: 80px; }
  .uc-text b { max-width: 34vw; font-size: 14px; } .uc-xp { width: 64px; }
  .pl-menu { width: 78vw; }
  .slider { grid-template-columns: 1fr 1fr 44px; }
  .wordmark { display: none; }
}
@media (max-width: 480px) {
  .menu { gap: 0; padding: 6px; } .mbtn { width: 11.6vw; max-width: 54px; font-size: 20px; }
}
@media (max-height: 520px) { .game-head { min-height: 40px; } .menu { margin-bottom: 4px; } .clock small { display: none; } .carousel { height: 170px; } }
