/* Spotify-like dark theme */
:root {
  --bg: #121212;
  --panel: #181818;
  --panel-2: #1f1f1f;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --muted-2: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  --green: #1DB954;
  --green-2: #1ed760;
  --red: #ff6b6b;
  --focus: rgba(30, 215, 96, 0.28);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(900px 520px at 20% 0%, rgba(30, 215, 96, 0.14), transparent 62%),
    radial-gradient(760px 460px at 95% 0%, rgba(29, 185, 84, 0.10), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  background-position: 0 0, 100% 0, 0 0;
  margin: 0;
  padding: 36px 18px;
  padding-bottom: 112px;
  color: var(--text);
}

/* Light mode token overrides */
body.light-mode {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #eef2f6;
  --text: #121212;
  --muted: rgba(0, 0, 0, 0.72);
  --muted-2: rgba(0, 0, 0, 0.55);
  --border: rgba(0, 0, 0, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
  --focus: rgba(29, 185, 84, 0.20);
  color-scheme: light;
  background:
    radial-gradient(900px 520px at 20% 0%, rgba(30, 215, 96, 0.10), transparent 62%),
    radial-gradient(760px 460px at 95% 0%, rgba(29, 185, 84, 0.08), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  background-position: 0 0, 100% 0, 0 0;
}

.container {
  margin: 0 auto;
  width: 100%;
  max-width: 1200px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
  border-radius: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 128px;
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}

.brand-text h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.2px;
}

.brand-subtitle {
  margin: 3px 0 0 0;
  font-size: 12px;
  color: var(--muted-2);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.theme-toggle {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  filter: none;
  border-color: rgba(255,255,255,0.25);
}

body.light-mode .theme-toggle {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.14);
  color: #121212;
}

/* Make light-mode cards/panels truly light (not grey translucent) */
body.light-mode .container {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode .app-header {
  background: linear-gradient(180deg, rgba(29, 185, 84, 0.08), rgba(29, 185, 84, 0));
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.light-mode #dashboard,
body.light-mode form,
body.light-mode .youtube-section,
body.light-mode .calculation-section {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.10);
}

body.light-mode .card,
body.light-mode .eda-chart-box,
body.light-mode .youtube-card,
body.light-mode .formula-box,
body.light-mode .calc-item,
body.light-mode .final-result {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

body.light-mode .youtube-audio-controls {
  background: #f6f8fa;
  border-color: rgba(0, 0, 0, 0.10);
}

body.light-mode .bottom-player {
  background: #ffffff;
  border-top-color: rgba(0,0,0,0.12);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.16);
}

body.light-mode .bottom-player-artist,
body.light-mode .bottom-player-time {
  color: rgba(0,0,0,0.66);
}

body.light-mode #similarity-chart {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.10);
}

body.light-mode .formula-text,
body.light-mode .calc-value,
body.light-mode .youtube-rank {
  color: #169c46;
}

/* Light-mode typography/controls readability fixes */
body.light-mode .tab-button {
  color: rgba(0, 0, 0, 0.72);
  border-color: rgba(0, 0, 0, 0.16);
  background: rgba(0, 0, 0, 0.04);
}

body.light-mode .tab-button.active {
  color: #0b0b0b;
  border-color: rgba(29, 185, 84, 0.55);
  background: linear-gradient(135deg, rgba(30, 215, 96, 0.28), rgba(29, 185, 84, 0.14));
}

body.light-mode label,
body.light-mode .pill,
body.light-mode .brand-subtitle,
body.light-mode .youtube-artist,
body.light-mode .youtube-meta,
body.light-mode .youtube-audio-controls .time-row {
  color: rgba(0, 0, 0, 0.70);
}

body.light-mode input,
body.light-mode select {
  color: #121212;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.16);
}

body.light-mode #compare-song {
  background: #ffffff !important;
  color: #121212 !important;
  border-color: rgba(0, 0, 0, 0.18) !important;
  -webkit-text-fill-color: #121212;
}

body.light-mode #compare-song option {
  background: #ffffff;
  color: #121212;
}

