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

:root {
  --good: #34d399;
  --near: #fcd34d;
  --off:  #fb7185;
}

/* ------------------------------------------------------------ Shell */
.tuner {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border); border-radius: 22px;
  padding: 1.25rem; margin: 0.5rem 0 1rem;
  box-shadow: 0 30px 70px -40px rgba(99, 102, 241, 0.6);
}
.bk .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;
}

.bk-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.bk-card {
  background: rgba(255, 255, 255, 0.025); border: 1px solid var(--border-soft);
  border-radius: 18px; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
  min-width: 0;
}
.bk-card-head { display: flex; align-items: center; gap: 0.6rem; }
.bk-card-head h3 { margin: 0; font-size: 1.08rem; font-family: "Space Grotesk", "Inter", sans-serif; }
.mode-tag {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700; font-size: 0.8rem;
  background: rgba(129, 140, 248, 0.18); color: #c7d2fe;
}
.bk-card-head .sub { margin-left: auto; font-size: 0.78rem; color: var(--text-dim); }

/* ------------------------------------------------------------ Tap pad */
.tap-pad {
  appearance: none; -webkit-appearance: none; cursor: pointer; font: inherit; color: var(--text);
  display: grid; place-items: center; align-content: center; gap: 0.15rem;
  min-height: 12.5rem; border-radius: 18px; padding: 1rem;
  background: radial-gradient(120% 90% at 50% 0%, rgba(99, 102, 241, 0.22), rgba(7, 8, 13, 0.6));
  border: 1px solid rgba(129, 140, 248, 0.45);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 70ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.tap-pad:hover { border-color: rgba(129, 140, 248, 0.8); }
.tap-pad:focus-visible { outline: 3px solid #67e8f9; outline-offset: 3px; }
.tap-pad[data-hit="true"] {
  transform: scale(0.985);
  box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.25), 0 0 40px -6px rgba(103, 232, 249, 0.55) inset;
  border-color: #67e8f9;
}
.tap-bpm {
  font-family: "Space Grotesk", "Inter", sans-serif; font-weight: 800; line-height: 1;
  font-size: clamp(3.2rem, 13vw, 4.6rem); letter-spacing: -0.03em; color: #fff;
  font-variant-numeric: tabular-nums;
}
.tap-unit {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.2em; color: var(--indigo);
}
.tap-unit #tap-factor { color: #67e8f9; letter-spacing: 0; margin-left: 0.3em; }
.tap-cta { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }
.tap-pad.is-live .tap-cta { color: #67e8f9; }

.tap-meta {
  display: flex; justify-content: space-between; gap: 0.5rem;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.78rem; color: var(--text-dim);
}
.stab { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem; }
.stab-track { height: 0.55rem; background: rgba(255, 255, 255, 0.06); border-radius: 99px; overflow: hidden; }
.stab-fill { display: block; height: 100%; width: 0; border-radius: 99px; background: currentColor; transition: width 160ms ease; }
#tap-stab-text { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.82rem; font-weight: 700; min-width: 3ch; text-align: right; }
.tap-msg { margin: 0; min-height: 2.6em; font-size: 0.92rem; color: var(--text-muted); }

.tap-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn-soft {
  appearance: none; -webkit-appearance: none; cursor: pointer; font: inherit;
  font-size: 0.88rem; font-weight: 700; color: var(--text);
  min-height: 44px; padding: 0.45rem 0.9rem; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
}
.btn-soft:hover { background: rgba(129, 140, 248, 0.2); }
.btn-soft:focus-visible, .step:focus-visible, .mic-btn:focus-visible, .alt-btn:focus-visible { outline: 3px solid #67e8f9; outline-offset: 2px; }

/* ------------------------------------------------------------ Drop zone */
.drop-zone {
  position: relative; cursor: pointer; display: grid; place-items: center; align-content: center;
  gap: 0.35rem; text-align: center; min-height: 12.5rem; padding: 1rem;
  border: 2px dashed rgba(129, 140, 248, 0.45); border-radius: 18px;
  background: rgba(7, 8, 13, 0.45); transition: border-color 0.15s ease, background 0.15s ease;
}
.drop-zone:hover, .drop-zone:focus-within { border-color: rgba(103, 232, 249, 0.75); }
.drop-zone:focus-within { outline: 3px solid #67e8f9; outline-offset: 2px; }
.drop-zone[data-over="true"] { border-color: #67e8f9; background: rgba(34, 211, 238, 0.10); }
.drop-zone[data-busy="true"] { opacity: 0.7; cursor: progress; }
.drop-icon { color: var(--indigo); }
.drop-main { font-weight: 700; font-size: 1rem; }
.drop-main u { color: #a5f3fc; text-underline-offset: 3px; }
.drop-sub { font-size: 0.8rem; color: var(--text-dim); }
.file-name { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.78rem; color: #c7d2fe; word-break: break-all; }
.privacy-note {
  margin: 0; font-size: 0.86rem; color: var(--text-muted);
  padding: 0.55rem 0.75rem; border-radius: 12px; background: rgba(52, 211, 153, 0.08); border: 1px solid rgba(52, 211, 153, 0.25);
}
.privacy-note strong { color: #6ee7b7; }

.progress { display: grid; gap: 0.35rem; }
.progress[hidden] { display: none; }
.progress-track { height: 0.5rem; background: rgba(255, 255, 255, 0.06); border-radius: 99px; overflow: hidden; }
#progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #818cf8, #22d3ee); border-radius: 99px; transition: width 120ms linear; }
#progress-text { font-size: 0.82rem; color: var(--text-dim); }

.tuner-status { margin: 0; font-size: 0.88rem; color: var(--text-muted); min-height: 1.3em; }
.tuner-status.err { color: #fca5a5; font-weight: 600; }

/* ------------------------------------------------------------ Results */
.bk-results {
  margin-top: 1rem; padding: 1rem; border-radius: 18px;
  border: 1px solid rgba(129, 140, 248, 0.35); background: rgba(99, 102, 241, 0.06);
}
.bk-results[hidden] { display: none; }
.res-region { margin: 0 0 0.75rem; font-size: 0.8rem; color: var(--text-dim); font-family: "JetBrains Mono", ui-monospace, monospace; word-break: break-all; }
.res-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.res-tile {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 0.85rem 1rem;
  border-radius: 14px; background: rgba(7, 8, 13, 0.55); border: 1px solid var(--border-soft);
}
.res-big {
  font-family: "Space Grotesk", "Inter", sans-serif; font-weight: 800; color: #fff;
  font-size: clamp(2rem, 8vw, 2.7rem); line-height: 1.05; letter-spacing: -0.02em;
}
.res-big small { font-size: 0.4em; color: var(--indigo); letter-spacing: 0.12em; font-family: "JetBrains Mono", ui-monospace, monospace; }
.res-line { font-size: 0.88rem; color: var(--text-muted); margin: 0; }
.res-line strong { color: var(--text); }
.camelot-badge {
  display: inline-block; font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700;
  padding: 0.1em 0.5em; border-radius: 8px; background: rgba(34, 211, 238, 0.14); color: #a5f3fc;
}
.alt-btn {
  appearance: none; -webkit-appearance: none; cursor: pointer; font: inherit;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700; font-size: 0.88rem;
  min-height: 36px; min-width: 44px; padding: 0.2rem 0.55rem; margin: 0 0.15rem; border-radius: 9px;
  background: rgba(129, 140, 248, 0.14); border: 1px solid var(--border); color: #c7d2fe;
}
.alt-btn:hover { background: rgba(129, 140, 248, 0.28); }
.conf { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; }
.is-good { color: var(--good) !important; }
.is-near { color: var(--near) !important; }
.is-off  { color: var(--off)  !important; }

.chroma { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.3rem; height: 5.5rem; margin: 1rem 0 0.25rem; }
.cbar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0.2rem; height: 100%; }
.cfill { display: block; width: 100%; border-radius: 5px 5px 2px 2px; background: rgba(129, 140, 248, 0.55); }
.cbar.is-tonic .cfill { background: linear-gradient(180deg, #67e8f9, #818cf8); }
.cname { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.62rem; color: var(--text-dim); }
.cbar.is-tonic .cname { color: #a5f3fc; font-weight: 700; }
.chroma-cap { margin: 0 0 0.9rem; font-size: 0.78rem; color: var(--text-dim); }

.wave { display: block; width: 100%; height: 120px; border-radius: 12px; background: #07080d; border: 1px solid var(--border-soft); cursor: pointer; }
.wave-cap { margin: 0.35rem 0 0.9rem; font-size: 0.78rem; color: var(--text-dim); }

.play-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.control {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.3rem 0.5rem;
}
.control .step {
  appearance: none; -webkit-appearance: none; cursor: pointer; font: inherit;
  min-width: 2.3rem; height: 2.3rem; border-radius: 8px; line-height: 1; padding: 0 0.3rem;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
  color: var(--text); font-size: 0.8rem; font-weight: 700;
}
.control .step:hover { background: rgba(129, 140, 248, 0.22); }
.control .val {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700;
  font-size: 0.9rem; min-width: 4.2rem; text-align: center; color: #c7d2fe;
}
.control input[type="range"] { width: 6.5rem; accent-color: #818cf8; }

.mic-btn {
  display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
  min-height: 44px; padding: 0.6rem 1.15rem; border: 0; border-radius: 12px;
  font: inherit; font-size: 0.95rem; font-weight: 700;
  background: linear-gradient(135deg, #818cf8, #22d3ee); color: #0b0620;
}
.mic-btn:hover { filter: brightness(1.08); }
.mic-btn[data-state="playing"] { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.45); }
.mic-btn .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.beat-dot { width: 1rem; height: 1rem; border-radius: 50%; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--border); transition: background 60ms linear; }
.beat-dot[data-on="true"] { background: #67e8f9; }
.beat-dot[data-on="accent"] { background: #fbbf24; }

/* ------------------------------------------------------------ Suno snippet */
.snippet-box { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); display: grid; gap: 0.45rem; }
.snippet-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.snippet-row input {
  flex: 1 1 16rem; min-width: 0; min-height: 44px; font: inherit; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.9rem; color: #a5f3fc; background: #07080d; border: 1px solid var(--border); border-radius: 12px; padding: 0.5rem 0.75rem;
}
.studio-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.45rem 1rem; border-radius: 12px;
  font-weight: 700; font-size: 0.9rem; text-decoration: none; color: #0b0620;
  background: linear-gradient(135deg, #818cf8, #22d3ee);
}
.studio-link:hover { filter: brightness(1.08); }
.snippet-src { margin: 0; font-size: 0.78rem; color: var(--text-dim); word-break: break-all; }

.tuner-hint { margin: 0.9rem 0 0; text-align: center; font-size: 0.85rem; color: var(--text-dim); }
.tuner-hint kbd, .article-body kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.78rem;
  background: rgba(129, 140, 248, 0.14); border: 1px solid var(--border-soft);
  border-radius: 5px; padding: 0.05em 0.35em; color: #c7d2fe;
}

/* ------------------------------------------------------------ Celebrate */
.celebrate { animation: bk-glow 1.4s ease-out; }
@keyframes bk-glow {
  0% { box-shadow: 0 0 0 0 rgba(103, 232, 249, 0.0); }
  25% { box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.45), 0 0 50px 4px rgba(129, 140, 248, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(103, 232, 249, 0.0); }
}
@media (prefers-reduced-motion: reduce) {
  .celebrate { animation: none; }
  .tap-pad, .stab-fill, #progress-fill, .beat-dot { transition: none; }
}

/* ------------------------------------------------------------ Prose tables */
.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-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.68rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--indigo); font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.mono, table.data th.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85rem; color: #a5f3fc; }
table.data tbody tr:hover { background: rgba(129, 140, 248, 0.05); }

/* ------------------------------------------------------------ Responsive */
@media (max-width: 760px) {
  .bk-modes, .res-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tuner { padding: 0.8rem; border-radius: 18px; }
  .bk-card { padding: 0.8rem; }
  .tap-pad { min-height: 11rem; }
  .drop-zone { min-height: 9rem; }
  .play-row .mic-btn { width: 100%; justify-content: center; }
  .studio-link { width: 100%; justify-content: center; }
  .cname { font-size: 0.55rem; }
}
