/* ==========================================================================
   FIX U SHOPPING — Subscription Portal
   Premium Pink × Blue design system
   tokens → base → ambient → layout → hero → cards → components →
   states → responsive → reduced motion
   ========================================================================== */

:root {
  /* Surfaces — deep indigo night */
  --bg-base: #06060f;
  --bg-elev-1: rgba(146, 132, 255, 0.055);
  --bg-elev-2: rgba(21, 20, 44, 0.92);
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --text-primary: rgba(255, 255, 255, 0.96);
  --text-secondary: rgba(224, 229, 255, 0.66);
  --text-tertiary: rgba(178, 186, 228, 0.42);

  /* Brand — Pink: personality, highlights, premium accents */
  --pink: #f472b6;
  --pink-deep: #ec4899;
  --pink-soft: rgba(244, 114, 182, 0.12);
  --pink-border: rgba(244, 114, 182, 0.28);
  --pink-glow: rgba(236, 72, 153, 0.35);

  /* Brand — Blue: trust, actions, important information */
  --blue: #60a5fa;
  --blue-deep: #3b82f6;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --blue-border: rgba(96, 165, 250, 0.28);
  --blue-glow: rgba(59, 130, 246, 0.35);
  --indigo: #a5b4fc;

  /* Signature gradient — used sparingly, always this exact blend */
  --grad-brand: linear-gradient(120deg, #f472b6 0%, #a5b4fc 52%, #60a5fa 100%);
  --grad-brand-soft: linear-gradient(120deg, rgba(244, 114, 182, 0.16), rgba(96, 165, 250, 0.14));

  /* Semantic */
  --success: #4ade80;
  --danger: #fb7185;

  /* Elevation */
  --shadow-card: 0 18px 48px rgba(2, 3, 14, 0.55);
  --shadow-card-hover: 0 24px 64px rgba(2, 3, 14, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-glow: 0 0 60px rgba(139, 122, 246, 0.28);

  /* Type — Inter for UI text, Sora for display + figures,
     Instrument Serif italic for the accent, JetBrains Mono for data. */
  --font-sans: "Inter", "Padauk", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Sora", "Inter", "Padauk", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-my: "Padauk", "Inter", sans-serif;

  /* Shape */
  --radius-card: 24px;
  --radius-inner: 16px;
  --radius-pill: 100px;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

::selection {
  background: rgba(236, 72, 153, 0.35);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

/* iOS haptic engine: a Safari `switch` checkbox toggled programmatically.
   Must stay rendered — `display: none` would suppress the Taptic tick. */
.haptic-switch {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0.01;
  pointer-events: none;
  z-index: -1;
}

/* --------------------------------------------------------------------------
   Ambient background
   Two fixed layers. ::before animates transform only (compositor-friendly).
   ::after is static grain — deliberately NOT mix-blend-mode: overlay, which
   would force a full-screen re-blend on every frame of the ::before loop.
   Pink blooms upper-left, blue upper-right, indigo anchors the base.
   -------------------------------------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 75% 55% at 12% 8%, rgba(236, 72, 153, 0.22), transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 22%, rgba(59, 130, 246, 0.2), transparent 55%),
    radial-gradient(ellipse 95% 70% at 50% 105%, rgba(129, 122, 246, 0.16), transparent 65%);
  z-index: -2;
  pointer-events: none;
  animation: aurora-drift 18s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.45;
  z-index: -1;
  pointer-events: none;
}

@keyframes aurora-drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-3%, 2%) scale(1.06); }
  100% { transform: translate(2%, -2%) scale(1.02); }
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  padding-top: max(28px, env(safe-area-inset-top));
  padding-bottom: max(64px, env(safe-area-inset-bottom));
}

/* Header — floating glass nav bar */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 36px;
  padding: 12px 16px;
  background: var(--bg-elev-1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: 0 10px 32px rgba(2, 3, 14, 0.4);
  opacity: 0;
  animation: fade-up 0.7s var(--ease-out-expo) 0.05s forwards;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .header { background: var(--bg-elev-2); }
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-bolt {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--grad-brand);
  box-shadow: 0 4px 18px var(--pink-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.logo-bolt svg {
  width: 17px;
  height: 17px;
  fill: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.logo-word {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.logo-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.01em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  white-space: nowrap;
}

.logo-sub {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* Theme toggle — icon button inside the glass nav bar. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: auto; /* pin toggle + status badge to the right of the logo */
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: var(--pink);
  border-color: var(--pink-border);
  transform: translateY(-1px);
}

.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Status badge — solid tints: it sits on the glass header bar, and a nested
   backdrop-filter would re-sample an already-rasterized backdrop for a full
   extra offscreen pass with no visual gain. */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.status-badge.active {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.26);
  color: var(--success);
}

.status-badge.expired {
  background: rgba(251, 113, 133, 0.1);
  border-color: rgba(251, 113, 133, 0.26);
  color: var(--danger);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  animation: pulse-soft 2s ease-in-out infinite;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  margin: 0 0 34px;
  opacity: 0;
  animation: fade-up 0.7s var(--ease-out-expo) 0.15s forwards;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--pink);
  background: var(--pink-soft);
  border: 1px solid var(--pink-border);
  border-radius: var(--radius-pill);
}

.hero-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(32px, 7vw, 46px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--text-primary);
}

.hero-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 46ch;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero-chips li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
}

.hero-chips li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: 0 0 8px var(--blue-glow);
}

/* --------------------------------------------------------------------------
   Sections + cards
   Cards are the only elements that carry a backdrop-filter. Nothing nested
   inside a card may add another one — a nested backdrop-filter re-samples an
   already rasterized backdrop and costs a full extra offscreen pass for no
   gain.
   -------------------------------------------------------------------------- */
.section {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

/* `display: grid` would otherwise defeat the `hidden` attribute the view
   layer uses to collapse a region on error. */
.section[hidden] {
  display: none;
}

.section-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 2px 2px;
  opacity: 0;
  animation: fade-up 0.7s var(--ease-out-expo) forwards;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.section-title::after {
  content: "";
  display: block;
  width: 26px;
  height: 2px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--grad-brand);
}

.section-sub {
  margin: 0;
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  text-align: right;
}

.card {
  grid-column: 1 / -1;
  position: relative;
  background: var(--bg-elev-1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  opacity: 0;
  animation: fade-up 0.7s var(--ease-out-expo) forwards;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s var(--ease-out-expo);
}

/* Without backdrop-filter support the translucent fill reads as near-black. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card { background: var(--bg-elev-2); }
}

/* Top inner highlight — the glass "edge light". */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 28%),
    linear-gradient(135deg, rgba(244, 114, 182, 0.05) 0%, transparent 40%, rgba(96, 165, 250, 0.05) 100%);
  border-radius: inherit;
  pointer-events: none;
}

@media (hover: hover) {
  .card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover);
  }
}