body.light-mode #compare-song:focus {
  border-color: rgba(29, 185, 84, 0.55) !important;
  box-shadow: 0 0 0 4px rgba(29, 185, 84, 0.20) !important;
}

body.light-mode .youtube-audio-controls .audio-toggle {
  color: #0b0b0b;
}

@media (max-width: 900px) {
  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .brand-logo {
    width: 112px;
  }
}

h2 {
  margin: 14px 0 10px;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.tab-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 20px;
}

.tab-button {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.tab-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.18);
}

.tab-button.active {
  background: linear-gradient(135deg, rgba(30, 215, 96, 0.20), rgba(29, 185, 84, 0.12));
  border-color: rgba(30, 215, 96, 0.45);
  color: var(--text);
}

.tab-content { display: none; }
.tab-content.active { display: block; }
.hidden { display: none; }

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
}

label {
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
}

input, select {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(30, 215, 96, 0.55);
  box-shadow: 0 0 0 4px var(--focus);
}

/* Native dropdown + number spinner theme fixes */
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.70) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.70) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

select option {
  background-color: #1a1a1a;
  color: var(--text);
}

input[type="number"] {
  color-scheme: dark;
}

/* Light-mode menu + spinner */
body.light-mode select {
  background:
    linear-gradient(45deg, transparent 50%, rgba(0,0,0,0.70) 50%) calc(100% - 18px) calc(50% - 3px) / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(0,0,0,0.70) 50%, transparent 50%) calc(100% - 12px) calc(50% - 3px) / 6px 6px no-repeat,
    #ffffff !important;
}

body.light-mode select option {
  background-color: #ffffff;
  color: #121212;
}

body.light-mode input[type="number"] {
  color-scheme: light;
}

/* Comparison panel */
.panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.16);
  border: 1px solid rgba(255,255,255,0.08);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 8px;
}

.section-title {
  margin: 16px 0 8px;
}

body.light-mode .panel {
  background: #ffffff;
  border-color: rgba(0,0,0,0.10);
}

button {
  background: linear-gradient(135deg, var(--green-2), var(--green));
  color: #0b0b0b;
  border: none;
  padding: 11px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* Dashboard */
#dashboard {
  margin-bottom: 30px;
  background: rgba(0,0,0,0.16);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
}

.dashboard-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  flex: 1 1 180px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
  color: var(--muted);
}

.eda-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.eda-chart-box {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
}

.eda-chart-box:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.40);
  border-color: rgba(30, 215, 96, 0.35);
}

.eda-chart-box h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--green-2);
  border-bottom: 1px solid rgba(30, 215, 96, 0.28);
  padding-bottom: 10px;
}

.eda-chart-box canvas {
  flex: 1;
  width: 100% !important;
  height: 320px !important;
  display: block;
}

.top-artists-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.top-artists-box {
  min-width: 900px;
}

/* Results + charts */
#results { margin-top: 20px; }

.chart-controls {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-container {
  margin-top: 10px;
  position: relative;
}

#similarity-chart {
  width: 100% !important;
  height: 300px !important;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  background-color: rgba(0,0,0,0.12);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
}

th, td {
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
}

th {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-weight: 800;
}

tbody tr {
  background: rgba(0,0,0,0.10);
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(30,215,96,0.10);
}

#error { margin-top: 20px; color: var(--red); }

/* Similarity breakdown */
.calculation-section {
  margin-top: 30px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(30, 215, 96, 0.08), rgba(0, 0, 0, 0.16));
  border: 1px solid rgba(30, 215, 96, 0.22);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

.calculation-section h3 {
  margin: 0 0 20px 0;
  color: var(--green-2);
  font-size: 16px;
  border-bottom: 1px solid rgba(30, 215, 96, 0.28);
  padding-bottom: 10px;
}

