:root {
  --bg: #f7f1e7;
  --surface: #fffaf1;
  --panel: #ffffff;
  --panel-soft: #fbf4e8;
  --ink: #24201d;
  --muted: #7c7168;
  --subtle: #a3978c;
  --accent: #d92323;
  --accent-strong: #b91519;
  --accent-soft: #e22b2f;
  --accent-wash: #fff0e5;
  --line: rgba(48, 35, 26, 0.12);
  --line-strong: rgba(48, 35, 26, 0.2);
  --ok: #138a5a;
  --danger: #c1262d;
  --shadow: 0 18px 50px rgba(71, 45, 22, 0.12);
  --shadow-soft: 0 8px 28px rgba(71, 45, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  min-height: 100vh;
}

.glow {
  display: none;
}

main {
  padding: 24px 24px 56px;
}

.header {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #030303;
  color: #ffffff;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.header-bar {
  width: min(1180px, calc(100% - 48px));
  min-height: 92px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: center;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  position: relative;
  border: 0;
  border-radius: 0;
  padding: 34px 12px 30px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.main-nav a::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 21px;
  left: 12px;
  height: 4px;
  border-radius: 999px;
  background: transparent;
}

.main-nav a:hover,
.main-nav a.active {
  color: #ffffff;
}

.main-nav a.active::after {
  background: var(--accent);
}

.header h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  color: var(--accent);
}

.header p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.68);
  margin: 9px 0 0;
  font-size: 0.98rem;
}

.auth-status {
  width: min(1180px, calc(100% - 48px));
  margin: -10px auto 0;
  padding: 0 0 16px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.72);
}

.verification-notice {
  width: min(1180px, calc(100% - 48px));
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 13px 16px;
  border: 1px solid rgba(217, 35, 35, 0.22);
  border-radius: 0;
  background: #fff3db;
  color: #3d332c;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: clamp(18px, 3vw, 30px);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel h2 {
  margin: 0 0 18px;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 500;
}

.section-copy,
.muted-copy,
.form-help,
.privacy-note {
  color: var(--muted);
}

.section-copy {
  margin-top: -8px;
}

.privacy-note {
  margin: 14px 0 0;
  padding: 13px 15px;
  border: 1px solid rgba(193, 38, 45, 0.22);
  border-radius: 2px;
  background: #fff1ee;
}

.full {
  max-width: 1180px;
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.profile-ratings-panel {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.profile-settings-card {
  display: grid;
  gap: 0;
  max-width: 760px;
  border: 1px solid var(--line);
  background: #fffdf8;
}

.profile-setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px 24px;
}

.profile-setting-row + .profile-setting-row {
  border-top: 1px solid var(--line);
}

.profile-setting-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.profile-setting-row strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.profile-setting-row p {
  max-width: 520px;
  margin: 8px 0 0;
  color: var(--muted);
}

.profile-action,
.visibility-toggle {
  min-width: 148px;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.92rem;
}

.profile-action:hover:not(:disabled),
.visibility-toggle:hover:not(:disabled) {
  background: #f7efe3;
  border-color: rgba(48, 35, 26, 0.32);
  color: var(--ink);
}

.visibility-toggle.is-private {
  border-color: rgba(48, 35, 26, 0.22);
  color: var(--ink);
}

.visibility-toggle.is-public {
  border-color: rgba(48, 35, 26, 0.22);
  color: var(--ink);
}

.form-help {
  margin: 13px 0 0;
}

.profile-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px 20px;
  align-items: flex-start;
}

.profile-header-row > div:first-child {
  min-width: 0;
}

.profile-header-row h2 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.profile-header-row .section-copy {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  line-height: 1.2;
}

.score-card {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(217, 35, 35, 0.18);
  border-radius: 999px;
  background: var(--accent-wash);
  display: inline-flex;
  align-items: center;
}

.score-card strong {
  display: inline-flex;
  align-items: center;
  color: var(--accent-strong);
}

.compatibility-score {
  display: inline-flex;
  min-width: 2.35rem;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-weight: 800;
}

.score-excellent {
  color: #087f5b;
}

.score-great {
  color: #0f9f6e;
}

.score-good {
  color: #aa7b05;
}

.score-fair {
  color: #c05621;
}

.score-low {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

input,
button,
select {
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  padding: 11px 12px;
  font: inherit;
}

input,
select {
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(217, 35, 35, 0.55);
  box-shadow: 0 0 0 3px rgba(217, 35, 35, 0.1);
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 800;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 8px 20px rgba(217, 35, 35, 0.16);
}

button.outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

button.outline:hover:not(:disabled) {
  background: #f7efe3;
  border-color: rgba(48, 35, 26, 0.28);
  box-shadow: none;
}

.header button.outline {
  border-color: rgba(255, 255, 255, 0.26);
  color: #ffffff;
}

.header button.outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

button.danger {
  border-color: rgba(193, 38, 45, 0.32);
  color: var(--danger);
}

button.danger:hover:not(:disabled) {
  background: #fff1ee;
  border-color: rgba(193, 38, 45, 0.46);
  color: var(--danger);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 11px 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.button-link:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

#searchForm.search-row {
  grid-template-columns: 1fr minmax(150px, auto) auto;
}

#clearSearch {
  min-width: 96px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.pager button {
  padding: 8px 12px;
}

.pager-bottom {
  margin-top: 18px;
  margin-bottom: 0;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.album-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: #ffffff;
  display: grid;
  box-shadow: var(--shadow-soft);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.album-card:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 35, 35, 0.22);
  box-shadow: var(--shadow);
}

