:root {
  --panel-bg: rgba(18, 22, 18, 0.72);
  --panel-fg: #e8eee6;
  --muted: #a9b5a6;
  --accent: #9fd27a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0d110d; overflow: hidden; }
body { font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--panel-fg); }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#view.pressing { cursor: grabbing; }

#hint {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  padding: 6px 12px; border-radius: 999px; background: var(--panel-bg); color: var(--muted);
  pointer-events: none; transition: opacity 0.6s;
}
#hint.hidden { opacity: 0; }

#soundGate {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  padding: 6px 14px; border: 0; border-radius: 999px; background: var(--panel-bg); color: var(--panel-fg);
  font: inherit; cursor: pointer;
}
#soundGate[hidden] { display: none; }

#panel {
  position: fixed; top: 12px; right: 12px; width: 250px; max-width: calc(100vw - 24px);
  background: var(--panel-bg); border-radius: 10px; backdrop-filter: blur(8px);
}
#panel[hidden] { display: none; }
#panel header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 0 12px; font-weight: 600;
}
#panelHide {
  padding: 3px 8px; border: 1px solid #3a4637; border-radius: 6px; background: transparent;
  color: var(--muted); font: inherit; font-weight: 400; cursor: pointer;
}
#panelHide:hover, #panelShow:hover { color: var(--panel-fg); }
#panelBody { padding: 0 12px 12px; }

#panelShow {
  position: fixed; top: 12px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: var(--panel-bg); color: var(--muted); cursor: pointer;
  backdrop-filter: blur(8px);
}
#panelShow[hidden] { display: none; }
/* With a mouse, the gear only shows when the pointer comes near it (or it has keyboard focus). */
@media (hover: hover) {
  #panelShow { opacity: 0; transition: opacity 0.35s ease; }
  #panelShow.near, #panelShow:focus-visible { opacity: 1; transition-duration: 0.15s; }
}
/* Touch screens have no hover: keep it visible but unobtrusive. */
@media (hover: none) {
  #panelShow { opacity: 0.55; }
}
#panel label { display: block; margin-top: 10px; color: var(--muted); }
#panel label span { float: right; color: var(--panel-fg); font-variant-numeric: tabular-nums; }
#panel label.row { display: flex; gap: 6px; align-items: center; color: var(--panel-fg); }
#panel select, #panel input[type=range] { width: 100%; margin-top: 4px; accent-color: var(--accent); }
#panel select { background: #1d241c; color: var(--panel-fg); border: 1px solid #3a4637; border-radius: 6px; padding: 4px; }
.note { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
#stats { margin-top: 12px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: pre-line; }

#error {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: #0d110d; color: var(--panel-fg);
}
#error[hidden] { display: none; }
#error .box { max-width: 520px; }
#error h1 { margin: 0 0 8px; font-size: 20px; }
#error p { margin: 0 0 10px; color: var(--muted); line-height: 1.5; }
#error details { color: var(--muted); }
#error pre { white-space: pre-wrap; font: 12px/1.5 ui-monospace, monospace; color: #f2c4b8; }
