 :root {
  --bg:#0b0b10;
  --card:#12131a;
  --fg:#e9e9ef;
  --muted:#b9bcc8;
  --accent:#ff6a00;
  --good:#20c868;
  --bad:#ff4a4a;
}

body {
  margin:0;
  background:#050509;
  color:var(--fg);
  font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16pt;      /* ~21.3px */
  line-height: 1.45;
}

.wrap {
  width: 100%;
  max-width: none;
  min-height: 100vh;               /* fill viewport */
  margin: 0;
  padding:24px;
  background:#12131a;
  border-radius:0;
  box-shadow: none;
}

h1 {
  margin:0 0 16px;
  letter-spacing:.5px;
}

.row {
  display:flex;
  align-items:center;
  gap:12px;
  margin:8px 0 16px;
  flex-wrap:wrap;
  font-size: 1em;  
}

label {
  color:var(--muted);
  font-size: 1em;  
}

input[type=text] {
  background:#1b1d27;
  color:var(--fg);
  border:1px solid #2a2e3a;
  border-radius:10px;
  padding:10px 12px;
  min-width:240px;
  font-size: 1em;  
}

select {
  background:#1b1d27;
  color:var(--fg);
  border:1px solid #2a2e3a;
  border-radius:10px;
  padding:8px 10px;
  font-size: 1em;  
}

button {
  background:#222639;
  color:var(--fg);
  border:1px solid #343a4d;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-size: 1em;  
}

button:hover {
  border-color:#4b536d;
}

button[disabled] {
  opacity:.5;
  cursor:not-allowed;
  font-size: 1em;  
}

.pill {
  background:#1b1d27;
  padding:6px 10px;
  border-radius:999px;
  border:2px solid #2a2e3a;
  font-size: 14px;  
  align-items: right;
  display: inline-block;
  white-space: nowrap;
}

.slider-wrap {
  display:flex;
  align-items:center;
  gap:10px;
  max-width:420px;
  width:100%;
  font-size: 1em;  
}

input[type=range] {
  width:280px;
  accent-color:var(--accent);
  font-size: 1em;  
}

.ticks {
  display:flex;
  gap:46px;
  font-size: 1em;  
  color:var(--muted);
  margin:-6px 0 10px 122px;
  user-select:none;
}

.beat {
  display:inline-block;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size: 1em;  
}

.dot {
  width:10px;
  height:10px;
  border-radius:50%;
  background:#3a3f55;
  box-shadow:0 0 0 0 transparent;
  transition:all .1s ease;
}

.dot.on {
  background:var(--accent);
  box-shadow:0 0 0 6px rgba(255,106,0,.2);
}

/* Keyboard layout */
.kbd {
  display:grid;
  grid-template-columns: repeat(8, 1fr);
  gap:6px;
  padding:12px;
  background:#10121a;
  border-radius:14px;
  border:1px solid #25293a;
  height: var(--kbdH, 350px);
  overflow: hidden;
}

.key {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;

  display: inline-block;
  width: 80%;
  height: 100%;
  /* Responsive height: never too small, never too tall, fits screen 
  height: clamp(
    220px, 
    calc(100vh - 360px - env(safe-area-inset-bottom, 0px)),
    420px
  ); */

  margin: 2px;
  padding: 16px 4px;
  text-align: center;
  border-radius: 8px;
  border: 3px solid #343a4d;
  background: #f2f2f3;
  color: #e90b0b;
  cursor: pointer;
  transition:
    background-color 0.3s linear,
    color 0.3s linear,
    box-shadow 0.15s ease;
}

/* Piano key base */
.old1_key {
  position: relative;         /* so the arrow can be positioned inside */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;

  /* existing styles… */
  display:inline-block;
  width:100px;
  height:400px;
  margin:2px;
  padding:16px 4px;
  text-align:center;
  border-radius:8px;
  border:3px solid #343a4d;
  background:#f2f2f3;
  color:#e95c0b;
  cursor:pointer;
  transition:
    background-color 0.3s linear,
    color 0.3s linear,
    box-shadow 0.15s ease;
}

/* ===========================
   Touch / double-tap behaviour
   Prevents mobile double-tap zoom and odd layout expansion
=========================== */
.kbd,
.key,
button,
select,
input {
  touch-action: manipulation;
}

.key {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ===========================
   Layout stability (reduces "floating" feel on mobile/tablet)
=========================== */
@media (max-width: 820px) {
  .wrap {
    margin: 0;
    max-width: none;
    min-height: 100svh;
    border-radius: 0;
    box-shadow: none;
  }
}


/* Base arrow pseudo-element: black arrow, hidden by default */
.key::after {
  content: "";
  position: absolute;
  top: 25%;                         /* adjust to taste */
  left: 50%;
  transform: translateX(-50%);
  width: 150px;                        /* match your PNG aspect */
  height: 100px;
  background-image: url("/aarm/assets/ui/arrow-up-black.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;                         /* hidden until anticipate */
  pointer-events: none;
  transition: opacity 0.3s linear;
}

/* Anticipatory fade-in: colour + green arrow PNG */
.key-anticipate {
  color: rgba(192, 10, 238, 0.4);
}

.key-anticipate::after {
  background-image: url("/aarm/assets/ui/arrow-up-green.png");
  opacity: 1;
}


/* “Hit now” state */
.key-lit {
  background-color:rgba(233, 229, 6, 0.9);
  box-shadow:0 0 12px rgba(60, 120, 255, 0.7); 
}

/* Hit feedback */
.key.hit-good {
  background-color:var(--good); 
}

.key.hit-bad {
  background-color:var(--bad); 
}

.lesson-bar {
  border-collapse: collapse;
}

.lesson-bar td {
  padding-right: 0.75rem;
  white-space: nowrap; /* keep everything on one row if possible */
}

/* Ensure the dropdown only grows to fit its content, not full-width */
.lesson-select {
  width: auto;
  max-width: 100%;
}
/* FINAL KEY STATE OVERRIDES – keep at the end of aarm.css */

/* Anticipatory fade-in (if used) */
.key-anticipate {
  color: rgba(192, 10, 238, 0.4) !important;
}

/* “Hit now” state */
.key-lit {
  background-color: rgba(233, 229, 6, 0.9) !important;
  box-shadow: 0 0 12px rgba(60, 120, 255, 0.7) !important;
}

/* Hit feedback – support both old and new class naming */
/* Case A: element has class="key hit-good" etc. */
.key.hit-good {
  background-color: var(--good) !important;
}

.key.hit-bad {
  background-color: var(--bad) !important;
}

/* Case B: element has class="key key-hit-good" etc. */
.key-hit-good {
  background-color: var(--good) !important;
}

.key-hit-bad {
  background-color: var(--bad) !important;
}

/* Ensure the green arrow is visible during the actual cue moment too */
.key-lit::after {
  background-image: url("/aarm/assets/ui/arrow-up-green.png");
  opacity: 1;
}
