:root { color-scheme: dark; --bar: rgba(16, 18, 24, .82); --ink: #e8ebf2; --dim: #9aa3b5; --accent: #4f8cff; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); font: 15px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; background: #000; }

.bar { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 6px; padding: max(6px, env(safe-area-inset-top)) 8px 6px; background: var(--bar);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 5; align-items: stretch; }
.bar button { min-height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--ink); font: inherit; font-weight: 600; }
.bar button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.bar button.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; text-align: center; font-size: 17px; }
@media (max-width: 640px) { .bar { flex-wrap: wrap; } .bar button.name { flex: 1 1 100%; order: 9; min-height: 36px; } }
.bar button:active { background: rgba(255,255,255,.2); }

.hud { position: fixed; left: 8px; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 4; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--dim);
  background: rgba(0,0,0,.45); padding: 6px 10px; border-radius: 8px; pointer-events: none; white-space: pre; }
body.benching .hud { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 64px); }
.hud b { color: var(--ink); font-weight: 600; }
.hud .bad { color: #ff7a7a; }
.hud .warn { color: #ffd166; }
.hud .ok { color: #7ee787; }

.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: rgba(16,18,24,.92); color: var(--ink); padding: 10px 16px; border-radius: 10px; z-index: 7; max-width: 90vw; }

.sheet { position: fixed; inset: 0; z-index: 6; background: rgba(8, 9, 12, .96); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 14px 10px; font-weight: 700; font-size: 18px; }
.sheet button.close { min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: var(--ink); font: inherit; font-weight: 600; }
.grid { overflow: auto; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 6px 14px max(14px, env(safe-area-inset-bottom)); }
.grid button { min-height: 64px; border: 0; border-radius: 12px; padding: 8px 10px; text-align: left; color: #fff; font: inherit; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,.8), 0 0 6px rgba(0,0,0,.6); background: var(--sw, var(--c)); position: relative; }
.grid button span { display: block; font-weight: 500; font-size: 12px; opacity: .9; }
.grid button[aria-pressed="true"] { outline: 3px solid #fff; }
.form { overflow: auto; padding: 6px 14px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.form select { font: inherit; min-height: 40px; padding: 4px 8px; border-radius: 8px; border: 1px solid #3a3f4c; background: #171a22; color: var(--ink); }
.form input[type="checkbox"] { width: 24px; height: 24px; }
.form .note { color: var(--dim); margin: 0; font-size: 14px; }
.form .row { display: flex; gap: 10px; }
.form .row button { min-height: 44px; flex: 1; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: var(--ink); font: inherit; font-weight: 600; }
.form textarea { flex: 1; min-height: 50vh; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; background: #0d0f14; color: var(--ink); border: 1px solid #3a3f4c; border-radius: 8px; padding: 10px; white-space: pre; -webkit-user-select: text; user-select: text; }

.bench { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); background: var(--bar); font: 14px ui-monospace, Menlo, Consolas, monospace; }
.bench div { flex: 1; white-space: pre; overflow: hidden; }
.bench button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: #c0392b; color: #fff; font: inherit; font-weight: 700; }