.section-head--stats { animation-delay: 0.25s; }
.card-info { animation-delay: 0.32s; }
.card-data { animation-delay: 0.38s; }
.card-time { animation-delay: 0.44s; }
.card-servers-count { animation-delay: 0.5s; }
.card-server-list { animation-delay: 0.56s; }
.section-head--access { animation-delay: 0.62s; }
.card-url { animation-delay: 0.68s; }
.card-qr { animation-delay: 0.74s; }
.card-import { animation-delay: 0.8s; }
.card-footer { animation-delay: 0.9s; }

/* Info rows */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.info-row:first-child { padding-top: 4px; }
.info-row:last-child { border-bottom: none; padding-bottom: 4px; }

.info-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  flex-shrink: 0;
}

.info-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  text-align: right;
  overflow-wrap: anywhere;
}

.info-value.active { color: var(--success); }
.info-value.expired { color: var(--danger); }
.info-value.accent { color: var(--pink); }

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */
.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-brand-soft);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--blue);
}

.stat-content { flex: 1; min-width: 0; }

.stat-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.stat-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.stat-value,
.server-count-value {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value { margin: 4px 0 12px; }
.server-count-value { margin: 4px 0 6px; }

.stat-value .unit,
.server-count-value .unit {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.stat-value .unit { margin-left: 4px; }
.server-count-value .unit { margin-left: 6px; }

/* Expiry urgency — amber under a week, red in the final stretch. */
.stat-value.time-warning { color: #fbbf24; }
.stat-value.time-urgent {
  color: var(--danger);
  text-shadow: 0 0 24px rgba(251, 113, 133, 0.45);
}

.stat-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.stat-bar-fill {
  height: 100%;
  background: var(--grad-brand);
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 1.2s var(--ease-out-expo);
  box-shadow: 0 0 12px var(--pink-glow);
}

.stat-bar-fill.over-quota {
  background: linear-gradient(90deg, var(--danger), #fb923c);
  box-shadow: 0 0 12px rgba(251, 113, 133, 0.6);
}

.stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 10px;
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Server list
   -------------------------------------------------------------------------- */
.server-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.server-list-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.server-list-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--pink);
  font-family: var(--font-mono);
  background: var(--pink-soft);
  border: 1px solid var(--pink-border);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.server-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 13px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-inner);
  transition:
    border-color 0.22s var(--ease-out-expo),
    transform 0.22s var(--ease-out-expo),
    box-shadow 0.22s var(--ease-out-expo);
  overflow: hidden;
  animation: fade-up 0.5s var(--ease-out-expo) backwards;
}

/* Gentle stagger for the first rows as the list renders in. */
.server-item:nth-child(2) { animation-delay: 0.04s; }
.server-item:nth-child(3) { animation-delay: 0.08s; }
.server-item:nth-child(4) { animation-delay: 0.12s; }
.server-item:nth-child(5) { animation-delay: 0.16s; }
.server-item:nth-child(6) { animation-delay: 0.2s; }
.server-item:nth-child(n + 7) { animation-delay: 0.24s; }

.server-item::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 114, 182, 0.55), rgba(96, 165, 250, 0.55), transparent);
  opacity: 0;
  transition: opacity 0.22s ease;
}

