body
{
   background-color: #FFFFFF;
   color: #000000;
   font-family: Arial;
   font-weight: normal;
   font-size: 13px;
   line-height: 1.1875;
   margin: 0;
   padding: 0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:      #0c0c1a;
  --surface: #13132a;
  --card:    #1a1a38;
  --acc:     #5b82c0;
  --acc2:    #8ab4f8;
  --ok:      #4ade80;
  --err:     #f87171;
  --warn:    #fbbf24;
  --muted:   #3a3a60;
  --text:    #e2e2f2;
  --dim:     #5a5a88;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px;
}

.screen { display: none; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 640px; }
.screen.active { display: flex; }

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px; padding: 18px 22px; width: 100%;
}

h1 {
  font-size: 2rem; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--acc2), var(--acc));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.subtitle { color: var(--dim); font-size: 0.88rem; text-align: center; }

#midi-status {
  font-size: 0.82rem; padding: 6px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--muted); color: var(--dim);
}
#midi-status.ok  { color: var(--ok);  border-color: var(--ok); }
#midi-status.err { color: var(--err); border-color: var(--err); }

.ctrl-grid { display: grid; grid-template-columns: max-content 1fr max-content; gap: 10px 16px; align-items: center; }
.ctrl-lbl  { font-size: 0.82rem; color: var(--dim); }
.ctrl-val  { font-size: 0.82rem; color: var(--acc2); min-width: 42px; text-align: right; }
input[type=range] { width: 100%; accent-color: var(--acc); cursor: pointer; }

.btn {
  background: var(--acc); color: #fff; border: none;
  padding: 12px 30px; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.btn:hover { background: var(--acc2); color: var(--bg); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.red   { background: #7a1f1f; } .btn.red:hover   { background: var(--err); color: #000; }
.btn.ghost { background: var(--muted); } .btn.ghost:hover { background: #505088; }
.btn-row { display: flex; gap: 12px; }

.hud { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.hud-cell { text-align: center; min-width: 80px; }
.hud-lbl  { font-size: 0.63rem; color: var(--dim); text-transform: uppercase; letter-spacing: 1.5px; }
.hud-val  { font-size: 1.35rem; font-weight: 800; color: var(--acc2); }

#staff-wrap {
  background: #fff; border-radius: 14px; padding: 10px;
  width: 100%; min-height: 160px; max-height: 420px;
  overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
}

#blocked-bar {
  width: 100%; height: 5px; border-radius: 999px;
  background: var(--err); opacity: 0;
  transition: opacity 0.08s;
}
#blocked-bar.active { opacity: 1; }

#feedback {
  font-size: 1.6rem; font-weight: 800;
  min-height: 44px; width: 100%; text-align: center;
  display: flex; align-items: center; justify-content: center;
}

.info-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
}
#note-reveal { font-size: 0.95rem; color: var(--dim); }
#combo-txt   { font-size: 0.9rem; font-weight: 700; color: var(--warn); }

#piano-wrap {
  width: 100%; overflow-x: auto;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 14px 12px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
#piano-legend {
  display: flex; gap: 16px;
  font-size: 0.72rem; color: var(--dim); letter-spacing: 0.5px;
}
#piano-legend span { display: flex; align-items: center; gap: 5px; }
#piano-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
#piano-svg-wrap { width: 100%; overflow-x: auto; display: flex; justify-content: center; }
#piano-svg-wrap svg { display: block; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5)); }

.grade-big {
  font-size: 8rem; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.score-pct { font-size: 1.7rem; font-weight: 700; color: var(--acc2); }
.res-table { width: 100%; border-collapse: collapse; }
.res-table td { padding: 10px 4px; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.95rem; }
.res-table td:last-child { text-align: right; font-weight: 700; color: var(--acc2); }

.clef-btn {
  flex:1; background:var(--muted); color:var(--text); border:2px solid transparent;
  padding:10px; border-radius:10px; font-size:0.9rem; font-weight:700; cursor:pointer;
}
.clef-btn.active { background:var(--acc); border-color:var(--acc2); color:#fff; }
.stag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 2px; color: var(--dim); margin-bottom: 8px; }

/* ── LEVEL GRID ── */
#level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}
.lvl-btn {
  background: var(--muted);
  color: var(--text);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px 4px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.lvl-btn:hover { background: #505088; transform: translateY(-1px); }
.lvl-btn.active { background: var(--acc); border-color: var(--acc2); color: #fff; }
.lvl-num { font-size: 1.4rem; font-weight: 900; display: block; line-height: 1; }
.lvl-tag { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--dim); margin-top: 4px; display: block; }
.lvl-btn.active .lvl-tag { color: rgba(255,255,255,0.65); }
.lvl-chord { font-size: 0.65rem; color: var(--warn); margin-top: 2px; display: block; }
.lvl-btn.active .lvl-chord { color: #fde68a; }

#lvl-desc {
  font-size: 0.82rem; color: var(--acc2);
  text-align: center; margin-top: 10px; min-height: 1.2em;
}

/* ── TIMER ── */
#g-timer {
  font-size: 1.35rem; font-weight: 800; color: var(--acc2);
  transition: color 0.3s; font-variant-numeric: tabular-nums;
}
#g-timer.warn   { color: var(--warn); }
#g-timer.danger { color: var(--err); animation: pulse-timer 0.5s ease-in-out infinite alternate; }
@keyframes pulse-timer {
  from { transform: scale(1);    opacity: 1; }
  to   { transform: scale(1.15); opacity: 0.75; }
}

#timer-bar-track {
  width: 100%; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 999px; overflow: hidden;
}
#timer-bar { height: 100%; width: 100%; border-radius: 999px; background: var(--ok); transition: background 0.4s; }
