/* /style.css */

/* =========================
   ROOT / VARIABLES
========================= */

:root {
  --bg: #080808;
  --bg-secondary: rgba(255, 255, 255, 0.04);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-border: rgba(255, 255, 255, 0.12);
  --text: #f5f5f5;
  --text-muted: #b0b0b0;
  --accent: #8a8a8a;
  --accent-strong: #d1d1d1;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --container: 1120px;
  --nav-height: 80px;
  --footer-height: 90px;
  --transition-duration: 420ms;
  --transition-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================
   RESET / BASE
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.045), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.025), transparent 25%),
    #080808;
}

body > main {
  flex: 1 0 auto;
  min-width: 0;
}

body > #navbar,
body > #footer {
  flex: 0 0 auto;
}

body > #footer {
  margin-top: auto;
}

body.is-transitioning {
  pointer-events: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

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

img {
  display: block;
  max-width: 100%;
}

.app-table th.is-sortable {
  cursor: pointer;
  user-select: none;
}

.app-table th.is-sortable::after {
  content: "";
  display: inline-block;
  margin-left: 0.45rem;
  color: currentColor;
  opacity: 0.42;
  transform: translateY(-1px);
}

.app-table th.is-sortable.sort-asc::after {
  content: "▲";
  opacity: 0.86;
}

.app-table th.is-sortable.sort-desc::after {
  content: "▼";
  opacity: 0.86;
}

.app-table th.is-sortable[data-sort-priority]::before {
  content: attr(data-sort-priority);
  display: inline-grid;
  place-items: center;
  width: 1.35em;
  height: 1.35em;
  margin-right: 0.4rem;
  color: #050505;
  font-size: 0.72em;
  font-weight: 900;
  line-height: 1;
  background: rgba(245, 245, 245, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.12);
  opacity: 1;
  vertical-align: 0.08em;
}

body.arena-theme .app-table th.is-sortable[data-sort-priority]::before {
  color: #160b04;
  background: rgba(255, 150, 58, 0.92);
  border-color: rgba(255, 190, 122, 0.72);
  box-shadow: 0 0 14px rgba(255, 138, 50, 0.18);
}

body.sc-theme .app-table th.is-sortable[data-sort-priority]::before,
body[data-game="space-engineers-1"] .app-table th.is-sortable[data-sort-priority]::before {
  color: #031219;
  background: rgba(142, 242, 255, 0.92);
  border-color: rgba(205, 250, 255, 0.72);
  box-shadow: 0 0 14px rgba(92, 225, 255, 0.2);
}

.app-table th.is-sortable:hover {
  color: var(--text);
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* =========================
   LAYOUT / GENERIC
========================= */

.container {
  width: min(100% - 2rem, var(--container));
  margin: 0 auto;
  min-width: 0;
}

.section {
  padding: 6rem 0;
}

.page-main {
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--nav-height) - var(--footer-height));
  min-height: calc(100dvh - var(--nav-height) - var(--footer-height));
}

.hero .container,
.page-main .container {
  width: min(100% - 2rem, var(--container));
}

.card {
  padding: 1.5rem;
  min-width: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

#home {
  scroll-margin-top: 100px;
}

/* =========================
   PAGE TRANSITIONS
========================= */

.page-transition {
  display: none !important;
}

body.is-transitioning .page-transition {
  opacity: 0;
}

body.is-transitioning .header,
body.is-transitioning main,
body.is-transitioning .footer {
  animation: none;
  will-change: auto;
}

body.page-enter .header,
body.page-enter main,
body.page-enter .footer {
  animation: none;
  will-change: auto;
}

@keyframes transition-content-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(14px) scale(0.995);
  }
}

@keyframes page-content-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