/* Hover effects only where a real pointer exists — avoids sticky :hover
   states on touch devices after a tap. */
@media (hover: hover) {
  .server-item:hover {
    border-color: rgba(244, 114, 182, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(2, 3, 14, 0.5), 0 0 24px rgba(236, 72, 153, 0.12);
  }
  .server-item:hover::after { opacity: 1; }
}

.server-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.server-flag {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
}

.server-proto {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  padding: 4px 9px;
  border-radius: 8px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.server-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.7em;
}

.server-empty {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 16px 0;
  font-family: var(--font-my);
}

/* --------------------------------------------------------------------------
   QR
   -------------------------------------------------------------------------- */
.card-qr .stat-label { display: block; margin-bottom: 10px; }

.qr-note {
  font-family: var(--font-my);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 18px;
}

.qr-wrap {
  display: flex;
  justify-content: center;
}

.qr-frame {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow:
    0 10px 34px rgba(2, 3, 14, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 44px rgba(139, 122, 246, 0.22);
}

.qr-frame::before,
.qr-frame::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.qr-frame::before {
  top: -6px;
  left: -6px;
  border: 2px solid var(--pink-deep);
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 8px;
  filter: drop-shadow(0 0 6px var(--pink-glow));
}

.qr-frame::after {
  bottom: -6px;
  right: -6px;
  border: 2px solid var(--blue-deep);
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 8px;
  filter: drop-shadow(0 0 6px var(--blue-glow));
}

.qr-frame svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
}

.qr-loading {
  font-size: 12px;
  color: #666;
  font-family: var(--font-mono);
  text-align: center;
  padding: 0 10px;
}

/* --------------------------------------------------------------------------
   Subscription URL
   -------------------------------------------------------------------------- */
.url-card .stat-label { margin-bottom: 10px; display: block; }

.url-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(2, 3, 12, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-inner);
  padding: 10px 10px 10px 16px;
}

.url-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Primary action — solid blue gradient. */
.copy-btn {
  background: linear-gradient(135deg, var(--blue-deep), var(--blue));
  border: 1px solid rgba(147, 197, 253, 0.45);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 9px 16px;
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--blue-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  text-transform: uppercase;
  flex-shrink: 0;
}

