.records-page {
  max-width: 1120px;
}

.records-page main {
  min-height: 70vh;
}

.records-shell {
  --records-line: rgba(127, 127, 127, 0.28);
  --records-soft: rgba(127, 127, 127, 0.09);
  --records-softer: rgba(127, 127, 127, 0.05);
  --records-danger: #c75a5a;
}

.records-hero {
  max-width: 720px;
  margin: 2.5rem 0 3rem;
}

.records-hero h1 {
  margin: 0.3rem 0 0.85rem;
  font-size: clamp(2.5rem, 7vw, 5rem);
  letter-spacing: -0.045em;
}

.records-hero > p:last-child {
  max-width: 620px;
  font-size: 1.08rem;
  color: var(--em-color);
}

.records-kicker,
.records-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--em-color);
}

.records-panel {
  border: 1px solid var(--records-line);
  border-radius: 14px;
  background: var(--records-softer);
  padding: clamp(1.1rem, 3vw, 2rem);
}

.records-loading {
  color: var(--em-color);
}

#records-auth {
  max-width: 620px;
}

.records-panel-heading,
.records-list-heading,
.records-member-bar,
.records-save-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.records-panel-heading h2,
.records-list-heading h2 {
  margin: 0.15rem 0 0;
}

.records-panel-heading-compact {
  align-items: flex-start;
}

.auth-switch {
  display: flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--records-line);
  border-radius: 999px;
}

.auth-switch button,
.records-text-button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.auth-switch button {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
}

.auth-switch button.is-active {
  background: var(--link-internal);
  color: #111;
}

.records-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.records-form label {
  display: grid;
  gap: 0.35rem;
}

.records-form input,
.album-search-form input,
.ranked-review {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--records-line);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.records-form input,
.album-search-form input {
  min-height: 44px;
  padding: 0.65rem 0.75rem;
}

.records-form input:focus,
.album-search-form input:focus,
.ranked-review:focus {
  outline: 2px solid color-mix(in srgb, var(--link-internal) 68%, transparent);
  outline-offset: 2px;
}

.records-hint {
  color: var(--em-color);
  font-size: 0.83rem;
}

.records-primary,
.album-search-form button,
.album-add-button,
.ranked-action,
.ranked-grabber {
  min-height: 40px;
  border: 1px solid var(--records-line);
  border-radius: 8px;
  background: var(--records-soft);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.records-primary,
.album-search-form button {
  padding: 0.55rem 0.9rem;
}

.records-primary {
  background: var(--link-internal);
  color: #111;
  border-color: transparent;
  font-weight: 700;
}

.records-primary:hover,
.album-search-form button:hover,
.album-add-button:hover,
.ranked-action:hover,
.ranked-grabber:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none !important;
}

.records-message {
  min-height: 1.5em;
  margin: 0.75rem 0 0;
  color: var(--em-color);
}

.records-message.is-error,
.records-save-status.is-error {
  color: var(--records-danger);
}

.records-member-bar {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--records-line);
}

.records-member-bar p {
  margin: 0;
}

.records-text-button {
  color: var(--link-internal);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.records-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.5fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.records-search-panel {
  position: sticky;
  top: 1rem;
}

.records-count {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--records-line);
  border-radius: 999px;
  font-size: 0.85rem;
}

.album-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.album-results,
.ranked-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.album-results {
  display: grid;
  gap: 0.65rem;
}

.album-result {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.65rem;
  border-top: 1px solid var(--records-line);
}

.album-result img,
.ranked-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 4px;
  background: var(--records-soft);
}

.album-result-copy,
.ranked-copy {
  min-width: 0;
}

.album-title,
.album-meta {
  margin: 0;
}

.album-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.album-meta {
  color: var(--em-color);
  font-size: 0.86rem;
}

.album-add-button {
  padding: 0.35rem 0.6rem;
}

.records-list-heading {
  margin-bottom: 1rem;
}

.records-save-group {
  justify-content: flex-end;
}

.records-save-status {
  color: var(--em-color);
  font-size: 0.86rem;
}

.ranked-list {
  counter-reset: records-rank;
  display: grid;
  gap: 0.85rem;
}

.ranked-item {
  counter-increment: records-rank;
  display: grid;
  grid-template-columns: 2.3rem 88px minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: start;
  padding: 0.85rem 0;
  border-top: 1px solid var(--records-line);
}

.ranked-item::before {
  content: counter(records-rank, decimal-leading-zero);
  padding-top: 0.15rem;
  color: var(--link-internal);
  font-weight: 700;
}

.ranked-cover {
  display: block;
}

.ranked-copy .album-title {
  margin-top: -0.1rem;
}

.ranked-review {
  min-height: 4.5rem;
  margin-top: 0.55rem;
  padding: 0.55rem 0.65rem;
  resize: vertical;
  line-height: 1.35;
}

.ranked-actions {
  display: grid;
  gap: 0.35rem;
}

.ranked-grabber {
  display: grid;
  place-items: center;
  min-width: 4.5rem;
  min-height: 3rem;
  padding: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ranked-grabber:active,
.ranked-list.is-reordering .ranked-grabber {
  cursor: grabbing;
}

.ranked-grip-dots {
  color: var(--em-color);
  font-size: 1.55rem;
  line-height: 1;
  transform: rotate(90deg);
}

.ranked-action {
  padding: 0 0.65rem;
}

.ranked-remove {
  color: var(--records-danger);
}

.ranked-item.is-dragging {
  opacity: 0.48;
}

.ranked-item.is-drop-before {
  box-shadow: inset 0 3px 0 var(--link-internal);
}

.ranked-item.is-drop-after {
  box-shadow: inset 0 -3px 0 var(--link-internal);
}

.records-empty {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 1.5rem;
  border: 1px dashed var(--records-line);
  border-radius: 12px;
  color: var(--em-color);
}

.records-empty span {
  color: var(--link-internal);
  font-weight: 700;
}

.records-empty p {
  margin: 0;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .records-workspace {
    grid-template-columns: 1fr;
  }

  .records-search-panel {
    position: static;
  }
}

@media (max-width: 600px) {
  .records-panel-heading,
  .records-list-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-switch {
    align-self: flex-start;
  }

  .records-save-group {
    justify-content: space-between;
  }

  .ranked-item {
    grid-template-columns: 2rem 68px minmax(0, 1fr);
    gap: 0.65rem;
  }

  .ranked-actions {
    grid-column: 2 / -1;
    display: flex;
  }

  .ranked-grabber {
    min-width: 4.5rem;
  }

  .ranked-remove {
    width: auto;
    padding: 0 0.6rem;
  }
}
