:root {
  --bg: #0b0c10;
  --fg: #e6edf3;
  --muted: #a2a9b1;
  --accent: #00d1ff;
  --panel: #121417cc;
  --panel-border: #24272b;
  --btn: #1c2229;
  --btn-hover: #242c35;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  overflow: hidden;
}
.app {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: clamp(260px, 28vw, 420px) 1fr;
  height: 100vh;
  min-height: 100vh;
  width: 100vw;
  min-width: 0;
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  aside { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 70vh; z-index: 10; border-right: none; border-top: 1px solid var(--panel-border); border-radius: 16px 16px 0 0; }
  .panel.collapsed { height: 46px; overflow: hidden; }
}
main {
  height: 100vh;
  min-height: 100vh;
  width: 100vw;
  min-width: 0;
  overflow: hidden;
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; }

aside {
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: auto;
}

.panel { padding: 14px 14px calc(80px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 2;
  background: linear-gradient(180deg, #121417f2, #121417cc 70%, #12141700);
  border-bottom: 1px solid #1d2126;
  margin: -14px -14px 8px; padding: 12px 14px 6px;
  display: flex; align-items: center; gap: 10px;
}
.title { font-size: 14px; font-weight: 700; letter-spacing: .6px; }
.chip { font-size: 11px; color: #cbd3dc; border: 1px solid #2b2e34; background: #161a1f; padding: 4px 8px; border-radius: 999px; }
.chip.warn { color: #ffd67d; border-color: #3a2f05; background: #1b1400; }
.spacer { flex: 1; }

.btn { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid #2b2e34; background: var(--btn); color: var(--fg); }
.btn:hover { background: var(--btn-hover); }

.sec { margin: 16px 0 8px; padding-top: 8px; border-top: 1px dashed #262a2f; color: var(--fg); font-weight: 600; letter-spacing: .4px; }

.group {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}
.group.wide { grid-template-columns: 1fr; }
.group label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); user-select: none; }
.group input[type="range"] { width: 100%; }
.group input[type="checkbox"] { transform: translateY(1px); }
.group input[type="color"] { width: 100%; height: 32px; background: #0000; border: none; }
.group select, .group input[type="text"], .group input[type="number"] {
  width: 100%; height: 32px; border-radius: 8px; border: 1px solid #2b2e34; background: var(--btn); color: var(--fg); padding: 0 10px; font-size: 12px;
}
.value { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.subtle { font-size: 11px; color: var(--muted); }
.hidden { display: none !important; }
.hint { font-size: 11px; color: var(--muted); }

.footer {
  position: sticky; bottom: 0; padding: 10px 0 0; margin-top: 8px;
  background: linear-gradient(0deg, #121417f2, #12141700 60%); border-top: 1px solid #1d2126;
}
.btn-row { display: flex; gap: 8px; padding: 8px 14px; }
.note { font-size: 11px; color: var(--muted); margin: 6px 14px 12px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 520px) {
  .group { grid-template-columns: 1fr; }
  .value { display: none; }
  .app, main {
    height: 100vh;
    min-height: 100vh;
    width: 100vw;
    min-width: 0;
  }
  canvas {
    height: 100vh !important;
    min-height: 100vh;
    width: 100vw !important;
    min-width: 0;
  }
}