/* =========================
   HEADER / NAVBAR
========================= */
.nav-notification-item {
  display: block;
  width: 100%;
  padding: 0.95rem 1rem;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-notification-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.nav-notification-item:last-child {
  border-bottom: none;
}

.nav-notification-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.nav-notification-item-top strong {
  font-size: 0.92rem;
}

.nav-notification-item-top span {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.nav-notification-item-message {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.nav-notification-item-time {
  margin-top: 0.45rem;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.7rem;
  line-height: 1.2;
}

.nav-notification-section,
.nav-notification-history {
  display: grid;
}

.nav-notification-section-header,
.nav-notification-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-notification-section-header strong,
.nav-notification-history-toggle strong {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-notification-section-body,
.nav-notification-history-body {
  display: grid;
}

.nav-notification-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  color: var(--text);
  font: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-notification-history-toggle span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.72rem;
}

.nav-notification-clear-history {
  padding: 0.2rem 0.42rem;
  color: rgba(255, 232, 232, 0.96);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #321a1a;
  border: 1px solid rgba(255, 198, 198, 0.08);
  border-radius: 999px;
  cursor: pointer;
  transition:
    filter 0.2s ease,
    opacity 0.2s ease;
}

.nav-notification-clear-history:hover:not(:disabled) {
  filter: brightness(1.08);
}

.nav-notification-clear-history:disabled {
  opacity: 0.42;
  cursor: default;
}

#navbar {
  position: sticky;
  top: 0;
  z-index: 7000;
}

.header {
  position: sticky;
  top: 0;
  z-index: 7000;
  background: rgba(12, 12, 12, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--nav-height);
}

.logo {
  --logo-hover-accent: rgba(255, 255, 255, 0.72);
  --logo-hover-soft: rgba(255, 255, 255, 0.12);
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.35rem;
  border-radius: 14px;
  isolation: isolate;
  overflow: hidden;
  outline: none;
}

.logo::before {
  content: "";
  position: absolute;
  inset: -12px;
  z-index: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 45%, var(--logo-hover-soft), transparent 62%),
    linear-gradient(
      120deg,
      transparent 18%,
      rgba(255, 255, 255, 0.18) 42%,
      transparent 66%
    );
  filter: blur(10px);
  transform: translateX(-18%) scale(0.96);
  transition:
    opacity 0.35s ease,
    transform 0.5s ease;
}

.logo::after {
  content: "";
  position: absolute;
  inset: 8px 2px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 35%,
    rgba(255, 255, 255, 0.42) 48%,
    transparent 62%,
    transparent 100%
  );
  mix-blend-mode: screen;
  transform: translateX(-135%) skewX(-16deg);
  transition:
    opacity 0.25s ease,
    transform 0.72s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.logo:hover::before,
.logo:focus-visible::before {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.logo:hover::after,
.logo:focus-visible::after {
  opacity: 1;
  transform: translateX(135%) skewX(-16deg);
}

.logo-img {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: 50px;
  filter:
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.1))
    drop-shadow(0 8px 16px rgba(0, 0, 0, 0.28));
  transition:
    transform 0.35s ease,
    filter 0.35s ease,
    opacity 0.35s ease;
}

.logo:hover .logo-img,
.logo:focus-visible .logo-img {
  opacity: 0.96;
  transform: translateY(-1px) scale(1.025);
  filter:
    drop-shadow(0 0 10px var(--logo-hover-accent))
    drop-shadow(0 14px 24px rgba(0, 0, 0, 0.38));
}

body.arena-theme .logo {
  --logo-hover-accent: rgba(255, 138, 50, 0.55);
  --logo-hover-soft: rgba(255, 138, 50, 0.12);
}

body[data-game="space-engineers-1"] .logo {
  --logo-hover-accent: rgba(112, 196, 255, 0.55);
  --logo-hover-soft: rgba(112, 196, 255, 0.12);
}

body.sc-theme .logo {
  --logo-hover-accent: rgba(92, 225, 255, 0.55);
  --logo-hover-soft: rgba(92, 225, 255, 0.12);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link,
.dropdown-toggle {
  position: relative;
  color: var(--text-muted);
  transition: color 0.25s ease;
}

.nav-link:hover,
.nav-link.active,
.dropdown-toggle:hover,
.dropdown-toggle.active-dropdown,
.dropdown.open .dropdown-toggle {
  color: var(--text);
}

.nav-link::after,
.dropdown-toggle::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after,
.dropdown-toggle:hover::after,
.dropdown-toggle.active-dropdown::after,
.dropdown.open .dropdown-toggle::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  width: 48px;
  height: 48px;
  padding: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  margin: 5px 0;
  background: var(--text);
  transition: 0.3s ease;
}

/* =========================
   NAV USER DROPDOWN
========================= */

/* =========================
   NAV NOTIFICATIONS
========================= */

.nav-notification-dropdown {
  position: relative;
}

.nav-notification-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.25s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease;
}

.nav-notification-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.nav-notification-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 3px;
}

.nav-notification-icon {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
}

.nav-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, #ff5a5a, #ff8744);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(255, 90, 90, 0.28);
}

.nav-notification-badge[hidden] {
  display: none !important;
}

