@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #0b0f14;
  --bg-raised: #10161d;
  --surface: #141b23;
  --surface-2: #1a232d;
  --surface-hover: #1f2a36;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #e9eef3;
  --text-2: #a9b6c4;
  --text-3: #74859a;
  --accent: #1fc8db;
  --accent-strong: #12aebf;
  --accent-soft: rgba(31, 200, 219, 0.12);
  --on-accent: #04191c;
  --success: #3fcf8e;
  --success-soft: rgba(63, 207, 142, 0.12);
  --warning: #f5b544;
  --warning-soft: rgba(245, 181, 68, 0.13);
  --danger: #f2555a;
  --danger-soft: rgba(242, 85, 90, 0.12);
  --staff: #ff8a1f;
  --staff-soft: rgba(255, 138, 31, 0.13);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --focus: 0 0 0 3px rgba(31, 200, 219, 0.35);
  --t-fast: 120ms ease;
  --t: 180ms ease;
}

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

html {
  scroll-behavior: smooth;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
}

.loading p {
  color: var(--text-3);
  font-size: 0.9rem;
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.content {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

.profileBanner {
  position: relative;
  height: 240px;
  overflow: hidden;
  background:
    radial-gradient(700px 300px at 20% 0%, rgba(31, 200, 219, 0.18), transparent 70%),
    radial-gradient(500px 260px at 90% 100%, rgba(255, 59, 59, 0.08), transparent 70%),
    var(--bg-raised);
  border-bottom: 1px solid var(--line);
}

.profileBanner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(11, 15, 20, 0.75));
}

.profileWrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: -90px;
  padding: 0 16px 64px;
}

.profileCard {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s ease-out both;
}

.profileTop {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 28px;
}

.avatarContainer {
  position: relative;
  flex-shrink: 0;
}

.profileAvatar {
  display: block;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-raised);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow);
}

.statusDot {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  background: var(--success);
}

.profileIdentity {
  flex: 1;
  min-width: 0;
}

.profileIdentity h1 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.profileIdentity p {
  margin-bottom: 14px;
  color: var(--text-2);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.profileBadges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge.admin {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.staff {
  background: var(--staff-soft);
  color: var(--staff);
}

.badge.user {
  background: var(--accent-soft);
  color: var(--accent);
}

.profileGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.infoCard {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  transition: border-color var(--t-fast);
}

.infoCard:hover {
  border-color: var(--line-strong);
}

.infoCard span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 600;
}

.infoCard h3 {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.statsGrid,
.staffGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.statCard {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  text-align: center;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.statCard:hover {
  border-color: rgba(31, 200, 219, 0.35);
}

.statCard span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 600;
}

.statCard h2 {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#messageBox {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.5;
}

#messageBox.success {
  background: var(--success-soft);
  border-color: rgba(63, 207, 142, 0.35);
  color: var(--success);
}

#messageBox.error {
  background: var(--danger-soft);
  border-color: rgba(242, 85, 90, 0.35);
  color: var(--danger);
}

#messageBox.warning {
  background: var(--warning-soft);
  border-color: rgba(245, 181, 68, 0.35);
  color: var(--warning);
}

#messageBox.info {
  background: var(--accent-soft);
  border-color: rgba(31, 200, 219, 0.35);
  color: var(--accent);
}

#messageBox:empty {
  display: none;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 6, 10, 0.7);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}

.popup {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.popup-header h3 {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 700;
}

.popup-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  background: var(--bg-raised);
}

.photo-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.photo-card:hover {
  border-color: rgba(31, 200, 219, 0.4);
  transform: translateY(-2px);
}

.popup-photo {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform var(--t);
}

.popup-photo:hover {
  transform: scale(1.03);
}

.photo-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  color: var(--text-2);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.photo-info p {
  margin: 0;
  line-height: 1.45;
}

.close-popup {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.close-popup:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.callCenter {
  margin-top: 28px;
  color: var(--text-3);
  font-size: 0.85rem;
  text-align: center;
}

.callCenter a {
  color: var(--accent);
  font-weight: 600;
}

.none {
  display: none !important;
}

.badges-earned-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}

