@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');

:root {
  --bg-start: #0f0f0f;
  --bg-mid: #1a1a1a;
  --bg-end: #000000;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.7);
  --muted-strong: rgba(255, 255, 255, 0.82);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.22);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --success: #6dd4a0;
  --danger: #ff7d7d;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-sm: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.05), transparent 25%),
    linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.04), transparent 30%),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.03), transparent 22%);
  z-index: -1;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

button,
input,
textarea {
  font: inherit;
}

button,
input,
textarea,
.card,
.topbar,
.topbar nav a {
  will-change: transform;
}

.topbar {
  position: sticky;
  top: 24px;
  z-index: 20;
  width: min(1080px, calc(100% - 32px));
  margin: 24px auto 0;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.topbar:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

.topbar h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.topbar nav a {
  position: relative;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.topbar nav a:hover {
  color: var(--text);
}

.topbar nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--text);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.topbar nav a:hover::after,
.topbar nav a:focus-visible::after {
  transform: scaleX(1);
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 40px auto 96px;
  display: grid;
  gap: 32px;
}

#authSection,
#dashboardSection .card {
  max-width: 900px;
  margin: 0 auto;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 40px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 35%);
}

.card:hover {
  background: var(--glass-strong);
  border-color: var(--line-strong);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.55);
}

h1,
h2,
h3 {
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.card h1,
.card h2 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 700;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #a6a6a6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

p,
li,
small,
.bio-preview,
#message,
#authMessage,
#publicBio {
  color: var(--muted);
}

small {
  display: block;
  margin-top: -6px;
  margin-bottom: 8px;
}

ol {
  padding-left: 1.35rem;
  display: grid;
  gap: 14px;
}

li {
  line-height: 1.7;
}

.auth-switch {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 28px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

button,
.form-grid a,
a.page-link,
a.link,
#termsBackLink,
#privacyBackLink,
.page > a,
#publicProfileLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

button:hover,
.form-grid a:hover,
a.page-link:hover,
a.link:hover,
#termsBackLink:hover,
#privacyBackLink:hover,
.page > a:hover,
#publicProfileLink:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

button.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.row-between > button,
#logoutBtn {
  background: transparent;
  color: var(--muted-strong);
}

.form-grid {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--muted-strong);
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  outline: none;
  transition: all 0.25s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

input:focus,
textarea:focus {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.message,
#message,
#authMessage {
  min-height: 1.4rem;
  font-weight: 600;
  color: #f2f2f2;
}

.hidden {
  display: none !important;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.profile-area {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
}

.profile-main {
  display: grid;
  gap: 10px;
  align-content: start;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bio-preview {
  margin: 0;
  font-size: 0.98rem;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
  flex-wrap: wrap;
}

.toggle-line input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: #ffffff;
  flex: 0 0 auto;
}

.toggle-line span {
  color: var(--muted-strong);
}

.link-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}

.link-disabled:hover,
.link-disabled:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  transform: none;
}

.link-disabled::after {
  content: attr(data-private-message);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(6px);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(8, 8, 8, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 0.88rem;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.link-disabled:hover::after,
.link-disabled:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.profile-pic {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.page {
  width: min(860px, calc(100% - 32px));
  margin: 48px auto 72px;
}

.page.card {
  padding: 38px;
}

.alert {
  padding: 18px 20px;
  border-left: 4px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted-strong);
}

.alert.danger {
  border-left-color: var(--danger);
  background: rgba(255, 125, 125, 0.08);
}

.verified-icon,
#verifiedBadge,
#publicVerified {
  flex-shrink: 0;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.page-loader-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.05), transparent 25%),
    rgba(7, 7, 7, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.page-loader-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  position: relative;
}

.spinner::before {
  content: '';
  position: absolute;
  inset: 22px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (max-width: 968px) {
  .topbar {
    width: min(100%, calc(100% - 32px));
    padding: 16px 24px;
    top: 18px;
  }

  .topbar h1 {
    font-size: 1.05rem;
  }

  .topbar nav {
    gap: 18px;
  }

  .container {
    margin-top: 28px;
    margin-bottom: 72px;
  }

  .card,
  .page.card {
    padding: 32px;
    border-radius: 28px;
  }

  .profile-area {
    padding: 18px;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: relative;
    top: 0;
    border-radius: 30px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .topbar:hover {
    transform: none;
  }

  .topbar nav {
    flex-wrap: wrap;
    gap: 14px;
  }

  .topbar nav a::after {
    display: none;
  }

  .container {
    width: calc(100% - 24px);
    margin: 18px auto 56px;
  }

  .page {
    width: calc(100% - 24px);
    margin: 18px auto 48px;
  }

  .card,
  .page.card {
    padding: 26px 22px;
    border-radius: 24px;
  }

  .card h1,
  .card h2 {
    font-size: clamp(1.8rem, 7vw, 2.6rem);
  }

  .auth-switch {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .auth-switch button,
  .form-grid button,
  .form-grid a,
  a.link,
  #publicProfileLink {
    width: 100%;
  }

  .row-between {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-area {
    flex-direction: column;
  }

  .profile-pic {
    width: 96px;
    height: 96px;
    border-radius: 24px;
  }
}

@media (max-width: 480px) {
  .topbar {
    width: calc(100% - 20px);
    margin-top: 12px;
    padding: 14px 18px;
  }

  .topbar h1 {
    font-size: 0.95rem;
  }

  .topbar nav a {
    font-size: 0.85rem;
  }

  .container,
  .page {
    width: calc(100% - 20px);
  }

  .card,
  .page.card {
    padding: 22px 18px;
    border-radius: 20px;
  }

  .profile-area {
    gap: 18px;
    padding: 16px;
    border-radius: 20px;
  }

  .profile-pic {
    width: 84px;
    height: 84px;
    border-radius: 20px;
  }

  button,
  .form-grid a,
  a.link,
  #publicProfileLink {
    min-height: 44px;
    padding: 11px 18px;
    font-size: 0.9rem;
  }

  input,
  textarea {
    padding: 12px 14px;
  }

  ol {
    gap: 12px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .card:hover,
  button:hover,
  .form-grid a:hover,
  a.link:hover,
  #publicProfileLink:hover {
    transform: none;
  }
}

@supports (-webkit-touch-callout: none) {
  .topbar,
  .card {
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
  }
}
