/* DIDBANK Player — 유튜브 스타일 다크 테마 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #0f0f0f; --bg2: #1a1a1a; --bg3: #272727;
  --fg: #fff; --fg2: #aaa; --accent: #ff0033; --border: #333;
  --player-h: 88px; --top-h: 56px; --tab-h: 48px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", Roboto, sans-serif;
  background: var(--bg); color: var(--fg);
  padding-bottom: var(--player-h);
  overflow-x: hidden;
}

/* 상단바 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h); display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 18px; white-space: nowrap; cursor: pointer; letter-spacing: -0.5px; }
.brand span { color: var(--accent); }
.search { flex: 1; max-width: 640px; margin: 0 auto; }
.search input {
  width: 100%; padding: 9px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--fg); font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.icon-btn {
  background: none; border: none; color: var(--fg); font-size: 20px;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
}
.icon-btn:active { background: var(--bg3); }
/* 선명한 텍스트 버튼 (이모지 대신) */
.btn-text {
  background: var(--bg3); border: none; color: var(--fg);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.btn-text:active { opacity: .8; }
.btn-text.upload { background: var(--accent); color: #fff; }

/* 탭 */
.tabs {
  position: sticky; top: var(--top-h); z-index: 19;
  display: flex; gap: 8px; padding: 8px 12px; background: var(--bg);
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.tab {
  background: var(--bg3); color: var(--fg); border: none;
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.tab.active { background: var(--fg); color: var(--bg); }

/* 메인 */
main { padding: 16px 12px; min-height: 50vh; }
.loading { text-align: center; color: var(--fg2); padding: 40px; }
.section-title { font-size: 16px; font-weight: 700; margin: 18px 4px 12px; }

/* 유튜브 스타일 썸네일 그리드 */
.grid {
  display: grid; gap: 16px 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.card { cursor: pointer; }
.card .thumb {
  width: 100%; aspect-ratio: 1/1; border-radius: 12px; overflow: hidden;
  background: var(--bg3); position: relative;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb .play-ov {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35); opacity: 0; transition: opacity .15s; font-size: 34px;
}
.card:hover .thumb .play-ov { opacity: 1; }
.card .c-title {
  font-size: 14px; font-weight: 600; margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .c-sub { font-size: 12px; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 곡 리스트 (행) */
.song-list { display: flex; flex-direction: column; }
.song-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 6px;
  border-radius: 8px; cursor: pointer;
}
.song-row:hover { background: var(--bg2); }
.song-row.playing { background: var(--bg3); }
.song-row.playing .s-title { color: var(--accent); }
.song-row .s-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--bg3); flex-shrink: 0; }
.song-row .s-meta { flex: 1; min-width: 0; }
.song-row .s-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-row .s-sub { font-size: 12px; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-row .s-dur { font-size: 12px; color: var(--fg2); flex-shrink: 0; }

.empty { text-align: center; color: var(--fg2); padding: 60px 20px; }
.empty .big { font-size: 40px; margin-bottom: 12px; }
.empty code { background: var(--bg3); padding: 2px 8px; border-radius: 6px; }

/* 하단 재생바 */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: var(--player-h); background: var(--bg2); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 0 16px;
}
.p-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.p-cover { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--bg3); flex-shrink: 0; }
.p-meta { min-width: 0; }
.p-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-artist { font-size: 12px; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-controls { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(480px, 40vw); }
.p-buttons { display: flex; align-items: center; gap: 14px; }
.ctrl { background: none; border: none; color: var(--fg); font-size: 20px; cursor: pointer; }
.ctrl.small { font-size: 16px; opacity: .7; }
.ctrl.small.on { opacity: 1; color: var(--accent); }
.ctrl.play {
  background: var(--fg); color: var(--bg); width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.p-progress { display: flex; align-items: center; gap: 8px; width: 100%; }
.p-progress .t { font-size: 11px; color: var(--fg2); width: 34px; text-align: center; }
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: var(--bg3); outline: none; cursor: pointer;
}
.p-progress input[type=range] { flex: 1; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent);
}
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: var(--accent); }
.p-volume { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.p-volume input { width: 90px; }
.vol-ico { font-size: 14px; }

/* 모바일 */
@media (max-width: 640px) {
  .player { grid-template-columns: 1fr auto; padding: 0 10px; }
  .p-volume { display: none; }
  .p-controls { width: auto; }
  .p-progress { position: absolute; top: -3px; left: 0; right: 0; padding: 0; }
  .p-progress .t { display: none; }
  .p-progress input { height: 3px; border-radius: 0; }
  .p-cover { width: 44px; height: 44px; }
  .brand { font-size: 15px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px 8px; }
  .icon-btn { font-size: 18px; width: 34px; }
}

/* hidden 속성은 무조건 숨김 (display:flex 등이 이기지 못하게) */
[hidden] { display: none !important; }

/* 업로드 진행 오버레이 */
.up-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.up-box {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; width: 100%; max-width: 380px; text-align: center;
}
.up-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.up-bar { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.up-bar-fill { height: 100%; width: 0%; background: var(--accent); transition: width .3s; }
.up-status { font-size: 13px; color: var(--fg2); min-height: 20px; }
.up-close {
  margin-top: 18px; padding: 10px 28px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}

/* 드래그 오버 시 화면 전체 하이라이트 */
body.dragover::after {
  content: "🎵 여기에 음악 파일을 놓으세요"; position: fixed; inset: 0; z-index: 90;
  background: rgba(255,0,51,0.12); border: 3px dashed var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff; pointer-events: none;
}
