:root {
  --bg-start: #161616;
  --bg-mid: #111111;
  --bg-end: #0c0c0c;
  --text: #ffffff;
  --muted: #a7a7a7;
  --brand: #e50914;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --overlay: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.38));
  --card-bg: linear-gradient(145deg, #202020, #0e0e0e);
  --name-bg: linear-gradient(180deg, rgba(44, 44, 44, 0.92), rgba(24, 24, 24, 0.98));
  --name-active-bg: rgba(255, 255, 255, 0.08);
  --toast-bg: rgba(18, 18, 18, 0.88);
  --toast-border: 1px solid rgba(255, 255, 255, 0.12);
  --button-text: #d0d0d0;
  --button-border: #6f6f6f;
  --button-hover-bg: rgba(255, 255, 255, 0.06);
  --surface-border: rgba(255, 255, 255, 0.06);
  --image-top-gloss: rgba(255, 255, 255, 0.03);
  --image-bottom-shade: rgba(0, 0, 0, 0.34);
  --toggle-bg: rgba(127, 127, 127, 0.12);
  --toggle-thumb-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

body.light-theme {
  --bg-start: #f5f1ea;
  --bg-mid: #ece6dd;
  --bg-end: #dfd7ca;
  --text: #171717;
  --muted: #5c574f;
  --shadow: 0 24px 80px rgba(64, 50, 34, 0.12);
  --overlay: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(196, 184, 168, 0.18));
  --card-bg: linear-gradient(145deg, #f7f1e8, #e6ddd1);
  --name-bg: linear-gradient(180deg, rgba(241, 234, 224, 0.96), rgba(224, 216, 205, 0.98));
  --name-active-bg: rgba(23, 23, 23, 0.08);
  --toast-bg: rgba(250, 245, 238, 0.92);
  --toast-border: 1px solid rgba(29, 29, 29, 0.12);
  --button-text: #38332d;
  --button-border: #8f8579;
  --button-hover-bg: rgba(23, 23, 23, 0.06);
  --surface-border: rgba(24, 24, 24, 0.08);
  --image-top-gloss: rgba(255, 255, 255, 0.12);
  --image-bottom-shade: rgba(0, 0, 0, 0.16);
  --toggle-bg: rgba(23, 23, 23, 0.06);
  --toggle-thumb-shadow: 0 6px 16px rgba(73, 61, 45, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 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;
}

.sr-only:focus,
.sr-only:focus-visible {
  position: fixed;
  top: 16px;
  left: 16px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 14px;
  clip: auto;
  overflow: visible;
  white-space: normal;
  z-index: 40;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg-start);
}

html {
  color-scheme: dark;
}

body.light-theme {
  color-scheme: light;
}

body {
  min-height: 100vh;
  font-family: "Montserrat", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(229, 9, 20, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg-start) 0%, var(--bg-mid) 45%, var(--bg-end) 100%);
  transition: background 220ms ease, color 220ms ease;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

body.is-transitioning {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--overlay);
  pointer-events: none;
}

button,
img {
  display: block;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 30px 42px 42px;
  transition: opacity 260ms ease, transform 360ms ease;
}

body.is-transitioning .page-shell {
  opacity: 0.18;
  transform: scale(1.02);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  row-gap: 12px;
  margin-bottom: 12px;
}

.brand {
  display: inline-block;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: 0.08em;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2.9rem, 3.8vw, 4rem);
}

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-switcher-text {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: 999px;
}

.theme-toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 86px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--toggle-bg);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.theme-toggle-track::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.theme-toggle-icon {
  position: relative;
  z-index: 1;
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 180ms ease, transform 220ms ease, opacity 220ms ease;
}

.theme-toggle-thumb {
  position: absolute;
  top: 50%;
  left: 6px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: var(--toggle-thumb-shadow);
  transform: translate(0, -50%);
  transition: transform 240ms ease, background 180ms ease, box-shadow 180ms ease;
}

body.light-theme .theme-toggle-thumb {
  transform: translate(40px, -50%);
}

body.light-theme .theme-toggle-icon-light,
body:not(.light-theme) .theme-toggle-icon-dark {
  color: var(--text);
  transform: scale(1.08);
  opacity: 1;
}

body.light-theme .theme-toggle-icon-dark,
body:not(.light-theme) .theme-toggle-icon-light {
  opacity: 0.7;
}

.profile-picker {
  min-height: calc(100vh - 90px);
  display: grid;
  align-items: start;
  justify-items: center;
  padding-top: clamp(42px, 7vh, 96px);
}

.hero-panel {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  text-align: center;
  padding: 20px 24px 36px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  font-weight: 500;
  line-height: 1.02;
  margin-bottom: 60px;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 150px));
  justify-content: center;
  gap: clamp(24px, 3vw, 36px);
  list-style: none;
}

