:root {
  --bg: #030712;
  --bg-elevated: #0b1220;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --glass: rgba(15, 23, 42, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(103, 232, 249, 0.25);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --cyan: #22d3ee;
  --violet: #818cf8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.45);
  --success: #34d399;
  --success-glow: rgba(52, 211, 153, 0.35);
  --warn: #fbbf24;
  --warn-glow: rgba(251, 191, 36, 0.3);
  --radius: 22px;
  --radius-sm: 14px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

body.tg-theme {
  --bg: var(--tg-theme-bg-color, #030712);
  --text: var(--tg-theme-text-color, #f8fafc);
  --accent: var(--tg-theme-button-color, #38bdf8);
}

body.preview-mode {
  background: #0a0a12;
}

body.preview-mode #app {
  margin-top: 44px;
  height: calc(100% - 44px);
  border-radius: 0 0 24px 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

/* Preview bar */
.preview-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(10, 10, 18, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.preview-bar__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin-right: 4px;
}

.preview-bar__btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}

.preview-bar__btn--active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(129, 140, 248, 0.2));
  border-color: var(--border-bright);
  color: var(--text);
}

#app {
  position: relative;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Background */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-mesh {
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(ellipse 60% 50% at 20% 10%, rgba(34, 211, 238, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 80% 20%, rgba(129, 140, 248, 0.14), transparent 45%),
    radial-gradient(ellipse 40% 50% at 50% 90%, rgba(20, 184, 166, 0.08), transparent 50%);
  animation: meshShift 18s ease-in-out infinite alternate;
}

@keyframes meshShift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3%, 2%) scale(1.05); }
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 20%, transparent 75%);
  opacity: 0.6;
}

.bg-noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  will-change: transform;
}

.orb-1 { width: 300px; height: 300px; background: #0891b2; top: -100px; right: -80px; animation: float1 16s ease-in-out infinite; }
.orb-2 { width: 240px; height: 240px; background: #4f46e5; bottom: 30%; left: -100px; animation: float2 20s ease-in-out infinite; }
.orb-3 { width: 180px; height: 180px; background: #0d9488; bottom: -40px; right: 10%; animation: float3 14s ease-in-out infinite; }
.orb-4 { width: 120px; height: 120px; background: #7c3aed; top: 40%; right: 5%; animation: float4 12s ease-in-out infinite; opacity: 0.35; }

@keyframes float1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, 25px); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(25px, -15px); }
}
@keyframes float3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-15px, -20px); }
}
@keyframes float4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(10px, 15px) scale(1.1); }
}

/* Header */
.header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 12px;
  padding: 20px 22px 12px;
  padding-top: max(20px, env(safe-area-inset-top));
}

.header__actions {
  align-self: start;
  padding-top: 6px;
  display: flex;
  gap: 6px;
}

.header-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-bright);
  background: rgba(129, 140, 248, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.header-btn:active { transform: scale(0.96); }

.header-btn__label {
  line-height: 1;
  color: var(--text-muted);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-ring {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.logo-ring__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(103, 232, 249, 0.3);
  animation: logoPulse 2.5s ease-out infinite;
}

@keyframes logoPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.15); opacity: 0; }
}

.logo-mark {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.15), rgba(129, 140, 248, 0.12));
  border: 1px solid var(--border-bright);
  box-shadow: 0 8px 32px rgba(34, 211, 238, 0.15);
}

.header__greeting {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.header__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.title-accent {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__sub {
  grid-column: 1 / -1;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 66px;
}

/* Main */
.main {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 28px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.main::-webkit-scrollbar { display: none; }

/* Glass card */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.status-card {
  position: relative;
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}

.status-card--active {
  border-color: rgba(52, 211, 153, 0.3);
}

.status-card--inactive {
  border-color: rgba(251, 191, 36, 0.25);
}

.status-card__glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
  background: radial-gradient(ellipse at 30% 0%, rgba(52, 211, 153, 0.15), transparent 60%);
  pointer-events: none;
}

.status-card--active .status-card__glow { opacity: 1; }

.status-card__inner {
  position: relative;
  padding: 18px 18px 16px;
}

.status-card__row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-indicator {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: background 0.4s, box-shadow 0.4s;
}

.status-dot--active {
  background: var(--success);
  box-shadow: 0 0 20px var(--success-glow);
  animation: dotPulse 2s ease-in-out infinite;
}

.status-dot--inactive {
  background: var(--warn);
  box-shadow: 0 0 16px var(--warn-glow);
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.status-ring {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 0.4s;
}

.status-dot--active ~ .status-ring {
  border-color: rgba(52, 211, 153, 0.25);
  animation: ringSpin 8s linear infinite;
}

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

.status-card__text { flex: 1; min-width: 0; }

.status-card__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.status-card__value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-top: 3px;
  letter-spacing: -0.02em;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.4s var(--ease-out);
}

.status-badge--active {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--success);
}

.status-badge--inactive {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--warn);
}