.formula-box {
  background: rgba(0,0,0,0.20);
  padding: 15px;
  border-radius: 12px;
  border-left: 4px solid rgba(30, 215, 96, 0.9);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.formula-label {
  margin: 0 0 8px 0;
  font-weight: 800;
  color: var(--muted);
  font-size: 13px;
}

.formula-text {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  color: var(--green-2);
  font-weight: 800;
}

.calculation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  margin: 14px 0 20px;
}

.calc-item {
  background: rgba(0,0,0,0.20);
  padding: 15px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.20);
  border-top: 2px solid rgba(30, 215, 96, 0.55);
}

.calc-label {
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
}

.calc-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--green-2);
  font-weight: 900;
  font-size: 13px;
  background: rgba(30, 215, 96, 0.12);
  padding: 5px 10px;
  border-radius: 10px;
}

.final-result {
  background: rgba(0,0,0,0.20);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.20);
}

.final-calc-text {
  margin: 0 0 15px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--green-2);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.similarity-meter {
  background: rgba(255,255,255,0.12);
  height: 30px;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.meter-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-2));
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: #0b0b0b;
  font-weight: 900;
  font-size: 12px;
}

/* YouTube "listen" section */
.youtube-section {
  margin-top: 10px;
  padding: 25px;
  background: rgba(0,0,0,0.20);
  border-radius: var(--radius);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.40);
  border: 1px solid rgba(255,255,255,0.08);
}

.youtube-section h3 {
  margin: 0 0 20px 0;
  color: var(--text);
  font-size: 18px;
  border-bottom: 1px solid rgba(30, 215, 96, 0.28);
  padding-bottom: 10px;
}

.youtube-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recommend-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.recommend-filter-row label {
  margin: 0;
  white-space: nowrap;
}

#genre-filter {
  max-width: 320px;
}

.chosen-song-section {
  margin-top: 6px;
}

.chosen-song-list {
  display: flex;
  justify-content: center;
}

.chosen-song-card {
  width: min(360px, 100%);
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
}

.chosen-song-cover {
  width: 240px;
  height: 240px;
  border-radius: 14px;
}

.chosen-song-info .youtube-song-title {
  white-space: normal;
  font-size: 22px;
  margin-top: 10px;
}

.chosen-song-info .youtube-artist {
  font-size: 14px;
}

.chosen-song-info .youtube-meta,
.chosen-song-info .youtube-rank {
  font-size: 13px;
}

.youtube-card {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  overflow: visible;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
  cursor: pointer;
  padding: 10px;
  gap: 12px;
  position: relative;
  margin-top: 10px;
  flex-wrap: nowrap;
  border: 1px solid rgba(255,255,255,0.08);
}

.youtube-card:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.youtube-card.playing {
  background: linear-gradient(135deg, rgba(30, 215, 96, 0.18) 0%, rgba(29, 185, 84, 0.10) 100%);
  border-color: rgba(30, 215, 96, 0.30);
}

.youtube-card.playing::before {
  content: 'Now Playing';
  position: absolute;
  top: -25px;
  left: 8px;
  background: rgba(30, 215, 96, 0.90);
  color: #0b0b0b;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  z-index: 10;
}

.youtube-thumbnail {
  position: relative;
  width: 56px;
  height: 56px;
  background: #000;
  overflow: hidden;
  border-radius: 10px;
  flex-shrink: 0;
}

.youtube-thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  background: rgba(30, 215, 96, 0.92);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 2;
  color: #0b0b0b;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.youtube-info {
  padding: 0;
  flex: 1;
  min-width: 0;
}

.youtube-song-title {
  font-weight: 900;
  color: var(--text);
  font-size: 14px;
  margin: 0 0 4px 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-artist {
  color: rgba(255, 255, 255, 0.70);
  font-size: 12px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-meta {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-rank {
  font-weight: 900;
  color: var(--green-2);
  font-size: 11px;
  margin-top: 4px;
  white-space: nowrap;
}

/* Fixed bottom mini-player */
.bottom-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: #181818;
  border-top: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.45);
}

.bottom-player.hidden {
  display: none !important;
}

.bottom-player-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 40%;
}

