* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

html, body {
  font-family: 'Inter', -apple-system, sans-serif;
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
  position: fixed;
  transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1), color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== THEME VARS ===== */
body {
  --bg1: #08080e;
  --bg2: #0b0916;
  --bg3: #09070e;
  --glass-bg: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.1);
  --glass-highlight: rgba(255,255,255,0.12);
  --glass-highlight2: rgba(255,255,255,0.03);
  --text1: rgba(255,255,255,0.85);
  --text2: rgba(255,255,255,0.6);
  --text3: rgba(255,255,255,0.35);
  --text4: rgba(255,255,255,0.2);
  --accent: rgba(168,85,247,0.9);
  --accent-bg: rgba(168,85,247,0.12);
  --accent-border: rgba(168,85,247,0.2);
  --accent-glow: rgba(168,85,247,0.4);
  --green: rgba(74,222,128,0.85);
  --green-bg: rgba(74,222,128,0.06);
  --green-border: rgba(74,222,128,0.15);
  --green-glow: rgba(74,222,128,0.3);
  --red: rgba(248,113,113,0.85);
  --red-bg: rgba(248,113,113,0.06);
  --red-border: rgba(248,113,113,0.2);
  --yellow-border: rgba(250,204,21,0.3);
  --yellow: rgba(250,204,21,0.8);
  --particle-a: 0.08;
  --orb-lum: 18%;
  --card-active: rgba(255,255,255,0.05);
  --sep: rgba(255,255,255,0.04);
  --tog-off-bg: rgba(255,255,255,0.06);
  --tog-off-border: rgba(255,255,255,0.1);
  --tog-off-knob: rgba(255,255,255,0.2);
  --input-bg: rgba(255,255,255,0.03);
  --input-border: rgba(255,255,255,0.08);
  --modal-bg: rgba(18,18,28,0.95);
  --hash-bg: rgba(255,255,255,0.06);
  --hash-color: rgba(168,85,247,0.7);
  --copy-bg: rgba(255,255,255,0.04);
  --dot-off: rgba(255,255,255,0.15);
  --badge-active-bg: rgba(74,222,128,0.08);
  --badge-active-border: rgba(74,222,128,0.35);
  --badge-active-color: rgba(74,222,128,0.85);
  --badge-expired-bg: rgba(248,113,113,0.08);
  --badge-expired-border: rgba(248,113,113,0.35);
  --badge-expired-color: rgba(248,113,113,0.85);
  --balance-grad-start: #fff;
  --balance-grad-end: #c084fc;
  --progress-bg: rgba(255,255,255,0.04);
  background: var(--bg1);
  color: #fff;
}

body.light {
  --bg1: #f2f0f5;
  --bg2: #eae7f0;
  --bg3: #e5e0ed;
  --glass-bg: rgba(255,255,255,0.55);
  --glass-border: rgba(180,160,210,0.25);
  --glass-highlight: rgba(255,255,255,0.6);
  --glass-highlight2: rgba(255,255,255,0.15);
  --text1: rgba(30,20,50,0.9);
  --text2: rgba(30,20,50,0.6);
  --text3: rgba(30,20,50,0.38);
  --text4: rgba(30,20,50,0.2);
  --accent: rgba(128,55,220,0.95);
  --accent-bg: rgba(128,55,220,0.1);
  --accent-border: rgba(128,55,220,0.25);
  --accent-glow: rgba(128,55,220,0.3);
  --green: rgba(34,180,90,0.9);
  --green-bg: rgba(34,180,90,0.08);
  --green-border: rgba(34,180,90,0.2);
  --green-glow: rgba(34,180,90,0.2);
  --red: rgba(220,60,60,0.85);
  --red-bg: rgba(220,60,60,0.06);
  --red-border: rgba(220,60,60,0.2);
  --yellow-border: rgba(180,140,30,0.3);
  --yellow: rgba(180,140,30,0.85);
  --particle-a: 0.06;
  --orb-lum: 78%;
  --card-active: rgba(0,0,0,0.03);
  --sep: rgba(0,0,0,0.05);
  --tog-off-bg: rgba(0,0,0,0.05);
  --tog-off-border: rgba(0,0,0,0.1);
  --tog-off-knob: rgba(0,0,0,0.12);
  --input-bg: rgba(255,255,255,0.5);
  --input-border: rgba(0,0,0,0.08);
  --modal-bg: rgba(245,242,250,0.97);
  --hash-bg: rgba(128,55,220,0.08);
  --hash-color: rgba(128,55,220,0.8);
  --copy-bg: rgba(0,0,0,0.03);
  --dot-off: rgba(0,0,0,0.12);
  --badge-active-bg: rgba(34,180,90,0.08);
  --badge-active-border: rgba(34,180,90,0.3);
  --badge-active-color: rgba(34,180,90,0.9);
  --badge-expired-bg: rgba(220,60,60,0.06);
  --badge-expired-border: rgba(220,60,60,0.25);
  --badge-expired-color: rgba(220,60,60,0.85);
  --balance-grad-start: #2a1850;
  --balance-grad-end: #8037dc;
  --progress-bg: rgba(0,0,0,0.06);
  background: var(--bg1);
  color: #1e1432;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  transition: opacity 0.8s ease;
}

