* {
  box-sizing: border-box;
}

:root {
  --bg0: #04130f;
  --bg1: #062016;
  --metal: rgba(35, 230, 170, 0.10);
  --metal2: rgba(0, 255, 208, 0.05);

  --panel: rgba(10, 24, 22, 0.72);
  --panel2: rgba(10, 42, 66, 0.35);
  --border: rgba(80, 160, 255, 0.25);

  --text: #eaf2f4;
  --muted: rgba(210, 232, 255, 0.72);
  --hint: rgba(190, 210, 230, 0.55);

  --royal: #2c7dff;
  --royal2: #58a8ff;
  --pearl: rgba(120, 200, 255, 0.25);
  --green: #21c46a;
  --green2: #0aa368;

  --favorite-bg: rgba(255, 182, 193, 0.1);
  --favorite-border: rgba(255, 182, 193, 0.3);
  --favorite-highlight: rgba(255, 182, 193, 0.2);
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 20% 0%, var(--metal), transparent 55%),
    radial-gradient(900px 600px at 80% 20%, var(--metal2), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  min-height: 100vh;
  padding: 20px 0;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 0 15px;
}

h1, h2, h3 {
  color: #d8eaff;
  margin-top: 0;
}

h1 {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 10px;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 30px;
  font-size: 1.1rem;
}

/* Panel Styles */
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    radial-gradient(500px 120px at 15% 0%, var(--pearl), transparent 60%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow:
    0 0 0 1px rgba(20, 70, 120, 0.08) inset,
    0 10px 30px rgba(0, 0, 0, 0.22);
}

.panel-spotify {
  background:
    linear-gradient(180deg, rgba(120, 200, 255, 0.12), rgba(30, 40, 60, 0.02)),
    radial-gradient(600px 180px at 10% 0%, rgba(58, 165, 255, 0.20), transparent 60%),
    var(--panel);
}

.favorites-panel {
  border: 2px solid var(--favorite-border);
  background: rgba(15, 30, 28, 0.75);
  grid-row: span 5;
  height: fit-content;
  position: sticky;
  top: 20px;
}

/* Button Styles */
button {
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-right: 10px;
  margin-bottom: 10px;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, #5a9bf8, #3a7bf8);
  color: white;
}

.btn-secondary {
  background: rgba(74, 144, 226, 0.2);
  color: #d8eaff;
  border: 1px solid rgba(90, 170, 255, 0.25);
}

.btn-analyze {
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  color: #2c1810;
  font-weight: 700;
}

.btn-clear {
  background: rgba(255, 99, 132, 0.2);
  color: #ffcdd2;
}

.btn-favorite {
  background: rgba(255, 235, 59, 0.2);
  color: #ffe082;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.btn-favorite.active {
  background: rgba(255, 193, 7, 0.4);
  color: #ffd54f;
}

/* Results List */
.results {
  list-style: none;
  padding: 0;
  margin: 15px 0 0;
}

.results-header {
  font-size: 1.1rem;
  color: #ffd54f;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 182, 193, 0.2);
}

.results-empty {
  text-align: center;
  padding: 20px;
  color: #ffcdd2;
  font-style: italic;
}