.profile-item {
  list-style: none;
}

.profile-card {
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
  transition: transform 180ms ease, opacity 180ms ease;
}

.profile-card:hover,
.profile-card:focus-visible {
  transform: scale(1.04);
  outline: none;
}

.profiles-grid:hover .profile-card:not(:hover) {
  opacity: 0.72;
}

.profile-card:hover .avatar-frame,
.profile-card:focus-visible .avatar-frame,
.profile-card.is-active .avatar-frame {
  border-color: var(--text);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.03);
}

.profile-card:hover .profile-name,
.profile-card:focus-visible .profile-name,
.profile-card.is-active .profile-name {
  color: var(--text);
  background: var(--name-active-bg);
}

.avatar-frame {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-rows: 1fr auto;
  border-radius: 8px;
  border: 3px solid transparent;
  background: var(--card-bg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.avatar-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, var(--image-top-gloss), transparent 32%),
    linear-gradient(180deg, transparent 48%, var(--image-bottom-shade));
  pointer-events: none;
}

.avatar-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.18));
  mix-blend-mode: multiply;
  pointer-events: none;
}

.avatar-frame img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  filter: contrast(1.06) saturate(0.9) brightness(0.93);
  transform: scale(1.01);
}

.profile-name {
  display: block;
  width: 100%;
  margin-top: 0;
  padding: 14px 10px 15px;
  font-family: "Manrope", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: var(--name-bg);
  border-top: 1px solid var(--surface-border);
  position: relative;
  z-index: 1;
  transition: color 180ms ease, background 180ms ease;
}

.actions {
  margin-top: 60px;
}

.manage-btn {
  margin: 0 auto;
  padding: 14px 26px;
  border: 1px solid var(--button-border);
  background: transparent;
  color: var(--button-text);
  letter-spacing: 0.2em;
  font-size: 0.82rem;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.manage-btn:hover,
.manage-btn:focus-visible {
  color: var(--text);
  border-color: var(--text);
  background: var(--button-hover-bg);
}

.selection-toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 2;
  min-width: 250px;
  padding: 16px 18px;
  border-radius: 18px;
  border: var(--toast-border);
  background: var(--toast-bg);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: slide-up 240ms ease;
}

.screen-transition {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #000000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease;
}

.screen-transition-logo {
  color: var(--brand);
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(3.8rem, 10vw, 7rem);
  letter-spacing: 0.1em;
  transform: scale(0.84);
  opacity: 0;
}

body.is-transitioning .screen-transition {
  opacity: 1;
  pointer-events: auto;
}

body.is-transitioning .screen-transition-logo {
  animation: transition-logo-in 620ms ease forwards;
}

.toast-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}

#selectedProfileName {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 4px;
}

#selectedProfileMessage {
  color: var(--muted);
  font-size: 0.92rem;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes transition-logo-in {
  from {
    opacity: 0;
    transform: scale(0.84);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 860px) {
  .page-shell {
    padding: 24px 20px 30px;
  }

  .hero-panel {
    padding-inline: 12px;
  }

  .profiles-grid {
    grid-template-columns: repeat(2, minmax(110px, 140px));
    gap: 24px 20px;
  }
}

@media (max-width: 520px) {
  .page-shell {
    padding: 18px 14px 24px;
  }

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

  .theme-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .theme-switcher-text {
    font-size: 0.76rem;
  }

  .profile-picker {
    min-height: auto;
    padding-top: 28px;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.9rem);
    margin-bottom: 34px;
  }

  .profiles-grid {
    grid-template-columns: repeat(2, minmax(108px, 1fr));
    gap: 18px 12px;
  }

  .profile-name {
    padding: 11px 8px 12px;
    font-size: 0.92rem;
  }

  .selection-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    min-width: auto;
  }
}

@media (max-width: 380px) {
  .profiles-grid {
    grid-template-columns: 1fr;
    max-width: 180px;
  }

  .hero-panel {
    width: 100%;
    padding-inline: 0;
  }

  .theme-toggle-track {
    width: 78px;
  }

  .theme-toggle-thumb {
    width: 30px;
    height: 30px;
  }

  body.light-theme .theme-toggle-thumb {
    transform: translate(36px, -50%);
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .page-shell {
    padding-top: 14px;
    padding-bottom: 18px;
  }

  .profile-picker {
    padding-top: 20px;
  }

  .topbar {
    align-items: center;
  }

  h1 {
    font-size: clamp(1.9rem, 4vw, 3rem);
    margin-bottom: 22px;
  }

  .profiles-grid {
    grid-template-columns: repeat(4, minmax(92px, 128px));
    gap: 16px 18px;
  }

  .actions {
    margin-top: 24px;
  }

  .manage-btn {
    padding: 10px 18px;
  }
}
