/* ===== Variables ===== */

:root {
  --bg: #0d0d0d;
  --bg-surface: #161616;
  --bg-elevated: #1e1e1e;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-dim: #777;
  --accent: #4fc3f7;
  --accent-dim: rgba(79, 195, 247, 0.12);
  --recording: #ef5350;
  --recording-dim: rgba(239, 83, 80, 0.15);
  --mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ===== Reset ===== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Base ===== */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 720px;
  padding: 2rem 1.5rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

h1 span {
  color: var(--text-dim);
  font-weight: 400;
}

/* ===== Screens ===== */

.screen { display: none; }
.screen.active { display: block; }

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}

.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover:not(:disabled) { opacity: 0.85; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

/* ===== Drop Zone ===== */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 1.5rem;
  position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--border);
  padding: 1.2rem 1.5rem;
}

.drop-zone p { color: var(--text-dim); font-size: 0.9rem; }
.drop-zone .filename { color: var(--accent); font-family: var(--mono); font-size: 0.85rem; }
.drop-zone input[type="file"] { display: none; }

/* ===== Textarea ===== */

.lyrics-area {
  width: 100%;
  min-height: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 1rem;
  resize: vertical;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.lyrics-area::placeholder { color: var(--text-dim); }
.lyrics-area:focus { outline: none; border-color: var(--accent); }

/* ===== Strip Punctuation ===== */

.option-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  cursor: pointer;
}
.option-label input[type="checkbox"] {
  accent-color: var(--accent);
}
.strip-options {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.strip-options .option-label { margin-bottom: 0; }
.option-sub {
  margin-bottom: 0;
  font-size: 0.8rem;
}
.option-sub strong {
  font-family: var(--mono);
  color: var(--text);
}

.strip-preview { margin-bottom: 1rem; }

.strip-preview-list {
  list-style: none;
  max-height: 30vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  margin-top: 0.5rem;
}

.strip-preview-list li {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.strip-preview-list li:last-child { border-bottom: none; }

.strip-preview-list .line-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  min-width: 2ch;
  text-align: right;
  flex-shrink: 0;
}

.strip-removed {
  background: var(--recording-dim);
  color: var(--recording);
  border-radius: 2px;
  padding: 0 2px;
}

/* ===== Audio Player ===== */

.player {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.play-btn:hover { opacity: 0.85; }
.play-btn svg { width: 14px; height: 14px; fill: #000; }

.player-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.seek-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.seek-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.player-time {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

/* ===== Timing Screen ===== */

.timing-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
}

.timing-hint kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* ===== Lyrics List ===== */

.lyrics-list {
  list-style: none;
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  scroll-behavior: smooth;
}

.lyrics-list li {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  font-size: 0.9rem;
  transition: background 0.1s;
}

.lyrics-list li:last-child { border-bottom: none; }

.lyrics-list li .line-num {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  min-width: 2ch;
  text-align: right;
  flex-shrink: 0;
}

.lyrics-list li.current { background: var(--accent-dim); color: var(--accent); }
.lyrics-list li.recording { background: var(--recording-dim); color: var(--recording); }
.lyrics-list li.timed { color: var(--text-dim); }

.line-ts {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.lyrics-list li.recording .line-ts { color: var(--recording); }

/* ===== Countdown Overlay ===== */

.countdown-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.countdown-overlay.active { display: flex; }

.countdown-number {
  font-family: var(--mono);
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  animation: countdown-pop 0.4s ease-out;
}

@keyframes countdown-pop {
  0% { transform: scale(1.6); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}

.countdown-info {
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
  padding: 0 1.5rem;
}

.countdown-info kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* ===== Preview Table ===== */

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.preview-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.preview-table tr {
  cursor: pointer;
  transition: background 0.1s;
}

.preview-table tbody tr:hover { background: var(--accent-dim); }

.preview-table .ts {
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

.preview-table tr.retiming { background: var(--accent-dim); }
.preview-table tr.retiming.recording { background: var(--recording-dim); color: var(--recording); }
.preview-table tr.active-playback { background: var(--accent-dim); }
.preview-table tr.active-playback td:first-child { color: var(--accent); }

.preview-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.retime-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.retime-banner {
  display: none;
  background: var(--recording-dim);
  border: 1px solid var(--recording);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--recording);
}
.retime-banner.active { display: block; }

/* ===== Preview Current Line ===== */

.preview-current-line {
  background: var(--bg-surface);
  border-left: 3px solid var(--border);
  border-radius: 0 6px 6px 0;
  padding: 0.6rem 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  min-height: 2.4rem;
  color: var(--text-dim);
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
}
.preview-current-line.active {
  border-left-color: var(--accent);
  color: var(--text);
}

/* ===== Mobile ===== */

.mobile-banner {
  display: none;
  background: rgba(255, 183, 77, 0.1);
  border: 1px solid #ffb74d;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: #ffb74d;
  text-align: center;
  line-height: 1.5;
}

.is-mobile .mobile-banner {
  display: block;
}

/* Hint toggling */
.mobile-hint { display: none; }
.is-mobile .mobile-hint { display: inline; }
.is-mobile .desktop-hint { display: none; }

/* Mobile tap button */
.mobile-tap-btn {
  display: none;
  width: 100%;
  height: 80px;
  background: var(--accent);
  color: #000;
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
  margin-top: auto;
}

.is-mobile .mobile-tap-btn {
  display: flex;
}

.mobile-tap-btn.recording {
  background: var(--recording);
  color: #fff;
}

/* Mobile timing screen — fixed full-viewport layout */
.is-mobile #screen-timing.active {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  z-index: 10;
  background: var(--bg);
  overflow: hidden;
}

.is-mobile #screen-timing .lyrics-list {
  flex: 1;
  max-height: none;
  min-height: 0;
}

.is-mobile #screen-timing .timing-hint {
  margin-bottom: 0.8rem;
}

.is-mobile #screen-timing .player {
  margin-bottom: 0.8rem;
}

.is-mobile #screen-timing #btn-back-setup {
  display: none;
}

/* Mobile preview — simplified: just buttons */
.is-mobile #screen-preview .retime-hint,
.is-mobile #screen-preview .retime-banner,
.is-mobile #screen-preview .preview-table,
.is-mobile #screen-preview .preview-current-line,
.is-mobile #screen-preview .player {
  display: none !important;
}

/* ===== Footer ===== */

.footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.footer img { height: 20px; }
.footer-links { display: flex; gap: 1rem; }
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-link:hover { color: var(--text); }
.footer-star:hover { color: #f5c518; }

/* ===== Hero Text ===== */

.hero-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.hero-text code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* ===== FAQ Section ===== */

.faq-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.faq-heading {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: var(--bg-surface);
  overflow: hidden;
}

.faq-item summary {
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--text-dim);
  flex-shrink: 0;
  margin-left: 1rem;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: '\2212';
}

.faq-item summary:hover {
  background: var(--bg-elevated);
}

.faq-item p {
  padding: 0 1rem 0.7rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.faq-item a {
  color: var(--accent);
  text-decoration: none;
}

.faq-item a:hover {
  text-decoration: underline;
}

/* ===== Landing Sections ===== */

.landing-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.landing-heading {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.feature-list {
  list-style: none;
  padding: 0;
}

.feature-list li {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
  padding: 0.2rem 0;
  padding-left: 1.2rem;
  position: relative;
}

.feature-list li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.landing-text {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 0.75rem;
  max-width: 600px;
}

.landing-text:last-child {
  margin-bottom: 0;
}
