:root { color-scheme: dark; --bg: #101418; --panel: #1c232b; --ink: #f2f4f6; --dim: #9aa7b4; --accent: #ffcc33; --bar: 44px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; overflow: hidden; background: #000; }
#screen { position: absolute; left: 0; top: 0; display: block; touch-action: none; outline: none; background: #000; }
#vcursor { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 3; }
#vcursor::after { content: ""; position: absolute; left: -2px; top: -2px; width: 22px; height: 22px;
  background: no-repeat 0 0 / contain var(--cursor-img, none); filter: drop-shadow(0 0 2px #000); }
#vcursor.plain::after { width: 0; height: 0; border-left: 14px solid #fff; border-bottom: 14px solid transparent; filter: drop-shadow(0 0 2px #000); background: none; left: 0; top: 0; }
#bar { position: absolute; z-index: 4; display: flex; gap: 6px; align-items: center; padding: 6px; }
#bar button { width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
#bar button[aria-pressed="true"] { background: var(--accent); color: #000; }
#res { font-size: 10px; color: var(--dim); white-space: nowrap; }
/* on the pillarbox bar (landscape), on the letterbox bar (portrait), or small in a corner when the scene fills the window */
#bar[data-mode="side"] { right: env(safe-area-inset-right); top: env(safe-area-inset-top); bottom: env(safe-area-inset-bottom); width: 46px; flex-direction: column; }
#bar[data-mode="side"] #res { writing-mode: vertical-rl; margin-top: auto; }
#bar[data-mode="bottom"] { left: env(safe-area-inset-left); right: env(safe-area-inset-right); bottom: env(safe-area-inset-bottom); height: 48px; flex-direction: row; justify-content: center; }
#bar[data-mode="bottom"] #res { margin-left: 8px; }
/* bottom right: the title keeps its own buttons in the top corners */
#bar[data-mode="float"] { right: env(safe-area-inset-right); bottom: env(safe-area-inset-bottom); flex-direction: row; opacity: .35; transform: scale(.8); transform-origin: bottom right; transition: opacity .15s; }
#bar[data-mode="float"]:hover, #bar[data-mode="float"]:focus-within { opacity: 1; }
#bar[data-mode="float"] #res, #bar[data-mode="float"] #b-hover, #bar[data-mode="float"] #b-mute { display: none; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8, 10, 12, .82); z-index: 5; padding: 12px; }
.overlay[hidden], .panel[hidden], #vcursor[hidden] { display: none; }
.card { background: var(--panel); border-radius: 14px; padding: 18px 22px; max-width: min(92%, 460px); text-align: center; box-shadow: 0 8px 30px #0008; }
.card h1 { margin: 0 0 4px; font-size: 24px; }
.card h2 { margin: 0 0 8px; font-size: 18px; }
#dlg-text { white-space: pre-wrap; }
.sub { margin: 0 0 14px; color: var(--dim); font-size: 13px; }
.status { min-height: 1.4em; margin: 10px 0 0; color: var(--dim); font-size: 12px; white-space: pre-wrap; }
button.primary { background: var(--accent); color: #000; border: 0; border-radius: 10px; padding: 10px 22px; font-size: 16px; font-weight: 600; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.row button { border: 0; border-radius: 8px; padding: 8px 14px; background: #2a3440; color: var(--ink); cursor: pointer; font-size: 14px; }
.panel { position: fixed; z-index: 8; right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); width: min(340px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px); overflow: auto; background: var(--panel); border-radius: 14px; padding: 14px 16px; box-shadow: 0 8px 30px #000a; -webkit-user-select: text; user-select: text; }
.panel h2 { margin: 0 0 10px; font-size: 17px; }
.panel label { display: block; margin: 0 0 10px; font-size: 13px; color: var(--dim); }
.panel label.check { color: var(--ink); }
.panel select, .panel input[type=range] { display: block; width: 100%; margin-top: 4px; }
.panel select { padding: 6px; border-radius: 6px; border: 0; background: #2a3440; color: var(--ink); font-size: 14px; }
.panel output { color: var(--ink); float: right; }
.hint { font-size: 12px; color: var(--dim); margin: 6px 0 0; }
#help { width: min(560px, calc(100vw - 16px)); }
#help pre { white-space: pre-wrap; font: 13px/1.45 system-ui, sans-serif; margin: 0; }