.status-stats {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.stat-chip {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease-spring), border-color 0.3s;
}

.stat-chip:hover { border-color: var(--border-bright); }

.stat-chip__val {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan);
}

.stat-chip__lbl {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-chip--proxy .stat-chip__val { color: #fbbf24; }
.stat-chip--vpn .stat-chip__val { color: var(--violet); }

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, opacity 0.25s;
}

.btn__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  width: 100%;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-block { width: 100%; margin-bottom: 14px; }

.btn-subscribe {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-bright);
  box-shadow: 0 4px 24px rgba(129, 140, 248, 0.1);
}

.btn-subscribe .btn__icon { color: var(--violet); }

.btn-donate {
  background: rgba(244, 114, 182, 0.1);
  color: #fbcfe8;
  border: 1px solid rgba(244, 114, 182, 0.35);
  box-shadow: 0 4px 24px rgba(244, 114, 182, 0.08);
}

.btn-donate .btn__icon { color: #f472b6; }

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  border: none;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
}

/* Tabs */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tabs--admin {
  grid-template-columns: 1fr 1fr 1fr;
}

.tabs__btn--admin {
  border-color: rgba(251, 191, 36, 0.25);
}

.tabs__btn--admin.tabs__btn--active {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fcd34d;
}

.tabs__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}

.tabs__btn svg { flex-shrink: 0; opacity: 0.7; }

.tabs__btn--active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(129, 140, 248, 0.12));
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-bright);
}

.tabs__btn--active[data-tab="proxy"] svg { stroke: #fbbf24; opacity: 1; }
.tabs__btn--active[data-tab="vpn"] svg { stroke: var(--violet); opacity: 1; }

.tabs__count {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.tabs__btn--active .tabs__count {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

/* Panels */
.panel { display: none; }
.panel--active { display: block; animation: panelIn 0.4s var(--ease-out); }

@keyframes panelIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.panel__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 2px;
}

/* Platform chips */
.platform-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.platform-chips::-webkit-scrollbar { display: none; }

.platform-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}

.platform-chip__icon { font-size: 14px; }

.platform-chip__count {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.platform-chip--active {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.2), rgba(34, 211, 238, 0.12));
  border-color: rgba(129, 140, 248, 0.4);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(129, 140, 248, 0.15);
}

.platform-chip--active .platform-chip__count {
  background: rgba(129, 140, 248, 0.25);
  color: #c4b5fd;
}

/* Item lists */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(14px);
  animation: cardIn 0.45s var(--ease-out) forwards;
  transition: border-color 0.25s, box-shadow 0.25s;
}

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

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

.item-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.item-card__icon--proxy {
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.18), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.item-card__icon--proxy svg {
  width: 22px;
  height: 22px;
  stroke: #fbbf24;
}

.item-card__icon--vpn {
  background: linear-gradient(145deg, rgba(129, 140, 248, 0.2), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.item-card__body { flex: 1; min-width: 0; }

.item-card__name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-card__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.item-card__action {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), opacity 0.2s;
  border: 1px solid transparent;
}

.item-card__action:active { transform: scale(0.94); }

.item-card__action--connect {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.15));
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

.item-card__action--download {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.22), rgba(99, 102, 241, 0.12));
  border-color: rgba(129, 140, 248, 0.35);
  color: #c4b5fd;
}

.item-card__action--loading {
  pointer-events: none;
  opacity: 0.5;
}

.item-card__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.vpn-hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.18);
  border-radius: 10px;
}

.empty-state__icon--proxy { color: #fbbf24; border-color: rgba(251, 191, 36, 0.2); }
.empty-state__icon--vpn { color: var(--violet); border-color: rgba(129, 140, 248, 0.2); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--glass);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
}

.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-bottom: 14px;
  animation: emptyFloat 3s ease-in-out infinite;
}

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-state__text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Loader */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
}

.loader__orb {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
  opacity: 0.4;
  animation: loaderOrb 1.2s ease-in-out infinite;
}

@keyframes loaderOrb {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50% { transform: scale(1.3); opacity: 0.5; }
}

.loader__ring {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-right-color: var(--violet);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(24px) scale(0.95);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-spring);
  pointer-events: none;
  max-width: calc(100% - 40px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
}

