* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { color-scheme: light dark; font-family: system-ui, "PingFang SC", sans-serif; --bg: #f4f8fc; --card: #fff; --ink: #182b40; --muted: #4d6277; --line: #dbe4ed; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) { --bg: #101923; --card: #182534; --ink: #eef4fa; --muted: #becad9; --line: #324255; }
}
:root[data-theme=dark] { --bg: #101923; --card: #182534; --ink: #eef4fa; --muted: #becad9; --line: #324255; }
body { margin: 0; background: var(--bg); color: var(--ink); }
#setup { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: auto 1fr; padding: 0 clamp(16px, 5vw, 72px) 32px; }
header { padding: 20px 0; }
header a { display: inline-flex; align-items: center; gap: 9px; color: inherit; font-size: 20px; font-weight: 700; text-decoration: none; }
.card { align-self: center; justify-self: center; text-align: center; width: min(100%, 460px); padding: clamp(20px, 5vw, 40px); border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
h1 { font-size: clamp(26px, 4vw, 36px); margin: 0 0 18px; }
#qr { display: block; width: min(100%, 230px); height: auto; margin: 20px auto; image-rendering: pixelated; }
#device-name, #status, #setup-notice { overflow-wrap: anywhere; line-height: 1.65; color: var(--muted); }
#setup-notice:empty { margin: 0; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 10px 16px; min-height: 44px; font: inherit; }
#action { background: #155faa; color: white; }
:focus-visible { outline: 3px solid #55abff; outline-offset: 3px; }
#player { position: fixed; inset: 0; background: #080a0e; color: white; }
#picture, #picture img { width: 100%; height: 100%; }
#picture { position: relative; overflow: hidden; isolation: isolate; }
#picture img { position: absolute; inset: 0; display: block; object-fit: contain; }
#picture img:first-child { z-index: 1; }
.controls { position: absolute; bottom: max(12px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 16px); display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 5px; padding: 6px; background: #141a21eb; color: white; border-radius: 15px; }
.controls button { color: inherit; background: transparent; padding-inline: 11px; }
.controls button:hover, .controls button:focus-visible { background: #334254; }
#count { font-size: 14px; font-variant-numeric: tabular-nums; }
#notice { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); margin: 0; padding: 8px 14px; background: #141a21eb; border-radius: 8px; }
@media (max-width: 540px) { .controls { width: calc(100% - 16px); gap: 2px; } .controls button { font-size: 14px; padding-inline: 8px; } }