.nav-timer[hidden],
body:not([data-game="star-citizen"]) .nav-timer {
  display: none !important;
}

.nav-timer {
  display: flex;
  align-items: center;
  margin-right: -0.95rem;
}

.nav-timer-shell {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 0.45rem;
}

.nav-timer-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  color: var(--text);
  background: rgba(92, 225, 255, 0.045);
  border: 1px solid rgba(92, 225, 255, 0.24);
  border-radius: 0;
  cursor: pointer;
  transition:
    width 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.nav-timer-toggle:hover,
.nav-timer.is-open .nav-timer-toggle,
.nav-timer.is-running .nav-timer-toggle {
  color: #e8fbff;
  background: rgba(92, 225, 255, 0.085);
  border-color: rgba(92, 225, 255, 0.42);
  transform: translateY(-1px);
}

.nav-timer.is-running .nav-timer-toggle {
  width: 92px;
  min-width: 92px;
  padding: 0 0.78rem;
  justify-content: center;
}

.nav-timer-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 1.28rem;
  line-height: 1;
}

.nav-timer-text {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-timer-text:empty {
  display: none;
}

.nav-timer-inputs {
  width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition:
    width 0.22s ease,
    max-width 0.22s ease,
    opacity 0.16s ease;
}

.nav-timer.is-open .nav-timer-inputs {
  width: 202px;
  max-width: 202px;
  opacity: 1;
  pointer-events: auto;
}

.nav-timer-inputs label {
  display: block;
}

.nav-timer-inputs input {
  width: 46px;
  min-height: 34px;
  padding: 0.28rem 0.5rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  outline: none;
}

.nav-timer-inputs input::placeholder {
  color: rgba(255, 255, 255, 0.44);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-timer-inputs input::-webkit-outer-spin-button,
.nav-timer-inputs input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.nav-timer-inputs input[type="number"] {
  appearance: textfield;
}

.nav-timer-inputs input:focus {
  border-color: rgba(92, 225, 255, 0.38);
  box-shadow: 0 0 0 1px rgba(92, 225, 255, 0.12);
}

.nav-timer-actions {
  display: grid;
  grid-template-columns: 54px 28px;
  column-gap: 0;
  row-gap: 0.28rem;
}

.nav-timer-action {
  min-width: 54px;
  min-height: 24px;
  padding: 0.16rem 0.46rem;
  color: #061318;
  background: #8ef2ff;
  border: 1px solid rgba(205, 250, 255, 0.72);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-timer-action.secondary {
  grid-column: 1;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-timer-action.is-stop {
  color: #fff3f5;
  background: #8d1626;
  border-color: rgba(255, 98, 116, 0.64);
}

.nav-timer-action.is-stop:not(:only-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.nav-timer-pause-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 24px;
  padding: 0;
  color: #fff5d8;
  background: #b36a11;
  border: 1px solid rgba(255, 190, 89, 0.72);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
}

.nav-timer-pause-action[hidden] {
  display: none;
}

.nav-timer.is-paused .nav-timer-pause-action {
  color: #061318;
  background: #8ef2ff;
  border-color: rgba(205, 250, 255, 0.72);
}

.nav-notification-menu {
  position: absolute;
  top: calc(100% + 0.7rem);
  right: 0;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: 420px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  background: rgba(18, 18, 18, 0.96);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: translateY(-8px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
  z-index: 1100;
}

.nav-notification-dropdown.open .nav-notification-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-notification-header {
  padding: 0.95rem 1rem 0.8rem;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-notification-list {
  max-height: 340px;
  overflow-y: auto;
}

.nav-notification-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.nav-notification-empty.compact {
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

/* 7. UNREAD NOTIFICATIONS */
.nav-notification-item.is-unread {
  background: #1f2e1f;
}

.nav-notification-item.is-unread:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-user-dropdown {
  position: relative;
}

.nav-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.25s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease;
}

.nav-user-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.nav-user-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 3px;
}

.nav-user-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #555, #aaa);
  box-shadow: 0 8px 18px rgba(255, 255, 255, 0.08);
}

.nav-user-avatar.has-profile-image {
  background-color: #050505;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  color: transparent;
  overflow: hidden;
}

.nav-user-avatar.default-profile-image {
  background-size: 132%;
}

.nav-user-name {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
}

.nav-user-arrow {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.nav-user-dropdown.open .nav-user-arrow {
  transform: rotate(180deg);
}

.nav-user-menu {
  position: absolute;
  top: calc(100% + 0.7rem);
  right: 0;
  min-width: 190px;
  padding: 0.45rem;
  opacity: 0;
  visibility: hidden;
  background: rgba(18, 18, 18, 0.96);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: translateY(-8px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
  z-index: 1100;
}

.nav-user-dropdown.open .nav-user-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-user-link {
  display: block;
  width: 100%;
  padding: 0.8rem 0.95rem;
  color: var(--text-muted);
  font: inherit;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.nav-user-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

.nav-user-link.danger {
  color: #ff9b9b;
}

.nav-user-link.danger:hover {
  color: #fff;
  background: rgba(255, 90, 90, 0.12);
}

/* =========================
   USER PREVIEW CARD
========================= */

.user-preview-link {
  --user-preview-accent: rgba(191, 191, 191, 0.72);
  --user-preview-bg-start: rgba(196, 126, 72, 0.62);
  --user-preview-bg-end: rgba(82, 42, 20, 0.8);
  --user-preview-line: rgba(237, 177, 110, 0.26);
  --user-preview-glow: rgba(237, 177, 110, 0.16);
  color: inherit;
  text-decoration: none;
}

.user-preview-link:hover,
.user-preview-link:focus-visible {
  color: #fff;
}

.user-preview-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 500;
  width: min(280px, calc(100vw - 2rem));
  padding: 0.9rem;
  color: rgba(245, 245, 245, 0.94);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transform-origin: left top;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(
      135deg,
      var(--user-preview-bg-start),
      var(--user-preview-bg-end)
    );
  border: 1px solid var(--user-preview-line);
  border-radius: 16px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.035) inset,
    0 0 28px var(--user-preview-glow);
  backdrop-filter: blur(18px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s ease;
}

.user-preview-card[data-user-preview-card] {
  display: none;
}

.user-preview-floating-card {
  z-index: 2147483000;
}

.user-preview-floating-card.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.user-preview-card::before {
  content: "";
  position: absolute;
  left: 18px;
  top: -6px;
  width: 10px;
  height: 10px;
  background: linear-gradient(
    135deg,
    var(--user-preview-bg-start),
    var(--user-preview-bg-end)
  );
  border-left: 1px solid var(--user-preview-line);
  border-top: 1px solid var(--user-preview-line);
  transform: rotate(45deg);
}

.user-preview-card[data-user-preview-rank="bronze"] {
  --user-preview-bg-start: rgba(196, 126, 72, 0.62);
  --user-preview-bg-end: rgba(82, 42, 20, 0.8);
  --user-preview-line: rgba(237, 177, 110, 0.26);
  --user-preview-glow: rgba(237, 177, 110, 0.16);
}

.user-preview-card[data-user-preview-rank="silver"] {
  --user-preview-bg-start: rgba(158, 168, 182, 0.6);
  --user-preview-bg-end: rgba(74, 84, 98, 0.76);
  --user-preview-line: rgba(222, 232, 245, 0.22);
  --user-preview-glow: rgba(194, 210, 232, 0.16);
}

.user-preview-card[data-user-preview-rank="gold"] {
  --user-preview-bg-start: rgba(222, 171, 60, 0.64);
  --user-preview-bg-end: rgba(102, 62, 10, 0.78);
  --user-preview-line: rgba(255, 220, 122, 0.26);
  --user-preview-glow: rgba(255, 210, 94, 0.18);
}

.user-preview-card[data-user-preview-rank="platinum"] {
  --user-preview-bg-start: rgba(140, 176, 204, 0.64);
  --user-preview-bg-end: rgba(58, 76, 104, 0.76);
  --user-preview-line: rgba(184, 228, 255, 0.24);
  --user-preview-glow: rgba(132, 194, 255, 0.16);
}

.user-preview-card[data-user-preview-rank="diamond"] {
  --user-preview-bg-start: rgba(86, 214, 255, 0.62);
  --user-preview-bg-end: rgba(18, 86, 112, 0.76);
  --user-preview-line: rgba(128, 238, 255, 0.28);
  --user-preview-glow: rgba(86, 214, 255, 0.2);
}

.user-preview-card[data-user-preview-rank="master"] {
  --user-preview-bg-start: rgba(180, 58, 72, 0.62);
  --user-preview-bg-end: rgba(78, 16, 22, 0.76);
  --user-preview-line: rgba(255, 148, 166, 0.22);
  --user-preview-glow: rgba(224, 86, 106, 0.16);
}

.user-preview-card[data-user-preview-rank="grandmaster"] {
  --user-preview-bg-start: rgba(140, 56, 88, 0.62);
  --user-preview-bg-end: rgba(58, 14, 34, 0.76);
  --user-preview-line: rgba(245, 166, 204, 0.22);
  --user-preview-glow: rgba(206, 92, 150, 0.18);
}

.user-preview-card[data-user-preview-rank="challenger"] {
  --user-preview-bg-start: rgba(74, 130, 255, 0.62);
  --user-preview-bg-end: rgba(18, 38, 98, 0.78);
  --user-preview-line: rgba(148, 188, 255, 0.24);
  --user-preview-glow: rgba(94, 148, 255, 0.2);
}

.user-preview-card[data-user-preview-rank="apex"] {
  --user-preview-bg-start: rgba(210, 154, 58, 0.62);
  --user-preview-bg-end: rgba(24, 24, 26, 0.84);
  --user-preview-line: rgba(255, 213, 132, 0.24);
  --user-preview-glow: rgba(216, 164, 72, 0.18);
}

.user-preview-card[data-user-preview-rank="titan"] {
  --user-preview-bg-start: rgba(116, 144, 188, 0.62);
  --user-preview-bg-end: rgba(26, 34, 52, 0.82);
  --user-preview-line: rgba(182, 210, 255, 0.22);
  --user-preview-glow: rgba(116, 166, 255, 0.18);
}

.user-preview-card[data-user-preview-rank="eternal"] {
  --user-preview-bg-start: rgba(48, 156, 148, 0.62);
  --user-preview-bg-end: rgba(12, 52, 50, 0.78);
  --user-preview-line: rgba(124, 246, 230, 0.22);
  --user-preview-glow: rgba(60, 220, 200, 0.16);
}

.user-preview-card[data-user-preview-rank="ascended"] {
  --user-preview-bg-start: rgba(216, 240, 255, 0.66);
  --user-preview-bg-end: rgba(116, 166, 188, 0.74);
  --user-preview-line: rgba(244, 251, 255, 0.26);
  --user-preview-glow: rgba(172, 232, 255, 0.18);
}

.user-preview-card[data-user-preview-rank="mythic"] {
  --user-preview-bg-start: rgba(106, 76, 190, 0.62);
  --user-preview-bg-end: rgba(40, 20, 92, 0.8);
  --user-preview-line: rgba(188, 164, 255, 0.24);
  --user-preview-glow: rgba(122, 96, 238, 0.18);
}

.user-preview-card[data-user-preview-rank="immortal"] {
  --user-preview-bg-start: rgba(160, 36, 48, 0.62);
  --user-preview-bg-end: rgba(32, 8, 10, 0.84);
  --user-preview-line: rgba(255, 108, 124, 0.26);
  --user-preview-glow: rgba(220, 54, 70, 0.2);
}

.user-preview-card[data-user-preview-rank="celestial"] {
  --user-preview-bg-start: rgba(46, 82, 162, 0.62);
  --user-preview-bg-end: rgba(10, 18, 48, 0.8);
  --user-preview-line: rgba(132, 194, 255, 0.24);
  --user-preview-glow: rgba(92, 186, 255, 0.18);
}

.user-preview-card[data-user-preview-rank="omega"] {
  --user-preview-bg-start: rgba(160, 44, 60, 0.62);
  --user-preview-bg-end: rgba(18, 18, 20, 0.84);
  --user-preview-line: rgba(255, 154, 132, 0.22);
  --user-preview-glow: rgba(240, 88, 62, 0.2);
}

.user-preview-card[data-user-preview-rank="infinite"] {
  --user-preview-bg-start: rgba(90, 132, 255, 0.62);
  --user-preview-bg-end: rgba(22, 10, 42, 0.82);
  --user-preview-line: rgba(198, 164, 255, 0.28);
  --user-preview-glow: rgba(138, 114, 255, 0.24);
}

.user-preview-floating-card.is-above::before {
  top: auto;
  bottom: -6px;
  border-top: 0;
  border-left: 0;
  border-right: 1px solid var(--user-preview-line);
  border-bottom: 1px solid var(--user-preview-line);
}

.user-preview-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.user-preview-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  background: #000;
  border: 1px solid var(--user-preview-line);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.user-preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.user-preview-avatar.is-default-profile img {
  transform: scale(1.22);
}

.user-preview-name {
  display: block;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.15;
}

.user-preview-role {
  display: inline-flex;
  width: fit-content;
  margin-top: 0.32rem;
  padding: 0.25rem 0.52rem;
  color: #f7f7f7;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border: 1px solid var(--user-preview-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.user-preview-role.member {
  color: #f4d58a;
  background: rgba(176, 132, 36, 0.18);
  border-color: rgba(244, 213, 138, 0.32);
}

.user-preview-role.admin {
  color: #ffb6b6;
  background: rgba(126, 31, 31, 0.32);
  border-color: rgba(255, 132, 132, 0.34);
}

.user-preview-role.pending {
  color: #d6d6d6;
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.16);
}

.user-preview-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.user-preview-meta-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.48rem 0.58rem;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 10px;
}

.user-preview-meta-row span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-preview-meta-row strong {
  min-width: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.76rem;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-preview-bio {
  display: block;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  line-height: 1.45;
}

.user-preview-open {
  display: inline-flex;
  margin-top: 0.75rem;
  color: var(--user-preview-accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.arena-theme .user-preview-link {
  --user-preview-accent: #ff8a32;
  --user-preview-bg: rgba(17, 12, 9, 0.97);
  --user-preview-line: rgba(255, 138, 50, 0.24);
}

body[data-game="space-engineers-1"] .user-preview-link {
  --user-preview-accent: #70c4ff;
  --user-preview-bg: rgba(5, 13, 20, 0.97);
  --user-preview-line: rgba(112, 196, 255, 0.24);
}

body.sc-theme .user-preview-link {
  --user-preview-accent: #5ce1ff;
  --user-preview-bg: rgba(4, 12, 18, 0.97);
  --user-preview-line: rgba(92, 225, 255, 0.24);
}

/* =========================
   DROPDOWN
========================= */

.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}

.dropdown-arrow {
  font-size: 0.9rem;
  transition: transform 0.25s ease;
}

.dropdown.open .dropdown-arrow,
.dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 1rem);
  left: 0;
  min-width: 250px;
  padding: 0.6rem;
  opacity: 0;
  visibility: hidden;
  background: rgba(18, 18, 18, 0.96);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: translateY(-8px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s ease;
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-link {
  display: block;
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  border-radius: 12px;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.dropdown-link:hover,
.dropdown-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.dropdown-link:hover {
  transform: translateX(4px);
}

/* =========================
   HERO / LANDING
========================= */

.hero {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--nav-height) - var(--footer-height));
  min-height: calc(100dvh - var(--nav-height) - var(--footer-height));
  padding-top: 20rem;
}

.hero h1,
.page-main h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.05;
}

.hero-title {
  display: grid;
  gap: 0.34em;
  width: fit-content;
  max-width: min(100%, 920px);
  overflow: visible;
}

.hero-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.28em;
  opacity: 0;
  transform: translateY(26px);
  filter: blur(8px);
  animation: heroTitleIn 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-title-line-main {
  font-size: clamp(1.05rem, 1.25vw, 1.35rem);
  line-height: 1;
  animation-delay: 180ms;
}

.hero-second-line {
  display: block;
  line-height: 0.9;
  animation-delay: 420ms;
}

.hero-welcome-text {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78em;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.1rem;
  padding: 0.42rem 0.78rem;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.86em;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.045)),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 14px 34px rgba(0, 0, 0, 0.28);
}

.hero h1 .hero-brand {
  display: inline-block;
  color: transparent;
  background:
    linear-gradient(
      105deg,
      #8f8f8f 0%,
      #e9e9e9 38%,
      #ffffff 50%,
      #b8b8b8 64%,
      #777777 100%
    );
  background-size: 220% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: heroSilverSheen 4.8s ease-in-out 1.1s infinite;
  filter:
    drop-shadow(0 0 26px rgba(255, 255, 255, 0.08))
    drop-shadow(0 18px 34px rgba(0, 0, 0, 0.45));
}

@keyframes heroTitleIn {
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes heroSilverSheen {
  0%,
  100% {
    background-position: 0% 50%;
  }

  45%,
  55% {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-title-line,
  .hero h1 .hero-brand {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }
}

.hero p,
.page-main p {
  max-width: 620px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* =========================
   404 / NOT FOUND
========================= */

.not-found-main {
  min-height: calc(100vh - var(--nav-height) - var(--footer-height));
  min-height: calc(100dvh - var(--nav-height) - var(--footer-height));
}

.not-found-hero {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--nav-height) - var(--footer-height));
  min-height: calc(100dvh - var(--nav-height) - var(--footer-height));
  padding-top: 16rem;
}

.not-found-kicker {
  margin-bottom: 0.8rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.not-found-title {
  margin-bottom: 1.25rem;
}

.not-found-title .hero-brand {
  color: transparent;
  background:
    linear-gradient(
      105deg,
      #8f8f8f 0%,
      #e9e9e9 38%,
      #ffffff 50%,
      #b8b8b8 64%,
      #8f8f8f 100%
    );
  background-size: 220% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: heroSilverSheen 4.8s ease-in-out 1.1s infinite;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.06);
}

.not-found-text {
  max-width: 620px;
  color: var(--text-muted);
  font-size: 1.08rem;
  line-height: 1.65;
  animation-delay: 620ms;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.8rem;
}

.not-found-actions-line {
  animation-delay: 780ms;
}

.not-found-primary,
.not-found-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.85rem 1.15rem;
  font-weight: 800;
  text-decoration: none;
  border-radius: 12px;
  transition:
    transform 0.2s ease,
    filter 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.not-found-primary {
  color: #080808;
  background: linear-gradient(180deg, #f1f1f1, #a8a8a8);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.not-found-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.not-found-primary:hover,
.not-found-secondary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  border-color: rgba(255, 255, 255, 0.26);
}

/* =========================
   FOOTER
========================= */

.footer {
  margin-top: 0;
  padding: 2rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer a {
  color: var(--text-muted);
  transition: color 0.25s ease;
}

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

/* =========================
   LOGIN / AUTH
========================= */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
    background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.05), transparent 35%),
    radial-gradient(circle at bottom center, rgba(255, 255, 255, 0.035), transparent 30%),
    rgba(6, 6, 6, 0.9);
  backdrop-filter: blur(10px);
}

body.auth-pending .auth-overlay {
  display: none;
}

.auth-card {
  width: min(100%, 430px);
  max-height: none;
  margin: auto 0;
  padding: 2rem;
  text-align: center;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.03)
    ),
    rgba(16, 16, 16, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.auth-logo {
  width: 360px;
  height: auto;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.12));
}