/* ===== APP LAYOUT ===== */
.app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.app-header {
  flex-shrink: 0;
  height: 56px;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 110;
}

.app-body {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
  z-index: 105;
}

.app-footer {
  flex-shrink: 0;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 110;
  pointer-events: auto;
}

/* ===== LOGO ===== */
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text3);
  transition: color 0.8s ease;
}

/* ===== GLASS ===== */
.glass-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  transition: background 0.8s ease, border-color 0.8s ease;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(168deg, var(--glass-highlight) 0%, var(--glass-highlight2) 20%, transparent 50%);
  pointer-events: none;
  z-index: 1;
  transition: background 0.8s ease;
}

.glass-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(168,85,247,0.12) 0%, transparent 40%, rgba(236,72,153,0.08) 100%);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  padding: 1px;
  pointer-events: none;
  z-index: 2;
}

.glass-inner {
  position: relative;
  z-index: 5;
}

/* ===== PAGES ===== */
.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 16px 20px;
  will-change: transform, opacity;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  /* Фикс: предотвращаем утечку контента */
  width: 100%;
  height: 100%;
  clip-path: inset(0 0 0 0);
  background: transparent; /* Сквозь страницы тоже виден фон */
}
.page::-webkit-scrollbar { display: none; }

.page {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.page.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.page.to-left {
  transform: translateX(-30%);
  opacity: 0;
  pointer-events: none;
}

.page.to-right {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.ci {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  /* Фикс: предотвращаем вылезание контента */
  max-width: 100%;
  overflow: hidden;
}

.ci.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ===== NAV ===== */
.nav-inner {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  padding: 4px;
  display: flex;
  overflow: hidden;
  transition: background 0.8s ease, border-color 0.8s ease;
  backdrop-filter: blur(12px) saturate(180%); /* Усиливаем эффект стекла */
  -webkit-backdrop-filter: blur(12px) saturate(180%);
}

.nav-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(168deg, rgba(255,255,255,0.06) 0%, transparent 40%);
  pointer-events: none;
}

.nav-ind {
  position: absolute;
  height: calc(100% - 8px);
  top: 4px;
  border-radius: 18px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--text4);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.3s ease;
}

.nav-item.active svg {
  stroke: #c084fc;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.nav-item span {
  font-size: 9px;
  font-weight: 500;
  color: var(--text4);
  transition: all 0.3s ease;
}

.nav-item.active span {
  color: #c084fc;
}

/* ===== TOGGLE ===== */
.tog {
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--tog-off-bg);
  border: 1px solid var(--tog-off-border);
  position: relative;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.tog::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tog-off-knob);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tog.on {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.tog.on::before {
  transform: translateX(20px);
  background: #a855f7;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ===== GLASS BTN ===== */
.gbtn {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.gbtn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(168deg, var(--glass-highlight) 0%, transparent 50%);
  pointer-events: none;
}

.gbtn:active {
  transform: scale(0.96);
  background: var(--card-active);
}

/* ===== SETTING ROW ===== */
.srow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
}

.srow + .srow {
  border-top: 1px solid var(--sep);
}

/* ===== STAT PILL ===== */
.spill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 4px;
  flex: 1;
}

.spill + .spill {
  border-left: 1px solid var(--sep);
}

/* ===== AVATAR ===== */
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(236,72,153,0.25));
  border: 1.5px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.avatar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(168deg, rgba(255,255,255,0.18) 0%, transparent 50%);
}

/* ===== BALANCE CARD ===== */
.balance-card {
  text-align: center;
  padding: 18px 14px;
}

.balance-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text3);
  transition: color 0.8s ease;
}