.album-card-rated {
  border-color: rgba(217, 35, 35, 0.78);
  background: #fff8f5;
  box-shadow: inset 0 0 0 2px rgba(217, 35, 35, 0.18), 0 12px 32px rgba(217, 35, 35, 0.1);
}

.album-card-rated:hover {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(217, 35, 35, 0.24), 0 18px 46px rgba(217, 35, 35, 0.14);
}

.album-card-collection {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.album-cover {
  aspect-ratio: 1/1;
  width: 100%;
  object-fit: cover;
  border: 1px solid rgba(48, 35, 26, 0.16);
  border-bottom-color: var(--line-strong);
  background: #efe5d7;
  cursor: pointer;
}

.album-cover-placeholder {
  cursor: default;
  background: linear-gradient(135deg, #f7efe3, #e8d9c6);
}

.album-body {
  padding: 11px;
  display: grid;
  gap: 7px;
}

.album-badge {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

.album-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.album-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.rating-row {
  display: grid;
  grid-template-columns: minmax(54px, 0.75fr) 1fr;
  gap: 6px;
  align-items: stretch;
  padding-top: 4px;
}

.rating-row button {
  padding: 8px;
  font-size: 0.86rem;
}

.rating-row .danger {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #ffffff;
}

.empty-state {
  display: grid;
  gap: 14px;
  justify-items: start;
  padding: 24px;
  border: 1px dashed rgba(48, 35, 26, 0.22);
  border-radius: 2px;
  background: var(--panel-soft);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.user-profile-modal {
  z-index: 80;
}

.intro-modal {
  z-index: 420;
}

#authModal {
  z-index: 500;
}

.modal-topmost {
  z-index: 300;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  width: min(820px, 100%);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 24px;
  background: #ffffff;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.28);
}

.modal-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--accent);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.modal-copy {
  margin: 6px 0 0;
  color: var(--muted);
}

.modal-close {
  flex-shrink: 0;
}

#userProfileHeader {
  min-width: 0;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.modal-grid .stack {
  margin-bottom: 0;
}

.auth-modal-panel {
  width: min(460px, 100%);
}

.intro-modal-panel {
  width: min(760px, 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.intro-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  background: #fffdf8;
}

.intro-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.intro-grid p {
  margin: 0;
  color: var(--muted);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.username-modal-panel {
  width: min(420px, 100%);
}

.user-profile-modal-panel {
  width: min(900px, 100%);
  max-height: min(84vh, 900px);
  overflow: auto;
}

.user-profile-modal-panel .modal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: flex-start;
}

.user-profile-modal-panel .score-card {
  margin-top: 2px;
}

.user-profile-modal-panel .privacy-note {
  max-width: 640px;
  margin-top: 24px;
  line-height: 1.35;
}

.auth-panel {
  display: grid;
  gap: 15px;
  max-width: 420px;
}

.auth-panel .stack {
  margin-bottom: 0;
}

.google-auth {
  display: grid;
  gap: 14px;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-switch {
  margin: 0;
  color: var(--muted);
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 800;
}

.link-button:hover {
  text-decoration: underline;
  transform: none;
  background: transparent;
  box-shadow: none;
}

.album-detail-modal {
  z-index: 300;
}

.album-detail-panel {
  width: min(460px, 100%);
}

.album-detail-content .album-card {
  margin: 0 auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  line-height: 1.2;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #fbf6ee;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-indicator {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

.score-chip {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(48, 35, 26, 0.18);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
}

.table-album-cell {
  padding-top: 6px;
  padding-bottom: 6px;
}

.table-album {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.table-cover {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f4eadc;
}

.top-row-rated {
  background: #fff8e7;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #fff3d8;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 500;
  background: #111111;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: 220ms ease;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.footer {
  max-width: 1180px;
  margin: 20px auto 0;
  color: var(--muted);
}

.footer a,
.back-link,
a {
  color: var(--accent-strong);
}

@media (max-width: 900px) {
  main {
    padding: 16px 14px 42px;
  }

  .header-bar,
  .auth-status,
  .verification-notice {
    width: calc(100% - 28px);
  }

  .header-bar,
  .profile-header-row,
  .modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-bar {
    min-height: 0;
    padding: 22px 0 14px;
  }

  .header-actions {
    justify-content: stretch;
    align-items: stretch;
  }

  .main-nav {
    justify-content: stretch;
    order: 2;
  }

  .main-nav a {
    flex: 1 1 auto;
    padding: 12px 8px 14px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .main-nav a::after {
    right: 10px;
    bottom: 6px;
    left: 10px;
    height: 3px;
  }

  .modal {
    padding: 14px;
  }

  .user-profile-modal-panel .modal-header {
    grid-template-columns: 1fr;
  }

  .user-profile-modal-panel .modal-close {
    justify-self: start;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }

  .search-row,
  #searchForm.search-row,
  .rating-row,
  .profile-setting-row {
    grid-template-columns: 1fr;
  }

  .profile-setting-row {
    padding: 18px;
  }

  .profile-action,
  .visibility-toggle {
    width: 100%;
  }

  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .panel {
    padding: 18px;
  }
}