.copy-btn:hover,
.copy-btn:active {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px var(--blue-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.copy-btn.copied {
  background: linear-gradient(135deg, #16a34a, #4ade80);
  border-color: rgba(74, 222, 128, 0.45);
  box-shadow: 0 4px 16px rgba(74, 222, 128, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --------------------------------------------------------------------------
   Import buttons — the conversion surface
   -------------------------------------------------------------------------- */
.import-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.import-note {
  font-family: var(--font-my);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.text-accent {
  color: var(--pink);
  font-weight: 700;
}

/* No backdrop-filter — these live inside an already-blurred .card. */
.btn-import {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-inner);
  padding: 14px 16px;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  text-decoration: none;
}

.btn-import:last-child { margin-bottom: 0; }

.btn-import:hover,
.btn-import:active {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(2, 3, 14, 0.45);
}

/* Recommended — the signature pink→blue gradient. */
.btn-import.recommended {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.85), rgba(99, 102, 241, 0.85) 55%, rgba(59, 130, 246, 0.85));
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 32px rgba(139, 122, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-import.recommended:hover {
  filter: brightness(1.1);
  box-shadow: 0 14px 40px rgba(139, 122, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Per-app brand fills — moved off inline style attributes so the page can
   ship a CSP without style-src 'unsafe-inline'. */
.btn-icon--hiddify  { background: #455fe9; }
.btn-icon--v2raytun { background: linear-gradient(135deg, #1a73e8, #34a853); }
.btn-icon--v2box    { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.btn-icon--happ     { background: linear-gradient(135deg, #7c3aed, #a855f7); }

.btn-name { line-height: 1.2; }

.btn-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.85);
}

.btn-arrow {
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.btn-import:hover .btn-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  text-align: center;
  padding: 30px 0 12px;
  opacity: 0;
  animation: fade-up 0.7s var(--ease-out-expo) 0.95s forwards;
}

.footer-divider {
  width: 44px;
  height: 2px;
  background: var(--grad-brand);
  border-radius: 2px;
  opacity: 0.7;
  margin: 0 auto 20px;
}

.footer-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.telegram-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--pink-soft);
  border: 1px solid var(--pink-border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--pink);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.telegram-link:hover {
  background: rgba(244, 114, 182, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.18);
}

.footer-copy {
  margin-top: 22px;
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(16, 15, 34, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(165, 180, 252, 0.3);
  color: var(--text-primary);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s var(--ease-out-expo),
    transform 0.4s var(--ease-out-expo),
    visibility 0s linear 0.4s;
  z-index: 1000;
  box-shadow: var(--shadow-glow);
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0s;
}

/* --------------------------------------------------------------------------
   Error / empty states
   -------------------------------------------------------------------------- */
.error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 20px;
  opacity: 0;
  animation: fade-up 0.6s var(--ease-out-expo) forwards;
}

.error-state h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  margin: 0 0 12px;
  color: var(--danger);
}

.error-state p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 6px;
  font-family: var(--font-my);
  overflow-wrap: anywhere;
}

.error-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 10px;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.btn-retry {
  background: linear-gradient(135deg, var(--blue-deep), var(--blue));
  border: 1px solid rgba(147, 197, 253, 0.45);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 6px 20px var(--blue-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: filter 0.2s ease, transform 0.2s ease;
}

.btn-retry:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn-retry[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

/* Placeholder shimmer while the first fetch is in flight.
   inline-block + em-relative min-width gives each placeholder a sensible
   width at its own font size, from 14px info rows up to 38px stat numbers. */
[data-loading="true"] .skeleton {
  display: inline-block;
  min-width: 3.5em;
  color: transparent;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(165, 180, 252, 0.12) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.4s ease-in-out infinite;
}

[data-loading="true"] .skeleton * { visibility: hidden; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.noscript-note {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 20px;
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: 14px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive — tablet
   -------------------------------------------------------------------------- */
@media (min-width: 720px) {
  .card-data,
  .card-time,
  .card-servers-count {
    grid-column: span 2;
  }
}

/* --------------------------------------------------------------------------
   Responsive — desktop browsers
   The panel opens up from a single column into a real website layout:
   wide canvas, three-across metrics, QR beside the import actions.
   -------------------------------------------------------------------------- */
@media (min-width: 1000px) {
  .container { max-width: 1040px; }

  .hero { margin-bottom: 44px; }
  .hero-title { font-size: 56px; }
  .hero-sub { font-size: 16px; }

  .card-qr { grid-column: span 2; }
  .card-import { grid-column: span 4; }

  .server-grid { grid-template-columns: repeat(4, 1fr); }

  .stat-value,
  .server-count-value { font-size: 44px; }
}

/* --------------------------------------------------------------------------
   Responsive — small phones
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
  .container { padding: 20px 16px 48px; }
  .stat-value,
  .server-count-value { font-size: 32px; }
  .logo-mark { font-size: 17px; }
  .card { padding: 18px; }
  .server-grid { gap: 8px; }
  .server-item { padding: 12px; }
  .server-flag { font-size: 26px; }
  .server-name { font-size: 12px; }
  .qr-frame { width: 176px; height: 176px; }
}

/* --------------------------------------------------------------------------
   Light theme
   Token swap plus the handful of component backgrounds that don't read from
   tokens. Dark remains the default; this block only applies when theme.js
   sets data-theme="light" on <html>.
   -------------------------------------------------------------------------- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg-base: #f4f6fc;
  --bg-elev-1: rgba(255, 255, 255, 0.66);
  --bg-elev-2: rgba(255, 255, 255, 0.96);
  --border-soft: rgba(24, 24, 66, 0.09);
  --border-strong: rgba(24, 24, 66, 0.18);

  --text-primary: rgba(18, 18, 42, 0.94);
  --text-secondary: rgba(34, 36, 70, 0.68);
  --text-tertiary: rgba(48, 52, 96, 0.48);

  --pink: #db2777;
  --pink-deep: #be185d;
  --pink-soft: rgba(219, 39, 119, 0.07);
  --pink-border: rgba(219, 39, 119, 0.22);
  --pink-glow: rgba(219, 39, 119, 0.22);

  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-soft: rgba(37, 99, 235, 0.07);
  --blue-border: rgba(37, 99, 235, 0.22);
  --blue-glow: rgba(37, 99, 235, 0.22);
  --indigo: #6366f1;

  --grad-brand: linear-gradient(120deg, #db2777 0%, #6366f1 52%, #2563eb 100%);
  --grad-brand-soft: linear-gradient(120deg, rgba(219, 39, 119, 0.1), rgba(37, 99, 235, 0.09));

  --shadow-card: 0 16px 44px rgba(88, 92, 180, 0.13);
  --shadow-card-hover: 0 22px 56px rgba(88, 92, 180, 0.18), 0 0 0 1px rgba(24, 24, 66, 0.05);
  --shadow-glow: 0 0 50px rgba(99, 102, 241, 0.18);
}

:root[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 75% 55% at 12% 8%, rgba(219, 39, 119, 0.1), transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 22%, rgba(37, 99, 235, 0.09), transparent 55%),
    radial-gradient(ellipse 95% 70% at 50% 105%, rgba(99, 102, 241, 0.08), transparent 65%);
}

:root[data-theme="light"] body::after { opacity: 0.25; }

:root[data-theme="light"] .header {
  box-shadow: 0 10px 30px rgba(88, 92, 180, 0.12);
}

:root[data-theme="light"] .card::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 30%),
    linear-gradient(135deg, rgba(219, 39, 119, 0.03) 0%, transparent 40%, rgba(37, 99, 235, 0.03) 100%);
}

:root[data-theme="light"] .stat-icon {
  border-color: rgba(24, 24, 66, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

:root[data-theme="light"] .stat-bar { background: rgba(24, 24, 66, 0.08); }

:root[data-theme="light"] .hero-chips li,
:root[data-theme="light"] .status-badge,
:root[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.55);
}

:root[data-theme="light"] .server-item {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.3));
  border-color: rgba(24, 24, 66, 0.08);
}

@media (hover: hover) {
  :root[data-theme="light"] .server-item:hover {
    border-color: rgba(219, 39, 119, 0.28);
    box-shadow: 0 10px 26px rgba(88, 92, 180, 0.16), 0 0 22px rgba(219, 39, 119, 0.08);
  }
}

:root[data-theme="light"] .url-box {
  background: rgba(24, 24, 66, 0.045);
  border-color: rgba(24, 24, 66, 0.07);
}

:root[data-theme="light"] .btn-import {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(24, 24, 66, 0.09);
}

:root[data-theme="light"] .btn-import:hover,
:root[data-theme="light"] .btn-import:active {
  border-color: rgba(24, 24, 66, 0.16);
  box-shadow: 0 10px 26px rgba(88, 92, 180, 0.14);
}

/* Recommended CTAs keep the signature gradient in both themes. */
:root[data-theme="light"] .btn-import.recommended {
  background: linear-gradient(135deg, rgba(219, 39, 119, 0.92), rgba(99, 102, 241, 0.92) 55%, rgba(37, 99, 235, 0.92));
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

:root[data-theme="light"] .btn-icon { background: rgba(24, 24, 66, 0.05); }

:root[data-theme="light"] .qr-frame {
  box-shadow:
    0 10px 30px rgba(88, 92, 180, 0.18),
    0 0 0 1px rgba(24, 24, 66, 0.06),
    0 0 40px rgba(99, 102, 241, 0.14);
}

:root[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(99, 102, 241, 0.3);
}

:root[data-theme="light"] .info-row { border-bottom-color: rgba(24, 24, 66, 0.06); }

:root[data-theme="light"] .stat-value.time-warning { color: #d97706; }
:root[data-theme="light"] .stat-value.time-urgent {
  text-shadow: 0 0 20px rgba(251, 113, 133, 0.3);
}

:root[data-theme="light"] [data-loading="true"] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(24, 24, 66, 0.05) 25%,
    rgba(99, 102, 241, 0.1) 50%,
    rgba(24, 24, 66, 0.05) 75%
  );
  background-size: 200% 100%;
}

/* --------------------------------------------------------------------------
   Reduced motion
   Every card starts at opacity:0 and is revealed by an animation. If those
   animations are suppressed the page would render blank, so the reveal is
   forced to its end state rather than merely disabled.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .header,
  .hero,
  .section-head,
  .card,
  .footer,
  .server-item,
  .error-state {
    opacity: 1;
    animation: none;
  }

  body::before,
  .status-dot,
  [data-loading="true"] .skeleton {
    animation: none;
  }

  [data-loading="true"] .skeleton { background: rgba(255, 255, 255, 0.06); }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
