:root {
  color-scheme: dark;                   /* native checkboxes, pickers and spinners */
  --font: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --bg: #000;
  --panel: #1a1a1a;
  --text: #b3b3b3;
  --text-strong: #fff;
  --line: #4d4d4d;
  --accent: #8a3dff;                    /* buttons: a deeper F# note color */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
}

#stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#menu {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-strong);
  font: 26px/44px var(--font);
  cursor: pointer;
}

#fullscreen {
  position: fixed;
  top: calc(max(8px, env(safe-area-inset-top)) + 52px);
  right: max(8px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-strong);
  display: grid;
  place-items: center;
  cursor: pointer;
}

#fullscreen[hidden], #fullscreen svg[hidden] { display: none; }

#fullscreen svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#options {
  position: fixed;
  top: calc(max(8px, env(safe-area-inset-top)) + 52px);
  right: max(8px, env(safe-area-inset-right));
  width: min(320px, calc(100vw - 16px));
  max-height: calc(100% - 76px);
  overflow-y: auto;
  touch-action: pan-y;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(10, 10, 14, 0.85);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: grid;
  gap: 14px;
}

#options[hidden] { display: none; }

#options h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 600;
}

#options label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

#options select, #options input[type="number"] {
  width: 100%;
  font: 16px var(--font);
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 12px;
}

#options select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3b3b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  cursor: pointer;
}

#options select option { background: #1a1a1a; }

#options select:focus-visible, #options input[type="number"]:focus-visible {
  outline: 2px solid #a64dff;
  outline-offset: 1px;
}

#options label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

#options button {
  margin-top: 4px;
  justify-self: center;
  padding: 10px 40px;
  border: 0;
  border-radius: 999px;
  font: 600 16px var(--font);
  color: #fff;
  background: var(--accent);
  box-shadow: 0 0 20px rgba(138, 61, 255, 0.4);
  cursor: pointer;
}

#options button:hover { filter: brightness(1.1); }

#start {
  position: fixed;
  inset: 0;
  display: grid;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.75));
  overflow-y: auto;
  touch-action: pan-y;
}

#start[hidden], #start [hidden], .auto-start #start { display: none; }

#start .card {
  margin: auto;                         /* centered, but scrollable when taller than the screen */
  width: min(460px, 100%);
  padding: 28px 24px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(10, 10, 14, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  user-select: text;
}

#start .logo {
  width: 88px;
  height: 88px;
}

#start h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

#start .tagline {
  margin: -4px 0 8px;
  font-size: 17px;
}

#start-status {
  margin: 0;
  color: #ff8a8a;
  font-size: 15px;
}

#start button {
  font: 600 17px var(--font);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#start .primary {
  padding: 14px 28px;
  border: 0;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 0 24px rgba(138, 61, 255, 0.45);
}

#start .primary:hover { filter: brightness(1.1); }
#start .primary:disabled { opacity: 0.6; cursor: default; filter: none; }

#start .primary svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

#start .secondary {
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-strong);
  background: transparent;
  font-size: 15px;
}

#start .skip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

#start .hint {
  margin: 0;
  font-size: 14px;
}

#start .how {
  margin: 8px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
}

#start b { color: var(--text-strong); font-weight: 600; }

#start .privacy {
  margin: 4px 0 0;
  font-size: 13px;
}

#start .source {
  color: var(--text);
  font-size: 13px;
}

/* Short screens, e.g. a phone held sideways: keep the button in view. */
@media (max-height: 560px) {
  #start .logo { width: 56px; height: 56px; }
  #start .card { padding-top: 20px; gap: 8px; }
}

#silence {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(26, 26, 26, 0.9);
  color: var(--text-strong);
  font-size: 15px;
  text-align: center;
}

#silence[hidden] { display: none; }

