:root { color-scheme: dark; font: 14px system-ui, sans-serif; background: #000; color: #f4f7fa; }
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: #000; }
button { color: inherit; background: #1c2631e8; border: 1px solid #ffffff30; border-radius: 10px; padding: 10px 14px; cursor: pointer; font: inherit; min-height: 44px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:hover { background: #34495e; } button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, .divider:focus-visible { outline: 2px solid #65bdff; outline-offset: -2px; }
[hidden] { display: none !important; }
#stage { position: fixed; inset: max(env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)) env(safe-area-inset-right) max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px)) env(safe-area-inset-left); display: flex; align-items: center; justify-content: center; }
#grid { position: relative; flex: none; background: #000; overflow: hidden; }
.card { position: absolute; overflow: hidden; min-width: 0; background: #000; border: 1px solid #000; }
.card video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; touch-action: manipulation; }
.card h2 { position: absolute; inset: 0 0 auto; margin: 0; padding: 9px 10px 26px; background: linear-gradient(#000a, transparent); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.card .actions { position: absolute; inset: auto 0 0; padding: 25px 8px 8px; background: linear-gradient(transparent, #000c); display: flex; gap: 5px; flex-wrap: wrap; }
.card .actions button { font-size: 12px; padding: 8px 10px; min-height: 44px; }
.card h2, .card .actions { opacity: 0; transition: opacity .15s; }
.card .actions { pointer-events: none; }
@media (hover: hover) { .card:hover h2, .card:hover .actions { opacity: 1; pointer-events: auto; } }
.card:focus-within h2, .card:focus-within .actions, .card.show-controls h2, .card.show-controls .actions, .card.has-error .actions { opacity: 1; pointer-events: auto; }
.card h2 { pointer-events: none !important; }
.card .actions button[aria-pressed="true"] { background: #246650; }
.card p { position: absolute; top: 45%; left: 10px; right: 10px; margin: 0; text-align: center; font-size: 13px; background: #111c; border-radius: 5px; padding: 8px; pointer-events: none; }
.divider { position: absolute; z-index: 5; touch-action: none; user-select: none; }
.divider::after { content: ''; position: absolute; background: #ffffff20; transition: background .15s; }
.divider.vertical { cursor: col-resize; z-index: 6; }
.divider.horizontal { cursor: row-resize; }
.divider.vertical::after { top: 0; bottom: 0; width: 2px; left: 13px; }
.divider.horizontal::after { left: 0; right: 0; height: 2px; top: 13px; }
.grip { position: absolute; z-index: 1; display: block; width: 44px; height: 44px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.grip::after { content: ''; position: absolute; inset: 13px; border: 1px solid #8bccff; border-radius: 7px; background: #21577d; box-shadow: 0 1px 6px #0008; }
.vertical .grip::after { inset: 8px 16px; }
.horizontal .grip::after { inset: 16px 8px; }
.divider:hover::after, .divider:focus::after, #grid.resizing .divider::after { background: #65bdff; }
#grid.resizing { user-select: none; } #grid.resizing .card { pointer-events: none; }
#viewer-dock { position: fixed; z-index: 20; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px)); display: flex; gap: 8px; }
#viewer-dock button { background: #101923ed; box-shadow: 0 2px 10px #0005; }
#toolbar { position: fixed; z-index: 15; bottom: max(66px, calc(env(safe-area-inset-bottom) + 60px)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); margin-left: auto; max-width: 520px; padding: 18px; background: #111b27fa; border: 1px solid #ffffff25; border-radius: 18px; box-shadow: 0 5px 25px #0008; max-height: 70dvh; overflow: auto; }
header, nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; } header { justify-content: space-between; margin-bottom: 10px; }
h1 { font-size: 16px; margin: 0; } #summary { margin: 3px 0 0; color: #aab9c8; font-size: 12px; }
.hint { color: #aab9c8; font-size: 12px; margin-bottom: 0; }
#notice { position: fixed; z-index: 16; left: 50%; top: max(12px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)); transform: translateX(-50%); max-width: 90%; margin: 0; padding: 9px 14px; border-radius: 10px; color: #ffd18c; background: #151d28ee; pointer-events: none; }
#notice:empty { display: none; }
#welcome { position: fixed; z-index: 12; bottom: max(72px, calc(env(safe-area-inset-bottom) + 66px)); left: 16px; right: 16px; max-width: 390px; margin: auto; padding: 16px; border: 1px solid #ffffff25; border-radius: 16px; background: #132232fa; box-shadow: 0 6px 24px #0008; }
#welcome p { font-size: 13px; line-height: 1.5; color: #becbd9; margin: 8px 0 12px; }
#dismiss-tip, #save, #choose { background: #327fc0; border-color: #69b4ed; color: #fff; font-weight: 600; }
#picker { position: fixed; z-index: 30; inset: max(12px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); margin: auto; max-width: 600px; max-height: 740px; display: flex; flex-direction: column; padding: 20px; background: #101b29; border: 1px solid #34475d; border-radius: 20px; box-shadow: 0 0 0 100vmax #000b; }
#picker header { flex-wrap: nowrap; align-items: flex-start; } #picker h2 { font-size: 21px; margin: 0; letter-spacing: -.4px; } #limit { color: #aebed1; font-size: 13px; margin: 6px 0; }
.search-label { color: #bdcad9; font-size: 12px; margin-bottom: 6px; }
#search { width: 100%; border: 1px solid #40536a; border-radius: 10px; background: #1b293a; color: #fff; font: inherit; font-size: 16px; min-height: 46px; padding: 10px 12px; }
.picker-info { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; } #selection-count { font-size: 13px; color: #90cfff; }
#picker-notice { color: #ffd18c; font-size: 13px; margin: 8px 0; } #picker-notice:empty { display: none; }
#games { display: grid; gap: 8px; margin: 12px 0; overflow-y: auto; min-height: 0; align-content: start; flex: 1; overscroll-behavior: contain; }
#games label { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px; background: #19283b; border: 1px solid transparent; border-radius: 12px; cursor: pointer; }
#games label:has(:checked) { background: #173952; border-color: #57a9e7; } #games label:has(:disabled) { opacity: .55; cursor: default; }
#games strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.4; } #games small { display: block; font-size: 12px; color: #b1c2d4; margin-top: 4px; }
input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; accent-color: #66baff; }
#picker footer { flex-shrink: 0; border-top: 1px solid #ffffff15; padding-top: 12px; } #picker footer p { margin: 0 0 10px; text-align: center; font-size: 12px; color: #aebed1; } #save { width: 100%; min-height: 48px; }
#no-results { color: #aebed1; text-align: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 500px) { .card .actions { padding: 14px 4px 4px; gap: 4px; } .card .actions button { font-size: 12px; padding: 6px 8px; } .card h2 { font-size: 11px; } #picker { inset-inline: 0; bottom: 0; margin: auto 0 0; border-radius: 20px 20px 0 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); } }
@media (max-height: 450px) { #welcome { max-width: 340px; bottom: 65px; padding: 12px; } #picker { padding: 12px; } #picker header { margin-bottom: 4px; } .search-label { display: none; } #picker footer p { display: none; } .picker-info { margin-top: 4px; } }
