/* ==========================================================================
   Paddy Prompt Studio — Microtonal tuner
   Layers on /blog/style.css and reuses the dial, pad and table styling from
   /tools/guitar-tuner/tuner.css. Only what differs lives here: the second
   settings row, variable-count pads, the pitch trail, the practice panel and
   the little bits of fun.
   ========================================================================== */

.tuner { position: relative; }

.tuner-controls.secondary {
  padding: 0.85rem 0 0.9rem; border-bottom: 1px solid var(--border-soft);
}
.control select { max-width: 19rem; }
.control .a4-val, .control .shift-val { min-width: 4.6rem; }
.control .shift-val {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700;
  font-size: 0.9rem; text-align: center; color: #c7d2fe;
}
#tonic-ctl[data-relevant="true"] { border-color: rgba(103, 232, 249, 0.45); }

.mode-note { margin: 0.7rem 0 0; font-size: 0.84rem; color: var(--text-dim); }

.ghost-btn {
  font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
  padding: 0.45rem 0.75rem; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); color: var(--text-muted);
}
.ghost-btn:hover { color: #fff; border-color: rgba(129, 140, 248, 0.55); background: rgba(99, 102, 241, 0.12); }
.ghost-btn:focus-visible, .seg button:focus-visible, .string-pad:focus-visible, .mic-btn:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px;
}
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------ Scala panel */
.scala-panel {
  margin-top: 0.9rem; padding: 0.9rem; border-radius: 14px;
  background: rgba(103, 232, 249, 0.04); border: 1px dashed rgba(103, 232, 249, 0.35);
}
.scala-panel[hidden] { display: none; }
.scala-panel label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; }
.scala-panel textarea {
  width: 100%; min-height: 7.5rem; resize: vertical; box-sizing: border-box;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem; line-height: 1.5;
  color: var(--text); background: #07080d; border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem;
}
.scala-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.55rem; }
.scala-row input[type="file"] { font-size: 0.8rem; color: var(--text-dim); max-width: 100%; }
.scala-msg { margin: 0.55rem 0 0; font-size: 0.84rem; color: var(--text-dim); }
.scala-msg.ok { color: #6ee7b7; }
.scala-msg.err { color: #fca5a5; font-weight: 600; }

/* ------------------------------------------------------------ Readout */
.note-read .note .mark {
  font-size: 0.36em; font-weight: 700; color: var(--cyan); margin-left: 0.12em; padding-top: 0.3em;
  font-family: "JetBrains Mono", ui-monospace, monospace; letter-spacing: 0;
}
.note-read .alt { font-size: 0.84rem; color: #c7d2fe; margin: 0.25rem 0 0; min-height: 1.3em; }

/* Pitch trail: the last ~10 seconds of where your note sat. */
.trail-wrap { width: 100%; max-width: 34rem; margin: 0.8rem auto 0; }
.trail-wrap canvas {
  display: block; width: 100%; height: 110px; border-radius: 12px;
  background: #07080d; border: 1px solid var(--border-soft);
}
.trail-wrap .hold {
  margin: 0.35rem 0 0; text-align: center; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem; color: var(--text-dim); min-height: 1.2em;
}

/* ------------------------------------------------------------ Pads */
.strings-wrap[hidden] { display: none; }
.strings { grid-template-columns: repeat(auto-fit, minmax(5.6rem, 1fr)); }
.string-pad .num { font-size: 0.56rem; line-height: 1.3; }
.string-pad[aria-pressed="true"] { box-shadow: 0 0 0 2px rgba(103, 232, 249, 0.55) inset; }
.lock-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: center; margin-top: 0.7rem; }
.lock-row p { margin: 0; font-size: 0.84rem; color: var(--text-dim); }
.lock-row .ghost-btn[hidden] { display: none; }

.quip {
  margin: 0.6rem 0 0; text-align: center; font-weight: 700; color: #6ee7b7; min-height: 1.4em; font-size: 0.95rem;
}
.quip.pop { animation: quip-pop 0.5s ease-out; }
@keyframes quip-pop { 0% { transform: scale(0.85); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }

/* Celebration burst — note glyphs fly out of the dial. */
.burst { position: absolute; left: 50%; top: 9rem; width: 0; height: 0; pointer-events: none; z-index: 2; }
.burst span {
  position: absolute; left: 0; top: 0; font-size: 1.3rem; font-weight: 800; color: var(--good);
  animation: burst 1.3s ease-out forwards;
}
.burst span:nth-child(3n) { color: var(--cyan); }
.burst span:nth-child(3n+1) { color: var(--amber); }
@keyframes burst {
  0% { transform: translate(0, 0) rotate(0) scale(0.6); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1.1); opacity: 0; }
}

/* ------------------------------------------------------------ Practice */
.practice {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0 0 1.25rem;
}
.practice-card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border); border-radius: 18px; padding: 1.1rem;
}
.practice-card h2 { font-size: 1.15rem; margin: 0 0 0.3rem; }
.practice-card > p { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 0.8rem; }
.practice-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.practice-row input[type="range"] { width: 7rem; accent-color: #818cf8; }
.drone-btn[data-state="on"] { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.45); }
.drone-btn[data-state="on"] .dot { animation: pulse 1.4s ease-in-out infinite; }
.drone-btn { margin-left: 0; }
.small-note { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--text-dim); }

.game-card {
  margin-top: 0.85rem; padding: 0.9rem; border-radius: 14px; text-align: center;
  background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(129, 140, 248, 0.35);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.game-card[hidden] { display: none; }
.game-card[data-state="got"] { border-color: rgba(52, 211, 153, 0.6); background: rgba(52, 211, 153, 0.10); }
.game-card .eyebrow-sm {
  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;
}
.game-target {
  font-family: "Space Grotesk", "Inter", sans-serif; font-weight: 800; font-size: 2.6rem; line-height: 1.1; color: #fff;
}
.game-target .mark { font-size: 0.45em; color: var(--cyan); font-family: "JetBrains Mono", ui-monospace, monospace; margin-left: 0.1em; vertical-align: super; }
.game-spoken { margin: 0.1rem 0 0; font-size: 0.85rem; color: #c7d2fe; }
.game-hint { margin: 0.5rem 0 0.7rem; font-weight: 700; font-size: 0.9rem; color: var(--text-muted); min-height: 1.4em; }
.game-score { display: flex; justify-content: center; gap: 1.2rem; font-size: 0.82rem; color: var(--text-dim); margin-top: 0.6rem; }
.game-score strong { color: #fff; font-family: "JetBrains Mono", ui-monospace, monospace; }

.share-row { text-align: center; margin-top: 0.8rem; }

/* ------------------------------------------------------------ Prose bits */
.byline-mini { font-size: 0.85rem; color: var(--text-dim); margin: 0.4rem 0 0; }
.byline-mini a { color: var(--indigo); }

@media (max-width: 760px) {
  .practice { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .control select { max-width: 100%; }
  .tuner-controls .control:has(select) { flex: 1 1 100%; }
  .tuner-controls .control:has(select) select { flex: 1; }
  .strings { grid-template-columns: repeat(auto-fit, minmax(4.9rem, 1fr)); }
  .burst { top: 12rem; }
}
@media (prefers-reduced-motion: reduce) {
  .quip.pop { animation: none; }
}