.bottom-player-art-wrap {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  flex: 0 0 auto;
}

.bottom-player-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bottom-player-meta {
  min-width: 0;
}

.bottom-player-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-player-artist {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: rgba(255,255,255,0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-player-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 60%;
  min-width: 0;
}

.bottom-player-toggle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  flex: 0 0 auto;
}

.bottom-player-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

#bottom-player-seek {
  flex: 1;
  min-width: 80px;
  accent-color: var(--green-2);
}

.bottom-player-time {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  width: 34px;
  text-align: center;
}

/* Keep the YouTube iframe in DOM but invisible (audio only) */
.youtube-embed {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.youtube-embed iframe {
  width: 1px !important;
  height: 1px !important;
  opacity: 0.01;
  border: 0;
  display: block;
  pointer-events: none;
}

.youtube-audio-controls {
  width: 420px;
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 10px 12px;
  flex: 0 0 auto;
}

.youtube-audio-controls .audio-toggle {
  background: linear-gradient(135deg, var(--green-2), var(--green));
  color: #0b0b0b;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-weight: 900;
}

.youtube-audio-controls .audio-seek {
  flex: 1;
  min-width: 0;
}

.youtube-audio-controls .seek-bar {
  width: 100%;
  accent-color: var(--green-2);
}

.youtube-audio-controls .time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 4px;
}

@media (max-width: 900px) {
  body {
    padding: 18px 10px;
    padding-bottom: 118px;
  }

  .container {
    padding: 14px;
    border-radius: 14px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 10px 14px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tab-buttons {
    justify-content: stretch;
  }

  .tab-button {
    flex: 1 1 auto;
    text-align: center;
  }

  .dashboard-cards {
    gap: 8px;
  }

  .card {
    flex: 1 1 100%;
  }

  .eda-chart-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .eda-chart-box {
    min-height: 340px;
    padding: 14px;
  }

  .eda-chart-box canvas {
    height: 260px !important;
  }

  .top-artists-box {
    min-width: 0;
    width: 100%;
  }

  #top-artists-chart {
    height: 260px !important;
  }

  .panel-header {
    justify-content: stretch;
  }

  .chart-controls {
    width: 100%;
    justify-content: space-between;
  }

  .chart-controls label {
    font-size: 12px;
  }

  #compare-song {
    min-width: 0;
    width: 72%;
  }

  .youtube-card {
    flex-wrap: wrap;
    gap: 10px;
  }

  .youtube-info {
    min-width: 150px;
  }

  .youtube-audio-controls {
    width: 100%;
    margin-left: 0;
    padding: 8px 10px;
  }

  .chosen-song-cover {
    width: 180px;
    height: 180px;
  }

  .chosen-song-info .youtube-song-title {
    font-size: 18px;
  }

  .recommend-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  #genre-filter {
    max-width: 100%;
  }

  .calculation-grid {
    grid-template-columns: 1fr;
  }

  .bottom-player {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px 10px;
  }

  .bottom-player-left,
  .bottom-player-center {
    flex: 1 1 auto;
  }
}

@media (max-width: 600px) {
  .brand-text h1 {
    font-size: 17px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .pill {
    font-size: 11px;
    padding: 6px 9px;
  }

  .theme-toggle {
    font-size: 11px;
    padding: 7px 10px;
  }

  form {
    padding: 12px;
  }

  .panel,
  .youtube-section,
  .calculation-section {
    padding: 12px;
  }

  #similarity-chart {
    height: 240px !important;
  }

  #top-artists-chart {
    height: 210px !important;
  }

  .youtube-thumbnail {
    width: 48px;
    height: 48px;
  }

  .youtube-song-title {
    font-size: 13px;
  }

  .youtube-artist,
  .youtube-meta,
  .youtube-rank {
    font-size: 10px;
  }
}
