@font-face { font-family: 'Permanent Marker'; src: url(/static/fonts/permanent-marker.ttf) format('truetype'); font-display: swap; }
:root { --ink: #1a1a1a; --b: #2457d6; --r: #d62828; --ac: #3d3fc9; --bg: #fff; --mut: #8a90a0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #f4f5f9; font: 16px/1.3 -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif; color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
svg { width: 20px; height: 20px; fill: currentColor; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: var(--bg); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; position: relative; }
@media (min-width: 520px) { .app { margin-top: 12px; min-height: calc(100dvh - 24px); border-radius: 28px; box-shadow: 0 10px 40px #1b1f3a1f; } }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { position: relative; aspect-ratio: 4 / 3.1; border-radius: 18px; overflow: hidden; background: linear-gradient(160deg, #dfe3ef, #c9cfe0); transition: box-shadow .3s; }
.tile.turn { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ac), 0 0 18px 4px #3d3fc955; animation: glow 2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ac), 0 0 26px 8px #3d3fc980; } }
.vid, .vid video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vid video.mirror { transform: scaleX(-1); }
.ph { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.ph .av { width: 56px; height: 56px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 20px; display: grid; place-items: center; }
.ph small { color: #5b6275; font-size: 12px; min-height: 14px; }
.tile.hasvid .ph { display: none; }
.tile.off:not(.hasvid) .av { opacity: .5; }
.lab { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 12px; background: #3a3a3cb8; backdrop-filter: blur(6px); color: #fff; font-size: 13px; font-weight: 600; max-width: 60%; }
.lab .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.tg { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 5px; }
.tb { width: 32px; height: 32px; border-radius: 50%; background: #3a3a3cb8; color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.tb svg { width: 16px; height: 16px; }
.tb.off { background: #d62828cc; }
.vj { align-self: center; margin-top: -2px; }
.conn { text-align: center; font-size: 13px; color: #9a5b00; background: #fff4d6; border-radius: 10px; padding: 4px; }

.hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hd h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.hd h1 span { font-weight: 500; margin: 0 2px; }
.hd h1 small { font-size: 16px; font-weight: 500; color: var(--mut); }
.ib { width: 38px; height: 38px; border-radius: 12px; background: #eef0f5; display: grid; place-items: center; }
.ib svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#banner { text-align: center; padding: 11px; border-radius: 14px; background: #eceaff; color: #2b2db8; font-weight: 700; font-size: 18px; }
#banner.me { background: var(--ac); color: #fff; animation: pop .4s; }
@keyframes pop { 50% { transform: scale(1.03); } }
.acts { display: flex; justify-content: center; gap: 18px; min-height: 22px; margin: -4px 0; }
.lnk { color: var(--mut); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 2px 4px; }
.lnk:hover { color: var(--ink); }

.kb { display: flex; flex-direction: column; gap: 8px; transition: opacity .2s; }
.kb.dim { opacity: .4; pointer-events: none; }
.kr { display: flex; justify-content: center; gap: 5px; }
.k { flex: 1; max-width: 40px; height: 44px; border-radius: 8px; background: #fff; box-shadow: 0 1px 0 #b9bdc9, 0 0 0 1px #e3e5ee; font-size: 18px; font-weight: 500; display: grid; place-items: center; }
.k:active, .k.hit { background: var(--ac); color: #fff; }
.k.bk { max-width: 56px; flex: 1.4; background: #d9dce6; }
.kr:nth-child(2) { padding: 0 18px; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 14px 18px; border-radius: 14px; background: var(--ac); color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; box-shadow: 0 3px 0 #2a2c91; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #2a2c91; }
.btn:disabled { opacity: .45; box-shadow: none; }
.btn.sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; box-shadow: 0 2px 0 #2a2c91; }
.btn.alt { background: #fff; color: var(--ac); box-shadow: 0 0 0 2px var(--ac); }
.play { width: 100%; }

input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 2px solid #d9dce6; background: #fff; width: 100%; min-width: 0; outline: none; }
input:focus { border-color: var(--ac); }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: #23232b; color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 15px; z-index: 50; max-width: 90vw; animation: up .25s; transition: opacity .35s; }
.toast.out { opacity: 0; }
@keyframes up { from { transform: translate(-50%, 12px); opacity: 0; } }
.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }

.modal { position: fixed; inset: 0; background: #14162a99; display: grid; place-items: center; padding: 18px; z-index: 40; animation: fade .2s; }
.modal .card { background: #fff; border-radius: 22px; padding: 20px; width: min(100%, 420px); display: flex; flex-direction: column; gap: 12px; max-height: 94dvh; overflow: auto; }
.modal h3 { margin: 0; font-size: 20px; } .modal p { margin: 0; color: #444a5c; }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; } }
