/* Piano Maestro. Built for an iPad on a music desk: dark so it does not glare
   off the page, big targets because she will be reaching from the keys, and
   nothing that depends on hover. */

:root {
  --bg: #0f1218;
  --panel: #161b25;
  --panel-2: #1c2230;
  --line: #262e3d;
  --text: #e8eef8;
  --muted: #94a1b5;
  --right: #4cc2ff;
  --left: #ffb454;
  --good: #4ade80;
  --bad: #f87171;
  --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}

.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.bar.slim { padding-top: calc(6px + var(--safe-t)); padding-bottom: 6px; }
.bar h1 { font-size: 19px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.play-title { text-align: center; line-height: 1.2; min-width: 0; }
.play-title strong { display: block; font-size: 16px; }
.play-title span { font-size: 12px; color: var(--muted); }

button {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 15px; min-height: 44px; cursor: pointer;
}
button:active { transform: translateY(1px); }
button.ghost { background: transparent; }
button.primary { background: var(--right); border-color: var(--right); color: #08111a; font-weight: 650; }
button:disabled { opacity: 0.45; }

.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
          padding: 14px 16px calc(24px + var(--safe-b)); }

/* Level and song cards */
.card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; min-height: 68px;
}
.card .num {
  flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid;
  place-items: center; background: var(--panel-2); font-weight: 700; font-size: 17px;
}
.card .grow { flex: 1; min-width: 0; }
.card .t { font-weight: 600; }
.card .s { font-size: 13px; color: var(--muted); }
.card .stars-mini { font-size: 13px; color: var(--left); letter-spacing: 1px; }
.card.locked { opacity: 0.45; }
.card.done .num { background: rgba(74,222,128,0.16); color: var(--good); }

/* Mode switch */
.modes { display: flex; gap: 8px; padding: 8px 16px; }
.modes button { flex: 1; padding: 9px 6px; min-height: 42px; font-size: 14px; }
.modes button.on { background: var(--right); border-color: var(--right); color: #08111a; font-weight: 650; }

#stage { flex: 1; width: 100%; display: block; touch-action: none; }

.hud { padding: 8px 16px calc(10px + var(--safe-b)); border-top: 1px solid var(--line);
       background: var(--panel); }
.hint { font-size: 13px; color: var(--muted); min-height: 18px; margin-bottom: 6px; }
.hint.warn { color: var(--left); }
.hint.err { color: var(--bad); }
.meters { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.meter button { min-height: 34px; padding: 4px 12px; font-size: 16px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.live { background: var(--good); }
.dot.off { background: var(--bad); }

/* Sheets */
.sheet {
  position: absolute; inset: 0; display: none; align-items: flex-end;
  background: rgba(6,9,14,0.72); z-index: 20;
}
.sheet.open { display: flex; }
.sheet-inner {
  width: 100%; max-height: 92%; overflow-y: auto;
  background: var(--panel); border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line);
  padding: 22px 20px calc(24px + var(--safe-b));
}
@media (min-width: 720px) {
  .sheet { align-items: center; justify-content: center; }
  .sheet-inner { max-width: 560px; border-radius: 20px; border: 1px solid var(--line); }
}
.sheet h2 { margin: 0 0 8px; font-size: 21px; }
.sheet p { color: var(--muted); margin: 0 0 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.row button { flex: 1 1 auto; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field .muted { font-size: 13px; }
.muted { color: var(--muted); }
input[type=text] {
  width: 100%; font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
}
input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--right); }
input[type=file] { color: var(--muted); font-size: 14px; }

.steps { margin: 6px 0 4px; }
.steps .step { display: flex; gap: 10px; align-items: baseline; padding: 7px 0;
               border-bottom: 1px solid var(--line); font-size: 14px; }
.steps .step:last-child { border-bottom: 0; }
.steps .step .k { color: var(--muted); min-width: 92px; }
.steps .step.ok .k { color: var(--good); }
.steps .step.bad .k { color: var(--bad); }

.stars { font-size: 34px; letter-spacing: 6px; color: var(--left); min-height: 42px; }

.toast {
  position: absolute; left: 50%; bottom: calc(26px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 17px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s; z-index: 40; max-width: 86%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
