* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #111214; color: #f2f3f5; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
body.tx { overflow: auto; }
[hidden] { display: none !important; }
h1 { margin: 0 0 8px; font-size: 22px; }
.muted { color: #949ba4; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; min-height: 18px; }
.center { display: flex; align-items: center; justify-content: center; height: 100%; text-align: center; }
.card { background: #1e1f22; border-radius: 12px; padding: 28px; width: min(340px, 90vw); }
form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
input[type=text], input[type=password], select { background: #2b2d31; color: inherit; border: 1px solid #3f4147; border-radius: 6px; padding: 9px 10px; font: inherit; }
input:focus, select:focus, button:focus-visible { outline: 2px solid #5865f2; outline-offset: 1px; }
button { background: #5865f2; color: #fff; border: 0; border-radius: 6px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button:hover { background: #4752c4; }
button:disabled { opacity: .6; cursor: default; }
button.danger { background: #da373c; }
button.danger:hover { background: #a12828; }
.msg { min-height: 20px; margin: 10px 0 0; }
.msg.error { color: #fa777c; }

#app { display: flex; flex-direction: column; height: 100%; position: relative; }
header { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: #1e1f22; flex: none; }
header button { margin-left: auto; }
#grid { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; padding: 8px; }
#empty { position: absolute; inset: 48px 0 0; pointer-events: none; }
.tile { position: relative; background: #000; border-radius: 8px; overflow: hidden; cursor: zoom-in; flex: none; }
#grid.focused .tile { cursor: zoom-out; }
.tile canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile .bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: linear-gradient(transparent, rgba(0,0,0,.75)); opacity: 0; transition: opacity .15s; }
.tile:hover .bar, .tile:focus-within .bar { opacity: 1; }
.tile .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .info { color: #c4c9ce; font-size: 12px; }
.tile .mute { margin-left: auto; padding: 3px 8px; font-size: 12px; background: rgba(255,255,255,.18); }
.tile .note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; text-align: center; color: #c4c9ce; }

.panel { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #c4c9ce; }
.controls label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; align-self: flex-end; padding-bottom: 9px; }
.actions { display: flex; gap: 10px; }
#preview { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 8px; margin-top: 8px; }
