:root {
  --bg: #0f1720;
  --panel: rgba(17, 25, 37, 0.75);
  --ink: #f5f7fb;
  --muted: #9aa9bf;
  --accent: #ff8f3f;
  --accent-soft: #ffb676;
  --line: rgba(255, 255, 255, 0.08);
  --ok: #34d399;
  --danger: #f87171;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(1200px 700px at 10% 0%, #18354f 0%, transparent 60%),
              radial-gradient(900px 600px at 90% 10%, #4f2f20 0%, transparent 60%),
              var(--bg);
  min-height: 100vh;
  padding: 24px;
}

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 143, 63, 0.12), transparent 45%, rgba(80, 195, 255, 0.1));
}

.header {
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.header-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.header-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.main-nav a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.main-nav a.active {
  border-color: rgba(255, 143, 63, 0.55);
  background: rgba(255, 143, 63, 0.16);
  color: var(--accent-soft);
}

.header h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.header p {
  color: var(--muted);
  margin: 6px 0 0;
}

.auth-status {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--accent-soft);
}

.verification-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 143, 63, 0.35);
  border-radius: 12px;
  background: rgba(255, 143, 63, 0.1);
  color: var(--accent-soft);
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--panel);
  backdrop-filter: blur(8px);
}

.panel h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

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

.privacy-note {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid rgba(248, 113, 113, 0.32);
  border-radius: 12px;
  background: rgba(248, 113, 113, 0.08);
}

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

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

.profile-ratings-panel {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.username-display,
.visibility-toggle {
  border-radius: 16px;
}

.username-display {
  min-width: min(100%, 280px);
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  text-align: left;
  background: rgba(2, 8, 18, 0.65);
  color: var(--ink);
}

.username-display span {
  color: var(--muted);
  font-size: 0.85rem;
}

.username-display strong {
  color: var(--accent-soft);
  font-size: 1.3rem;
}

.visibility-toggle {
  align-self: center;
  padding: 9px 12px;
  font-size: 0.9rem;
}

.visibility-toggle.is-private {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}

.visibility-toggle.is-public {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
  color: var(--ok);
}

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

.profile-header-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.profile-header-row h2 {
  margin-bottom: 4px;
}

.score-card {
  min-width: 0;
  padding: 6px;
  border: 1px solid rgba(255, 143, 63, 0.28);
  border-radius: 999px;
  background: rgba(255, 143, 63, 0.1);
  display: inline-flex;
  align-items: center;
}

.score-card strong {
  color: var(--accent-soft);
}

.compatibility-score {
  display: inline-flex;
  min-width: 2.2rem;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-weight: 800;
}

.score-excellent {
  color: #6ee7b7;
}

.score-great {
  color: #a7f3d0;
}

.score-good {
  color: #fde68a;
}

.score-fair {
  color: #fdba74;
}

.score-low {
  color: #fca5a5;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

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

input,
select {
  background: rgba(2, 8, 18, 0.65);
  color: var(--ink);
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #ff6a3d);
  color: #171b25;
  font-weight: 700;
  transition: transform 120ms ease;
}

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

button:hover {
  transform: translateY(-1px);
}

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

button.danger {
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

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

#clearSearch {
  min-width: 96px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

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

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

.album-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(5, 13, 24, 0.65);
  display: grid;
}

.album-card-rated {
  border-color: rgba(255, 143, 63, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 143, 63, 0.16);
}

.album-cover {
  aspect-ratio: 1/1;
  width: 100%;
  object-fit: cover;
  background: #1a2536;
  cursor: pointer;
}

.album-cover-placeholder {
  cursor: default;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)), #1a2536;
}

.album-body {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.album-badge {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 143, 63, 0.16);
  color: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.album-title {
  margin: 0;
  font-size: 1rem;
}

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

.rating-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
}

.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(2, 8, 18, 0.28);
}

.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;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 18, 0.72);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(820px, 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  background: rgba(10, 18, 31, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

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

.modal-header h2 {
  margin: 0;
}

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

.modal-close {
  flex-shrink: 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%);
}

.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 {
  align-items: flex-start;
}

.auth-panel {
  display: grid;
  gap: 14px;
  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-soft);
  font-weight: 700;
}

.link-button:hover {
  text-decoration: underline;
  transform: 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;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.table-indicator {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 143, 63, 0.16);
  color: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.top-row-rated {
  background: rgba(255, 143, 63, 0.06);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: 220ms ease;
}

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

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

.footer a {
  color: var(--accent-soft);
}

@media (max-width: 900px) {
  body {
    padding: 14px;
  }

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

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

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

  .main-nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .modal {
    padding: 14px;
  }

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

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