.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.toast__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.2);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast--error .toast__icon {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.hidden { display: none !important; }

/* VPN instruction sheet */
.guide-sheet {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

body.vpn-guide-open {
  overflow: hidden;
}

.guide-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(6px);
}

.guide-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(165deg, #0f172a 0%, #030712 100%);
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.45);
  animation: guideSlideUp 0.35s var(--ease-out);
}

@keyframes guideSlideUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.guide-sheet__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.guide-sheet__badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c4b5fd;
  background: rgba(129, 140, 248, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.25);
}

.guide-sheet__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.guide-sheet__app {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
}

.guide-sheet__app strong {
  color: #e0e7ff;
}

.guide-sheet__app a {
  color: #93c5fd;
  text-decoration: underline;
}

.guide-sheet__status {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}

.guide-sheet__status--warn {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.25);
  color: #fcd34d;
}

.guide-sheet__steps {
  margin: 0 0 18px;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.guide-sheet__steps li {
  margin-bottom: 10px;
}

.guide-sheet__steps li::marker {
  color: var(--violet);
  font-weight: 700;
}

.guide-sheet__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-btn {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.guide-btn:active { transform: scale(0.98); }

.guide-btn--primary {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
}

.guide-btn--secondary {
  background: rgba(129, 140, 248, 0.12);
  border-color: rgba(129, 140, 248, 0.3);
  color: #e0e7ff;
}

.guide-btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

/* Entrance animations */
.anim-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.7s var(--ease-out) forwards;
}

.anim-d1 { animation-delay: 0.06s; }
.anim-d2 { animation-delay: 0.12s; }
.anim-d3 { animation-delay: 0.18s; }
.anim-d4 { animation-delay: 0.24s; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Touch devices: lighter UI for faster first paint */
@media (hover: none) and (pointer: coarse) {
  .bg-orbs,
  .bg-noise {
    display: none;
  }

  .bg-mesh {
    animation: none;
    inset: 0;
    transform: none;
  }

  .glass,
  .status-card,
  .login-gate,
  .loader,
  .toast,
  .guide-sheet__panel,
  .proxy-item,
  .vpn-item,
  .admin-form,
  .preview-bar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .glass,
  .status-card {
    background: rgba(15, 23, 42, 0.94);
  }

  .login-gate {
    background: rgba(3, 7, 18, 0.98);
  }

  .anim-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .logo-ring__pulse,
  .status-dot--active,
  .empty-state__icon {
    animation: none !important;
  }
}

/* Admin panel */
.admin-subtabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-subtabs--3 {
  grid-template-columns: repeat(3, 1fr);
}

.admin-field-hint {
  margin: -4px 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.admin-item__badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #6ee7b7;
}

.admin-item__badge--paid {
  background: rgba(129, 140, 248, 0.12);
  border-color: rgba(129, 140, 248, 0.3);
  color: #c7d2fe;
}

.admin-subtabs__btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-subtabs__btn--active {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

.admin-pane.hidden { display: none; }

.admin-form {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.admin-field small {
  font-weight: 400;
  opacity: 0.8;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.admin-field textarea {
  resize: vertical;
  min-height: 72px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.admin-item__body {
  flex: 1;
  min-width: 0;
}

.admin-item__name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-item__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-item__del {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.admin-item__del:active { transform: scale(0.96); }

/* Standalone login */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(16px);
}

.login-gate.hidden {
  display: none;
}

.login-gate__card {
  width: 100%;
  max-width: 380px;
  padding: 28px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border-bright);
  text-align: center;
}

.login-gate__logo {
  margin-bottom: 12px;
}

.login-gate__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-gate__text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.login-gate__error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.login-gate__widget {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.login-gate__widget.hidden {
  display: none;
}

.login-gate__tgbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #2aabee, #229ed9);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.login-gate__tgbtn:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.login-gate__tgbtn.hidden {
  display: none !important;
}

.login-gate__tgbtn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.guide-sheet__steps li {
  margin-bottom: 10px;
  line-height: 1.45;
}

.guide-sheet__status {
  font-weight: 600;
  color: #e2e8f0;
}

.login-gate__botbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(129, 140, 248, 0.12));
  color: #e0f2fe;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.login-gate__botbtn:active {
  transform: scale(0.98);
}

.login-gate__hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 8px;
}

.login-gate__hint--small {
  font-size: 12px;
  opacity: 0.85;
}

body.standalone-mode .header-btn#installBtn .header-btn__label {
  content: "Установлено";
}
