:root {
  --bg: #fbfbfd;
  --fg: #1d1d1f;
  --fg-dark: #f5f5f7;
  --muted: #6e6e73;
  --link: #0066cc;
  --blue: #0071e3;
  --blue-2: #0077ed;
  --border: rgba(0, 0, 0, 0.08);
  --glass: rgba(251, 251, 253, 0.72);
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 251, 253, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav ul {
  display: flex;
  align-items: center;
  gap: 32px;
  margin: 0 auto;
  padding: 0 24px;
  list-style: none;
  height: 52px;
  max-width: 1120px;
  font-size: 0.82rem;
}
.nav .brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.nav .brand span { color: var(--link); }
.nav a {
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
}
.nav a:hover { opacity: 1; }
.nav .cta-link { color: var(--link); font-weight: 600; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 64vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #101014;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  filter: saturate(1.1);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.25) 45%, rgba(0,0,0,0.62));
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 860px;
  padding: 96px 24px 120px;
  text-align: center;
  color: #fff;
}
.hero .eyebrow {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 18px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}
.hero .sub {
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
  max-width: 640px;
  margin: 0 auto 28px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
.hero-cta {
  display: inline-block;
  background: #fff;
  color: #1d1d1f;
  font-size: 1.02rem;
  font-weight: 600;
  padding: 14px 34px;
  border-radius: 980px;
  text-decoration: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.hero-cta:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ---------- Layout ---------- */

html { scroll-behavior: smooth; }
#steps { scroll-margin-top: 70px; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 60px;
  position: relative;
  z-index: 2;
}

#step-input { margin-top: -70px; }

.card {
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 22px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.07);
}

.card.glass {
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}

.card-head { margin-bottom: 18px; }
.card-head .eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 4px;
}
.card-head h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ---------- Input tiles ---------- */

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.tab:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08); }
.tab.active {
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.12);
}
.tab svg {
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  color: var(--muted);
}
.tab.active svg { color: var(--link); }
.tab strong { font-size: 1rem; font-weight: 600; }
.tab span { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

.panels .panel { display: none; }
.panels .panel.active { display: block; }

/* ---------- Inputs ---------- */

.row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.mic-row { justify-content: flex-start; gap: 16px; }

input[type="url"] {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.8);
  color: var(--fg);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="url"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 34px 24px;
  border-radius: 16px;
  border: 1.5px dashed rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover { border-color: var(--blue); background: rgba(255, 255, 255, 0.8); }
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dz-icon { color: var(--link); margin-bottom: 4px; }
.dz-icon svg { width: 30px; height: 30px; }
.dropzone strong { font-size: 1rem; font-weight: 600; }
.dz-hint { font-size: 0.8rem; color: var(--muted); }

.hint { color: var(--muted); font-size: 0.85rem; }

/* ---------- Buttons ---------- */

.btn {
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 980px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: scale(1.03); }

.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(0, 113, 227, 0.35); }
.btn-primary:not(:disabled):hover { background: var(--blue-2); box-shadow: 0 8px 24px rgba(0, 113, 227, 0.45); }

.btn-secondary { background: rgba(0, 0, 0, 0.05); color: var(--fg); }
.btn-secondary:hover { background: rgba(0, 0, 0, 0.09); }

.btn-icon { display: inline-flex; align-items: center; gap: 7px; }
.btn-icon svg { width: 15px; height: 15px; }

.rec-pulse { animation: recPulse 1.6s ease-in-out infinite; }
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 9px rgba(220, 38, 38, 0); }
}

.transcribe-row { display: flex; justify-content: center; }
#transcribeBtn { padding: 15px 40px; font-size: 1.02rem; }

/* ---------- Status / progress ---------- */

.status {
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--muted);
  min-height: 18px;
}
.status.ok { color: #1a7f4e; }
.status.error { color: #c41e2f; }

.progress-track {
  margin-top: 14px;
  height: 7px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 4px;
  transition: width 0.15s;
}

/* ---------- Result ---------- */

.result { animation: fadeUp 0.35s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.score-info { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }
.score-info b { color: var(--fg); }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.tempo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  margin-left: 6px;
}
.tempo input[type="range"] { width: 130px; accent-color: var(--blue); }
#bpmVal { color: var(--fg); min-width: 30px; text-align: right; font-weight: 700; }

#keyboard {
  width: 100%;
  height: 150px;
  display: block;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 20px rgba(0, 0, 0, 0.25);
}

#scoreWrap {
  margin-top: 18px;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
#score { display: block; }

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px 72px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}
footer p { margin: 6px 0; }
footer .muted { color: var(--muted); }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .tabs { grid-template-columns: 1fr; }
  .row { flex-direction: column; align-items: stretch; }
  .mic-row { align-items: flex-start; }
  .nav ul { gap: 20px; }
  .nav li:nth-child(2) { display: none; }
  #step-input { margin-top: -40px; }
}