.balance-value {
  font-size: 30px;
  font-weight: 700;
  margin: 6px 0;
  background: linear-gradient(135deg, var(--balance-grad-start) 0%, var(--balance-grad-end) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: all 0.8s ease;
}

.sub-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.8s ease;
}

.badge-active {
  border: 1px solid var(--badge-active-border);
  background: var(--badge-active-bg);
  color: var(--badge-active-color);
}

.badge-expired {
  border: 1px solid var(--badge-expired-border);
  background: var(--badge-expired-bg);
  color: var(--badge-expired-color);
}

/* ===== SUB URL INPUT ===== */
.sub-url-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sub-url-input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 10px 12px;
  color: #a855f7;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  outline: none;
  min-width: 0;
  transition: all 0.8s ease;
}

.sub-url-input:focus {
  border-color: var(--accent-border);
}

.btn-copy {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--copy-bg);
  border: 1px solid var(--input-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-copy:active {
  transform: scale(0.92);
  background: var(--accent-bg);
}

/* ===== PRIMARY BTN ===== */
.btn-primary {
  width: 100%;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(168,85,247,0.3);
  background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(236,72,153,0.1));
  color: var(--text1);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(168deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-ghost {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-ghost:active {
  background: var(--card-active);
}

/* ===== DEVICE LIST ===== */
.device-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.device-item:active {
  transform: scale(0.98);
  background: var(--card-active);
}

.device-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.device-icon-wrap.android { background: linear-gradient(135deg, rgba(61,220,132,0.2), rgba(61,220,132,0.05)); }
.device-icon-wrap.ios { background: linear-gradient(135deg, rgba(162,170,173,0.2), rgba(162,170,173,0.05)); }
.device-icon-wrap.windows { background: linear-gradient(135deg, rgba(0,164,239,0.2), rgba(0,164,239,0.05)); }
.device-icon-wrap.macos { background: linear-gradient(135deg, rgba(255,107,107,0.2), rgba(255,107,107,0.05)); }
.device-icon-wrap.linux { background: linear-gradient(135deg, rgba(252,198,36,0.2), rgba(252,198,36,0.05)); }
.device-icon-wrap.unknown { background: var(--card-active); }

.device-meta {
  flex: 1;
  min-width: 0;
}

.device-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-hash {
  background: var(--hash-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  color: var(--hash-color);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-off);
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

.device-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.btn-device {
  flex: 1;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--glass-bg);
  color: var(--text2);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}

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

.btn-device.btn-rename {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.btn-device.btn-delete {
  border-color: var(--red-border);
  background: var(--red-bg);
}

/* ===== DEVICES LIMIT ===== */
.devices-limit-card {
  padding: 14px;
}

.devices-limit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.devices-limit-chip {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--glass-bg);
  border: 1px solid var(--input-border);
  color: var(--text2);
  transition: all 0.8s ease;
}

.devices-limit-chip.warning {
  border-color: var(--yellow-border);
  color: var(--yellow);
}

.devices-limit-chip.danger {
  border-color: var(--red-border);
  color: var(--red);
}

.traffic-progress {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--progress-bg);
  overflow: hidden;
  transition: background 0.8s ease;
}

.traffic-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #a855f7, #c084fc);
  transition: width 0.4s ease;
}

.traffic-bar.warning {
  background: linear-gradient(90deg, #eab308, #facc15);
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
}

.login-card {
  width: 100%;
  max-width: 320px;
  padding: 30px 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text1);
}

.login-sub {
  font-size: 14px;
  color: var(--text3);
  margin-bottom: 25px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  margin-bottom: 8px;
  display: block;
}

.web-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text1);
  font-size: 15px;
  outline: none;
  transition: all 0.3s;
}

.web-input:focus {
  border-color: var(--accent);
  background: var(--card-active);
}

.code-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 25px;
}

.code-digit {
  width: 40px;
  height: 50px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #a855f7;
}

.code-digit.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

#login-email-step, #login-code-step {
  width: 100%;
  transition: all 0.3s ease;
}

.hidden-step {
  display: none;
  opacity: 0;
  transform: translateY(10px);
}

/* ===== PAGER ===== */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.pager-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--glass-bg);
  color: var(--text2);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.pager-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.pager-btn:active {
  transform: scale(0.95);
}

.pager-info {
  font-size: 11px;
  color: var(--text4);
  font-family: 'Fira Code', monospace;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: modalIn 0.25s ease-out;
}

.modal-overlay.show {
  display: flex;
}

