/* Aria — piano practice app */

:root {
  --bg: #10141d;
  --bg-raised: #1a2030;
  --paper: #f6f0e4;
  --ink: #2b2620;
  --text: #e8e6e1;
  --text-dim: #9aa0ad;
  --accent: #ffb05c;       /* right hand / primary */
  --accent-2: #36d6c3;     /* left hand */
  --line: rgba(255, 255, 255, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-right: 4px;
}
.brand span { color: var(--text-dim); font-weight: 400; font-size: 12px; letter-spacing: 0.02em; }

.topbar select {
  flex: 1 1 160px;
  max-width: 320px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
}

.btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { background: #232b3f; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #2c1a05;
  font-size: 18px;
}
.btn.primary:active { filter: brightness(1.1); }

.btn-icon { min-width: 44px; padding: 0; font-weight: 700; color: var(--text-dim); }

.transport { display: flex; gap: 8px; }

#loop.armed { border-color: var(--accent); color: var(--accent); }
#loop.active { background: var(--accent); border-color: var(--accent); color: #2c1a05; }

.hands-group {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.seg {
  min-height: 44px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg);
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg.active { background: #2a3349; color: var(--text); }
/* hand colour dots match the falling-note colours */
.seg-r::before, .seg-l::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}
.seg-r::before { background: var(--accent); }
.seg-l::before { background: var(--accent-2); }

.speed-group {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
}
.speed-group input[type='range'] {
  width: 130px;
  accent-color: var(--accent);
  min-height: 44px;
}
#speed-label { width: 42px; font-variant-numeric: tabular-nums; color: var(--text); }

.toggles { display: flex; gap: 14px; flex-wrap: wrap; }
.toggles label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 44px;
  cursor: pointer;
}
.toggles input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------------------------------------------------------------- panels */

.sheet-panel {
  flex: 0 0 30%;
  min-height: 150px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: relative;
}
#sheet { width: 100%; height: 100%; display: block; --ink: #2b2620; }

#progress {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 4px 10px;
  background: rgba(43, 38, 32, 0.08);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.fall-panel { flex: 1 1 auto; min-height: 0; position: relative; }
#fall { width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------------------------------------------------------------- toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: min(90vw, 480px);
  padding: 12px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: #c0463f; color: #ffb3ae; }

/* ---------------------------------------------------------------- help overlay */

#help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 16, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}
#help-overlay[hidden] { display: none; }

.help-card {
  max-width: 520px;
  max-height: 80dvh;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
}
.help-card h2 { font-size: 18px; margin-bottom: 12px; color: var(--accent); }
.help-card p { margin-bottom: 10px; }
.help-card ul { margin: 0 0 10px 20px; }
.help-card li { margin-bottom: 8px; }
.help-card code {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 13px;
}
.help-card .btn { margin-top: 6px; }

/* ---------------------------------------------------------------- compact phones */

@media (max-width: 700px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .brand span { display: none; }
  .speed-group input[type='range'] { width: 90px; }
  .sheet-panel { flex-basis: 26%; }
}
