/* ===== RESET & VARIABLES ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #09090f;
  --card:      #111118;
  --card2:     #18182a;
  --accent:    #7c3aed;
  --accent-l:  #a78bfa;
  --accent-g:  linear-gradient(135deg, #7c3aed, #a855f7);
  --text:      #e2e8f0;
  --muted:     #64748b;
  --border:    #1e1e32;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 4px 32px rgba(0,0,0,0.6);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
}

.hidden {
  display: none !important;
}

/* ===== HEADER / NAV ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--accent-g);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a.active {
  color: var(--text);
}

/* 음악 신청 버튼 */
.btn-request {
  background: var(--accent-g);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.btn-request:hover { opacity: 0.85; }

/* 신청 모달 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-backdrop.hidden { display: none; }

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  position: relative;
}
.modal-box h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.modal-box .modal-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-form label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.modal-form input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 16px;
  outline: none;
  box-sizing: border-box;
}
.modal-form input[type="text"]:focus {
  border-color: var(--accent-l);
}
.modal-submit {
  width: 100%;
  padding: 12px;
  background: var(--accent-g);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.modal-submit:hover { opacity: 0.85; }
.modal-submit:disabled { opacity: 0.5; cursor: default; }

.modal-success {
  text-align: center;
  padding: 16px 0 4px;
  color: var(--accent-l);
  font-size: 0.95rem;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 72px 24px 48px;
  max-width: 680px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #e2e8f0 30%, var(--accent-l));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ===== UPLOAD ===== */
.upload-section {
  max-width: 640px;
  margin: 0 auto 40px;
  padding: 0 24px;
}

.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
  position: relative;
}

.upload-box:hover {
  border-color: var(--accent);
  background: var(--card2);
}

.upload-box.drag-over {
  border-color: var(--accent-l);
  background: rgba(124, 58, 237, 0.08);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--muted);
}

.upload-icon svg {
  width: 100%;
  height: 100%;
}

.upload-main-text {
  font-size: 1rem;
  color: var(--text);
}

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

.upload-btn {
  margin-top: 8px;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-l);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.upload-btn:hover {
  background: var(--accent);
  color: #fff;
}

.preview-img {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

/* ===== ACTION BUTTONS ===== */
.action-area {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

.find-btn {
  flex: 1;
  max-width: 280px;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  background: var(--accent-g);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.find-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.find-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.reset-btn {
  padding: 14px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.reset-btn:hover {
  border-color: var(--muted);
  color: var(--text);
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 48px 24px;
  max-width: 640px;
  margin: 0 auto;
}

/* 이퀄라이저 바 */
.waveform {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 48px;
  margin: 0 auto 28px;
}

.waveform .bar {
  width: 5px;
  border-radius: 3px;
  background: var(--accent-l);
  animation: wave 0.7s ease-in-out infinite alternate;
  min-height: 6px;
}

.waveform .bar:nth-child(1) { animation-duration: 0.65s; animation-delay: 0.0s; }
.waveform .bar:nth-child(2) { animation-duration: 0.80s; animation-delay: 0.1s; }
.waveform .bar:nth-child(3) { animation-duration: 0.55s; animation-delay: 0.2s; }
.waveform .bar:nth-child(4) { animation-duration: 0.90s; animation-delay: 0.05s; }
.waveform .bar:nth-child(5) { animation-duration: 0.60s; animation-delay: 0.15s; }
.waveform .bar:nth-child(6) { animation-duration: 0.75s; animation-delay: 0.25s; }
.waveform .bar:nth-child(7) { animation-duration: 0.50s; animation-delay: 0.08s; }

@keyframes wave {
  from { height: 6px;  opacity: 0.5; }
  to   { height: 44px; opacity: 1;   }
}

/* 찾았다 순간 */
.waveform.found .bar {
  background: #22d3ee;
  animation: wave-found 0.15s ease-in-out infinite alternate;
}

@keyframes wave-found {
  from { height: 20px; }
  to   { height: 44px; }
}

#loadingText {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  min-height: 1.5em;
  animation: msgFade 0.35s ease;
}

#loadingText.found-text {
  color: #22d3ee;
  font-size: 1.3rem;
}

.loading-sub {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
  animation: msgFade 0.35s ease;
}

@keyframes msgFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== RESULTS ===== */
.result-section {
  max-width: 960px;
  margin: 0 auto 60px;
  padding: 0 24px;
}

.analysis-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.mood-badge {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.18);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--accent-l);
  font-size: 0.88rem;
  font-weight: 600;
}

.photo-desc {
  color: var(--muted);
  font-size: 0.95rem;
}

.songs-grid {
  display: flex;
  justify-content: center;
}

.songs-grid .video-card {
  width: 100%;
  max-width: 640px;
}

.video-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.video-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.2);
}

.video-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--card2);
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.video-card:hover .video-thumb {
  transform: scale(1.04);
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 2.4rem;
  color: #fff;
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.video-info {
  padding: 12px 14px;
}

.video-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 4px;
}

.video-channel {
  font-size: 0.78rem;
  color: var(--muted);
}

.video-card.playing {
  cursor: default;
  transform: none;
}

.video-card.playing:hover {
  border-color: var(--accent);
  transform: none;
  box-shadow: 0 0 0 2px var(--accent);
}

.video-card.playing iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
}

.no-results {
  color: var(--muted);
  text-align: center;
  padding: 40px 0;
  grid-column: 1 / -1;
}

/* ===== HOW-TO ===== */
.how-to {
  max-width: 720px;
  margin: 0 auto 60px;
  padding: 0 24px;
  text-align: center;
}

.how-to h2,
.faq h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
  letter-spacing: -0.5px;
}

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.step {
  flex: 1;
  min-width: 140px;
  max-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-g);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.step-title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.step-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.step-arrow {
  color: var(--muted);
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* ===== FAQ ===== */
.faq {
  max-width: 640px;
  margin: 0 auto 80px;
  padding: 0 24px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item summary {
  padding: 18px 4px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

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

.faq-item summary::after {
  content: '+';
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 300;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  padding: 0 4px 20px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ===== FOOTER ===== */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 28px 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--text);
}

/* ===== STATIC PAGES (about, privacy) ===== */
.static-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 100px;
}

.static-page h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.static-page .page-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 48px;
}

.static-page h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 36px 0 12px;
  color: var(--accent-l);
}

.static-page p,
.static-page li {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.8;
  margin-bottom: 10px;
}

.static-page ul {
  padding-left: 20px;
}

.static-page ul li {
  margin-bottom: 6px;
}

/* ===== NAV TOGGLE (mobile) ===== */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(9, 9, 15, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 20px;
    gap: 0;
    z-index: 99;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child {
    border-bottom: none;
    padding-top: 12px;
  }

  .nav-links a {
    display: block;
    padding: 14px 0;
    font-size: 1rem;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 720px) {
  .step-arrow {
    display: none;
  }
}

@media (max-width: 480px) {
  .songs-grid .video-card {
    max-width: 100%;
  }
  .hero {
    padding: 48px 24px 32px;
  }
  .action-area {
    flex-direction: column;
    align-items: stretch;
  }
  .find-btn {
    max-width: 100%;
  }
}
