/* nono-timing — soft nono theme (palette shared with *.nono.my apps) */

:root {
  --bg: #2B2A33;
  --panel: #3f2f52;
  --inset: #221d2c;          /* canvas + code wells */
  --text: #ece7f4;
  --dim: #a99cc0;
  --lav: #d2ace8;
  --lav-deep: #ab80d1;
  --red: #ff6c6c;
  --amber: #ffcc66;
  --glow: rgba(210, 172, 232, 0.2);
  --radius: 12px;
  --mono: "Cascadia Mono", Consolas, "JetBrains Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

#app { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; min-height: 100dvh; }

/* Landing: the intro sits in the middle of the screen. Once a result is ready
   the #stage slides up to the top (padding-top transition) and the result
   panels fade in — see JS removing .landing. */
#stage { transition: padding-top .55s cubic-bezier(.22, 1, .36, 1); }
#app.landing #stage { padding-top: clamp(6vh, 22vh, 240px); }

/* ---------------- header ---------------- */

header { text-align: center; margin-bottom: 20px; animation: fadeIn .4s ease; }
header h1 {
  font-size: 1.7em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--lav);
}

/* ---------------- panels ---------------- */

.panel {
  background: var(--panel);
  border: 1px solid rgba(210, 172, 232, 0.12);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: fadeIn .35s ease both;
}
#result .panel:nth-child(2) { animation-delay: .06s; }
#result .panel:nth-child(3) { animation-delay: .12s; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- dropzone ---------------- */

#dropzone {
  border: 2px dashed var(--lav);
  background: rgba(210, 172, 232, 0.05);
  text-align: center;
  padding: 34px 18px 22px;
  cursor: pointer;
  transition: all 0.25s ease;
}
#dropzone:hover {
  background: rgba(210, 172, 232, 0.1);
  border-color: var(--lav-deep);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--glow);
}
#dropzone.dragover {
  background: rgba(210, 172, 232, 0.15);
  border-color: var(--lav-deep);
  transform: scale(1.01);
  box-shadow: 0 6px 20px rgba(210, 172, 232, 0.3);
}
#dropzone svg { stroke: var(--lav); margin-bottom: 10px; }
#dropzone p { color: var(--lav); font-size: 1.1em; }

#settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 18px;
  margin-top: 22px;
  color: var(--dim);
}
#settings label { display: flex; gap: 7px; align-items: center; }

/* ---------------- controls ---------------- */

select, input[type=number] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid rgba(210, 172, 232, 0.3);
  border-radius: 6px;
  font: inherit;
  padding: 4px 8px;
  transition: border-color .2s, box-shadow .2s;
}
input[type=number] { width: 80px; }
select:focus, input[type=number]:focus {
  outline: none;
  border-color: var(--lav-deep);
  box-shadow: 0 0 0 2px var(--glow);
}

button {
  background: transparent;
  color: var(--lav);
  border: 1px solid rgba(210, 172, 232, 0.35);
  border-radius: 6px;
  font: inherit;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
button:hover {
  background: rgba(210, 172, 232, 0.12);
  border-color: var(--lav);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--glow);
}
button.primary {
  background: var(--lav);
  border-color: var(--lav);
  color: var(--bg);
  font-weight: 600;
}
button.primary:hover { background: var(--lav-deep); border-color: var(--lav-deep); }
button.toggle.on { color: var(--amber); border-color: rgba(255, 204, 102, 0.5); }

/* ---------------- status ---------------- */

#status { display: flex; align-items: center; gap: 12px; }
#status .spinner {
  width: 16px; height: 16px;
  flex-shrink: 0;
  border: 2px solid rgba(210, 172, 232, 0.25);
  border-top-color: var(--lav);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
#status:has(.error) .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
#statusText { color: var(--dim); white-space: pre-wrap; font-family: inherit; }
#statusText.error { color: var(--red); }

/* ---------------- summary ---------------- */

#summaryText { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; color: var(--text); }
#summaryText .warn { color: var(--amber); }