@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-body {
  background: var(--modal-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 340px;
  animation: modalSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  transition: background 0.8s ease, border-color 0.8s ease;
}

.modal-body::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(168deg, var(--glass-highlight) 0%, transparent 40%);
  pointer-events: none;
}

@keyframes modalSlide {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text1);
  position: relative;
  z-index: 1;
}

.modal-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text1);
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.2s, background 0.8s ease;
  position: relative;
  z-index: 1;
}

.modal-input:focus {
  border-color: var(--accent-border);
}

.modal-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.btn-modal-cancel {
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--glass-bg);
  color: var(--text2);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-modal-save {
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(168,85,247,0.3);
  background: linear-gradient(135deg, rgba(168,85,247,0.2), rgba(236,72,153,0.12));
  color: var(--text1);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-modal-cancel:active, .btn-modal-save:active {
  transform: scale(0.96);
}

/* ===== BTN UNLINK ALL ===== */
.btn-unlink-all {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--red-border);
  background: var(--red-bg);
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  margin-top: 8px;
}

.btn-unlink-all:active {
  transform: scale(0.97);
}

/* ===== INSTRUCTION ===== */
.instruction-step {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168,85,247,0.3), rgba(236,72,153,0.2));
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 12px;
  color: var(--text1);
}

/* ===== AUTH SCREEN ===== */
#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #08080e;
}

#auth-screen.hidden {
  display: none;
}

.auth-loader {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(168,85,247,0.15);
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 18px;
}

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

.auth-title {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

.auth-error {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  max-width: 300px;
}

.auth-error-icon { font-size: 40px; margin-bottom: 12px; }
.auth-error-title { font-size: 16px; font-weight: 700; color: rgba(248,113,113,0.85); margin-bottom: 8px; }
.auth-error-text { font-size: 12px; color: rgba(255,255,255,0.35); margin-bottom: 16px; line-height: 1.5; }

.btn-telegram {
  height: 44px;
  background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(236,72,153,0.15));
  border: 1px solid rgba(168,85,247,0.3);
  color: white;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

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

/* ===== STAT PILL (kept for future use) ===== */

/* ===== COLORS ===== */
.t1 { color: var(--text1); transition: color 0.8s ease; }
.t2 { color: var(--text2); transition: color 0.8s ease; }
.t3 { color: var(--text3); transition: color 0.8s ease; }
.t4 { color: var(--text4); transition: color 0.8s ease; }
.ta { color: var(--accent); transition: color 0.8s ease; }
.tg { color: var(--green); }

/* ===== ADD DEVICE STEPS ===== */
.add-step { position: relative; z-index: 1; }
.add-step p { color: var(--text3); font-size: 12px; margin-bottom: 12px; }
.add-step .field-label { font-size: 12px; color: var(--text2); margin-bottom: 6px; }

/* ===== THEME SWITCH ANIMATION ===== */
.theme-morph {
  position: fixed;
  border-radius: 50%;
  z-index: 9999;
  pointer-events: none;
  transform: scale(0);
  animation: themeMorphAnim 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes themeMorphAnim {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== LANG MODAL ===== */
.lang-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  margin-bottom: 6px;
}

.lang-option:hover, .lang-option:active {
  background: var(--card-active);
}

.lang-option.selected {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.lang-option .lang-flag {
  font-size: 24px;
}

.lang-option .lang-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text1);
}

.lang-option .lang-native {
  font-size: 11px;
  color: var(--text3);
}

.lang-check {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--input-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 12px;
}

.lang-option.selected .lang-check {
  background: #a855f7;
  border-color: #a855f7;
  color: #fff;
}

/* ===== WIZARD ===== */
@keyframes wizardIn {
  from { opacity:0; transform:translateY(40px) scale(0.96); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
@keyframes popIn {
  from { transform:scale(0); opacity:0; }
  to   { transform:scale(1); opacity:1; }
}

/* ===== LANG PILLS ===== */
.lang-pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--input-border);
  background: var(--glass-bg);
  color: var(--text2);
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  user-select: none;
}

.lang-pill:active {
  transform: scale(0.93);
}

.lang-pill.active-pill {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: #c084fc;
}

/* ===== THEME ICON ANIMATION ===== */
.theme-icon-wrap {
  position: relative;
  width: 24px;
  height: 24px;
}

.theme-icon-wrap .ti-sun,
.theme-icon-wrap .ti-moon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-icon-wrap .ti-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.theme-icon-wrap .ti-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

body.light .theme-icon-wrap .ti-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

body.light .theme-icon-wrap .ti-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}