/* ==========================================================================
   Paddy Prompt Studio — Online piano keyboard
   Layers on /blog/style.css (same dark indigo/cyan palette and type scale).
   Only the keyboard widget lives here; prose styling is inherited.
   ========================================================================== */

.machine {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border); border-radius: 22px;
  padding: 1.15rem; margin: 0.5rem 0 1rem;
  box-shadow: 0 30px 70px -40px rgba(99, 102, 241, 0.6);
}

/* ---------------------------------------------------------------- Controls */
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.control {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.35rem 0.6rem;
}
.lbl {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.62rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); font-weight: 700;
}
.machine select {
  font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text);
  background: #07080d; border: 1px solid var(--border); border-radius: 9px;
  padding: 0.4rem 0.5rem; max-width: 16rem;
}
.machine select:disabled, .mini:disabled { opacity: 0.45; cursor: not-allowed; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 1.5rem;
  background: transparent; cursor: pointer; width: 6rem; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -6px;
  width: 17px; height: 17px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, #a5b4fc, #67e8f9);
}
input[type="range"]::-moz-range-thumb { width: 17px; height: 17px; border-radius: 50%; border: 0; background: linear-gradient(135deg, #a5b4fc, #67e8f9); }
input[type="range"]:focus-visible { outline: 2px solid var(--indigo-strong); outline-offset: 3px; border-radius: 99px; }

.mini {
  appearance: none; cursor: pointer; font: inherit; font-size: 0.82rem; font-weight: 700;
  padding: 0.5rem 0.8rem; border-radius: 11px; color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
}
.mini:hover:not(:disabled) { background: rgba(129, 140, 248, 0.18); color: #fff; }
.mini.primary { background: linear-gradient(135deg, #818cf8, #22d3ee); color: #0b0620; border: 0; }
.mini.primary:hover:not(:disabled) { filter: brightness(1.08); color: #0b0620; }
.mini[aria-pressed="true"] { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.45); }
#rec-btn[aria-pressed="true"] { background: rgba(251, 113, 133, 0.18); color: #fda4af; border-color: rgba(251, 113, 133, 0.5); }

/* ----------------------------------------------------------------- Readout */
.readout {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin: 1rem 0 0.8rem; padding: 0.75rem 1rem;
  background: rgba(8, 145, 178, 0.07); border: 1px solid rgba(34, 211, 238, 0.22); border-radius: 14px;
}
.readout-main {
  font-family: "Space Grotesk", "Inter", sans-serif; font-weight: 800; font-size: 2rem; line-height: 1;
  background: linear-gradient(120deg, #fff, #c7d2fe 55%, #a5f3fc);
  -webkit-background-clip: text; background-clip: text; color: transparent; min-width: 4ch;
}
.readout-sub { color: var(--text-muted); font-size: 0.88rem; margin-top: 0.3rem; }
.range-nav { display: inline-flex; align-items: center; gap: 0.4rem; }
.range-nav .val { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem; color: #a5f3fc; min-width: 6.5rem; text-align: center; }

/* ---------------------------------------------------------------- Keyboard */
.keys-shell {
  background: linear-gradient(180deg, #1a1c28, #0b0c12);
  border: 1px solid var(--border); border-radius: 16px; padding: 0.7rem 0.6rem 0.6rem;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.04);
}
.keys-shell::before {
  content: ""; display: block; height: 4px; margin: 0 0 0.55rem; border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #9333ea, #ec4899, #06b6d4, #fbbf24); opacity: 0.8;
}
.keys {
  position: relative; height: clamp(170px, 26vw, 240px);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.keys.celebrate { animation: cheer 0.9s ease-out; }
@keyframes cheer { 0% { filter: none; } 30% { filter: drop-shadow(0 0 18px #67e8f9) brightness(1.15); } 100% { filter: none; } }

.key { position: absolute; top: 0; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; }
.key.white {
  height: 100%; z-index: 1;
  background: linear-gradient(180deg, #f1f3f9 0%, #ffffff 85%, #e3e6ef 100%);
  border: 1px solid #9aa1b4; border-top: 0; border-radius: 0 0 8px 8px;
  box-shadow: inset 0 -6px 0 #d4d8e3;
  transition: background 0.05s linear, box-shadow 0.05s linear;
}
.key.black {
  height: 62%; z-index: 2;
  background: linear-gradient(180deg, #2a2d3a, #0c0d12);
  border: 1px solid #000; border-radius: 0 0 6px 6px;
  box-shadow: inset 0 -5px 0 #3a3e4f, 0 3px 4px rgba(0, 0, 0, 0.5);
}
.key .lab {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700; font-size: 0.68rem;
  margin-bottom: 0.65rem; pointer-events: none; color: #6b7287;
}
.key.black .lab { color: #9aa1b4; margin-bottom: 0.45rem; font-size: 0.6rem; }
.key.middle-c .lab { color: #4f46e5; }
.key.kb-zone.white { box-shadow: inset 0 -6px 0 #c7d2fe; }

/* Scale / chord highlight: a dot above the label */
.key.hl::before {
  content: ""; position: absolute; bottom: 2.1rem; left: 50%; transform: translateX(-50%);
  width: 0.62rem; height: 0.62rem; border-radius: 50%; background: #22d3ee; box-shadow: 0 0 8px #22d3ee;
}
.key.black.hl::before { bottom: 1.6rem; }
.key.hl-root::before { background: #f472b6; box-shadow: 0 0 8px #f472b6; width: 0.75rem; height: 0.75rem; }

/* Song trainer: the next key glows and pulses */
.key.next.white { background: linear-gradient(180deg, #e0e7ff, #a5f3fc); animation: nextpulse 1s ease-in-out infinite; }
.key.next.black { background: linear-gradient(180deg, #4f46e5, #0e7490); animation: nextpulse 1s ease-in-out infinite; }
@keyframes nextpulse { 50% { filter: brightness(1.25); } }

.key.down.white { background: linear-gradient(180deg, #c7d2fe, #a5b4fc); box-shadow: inset 0 -2px 0 #818cf8; }
.key.down.black { background: linear-gradient(180deg, #6366f1, #4338ca); box-shadow: inset 0 -2px 0 #312e81; }
.key.wrong.white { background: #fecdd3; }
.key.wrong.black { background: #9f1239; }

/* ------------------------------------------------------------------ Panels */
.panels { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); margin-top: 0.9rem; }
.panel {
  background: rgba(255, 255, 255, 0.025); border: 1px solid var(--border-soft);
  border-radius: 14px; padding: 0.85rem 0.95rem;
}
.panel h3 { margin: 0 0 0.25rem; font-size: 0.98rem; font-family: "Space Grotesk", "Inter", sans-serif; }
.panel p.hint { margin: 0 0 0.6rem; font-size: 0.82rem; color: var(--text-dim); line-height: 1.5; }
.panel .row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.panel .row + .row { margin-top: 0.5rem; }
.progress { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 0.6rem; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #818cf8, #22d3ee); transition: width 0.15s ease-out; }
.songs-done { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.7rem; color: #a5f3fc; margin-top: 0.45rem; }
.chord-log { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85rem; color: #dfe4f1; min-height: 1.4em; margin: 0 0 0.6rem; word-break: break-word; }

.piano-status { margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--text-muted); min-height: 1.3em; }
.piano-status[data-error="true"] { color: #fda4af; }
.piano-hint { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--text-dim); line-height: 1.7; }
kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border);
  border-radius: 5px; padding: 0.05rem 0.32rem; color: #c7d2fe;
}

/* ------------------------------------------------------------ Prose extras */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data caption { text-align: left; padding: 0.85rem 1rem 0.2rem; color: var(--text-dim); font-size: 0.82rem; }
table.data th, table.data td { padding: 0.6rem 1rem; text-align: left; border-bottom: 1px solid var(--border-soft); }
table.data thead th { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); background: rgba(255, 255, 255, 0.03); font-weight: 700; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85rem; color: #a5f3fc; }
.notes-line { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85rem; color: #c7d2fe; word-spacing: 0.2em; }

@media (max-width: 640px) {
  .machine { padding: 0.8rem; }
  .readout-main { font-size: 1.6rem; }
  .key .lab { font-size: 0.56rem; margin-bottom: 0.45rem; }
  input[type="range"] { width: 5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .key.next.white, .key.next.black, .keys.celebrate { animation: none; }
}