/* ---------------- waveform ---------------- */

#wavePanel { padding: 12px; }
#wave {
  width: 100%; height: 220px;
  display: block;
  background: var(--inset);
  border-radius: 8px;
  cursor: crosshair;
}
#waveHelp { position: relative; display: inline-block; margin-top: 8px; }
#helpChip {
  display: inline-block;
  color: var(--dim);
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid rgba(210, 172, 232, 0.25);
  border-radius: 999px;
  cursor: default;
  transition: all 0.2s ease;
}
#waveHelp:hover #helpChip {
  color: var(--lav);
  border-color: var(--lav);
  background: rgba(210, 172, 232, 0.08);
}
#helpPop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto auto;
  gap: 7px 12px;
  align-items: center;
  width: max-content;
  max-width: min(92vw, 480px);
  padding: 12px 14px;
  background: #46345e;
  border: 1px solid rgba(210, 172, 232, 0.35);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 12px var(--glow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
#waveHelp:hover #helpPop { opacity: 1; visibility: visible; transform: translateY(0); }
#helpPop kbd {
  justify-self: start;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--lav);
  background: var(--bg);
  border: 1px solid rgba(210, 172, 232, 0.3);
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
}
#helpPop span { font-size: 12.5px; color: var(--text); }
#helpPop .helpSection {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(210, 172, 232, 0.18);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lav);
}
#helpPop .helpSection em { font-style: normal; text-transform: none; color: var(--dim); }

#lineTools {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 10px;
  background: rgba(255, 108, 108, 0.08);
  border: 1px solid rgba(255, 108, 108, 0.4);
  border-radius: 8px;
  animation: fadeIn .25s ease;
}
#lineInfo { color: var(--red); font-family: var(--mono); font-size: 13px; }
#bpmSet { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 12px; }
#lineBpm { width: 92px; }
#lineTools .hint { color: var(--dim); font-size: 12px; margin-left: auto; }
#editBar { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
#editHint { color: var(--dim); font-size: 12px; }

#transport {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 12px;
}
#transport label { display: flex; gap: 6px; align-items: center; color: var(--dim); }
#timePos { color: var(--amber); margin-left: auto; font-family: var(--mono); }
input[type=range] { accent-color: var(--lav); width: 90px; }

/* ---------------- outputs ---------------- */

.rowhead {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
  color: var(--dim);
}
.rowhead > span:first-child { font-family: var(--mono); font-size: 13px; }
.rowhead .actions { display: flex; gap: 8px; align-items: center; }

pre.code {
  max-height: 240px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--inset);
  border: 1px solid rgba(210, 172, 232, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  user-select: all;
}

/* ---------------- footer ---------------- */

footer { margin-top: auto; padding-top: 28px; text-align: center; }
/* stack the source-code link below the disclaimer toggle. */
.footRow { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#sourceLink {
  color: var(--dim);
  font-size: 12px;
  text-decoration: none;
  padding: 4px 12px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}
#sourceLink:hover { color: var(--lav); background: rgba(210, 172, 232, 0.08); }
/* column-reverse so the opened info renders ABOVE the summary toggle. */
#about { display: flex; flex-direction: column-reverse; align-items: center; }
#about summary {
  display: inline-block;
  list-style: none;
  color: var(--dim);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
#about summary::-webkit-details-marker { display: none; }
#about summary:hover { color: var(--lav); background: rgba(210, 172, 232, 0.08); }
#about[open] summary { color: var(--lav); }
.aboutBody {
  max-width: 560px;
  margin: 0 auto 10px;
  padding: 14px 18px;
  text-align: left;
  font-size: 13px;
  color: var(--dim);
  background: var(--panel);
  border: 1px solid rgba(210, 172, 232, 0.12);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.25s ease;
}
.aboutBody p + p { margin-top: 8px; }
.aboutBody b { color: var(--lav); font-weight: 600; }

@media (max-width: 860px) {
  #timePos { margin-left: 0; width: 100%; }
}
