html, body, #app { height: 100%; margin: 0; }
#app { position: relative; }
#c { width: 100%; height: 100%; display: block; background: #111; touch-action: none; }

:root {
  --bg: #0e1117;
  --panel: rgba(16, 20, 28, 0.92);
  --text: #e8eef7;
  --muted: #9fb0c8;
  --accent: #5b9dff;
  --accent-2: #9b7bff;
}

/* Settings dropdown panel */
#toolbar {
  position: absolute;
  top: 48px; /* sit below toggle button */
  left: 10px;
  width: min(420px, calc(100% - 20px));
  padding: 12px;
  background: var(--panel);
  color: var(--text);
  display: none; /* hidden by default; shown when menu open */
  gap: 10px;
  z-index: 10;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.06) inset;
  backdrop-filter: blur(8px);
}

body.menu-open #toolbar { display: block; }

#toolbar .toolbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font: 600 13px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
}

#toolbar .section-title {
  margin: 6px 0 2px;
  font: 700 12px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

#toolbar .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

#toolbar .row { display: flex; align-items: center; gap: 8px; }
#toolbar label { font: 12px/1.2 system-ui, sans-serif; display: flex; align-items: center; gap: 6px; }
#toolbar input[type="number"],
#toolbar input[type="range"] {
  width: 100%;
}
#toolbar button {
  font: 12px/1.2 system-ui, sans-serif;
  background: linear-gradient(135deg, #283045, #21283a);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
}
#toolbar button:hover { background: linear-gradient(135deg, #2f3750, #262e42); }

#overlay { position: absolute; bottom: 10px; left: 10px; color: #0f0; font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; z-index: 10; white-space: pre; background: rgba(0,0,0,0.4); padding: 6px; border-radius: 4px; }
.hint { position: absolute; top: 50px; left: 10px; background: rgba(0,0,0,0.7); color:#fff; padding:6px 8px; border-radius: 4px; font: 12px/1.2 system-ui, sans-serif; z-index: 10; }
#select-rect { position: absolute; border: 1px dashed #4af; background: rgba(64,160,255,0.15); z-index: 9; pointer-events: none; }

/* Settings toggle */
#menu-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 11;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color:#0b0f17;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font: 600 13px/1 system-ui,sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 2px 0 rgba(0,0,0,0.2) inset;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 160ms ease;
}
#menu-toggle:hover { transform: translateY(-1px); filter: saturate(1.05); }
#menu-toggle:active { transform: translateY(0); }
#menu-toggle::before { content: "⚙︎  Settings"; }

@media (max-width: 820px) {
  #toolbar { top: 54px; left: 10px; right: 10px; width: auto; }
  body.menu-open #toolbar { max-height: calc(100% - 80px); overflow: auto; }
}

/* Prevent iOS scroll/zoom gestures in demo area */
body, #app, #c { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