.auth-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  line-height: 1.1;
}

.auth-subtitle {
  margin: 0.65rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
  text-align: left;
}

.auth-field {
  display: grid;
  gap: 0.45rem;
}

.auth-field label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  padding: 0.95rem 1rem;
  color: var(--text);
  font: inherit;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.auth-field input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.auth-submit-btn {
  margin-top: 0.5rem;
  padding: 1rem 1.1rem;
  color: white;
  font: inherit;
  font-weight: 700;
  background: linear-gradient(90deg, #555, #aaa);
  box-shadow: 0 12px 24px rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-submit-btn:hover {
  transform: translateY(-2px) scale(1.02);
  background: #ffffff;
  color: #000000;
}

.auth-text-btn {
  justify-self: end;
  width: fit-content;
  margin-top: -0.35rem;
  padding: 0.2rem 0;
  color: rgba(255, 255, 255, 0.68);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.auth-text-btn:hover,
.auth-text-btn:focus-visible {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.22rem;
  outline: none;
}

.auth-text-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.auth-error {
  min-height: 1.25rem;
  margin-top: 1rem;
  color: #ff8f8f;
  font-size: 0.95rem;
}

.auth-success {
  min-height: 1.25rem;
  margin-top: 1rem;
  color: #8fffb0;
  font-size: 0.95rem;
}

.auth-toggle-btn {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.95rem 1rem;
  color: #d9deea;
  font: inherit;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.auth-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-popup {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.auth-popup.is-open {
  opacity: 1;
  pointer-events: auto;
}

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

.auth-popup-box {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 1.45rem;
  text-align: center;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.1),
      rgba(255, 255, 255, 0.035)
    ),
    rgba(18, 18, 18, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(10px) scale(0.98);
  transition: transform 180ms ease;
}

.auth-popup.is-open .auth-popup-box {
  transform: translateY(0) scale(1);
}

.auth-popup-kicker {
  margin: 0 0 0.55rem;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-popup-box h3 {
  margin: 0 0 0.75rem;
  color: #fff;
  font-size: 1.45rem;
}

.auth-popup-text {
  margin: 0 0 1.1rem;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.55;
}

@media (max-height: 900px) {
  .auth-overlay {
    padding-block: 1rem;
  }

  .auth-card {
    margin-block: 0;
    padding: 1.35rem 1.65rem;
  }

  .auth-logo {
    width: min(240px, 70%);
    margin-bottom: 0.75rem;
  }

  .auth-card h2 {
    font-size: 1.72rem;
  }

  .auth-form {
    gap: 0.75rem;
  }

  .auth-field {
    gap: 0.3rem;
  }

  .auth-field input {
    padding: 0.78rem 0.9rem;
  }

  .auth-submit-btn,
  .auth-toggle-btn {
    padding: 0.82rem 0.95rem;
  }

  .auth-divider {
    margin: 1rem 0 0.75rem;
  }
}

body:not(.is-authenticated):not(.public-page) #navbar,
body:not(.is-authenticated):not(.public-page) main,
body:not(.is-authenticated):not(.public-page) #footer {
  visibility: hidden;
}

.auth-blur {
  filter: blur(4px);
  opacity: 0.5;
  pointer-events: none;
  transition:
    filter 0.3s ease,
    opacity 0.3s ease;
}

/* =========================
   LOGOUT BUTTON
========================= */

#logoutBtn {
  justify-content: flex-start;
}

/* =========================
   ACCESSIBILITY / REDUCED MOTION
========================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================
   ROLE-BASED UI
========================= */

.admin-only {
  display: none !important;
}

body.is-admin .admin-only {
  display: revert !important;
}

body.is-admin .admin-only.flex {
  display: flex !important;
}

body.is-admin .admin-only.grid {
  display: grid !important;
}

body.is-admin .admin-only.inline-flex {
  display: inline-flex !important;
}

body.is-guest .guest-hidden,
body:not(.is-admin) .guest-hidden {
  display: none !important;
}

/* =========================
   MOBILE / TABLET
========================= */

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }

  body.menu-open {
    overflow: hidden;
  }

  .navbar {
    min-height: 72px;
  }

  .logo-img {
    height: 42px;
  }

  .nav-toggle {
    width: 52px;
    height: 52px;
    padding: 0.8rem;
  }

  .nav-menu {
    position: absolute;
    top: calc(var(--nav-height) - 0.5rem);
    right: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: auto;
    gap: 0.4rem;
    padding: 0.85rem;
    opacity: 0;
    visibility: hidden;
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    transform: translateY(-10px);
    transition:
      opacity 0.25s ease,
      transform 0.25s ease,
      visibility 0.25s ease;
  }

  .nav-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-menu li,
  .dropdown {
    width: 100%;
  }

  .dropdown:hover .dropdown-menu {
    display: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
  }

  .nav-link,
  .dropdown-toggle,
  #logoutBtn {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 1rem;
    border-radius: 12px;
  }

  .dropdown-toggle {
    justify-content: space-between;
  }

  .dropdown-menu {
    position: static;
    display: none;
    min-width: 100%;
    margin-top: 0.8rem;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .dropdown.open .dropdown-menu {
    display: block !important;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .dropdown-link {
    display: flex;
    align-items: center;
    min-height: 46px;
  }

  .nav-timer,
  .nav-notification-dropdown,
  .nav-user-dropdown {
    width: 100%;
  }

  .nav-timer-shell {
    width: 100%;
    flex-direction: column-reverse;
  }

  .nav-timer-toggle,
  .nav-notification-btn,
  .nav-user-btn {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
  }

  .nav-timer.is-open .nav-timer-inputs {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .nav-notification-menu,
  .nav-user-menu {
    position: static;
    width: 100%;
    margin-top: 0.8rem;
  }

  .nav-notification-dropdown:not(.open) .nav-notification-menu,
  .nav-user-dropdown:not(.open) .nav-user-menu {
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

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

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

@media (max-width: 640px) {
  :root {
    --footer-height: 134px;
  }

  .container {
    width: min(100% - 1.25rem, var(--container));
  }

  .card {
    padding: 1rem;
    border-radius: 14px;
  }

  .section {
    padding: 4.5rem 0;
  }

  .hero,
  .page-main {
    align-items: flex-start;
    padding-top: 3rem;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero h1,
  .page-main h1 {
    font-size: clamp(2.2rem, 12vw, 3.5rem);
    line-height: 1.1;
  }

  .hero-title-line-main {
    font-size: 1rem;
  }

  .hero-user-pill {
    min-height: 1.9rem;
    padding: 0.36rem 0.64rem;
  }

  .auth-card {
    padding: 1.4rem;
    border-radius: 20px;
  }

  .auth-card h2 {
    font-size: 1.65rem;
  }

  .auth-logo {
    width: min(150px, 58%);
  }

  .footer-content,
  .footer-links {
    width: 100%;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}