.badge-earned {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.badge-earned:hover {
  border-color: rgba(31, 200, 219, 0.45);
  transform: translateY(-2px);
}

.badge-earned img {
  display: block;
  width: 52px;
  height: 52px;
  padding: 4px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
}

.badge-earned span {
  max-width: 80px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

.badge-progress-item {
  margin-bottom: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color var(--t-fast);
}

.badge-progress-item:hover {
  border-color: var(--line-strong);
}

.badge-progress-title {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.badge-progress-bar {
  width: 100%;
  height: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.badge-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.badge-progress-text {
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
  font-size: 0.8rem;
}

.badge-progress-current {
  color: var(--accent);
  font-weight: 700;
}

.badge-section {
  margin-bottom: 24px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}

.badge-section h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
}

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

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  text-align: center;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.badge-card:hover {
  border-color: rgba(31, 200, 219, 0.45);
  transform: translateY(-2px);
}

.badge-card img {
  display: block;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  padding: 3px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
}

.badge-card-name {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.badge-card-date {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 0.72rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (max-width: 992px) {
  .profileCard {
    padding: 26px;
  }
}

@media (max-width: 768px) {
  .profileBanner {
    height: 190px;
  }

  .profileWrapper {
    margin-top: -64px;
  }

  .profileTop {
    flex-direction: column;
    gap: 18px;
    text-align: center;
  }

  .profileIdentity p {
    font-size: 0.92rem;
  }

  .profileBadges {
    justify-content: center;
  }

  #statHiddenCard {
    display: none;
  }

  .popup {
    max-height: 90vh;
  }

  .popup-content {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .popup-photo {
    height: 180px;
  }

  .badges-earned-list {
    gap: 10px;
    padding: 12px;
  }

  .badge-earned {
    padding: 12px;
  }

  .badge-earned img {
    width: 44px;
    height: 44px;
  }

  .badge-section {
    padding: 18px;
  }

  .badges-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
  }

  .badge-card {
    padding: 12px;
  }

  .badge-card img {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .profileCard {
    padding: 20px 16px;
  }

  .profileAvatar {
    width: 104px;
    height: 104px;
  }

  .infoCard {
    padding: 14px;
  }

  .badges-earned-list {
    flex-direction: column;
  }

  .badge-earned {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
  }

  .badge-earned span {
    max-width: none;
    text-align: left;
  }

  .badges-grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  }
}

button.badge-earned {
  color: inherit;
  font: inherit;
  text-align: center;
}

.badge-earned small {
  color: var(--text-3);
  font-size: 0.7rem;
}

.badge-earned:focus-visible {
  border-color: var(--accent);
}

.empty-text {
  width: 100%;
  padding: 24px;
  color: var(--text-3);
  text-align: center;
}

.private-box {
  grid-column: 1 / -1;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  border: 1px solid rgba(242, 85, 90, 0.3);
  color: var(--danger);
  text-align: center;
}

.private-box strong {
  display: block;
  font-size: 1.05rem;
}

.private-box p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 0.88rem;
}

.badge-popup {
  max-width: 420px;
}

.badge-detail {
  --badge-color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 24px 24px;
  overflow-y: auto;
  text-align: center;
}

.badge-detail__icon {
  width: 88px;
  height: 88px;
  padding: 8px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
  border: 3px solid var(--badge-color);
  box-shadow: 0 0 0 6px rgba(31, 200, 219, 0.08);
}

.badge-detail h2 {
  margin-top: 4px;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.badge-detail__description {
  color: var(--text-2);
  line-height: 1.55;
}

.badge-detail__facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 16px;
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  text-align: left;
}

.badge-detail__facts dt {
  color: var(--text-3);
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-detail__facts dd {
  color: var(--text);
  font-size: 0.88rem;
}

@media (max-width: 480px) {
  .badge-detail__facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .badge-detail__facts dd + dt {
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profileCard,
  .popup-overlay {
    animation: none;
  }
}
