/* Woven-canvas rules this sheet keeps (DisplayXR/displayxr-web docs/woven-canvas-rules.md):
   - The canvas and its ancestors (html, body) carry no filter, opacity, mask, clip-path,
     blend mode, border, radius or shadow.
   - The canvas has will-change: transform from its first paint.
   - Black sits UNDER the canvas (body), never over it. The only thing over it with a background
     is #cover, which comes off on handle.firstWoven.
   - Controls over the canvas use a plain translucent tint, never backdrop-filter, and are
     hidden with display:none (the hidden attribute), never opacity:0. */

:root {
  --bg: #000;
  --panel: rgba(8, 10, 18, 0.82);
  --line: rgba(255, 255, 255, 0.14);
  --text: #eef1f8;
  --dim: #9aa3b8;
  --accent: #7cf2ff;
  --accent-ink: #001418;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  will-change: transform;
}

#cover {
  position: fixed;
  inset: 0;
  background: var(--bg);
}

.panel {
  position: fixed;
  z-index: 2;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* ---- start menu ------------------------------------------------------------------------- */
#start {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 28px 28px 20px;
}
#start h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.01em; }
.lede { margin: 0 0 20px; color: var(--dim); }
.sources { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sources button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; padding: 14px 14px 12px; min-height: 76px;
}
.sources .t { font-weight: 600; font-size: 15px; }
.sources .d { color: var(--dim); font-size: 12.5px; line-height: 1.35; }
.sources .primary .d { color: inherit; opacity: 0.75; }
.error { color: #ff9b9b; margin: 14px 0 0; }
#start-close { margin-top: 14px; }
body.idle { cursor: none; }
.mode { margin: 16px 0 0; }
.badge {
  display: inline-block; font-size: 12.5px; padding: 3px 10px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--dim);
}
.badge.on { color: #8dffb0; border-color: rgba(141, 255, 176, 0.4); }
.keys { color: var(--dim); font-size: 12.5px; margin: 10px 0 0; }
kbd {
  font: 11.5px ui-monospace, Consolas, monospace; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 520px) {
  .sources { grid-template-columns: 1fr; }
  #start { padding: 22px 18px 16px; }
}

/* ---- buttons ---------------------------------------------------------------------------- */
button {
  font: inherit; color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 12px;
}
button:hover { background: rgba(255, 255, 255, 0.13); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.primary:hover, button.on:hover { background: #a6f7ff; }
button.icon { width: 40px; padding: 7px 0; text-align: center; }

/* ---- drop target ------------------------------------------------------------------------ */
.drop {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 34px 54px; font-size: 22px; font-weight: 600;
  border: 2px dashed var(--accent); z-index: 3;
}

/* ---- control bar ------------------------------------------------------------------------ */
.bar {
  left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px));
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.bar .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.now { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 2px; }
.label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
#seek { width: 100%; accent-color: var(--accent); }
.beat {
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.15); flex: none;
}
.beat.hit { background: var(--accent); }
.styles { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.styles button { padding: 6px 10px; font-size: 13.5px; }
.toggle { font-size: 13.5px; padding: 6px 10px; }
.depth { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.depth input { width: 90px; accent-color: var(--accent); }

#hud {
  position: fixed; left: 8px; top: 8px; z-index: 4;
  background: rgba(0, 0, 0, 0.75); color: #8f8;
  font: 12px/1.45 ui-monospace, Consolas, monospace; padding: 6px 8px; white-space: pre;
  pointer-events: none;
}
