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

:root {
  --bg: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a26;
  --text: #e8e8f0;
  --text-secondary: #8888a0;
  --accent: #f5c542;
  --accent-hover: #ffd966;
  --danger: #e74c3c;
  --border: rgba(255,255,255,0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --player-height: 64px;
  --tab-height: 56px;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--player-height) + var(--tab-height) + var(--safe-bottom) + 8px);
  overscroll-behavior-y: contain;
}

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 10px clamp(10px, 3vw, 16px);
  padding-top: calc(10px + var(--safe-top));
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.logo-icon { font-size: clamp(18px, 5vw, 24px); }
.logo-text { font-size: clamp(14px, 4vw, 18px); font-weight: 700; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  transition: border-color 0.2s, max-width 0.2s;
}

.search-box:focus-within { border-color: var(--accent); }

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: clamp(13px, 3.5vw, 15px);
  width: 100%;
  min-width: 0;
}

.search-box input::placeholder { color: var(--text-secondary); }
.search-box svg { color: var(--text-secondary); flex-shrink: 0; }

.search-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

/* ── Tab Bar ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(12,12,18,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 90;
  transition: transform 0.25s;
}

body.has-player .tab-bar {
  transform: translateY(calc(-1 * var(--player-height)));
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: clamp(9px, 2.5vw, 11px);
  cursor: pointer;
  padding: 6px clamp(10px, 3vw, 20px);
  border-radius: 12px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tab span { white-space: nowrap; }
.tab.active { color: var(--accent); }
.tab svg { opacity: 0.6; width: clamp(18px, 5vw, 22px); height: clamp(18px, 5vw, 22px); }
.tab.active svg { opacity: 1; }

.record-tab-btn {
  width: clamp(40px, 10vw, 48px);
  height: clamp(40px, 10vw, 48px);
  border-radius: 50%;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4.5vw, 22px);
  box-shadow: 0 4px 16px rgba(231,76,60,0.35);
  margin-top: -8px;
}

/* ── Main ── */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(12px, 3vw, 20px) clamp(12px, 4vw, 20px);
}

.page-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.page-header h1 { font-size: clamp(18px, 5vw, 24px); font-weight: 700; }

