/* Layout: the frame fills the screen; one bottom panel holds every control (thumb reach). Single dark look on purpose. */
:root {
  color-scheme: dark;
  --ink: #06060a;
  --panel: rgba(13, 12, 20, .84);
  --line: rgba(236, 232, 255, .15);
  --fg: #f2effb;
  --dim: rgba(242, 239, 251, .62);
  --accent: #9db4ff;
  --good: #5ee0a0; --ok: #ffcc5c; --bad: #ff7a8a;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--fg); font: 15px/1.4 var(--body); overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button, label.file { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.stage { position: fixed; inset: 0; }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }

.start { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; text-align: center;
  background: radial-gradient(120% 80% at 50% 25%, #1b1530 0%, var(--ink) 70%);
  padding: 24px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.start-inner { max-width: 30rem; }
.start h1 { margin: 0; font-size: clamp(32px, 8vw, 48px); letter-spacing: -.01em; }
.start p { color: var(--dim); }
.start-actions { display: grid; gap: 10px; margin-top: 22px; }
.primary, label.file { display: block; padding: 15px 22px; border-radius: 999px; font-weight: 600; }
.primary { border: 0; background: var(--fg); color: var(--ink); }
label.file { border: 1px solid var(--line); background: rgba(255,255,255,.06); }
label.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fine { font-size: 12px; color: var(--dim); text-align: center; margin: 0; }
.fine a { color: var(--dim); }

.panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; gap: 10px;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; transition: transform .3s ease; max-height: 80vh; overflow-y: auto; }
.panel.tucked { transform: translateY(calc(100% - 40px - env(safe-area-inset-bottom))); }
.grab { justify-self: center; width: 64px; height: 18px; margin: -4px 0 -4px; border: 0; background: none; display: grid; place-items: center; }
.grab::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chips { justify-content: center; flex-wrap: wrap; gap: 8px; }
.nav { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 20px; }
.now { flex: 1; min-width: 0; text-align: center; }
.now b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now span { display: block; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--dim);
  font: 11px/1.6 var(--mono); font-variant-numeric: tabular-nums; }
.chip.good { color: var(--good); } .chip.ok { color: var(--ok); } .chip.bad { color: var(--bad); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--dim); min-width: 0; }
.field output { color: var(--fg); font-family: var(--mono); }
.field select, .field input[type="color"] { width: 100%; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); padding: 6px 10px; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }

.toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 30;
  background: var(--panel); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; font-size: 13px;
  opacity: 0; transition: opacity .25s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; }
@media (min-width: 720px) {
  .panel { left: 50%; right: auto; width: 560px; transform: translateX(-50%); }
  .panel.tucked { transform: translate(-50%, calc(100% - 40px)); }
}
@media (prefers-reduced-motion: reduce) { .panel, .toast { transition: none; } }
