:root {
  --background: #fff4f5;
  --surface: #ffffff;
  --surface-soft: #ffe6ea;
  --pink: #f28d9b;
  --coral: #f45c63;
  --text: #35282c;
  --text-muted: #7d696e;
  --border: #ebc8ce;
  --focus: #9b3945;
  --shadow: 0 10px 28px rgba(123, 62, 72, 0.07);
  --radius-large: 22px;
  --radius-medium: 16px;
  color-scheme: light;
  font-family:
    Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.8), transparent 30rem),
    var(--background);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 50;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid rgba(235, 200, 206, 0.9);
  background: rgba(255, 230, 234, 0.96);
  box-shadow: 0 6px 20px rgba(123, 62, 72, 0.05);
  backdrop-filter: blur(14px);
}

.site-header__inner {
  display: flex;
  width: min(calc(100% - 32px), 1800px);
  margin: 0 auto;
  padding: 14px 0;
  flex-direction: column;
  gap: 12px;
}

.brand {
  min-width: 0;
}

.brand__eyebrow {
  margin: 0 0 3px;
  color: var(--coral);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.brand__title-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 12px;
}

.brand h1 {
  flex: none;
  margin: 0;
  font-size: clamp(1.45rem, 5.8vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.05em;
}

.brand__description {
  display: none;
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.search-field {
  min-width: 0;
}

.search-field__control {
  display: flex;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  align-items: center;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-muted);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.search-field__control:focus-within {
  border-color: var(--coral);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(244, 92, 99, 0.11);
}

.search-field__control input {
  width: 100%;
  min-width: 0;
  padding: 12px 0 12px 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-field__control input::placeholder {
  color: #9b868b;
}

.app-shell {
  display: grid;
  width: min(calc(100% - 32px), 1800px);
  margin: 18px auto 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.category-sidebar,
.results-section {
  min-width: 0;
}

.category-panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.category-panel__heading {
  display: flex;
  margin-bottom: 12px;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.category-panel__eyebrow {
  margin: 0 0 2px;
  color: var(--coral);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.category-panel h2 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
}

.category-panel__hint {
  flex: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.category-filter__buttons {
  display: flex;
  margin: 0 -4px -4px;
  padding: 4px;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.filter-chip {
  display: flex;
  flex: none;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.83rem;
  font-weight: 750;
  scroll-snap-align: start;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease;
}

.filter-chip:not(:disabled):hover {
  border-color: var(--pink);
  color: var(--text);
}

.filter-chip.is-selected {
  border-color: var(--coral);
  background: var(--coral);
  color: #fff;
}

.filter-chip__check {
  display: grid;
  width: 17px;
  height: 17px;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 5px;
  opacity: 0.35;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  place-items: center;
}

.filter-chip.is-selected .filter-chip__check {
  opacity: 1;
}

.filter-chip--favorite .filter-chip__check {
  border: 0;
  border-radius: 0;
  opacity: 1;
  color: var(--coral);
  font-size: 1rem;
}

.filter-chip--favorite.is-selected .filter-chip__check {
  color: #fff;
}

.filter-chip__label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-chip__count {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #8a4650;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: center;
}

.filter-chip.is-selected .filter-chip__count {
  background: rgba(255, 255, 255, 0.9);
  color: var(--coral);
}

.results-section {
  padding: 2px 0 0;
}

.results-toolbar {
  display: flex;
  min-height: 52px;
  margin-bottom: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.results-summary {
  min-width: 0;
}

.results-toolbar h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.025em;
}

#active-filter-summary {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.79rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reset-button,
.retry-button {
  display: inline-flex;
  min-height: 40px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 850;
}

.reset-button {
  flex: none;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--coral);
  font-size: 0.84rem;
}

.reset-button:not(:disabled):hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.song-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.song-card {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(123, 62, 72, 0.04);
}

.song-card__content {
  min-width: 0;
}

.song-card__artist,
.song-card__title {
  overflow-wrap: anywhere;
}

.song-card__artist {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.35;
}

.song-card__title {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.song-card__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.song-card__category {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  overflow-wrap: anywhere;
  background: var(--surface-soft);
  color: #8a4650;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.25;
}

.favorite-button {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  place-items: center;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.favorite-button:not(:disabled):hover {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--coral);
}

.favorite-button:active {
  transform: scale(0.94);
}

.favorite-button.is-favorite {
  color: var(--coral);
}

.favorite-button__heart {
  font-family: Arial, sans-serif;
  font-size: 1.7rem;
  line-height: 1;
}

.status-panel {
  display: flex;
  min-height: 250px;
  padding: 34px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.55);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.status-panel[hidden] {
  display: none;
}

.status-panel__icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--coral);
  font-size: 1.5rem;
  place-items: center;
}

.status-panel__icon--heart {
  font-family: Arial, sans-serif;
}

.status-panel__title {
  margin: 0;
  font-weight: 850;
}

.status-panel__description {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.retry-button {
  margin-top: 18px;
  padding: 9px 16px;
  border: 1px solid var(--coral);
  background: var(--coral);
  color: #fff;
}

.retry-button:hover {
  background: #df4d55;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
  border: 4px solid var(--surface-soft);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

footer {
  padding: 28px 20px 30px;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

footer p {
  margin: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 520px) {
  .brand__description {
    display: block;
  }
}

@media (min-width: 768px) {
  .site-header__inner {
    min-height: 82px;
    padding: 12px 0;
    flex-direction: row;
    align-items: center;
    gap: 28px;
  }

  .brand {
    flex: 0 0 auto;
  }

  .brand__description {
    display: none;
  }

  .search-field {
    max-width: 860px;
    flex: 1 1 520px;
    margin-left: auto;
  }

  .app-shell {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 16px;
  }

  .category-panel {
    position: sticky;
    top: 98px;
    display: flex;
    max-height: calc(100vh - 116px);
    padding: 14px;
    flex-direction: column;
  }

  .category-filter__buttons {
    flex-direction: column;
    margin: 0 -5px -5px 0;
    padding: 0 5px 5px 0;
    gap: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: none;
  }

  .filter-chip {
    width: 100%;
    min-height: 42px;
    padding: 7px 9px;
    border-radius: 12px;
    text-align: left;
  }

  .filter-chip__count {
    margin-left: auto;
  }

  .song-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .song-card {
    display: block;
    padding: 15px;
  }

  .song-card__content {
    padding-right: 42px;
  }

  .song-card__categories {
    margin-top: 12px;
  }

  .favorite-button {
    position: absolute;
    top: 7px;
    right: 7px;
  }
}

@media (min-width: 1024px) {
  .site-header__inner,
  .app-shell {
    width: min(calc(100% - 48px), 1800px);
  }

  .brand__description {
    display: block;
  }

  .app-shell {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
  }

  .song-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
  }
}

@media (min-width: 1280px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 24px;
  }

  .song-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .song-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