.badge {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: clamp(11px, 3vw, 13px);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.page-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-top-bar h2 { font-size: clamp(16px, 4.5vw, 20px); font-weight: 600; }
.page-top-bar .spacer { width: 60px; }

/* ── Song List ── */
.song-list { display: flex; flex-direction: column; gap: 2px; }

.song-item {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.5vw, 14px);
  padding: clamp(8px, 2vw, 12px) clamp(8px, 2.5vw, 14px);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.song-item:active { background: var(--bg-tertiary); }
.song-item.playing { background: var(--bg-secondary); }

.song-cover-sm {
  width: clamp(38px, 10vw, 50px);
  height: clamp(38px, 10vw, 50px);
  border-radius: clamp(8px, 2vw, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4.5vw, 22px);
  flex-shrink: 0;
}

.song-info { flex: 1; min-width: 0; }

.song-title {
  font-size: clamp(13px, 3.8vw, 16px);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: clamp(11px, 3vw, 13px);
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-item.playing .song-title { color: var(--accent); }

.song-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.song-play-count {
  font-size: clamp(10px, 2.8vw, 12px);
  color: var(--text-secondary);
  margin-right: 4px;
}

.song-comment-badge {
  font-size: clamp(11px, 3vw, 13px);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.song-comment-badge:active {
  background: rgba(255,255,255,0.12);
  color: var(--accent);
}

.song-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 6px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}

.song-item:hover .song-delete-btn,
.song-item:active .song-delete-btn { opacity: 1; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: clamp(40px, 10vw, 70px) 20px;
  color: var(--text-secondary);
}

.empty-icon { font-size: clamp(40px, 12vw, 64px); margin-bottom: 10px; }
.empty-state p { font-size: clamp(14px, 4vw, 17px); margin-bottom: 5px; }
.empty-hint { font-size: clamp(11px, 3vw, 14px); color: var(--text-secondary); opacity: 0.7; }

.empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: clamp(13px, 3.5vw, 15px);
  border: none;
  border-radius: 20px;
  padding: clamp(8px, 2vw, 11px) clamp(18px, 5vw, 28px);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active { transform: scale(0.96); }

.btn-outline {
  background: none;
  color: var(--accent);
  font-weight: 600;
  font-size: clamp(13px, 3.5vw, 15px);
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  padding: clamp(8px, 2vw, 11px) clamp(18px, 5vw, 28px);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-outline:active { transform: scale(0.96); }

.btn-primary-sm {
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: clamp(12px, 3vw, 14px);
  border: none;
  border-radius: 16px;
  padding: clamp(6px, 1.8vw, 9px) clamp(14px, 4vw, 20px);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text);
  font-weight: 500;
  font-size: clamp(13px, 3.5vw, 15px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(8px, 2vw, 11px) clamp(18px, 5vw, 28px);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: clamp(13px, 3.5vw, 16px);
  cursor: pointer;
  padding: 8px 0;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.btn-icon {
  width: clamp(36px, 9vw, 44px);
  height: clamp(36px, 9vw, 44px);
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: clamp(14px, 3.5vw, 18px);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-play-main {
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: clamp(13px, 3.5vw, 16px);
  border: none;
  border-radius: 20px;
  padding: clamp(8px, 2vw, 11px) clamp(20px, 5vw, 32px);
  cursor: pointer;
  margin-top: 10px;
  -webkit-tap-highlight-color: transparent;
}

.btn-play-main:active { transform: scale(0.96); }

.btn-danger-sm {
  background: none;
  color: var(--text-secondary);
  font-size: clamp(12px, 3vw, 14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(7px, 1.8vw, 10px) clamp(14px, 3.5vw, 20px);
  cursor: pointer;
  margin-top: 10px;
}

/* ── Upload ── */
.upload-container { max-width: 560px; margin: 0 auto; }

.upload-drop-zone {
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: clamp(30px, 8vw, 52px) clamp(16px, 4vw, 28px);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.upload-drop-zone:active,
.upload-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(245,197,66,0.03);
}

.drop-icon { font-size: clamp(30px, 8vw, 44px); margin-bottom: 8px; }
.drop-zone p { font-size: clamp(13px, 3.8vw, 16px); margin-bottom: 5px; color: var(--text); }
.drop-hint { font-size: clamp(11px, 2.8vw, 13px); color: var(--text-secondary); }

.upload-form { margin-top: 16px; }

.selected-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: clamp(10px, 2.5vw, 14px) clamp(12px, 3vw, 18px);
  margin-bottom: 14px;
  font-size: clamp(13px, 3.5vw, 15px);
}

.file-icon { font-size: clamp(16px, 4vw, 22px); }
#selectedFileName { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.form-row { margin-bottom: 14px; }

.form-row label {
  display: block;
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row input[type="text"] {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: clamp(9px, 2.2vw, 13px) clamp(10px, 2.8vw, 16px);
  color: var(--text);
  font-size: clamp(14px, 3.8vw, 16px);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-row input[type="text"]:focus { border-color: var(--accent); }

.color-picker { display: flex; gap: clamp(7px, 2vw, 12px); flex-wrap: wrap; }

.color-option {
  width: clamp(26px, 7vw, 34px);
  height: clamp(26px, 7vw, 34px);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.color-option:active { transform: scale(0.9); }
.color-option.active { border-color: #fff; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #fff; }

.upload-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.upload-progress { margin-top: 14px; }

.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}

.upload-progress span, #saveProgressText { font-size: clamp(11px, 3vw, 13px); color: var(--text-secondary); }

/* ── Record ── */
.record-container { max-width: 560px; margin: 0 auto; }

.waveform-container {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: clamp(14px, 4vw, 24px);
  margin-bottom: clamp(16px, 4vw, 28px);
  min-height: clamp(120px, 25vw, 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.waveform-canvas {
  width: 100%;
  height: clamp(70px, 18vw, 120px);
  display: block;
}

.record-timer {
  position: absolute;
  bottom: clamp(6px, 1.5vw, 10px);
  right: clamp(10px, 3vw, 18px);
  font-size: clamp(12px, 3.2vw, 15px);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.record-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(16px, 4vw, 28px);
}

.rec-btn {
  width: clamp(58px, 16vw, 76px);
  height: clamp(58px, 16vw, 76px);
  border-radius: 50%;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(231,76,60,0.4);
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.rec-btn:active { transform: scale(0.92); }

.rec-btn-inner {
  width: clamp(22px, 6vw, 30px);
  height: clamp(22px, 6vw, 30px);
  background: #fff;
  border-radius: 50%;
  transition: all 0.2s;
}

.rec-btn.recording .rec-btn-inner {
  width: clamp(18px, 5vw, 24px);
  height: clamp(18px, 5vw, 24px);
  border-radius: 6px;
}

.rec-btn.recording {
  animation: rec-pulse 1.5s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(231,76,60,0.4); }
  50% { box-shadow: 0 4px 30px rgba(231,76,60,0.7); }
}

.rec-hint {
  font-size: clamp(12px, 3vw, 14px);
  color: var(--text-secondary);
}

.rec-support-hint {
  font-size: clamp(11px, 2.8vw, 13px);
  margin-top: 2px;
}

/* ── Record Preview ── */
.record-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(14px, 3.5vw, 22px);
}

.record-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: clamp(13px, 3.8vw, 16px);
  font-weight: 600;
}

.record-duration { color: var(--text-secondary); font-size: clamp(11px, 3vw, 14px); font-weight: 400; }

.record-preview-actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
}

.preview-progress {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

.preview-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
}

.preview-time {
  font-size: clamp(11px, 2.8vw, 13px);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── Detail ── */
.detail-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3.5vw, 24px);
  margin-bottom: clamp(20px, 5vw, 36px);
  text-align: center;
}

.detail-cover {
  width: clamp(140px, 40vw, 200px);
  height: clamp(140px, 40vw, 200px);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.cover-icon { font-size: clamp(40px, 12vw, 64px); }

.detail-info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; width: 100%; }
.detail-info h2 { font-size: clamp(18px, 5.5vw, 28px); font-weight: 700; margin-bottom: 4px; word-break: break-word; }
.detail-info p { font-size: clamp(13px, 3.8vw, 17px); color: var(--text-secondary); margin-bottom: 6px; }

.detail-meta {
  display: flex;
  gap: clamp(8px, 2.5vw, 16px);
  font-size: clamp(11px, 2.8vw, 13px);
  color: var(--text-secondary);
  flex-wrap: wrap;
  justify-content: center;
}

.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ── Comments ── */
.comments-section { max-width: 100%; }
.comments-section h3 { font-size: clamp(15px, 4.5vw, 19px); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.comment-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(12px, 3vw, 18px);
  margin-bottom: 18px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: clamp(8px, 2.2vw, 12px) clamp(10px, 2.8vw, 16px);
  color: var(--text);
  font-size: clamp(13px, 3.5vw, 15px);
  outline: none;
  margin-bottom: 8px;
  resize: vertical;
  font-family: inherit;
  -webkit-appearance: none;
}

.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); }

.comment-list { display: flex; flex-direction: column; gap: 8px; }

.comment-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(10px, 2.8vw, 16px);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.comment-nickname { font-weight: 600; font-size: clamp(12px, 3vw, 14px); color: var(--accent); }
.comment-time { font-size: clamp(10px, 2.5vw, 12px); color: var(--text-secondary); }
.comment-text { font-size: clamp(13px, 3.3vw, 15px); line-height: 1.6; }

.comment-del {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Player Bar ── */
/* ══════════════════════════════════════════════
   Player Panel — Mini Bar + Expandable Full Player
   ══════════════════════════════════════════════ */
.player-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

/* ── Mini bar ── */
.player-mini {
  position: relative;
  z-index: 10;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.player-mini-progress {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.06);
}

.player-mini-progress-fill {
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  width: 0%;
  transition: width 0.3s linear;
}

.player-mini-inner {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.5vw, 16px);
  height: var(--player-height);
  padding: 0 clamp(10px, 3vw, 16px);
  background: rgba(18,18,26,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}

.player-mini-controls {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Player cover (shared) ── */
.player-cover, .playing-cover {
  width: clamp(36px, 9vw, 46px);
  height: clamp(36px, 9vw, 46px);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 3.8vw, 20px);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.player-cover.is-playing {
  animation: coverPulse 2s ease-in-out infinite;
}

@keyframes coverPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,197,66,0.3); }
  50% { box-shadow: 0 0 12px 4px rgba(245,197,66,0.15); }
}

.player-meta { min-width: 0; flex: 1; }
.player-title { display: block; font-size: clamp(12px, 3.2vw, 14px); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { display: block; font-size: clamp(10px, 2.6vw, 12px); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Control buttons ── */
.ctrl-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: clamp(16px, 4.2vw, 20px);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.15s;
  width: clamp(32px, 8.5vw, 40px);
  height: clamp(32px, 8.5vw, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:active { transform: scale(0.9); }

.ctrl-btn-lg {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: clamp(16px, 4.2vw, 22px);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.15s;
  width: clamp(38px, 10vw, 48px);
  height: clamp(38px, 10vw, 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn-lg.active { color: var(--accent); }
.ctrl-btn-lg:active { transform: scale(0.9); }

.ctrl-btn-xl {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  width: clamp(44px, 11vw, 54px);
  height: clamp(44px, 11vw, 54px);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}

.ctrl-btn-xl:active { transform: scale(0.9); }

.ctrl-btn-sm {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn-play {
  background: var(--accent);
  border: none;
  color: #000;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  width: clamp(56px, 14vw, 68px);
  height: clamp(56px, 14vw, 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
  box-shadow: 0 4px 20px rgba(245,197,66,0.3);
}

.ctrl-btn-play:active { transform: scale(0.93); }

/* ── Expanded full player ── */
.player-expanded {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: none;
  flex-direction: column;
}

.player-expanded.active {
  display: flex;
}

.player-expanded-bg {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: -1;
}

.player-expanded-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-top) + 12px) clamp(20px, 6vw, 40px) calc(var(--safe-bottom) + 16px);
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  gap: 12px;
}

/* Top bar */
.player-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 0;
  flex-shrink: 0;
}

.player-collapse-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.player-collapse-btn:active { background: rgba(255,255,255,0.06); }

.player-top-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.player-top-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.player-top-song {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* Large cover */
.player-cover-large {
  width: clamp(180px, 50vw, 320px);
  height: clamp(180px, 50vw, 320px);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  margin: 16px 0;
  flex-shrink: 0;
}

.player-cover-large.is-playing {
  animation: coverLargePulse 3s ease-in-out infinite;
}

@keyframes coverLargePulse {
  0%, 100% { box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
  50% { box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 30px 8px rgba(245,197,66,0.1); }
}

.cover-large-icon { font-size: clamp(48px, 14vw, 80px); }

/* Song detail */
.player-song-detail {
  text-align: center;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

/* Lyrics */
.lyrics-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  pointer-events: none;
}

.lyrics-panel {
  width: 100%;
  height: clamp(180px, 50vw, 320px);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.lyrics-container {
  height: 100%;
  overflow-y: auto;
  padding: 60px 20px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
}

.lyric-line {
  text-align: center;
  padding: 8px 12px;
  font-size: clamp(14px, 4vw, 18px);
  color: rgba(255,255,255,0.3);
  transition: all 0.35s ease;
  line-height: 1.6;
}

.lyric-line.active {
  color: var(--accent);
  font-size: clamp(16px, 4.5vw, 20px);
  font-weight: 600;
  text-shadow: 0 0 20px rgba(245, 197, 66, 0.3);
}

.lyrics-loading,
.lyrics-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-secondary);
}

.player-expanded-title {
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.player-expanded-artist {
  font-size: clamp(13px, 3.5vw, 16px);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress bar */
.player-progress-container {
  width: 100%;
  flex-shrink: 0;
  padding: 0 4px;
}

.player-progress-track {
  position: relative;
  height: 28px;
  width: 100%;
  display: flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.player-progress-buffered {
  position: absolute;
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  left: 0;
  right: 0;
  transition: height 0.15s;
}

.player-progress-active {
  position: absolute;
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  left: 0;
  width: 0%;
  pointer-events: none;
  transition: height 0.15s;
}

.player-progress-thumb {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%) scale(1);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(245,197,66,0.5), 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.15s;
}

.player-progress-track.dragging .player-progress-thumb,
.player-progress-track:hover .player-progress-thumb {
  transform: translateY(-50%) scale(1.2);
}

.player-progress-track.dragging .player-progress-active,
.player-progress-track.dragging .player-progress-buffered {
  height: 8px;
}

.player-progress-track:hover .player-progress-active,
.player-progress-track:hover .player-progress-buffered {
  height: 8px;
}

.player-progress-times {
  display: flex;
  justify-content: space-between;
  font-size: clamp(11px, 2.8vw, 13px);
  color: rgba(255,255,255,0.65);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  padding: 0 2px;
}

/* Main controls row */
.player-main-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 4vw, 24px);
  flex-shrink: 0;
  width: 100%;
  max-width: 360px;
}

/* Volume row */
.player-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 240px;
  flex-shrink: 0;
}

.player-volume-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  outline: none;
}

.player-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.player-volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: none;
}

/* ── Speed button active style ── */
#speedBtn.active {
  color: var(--accent);
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: calc(50px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--bg-tertiary);
  color: var(--text);
  padding: clamp(8px, 2vw, 12px) clamp(14px, 4vw, 24px);
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: clamp(12px, 3vw, 14px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 200;
  box-shadow: var(--shadow);
  white-space: nowrap;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════════════
   Responsive Breakpoints
   ══════════════════════════════════════════════ */

/* ── Very small phones (< 360px) ── */
@media (max-width: 359px) {
  .logo-text { display: none; }
  .player-time { display: none; }
  .song-play-count { display: none; }
  .drop-hint { display: none; }
}

/* ── Medium phones (360px - 414px) — base styles above handle this ── */

/* ── Large phones / Small tablets (415px - 767px) ── */
@media (min-width: 415px) {
  .search-box {
    max-width: 300px;
  }

  .detail-header {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
  }

  .detail-meta {
    justify-content: flex-start;
  }

  .detail-actions {
    justify-content: flex-start;
  }

  .song-delete-btn { opacity: 0; }
  .song-item:hover .song-delete-btn { opacity: 1; }
}

/* ── Tablets & Desktop (768px+) ── */
@media (min-width: 768px) {
  body { padding-bottom: calc(var(--player-height) + 16px); }

  .tab-bar { display: none; }
  body.has-player .tab-bar { transform: none; }

  .player-panel { bottom: 0; }

  main { padding: clamp(20px, 3vw, 36px) clamp(20px, 4vw, 40px); }
  header { padding: 12px clamp(20px, 4vw, 40px); }

  .search-box { max-width: 360px; padding: 9px 16px; }

  .page-header h1 { font-size: clamp(22px, 3vw, 30px); }

  .empty-state { padding: clamp(60px, 8vw, 100px) 20px; }

  .detail-header {
    gap: clamp(20px, 3vw, 32px);
  }
  .detail-cover { width: clamp(180px, 22vw, 260px); height: clamp(180px, 22vw, 260px); }
  .detail-info h2 { font-size: clamp(24px, 3vw, 36px); }

  .player-volume-row { max-width: 280px; }

  .player-mini-inner {
    height: 72px;
    gap: 20px;
    padding: 0 24px;
  }
  :root { --player-height: 72px; }

  .song-delete-btn { opacity: 0; }
  .song-item:hover .song-delete-btn { opacity: 1; }
}

/* ── Large desktop (1200px+) ── */
@media (min-width: 1200px) {
  main { padding: 32px 48px; }
  header { padding: 14px 48px; }
  .player-mini-inner { padding: 0 32px; }
}

/* ── Landscape phones (height < 500px) ── */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --player-height: 52px;
    --tab-height: 48px;
  }

  .empty-state { padding: 24px 16px; }
  .empty-icon { font-size: 32px; margin-bottom: 6px; }
  .waveform-container { min-height: 80px; padding: 10px; }
  .waveform-canvas { height: 50px; }
  .record-controls { margin-bottom: 12px; }
  .rec-btn { width: 50px; height: 50px; }
  .rec-btn-inner { width: 20px; height: 20px; }
  .detail-cover { width: 100px; height: 100px; }
  .cover-icon { font-size: 32px; }
}

/* ── Landscape tablets (height < 700px) ── */
@media (min-width: 768px) and (max-height: 700px) and (orientation: landscape) {
  .empty-state { padding: 30px 20px; }
  .waveform-container { min-height: 100px; padding: 12px; }
  .waveform-canvas { height: 60px; }
}
