/* ===== Shared theme for auth + dashboard pages ===== */
:root {
  --bg: #000000;
  --bg-2: #0a0a0b;
  --panel: #0a0a0b;
  --inset: #050506;
  --accent: #ebeced;
  --accent-soft: rgba(255, 255, 255, 0.4);
  --accent-glow: rgba(255, 255, 255, 0.12);
  --text: #a1a4a5;
  --text-dim: #5c6165;
  --text-faint: #43474a;
  --white: #ebeced;
  /* cool-tinted hairline, never pure white */
  --border: rgba(214, 235, 253, 0.13);
  --border-strong: rgba(217, 237, 255, 0.28);
  --green: #2bff88;
  --red: #ff3344; /* menu accent red */
  --red-dim: #b3121f;
  --red-soft: rgba(255, 51, 68, 0.55);
  --red-glow: rgba(255, 51, 68, 0.12);
  --glass: linear-gradient(
    104deg,
    rgba(253, 253, 253, 0.05) 5%,
    rgba(240, 240, 228, 0.1) 100%
  );
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

::selection {
  background: var(--red);
  color: #000;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse 90% 55% at 50% -10%,
    rgba(217, 237, 255, 0.05),
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
}

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

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.btn-primary {
  background: #fff;
  color: #000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.btn-primary:hover {
  background: #d9dcde;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-ghost {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--white);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.btn-block {
  width: 100%;
  text-align: center;
}

/* ===== Auth card layout ===== */
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.2rem;
}

.auth-logo {
  margin-bottom: 1.8rem;
}

.auth-logo img {
  height: 38px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2.4rem 2.2rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
}

.auth-card h1 {
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
  background: linear-gradient(
    to bottom right,
    #ffffff 30%,
    rgba(255, 255, 255, 0.45)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--white);
}

.auth-card .sub {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 1.8rem;
}

/* Secure badge */
.secure-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.6563rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.6rem;
}

.secure-note svg {
  width: 13px;
  height: 13px;
}

/* ===== Form fields ===== */
.field {
  margin-bottom: 1.1rem;
}

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.field input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:focus {
  outline: none;
  border-color: var(--red-soft);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.field input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 84, 112, 0.12);
}

.hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

/* Message banner */
.msg {
  display: none;
  font-size: 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: 9px;
  margin-bottom: 1.2rem;
}

.msg.show {
  display: block;
}

.msg.error {
  color: var(--red);
  background: rgba(255, 84, 112, 0.08);
  border: 1px solid rgba(255, 84, 112, 0.25);
}

.msg.success {
  color: var(--green);
  background: rgba(43, 255, 136, 0.08);
  border: 1px solid rgba(43, 255, 136, 0.25);
}

.auth-foot {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.auth-foot a {
  color: var(--red);
  font-weight: 600;
}

.auth-foot a:hover {
  text-decoration: underline;
}

.back-home {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 2;
  font-size: 0.85rem;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.back-home:hover {
  color: var(--accent);
}

/* ===== Dashboard ===== */
.dash-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 0.85rem 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.dash-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.dash-nav a {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.25s;
}

.dash-nav a:hover,
.dash-nav a.active {
  color: var(--white);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

.dash-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-header img {
  height: 30px;
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.dash-user .uname {
  color: var(--white);
  font-weight: 600;
}

.dash-main {
  position: relative;
  z-index: 1;
  /* extra top padding clears the fixed header */
  padding: 8rem 0 4rem;
}

.welcome {
  margin-bottom: 2rem;
}

.welcome h1 {
  color: var(--white);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.welcome p {
  color: var(--text-dim);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
}

.card {
  padding: 1.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.card.highlight {
  border-color: rgba(255, 51, 68, 0.3);
  background: rgba(255, 51, 68, 0.02);
}

.card h2 {
  color: var(--white);
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sub-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

.sub-status .game {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--white);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
}

.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge.up {
  color: var(--green);
  background: rgba(43, 255, 136, 0.08);
}
.badge.up .dot {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-row .k {
  color: var(--text-dim);
}

.meta-row .v {
  color: var(--white);
  font-weight: 600;
}

.meta-row .v.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.download-row {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.key-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.key-box input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.88rem;
  letter-spacing: 1px;
}

.copy-btn {
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .dash-nav {
    display: none;
  }
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Dashboard polish ===== */
.dash-main {
  animation: fadeUp 0.5s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

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

.card.highlight {
  position: relative;
  overflow: hidden;
}

/* welcome banner */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.8rem 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(
      ellipse at top left,
      rgba(255, 51, 68, 0.08),
      transparent 55%
    ),
    var(--panel);
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), transparent 60%);
}

.welcome-banner .welcome {
  margin-bottom: 0;
}

.quick-stats {
  display: flex;
  gap: 1rem;
}

.qstat {
  min-width: 96px;
  padding: 0.9rem 1.2rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}

.qstat .num {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--white);
  letter-spacing: -0.02em;
}

.qstat .label {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 0.2rem;
}

/* welcome + avatar */
.welcome {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.welcome .avatar {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  background: linear-gradient(150deg, var(--red), var(--red-dim));
  box-shadow: 0 4px 16px rgba(255, 51, 68, 0.25);
}

.welcome h1 span {
  color: var(--red);
}

/* ===== Loading overlay ===== */
#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  background: rgba(6, 6, 7, 0.92);
  backdrop-filter: blur(8px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#loadingOverlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--red);
  border-right-color: var(--red);
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.loading-text b {
  color: var(--red);
}

.loading-dots::after {
  content: "";
  animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
}

/* ===== Skeleton shimmer for values still loading ===== */
.skeleton {
  display: inline-block;
  min-width: 70px;
  height: 0.85em;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.12) 37%,
    rgba(255, 255, 255, 0.05) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}