.result-card {
  background: rgba(18, 38, 34, 0.5);
  border: 1px solid rgba(80, 160, 255, 0.15);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  background: rgba(22, 44, 40, 0.6);
  border-color: rgba(255, 182, 193, 0.3);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.result-header strong {
  font-size: 1.05rem;
  line-height: 1.3;
  max-width: 80%;
}

.score-badge {
  background: rgba(80, 160, 255, 0.3);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  align-self: flex-start;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.source-info {
  color: #81c784;
  font-style: italic;
}

.match-percent {
  color: #ffd54f;
  font-weight: bold;
}

/* Favorites Styles */
.favorites-container {
  display: grid;
  gap: 12px;
}

.favorite-card {
  background: rgba(28, 48, 44, 0.6);
  border: 1px solid var(--favorite-border);
  border-radius: 10px;
  padding: 15px;
  transition: all 0.2s ease;
}

.favorite-card:hover {
  background: rgba(32, 56, 52, 0.7);
  border-color: rgba(255, 182, 193, 0.5);
}

.favorite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.favorite-title {
  margin: 0;
  font-size: 1.1rem;
  color: #ffd54f;
}

.favorite-remove {
  background: rgba(255, 99, 132, 0.2);
  color: #ffcdd2;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
}

.favorite-remove:hover {
  background: rgba(255, 82, 82, 0.3);
}

.favorite-genre {
  color: #ce93d8;
  font-size: 0.9rem;
  margin-bottom: 6px;
  font-style: italic;
}

.favorite-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.favorite-actions {
  display: flex;
  justify-content: flex-end;
}

.favorite-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.favorites-empty {
  text-align: center;
  padding: 20px;
  color: var(--muted);
}

.favorites-empty .hint {
  font-size: 0.9rem;
  margin-top: 8px;
  color: #81c784;
}

/* Sound Profile */
.sound-profile {
  background: rgba(18, 38, 34, 0.4);
  border: 1px solid var(--favorite-border);
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.sound-profile strong {
  color: #ffd54f;
  display: block;
  margin-bottom: 8px;
}

/* Status and Hint Styles */
.status-line {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 10px;
}

.hint {
  font-size: 0.9rem;
  color: var(--hint);
  margin: 10px 0;
  padding-left: 15px;
  border-left: 3px solid rgba(129, 199, 132, 0.5);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

input[type="range"] {
  width: 100%;
  margin-top: 5px;
}

/* Soft gold read-only indicators */
input[type="range"][disabled],
.metric-slider[disabled] {
  accent-color: #b89a58;
  opacity: 0.95;
  cursor: default;
}

.metric-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.metric-slider {
  pointer-events: none;
}

.metric-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(180, 150, 86, 0.45), rgba(220, 193, 130, 0.35));
}

.metric-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border-radius: 50%;
  border: 1px solid rgba(35, 35, 35, 0.9);
  background: #1b1b1b;
}

input[type="text"] {
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(90, 170, 255, 0.25);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  outline: none;
}

input[type="text"]:focus {
  border-color: rgba(90, 170, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(44, 125, 255, 0.16);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 1fr 380px;
  }
}

/* Recommended Section */
.recommended-section {
  background: rgba(10, 24, 22, 0.8);
  padding: 20px 0;
  margin-top: 30px;
  border-top: 1px solid rgba(255, 182, 193, 0.2);
}

.recommended-section h2 {
  color: #ffd54f;
  margin-bottom: 15px;
  font-size: 1.4rem;
}

.recommended-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.recommended-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

.recommended-card {
  background: rgba(18, 38, 34, 0.6);
  border: 1px solid rgba(255, 182, 193, 0.3);
  border-radius: 10px;
  padding: 15px;
  transition: all 0.2s ease;
}

.recommended-card:hover {
  background: rgba(22, 44, 40, 0.7);
  border-color: rgba(255, 182, 193, 0.5);
  transform: translateY(-2px);
}

.recommended-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.recommended-title {
  margin: 0;
  font-size: 1.1rem;
  color: #ffd54f;
  line-height: 1.3;
}

.recommended-score {
  background: rgba(80, 160, 255, 0.3);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}

.recommended-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.recommended-source {
  color: #81c784;
  font-style: italic;
}

.recommended-match {
  color: #ffd54f;
  font-weight: bold;
}

/* Privacy Section */
details[open] > summary {
  margin-bottom: 15px;
}

summary {
  cursor: pointer;
  padding: 8px 0;
  font-size: 1.1rem;
  color: #d8eaff;
}

.privacy-content {
  margin-bottom: 15px;
  line-height: 1.5;
}

.privacy-content p {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.privacy-content strong {
  color: #ffd54f;
}

/* Actions */
.actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.actions-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Divider */
.divider {
  margin: 14px 0 4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90, 170, 255, 0.35), transparent);
}

/* Empty states */
.empty {
  color: var(--hint);
  padding: 8px 2px;
  text-align: center;
}

/* Hide utility */
.is-hidden {
  display: none !important;
}

/* Match details visualization */
.match-details {
  margin: 10px 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  padding: 8px;
}

.match-item {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
}

.match-item span {
  display: inline-block;
  width: 60px;
  color: var(--muted);
  font-size: 11px;
}

.match-percent {
  margin-left: 8px;
  color: #ffd54f;
  font-weight: bold;
  font-size: 11px;
  min-width: 30px;
  text-align: right;
}

.match-bar {
  height: 6px;
  background: linear-gradient(90deg, #f1c40f, #e67e22);
  border-radius: 3px;
  margin-left: 8px;
  transition: width 0.3s ease;
}

/* Profile controls blur effect */
.profile-controls.blurred {
  filter: blur(3px);
  opacity: 0.7;
  position: relative;
}

.profile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.8);
  color: #333;
  padding: 20px;
  text-align: center;
  z-index: 10;
}

.profile-overlay p {
  margin: 5px 0;
  font-size: 14px;
  font-weight: 500;
}

/* Recommended tracks section */
.recommended-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.recommended-header h2 {
  margin: 0 0 5px 0;
  color: #2c3e50;
}

.recommended-header p {
  margin: 0;
  color: #7f8c8d;
  font-size: 14px;
}

.recommended-empty {
  padding: 20px;
  text-align: center;
  color: #7f8c8d;
  background-color: #f9f9f9;
  border-radius: 5px;
}

.recommended-empty p {
  margin: 5px 0;
}

.recommended-empty .hint {
  font-size: 13px;
  font-style: italic;
}

.recommended-card {
  background-color: white;
  border-radius: 5px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  border: 1px solid #f0f0f0;
}

.recommended-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.recommended-title {
  margin: 0;
  font-size: 16px;
  color: #2c3e50;
  flex-grow: 1;
}

.recommended-score {
  background-color: #3498db;
  color: white;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
}

.recommended-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  color: #7f8c8d;
}

.recommended-actions {
  text-align: right;
}

.btn-favorite {
  background-color: #ecf0f1;
  border: none;
  padding: 5px 10px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-favorite.active {
  background-color: #f1c40f;
  color: white;
}

.btn-favorite:hover {
  opacity: 0.9;
}