/* 3D Cat PWA — chalk paper + ink + logo purple/blue */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap");

:root {
  --font: "Outfit", system-ui, sans-serif;
  --display: "Syne", "Outfit", sans-serif;
  --ink: #101418;
  --ink-soft: #2a323a;
  --chalk: #f3f1ec;
  --chalk-2: #e9e6df;
  --paper: rgba(255, 255, 255, 0.72);
  --lime: #9333ea;
  --lime-bright: #a855f7;
  --lime-ink: #ffffff;
  --signal: #1f6bff;
  --ok: #1f8a4c;
  --warn: #c47a12;
  --bad: #d64545;
  --muted: #6d757e;
  --stroke: rgba(16, 20, 24, 0.1);
  --r: 20px;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* bridge old vars used across app.css */
  --bg: var(--chalk);
  --bg2: var(--chalk-2);
  --surface: var(--paper);
  --surface2: #fff;
  --text: var(--ink);
  --muted2: #5c656e;
  --accent: #1a1f24;
  --accent2: #1f6bff;
  --cyan: #1f6bff;
  --glass: rgba(255, 255, 255, 0.55);
  --shadow: none;
}

html {
  background-color: #f3f1ec !important;
}
html, body {
  color: var(--ink) !important;
  font-family: var(--font) !important;
  background-color: #f3f1ec !important;
  background-image:
    radial-gradient(900px 420px at 0% -5%, rgba(147, 51, 234, 0.18), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(31, 107, 255, 0.12), transparent 50%),
    linear-gradient(180deg, #f7f5f0 0%, #f3f1ec 45%, #ebe7df 100%) !important;
  background-attachment: fixed !important;
  letter-spacing: -0.015em;
  min-height: 100%;
}

html.standalone,
html.standalone body { background-color: #f3f1ec !important; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(16, 20, 24, 0.06) 0.7px, transparent 0.7px);
  background-size: 3px 3px;
}
#app { position: relative; z-index: 1; }
.status-bar-fill { background: transparent !important; z-index: 90; }

.shell {
  max-width: 430px !important;
  padding: calc(14px + var(--safe-t)) 22px calc(var(--nav-h) + var(--safe-b) + 24px) !important;
}

/* Typography */
.brand, .brand-small, .home-name, .screen-title, .auth-title, .profile-name,
.vpn-connect-title, .auth-brand, .home-brand, .block-title, .wallet-card-amount {
  font-family: var(--display) !important;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--ink) !important;
}

.muted, .sub, .section-hint, .screen-sub, .home-greet, .home-handle, .vpn-tile-sub {
  color: var(--muted) !important;
}

/* Quiet surfaces */
.card, .home-sub, .vpn-status, .vpn-connect, .vpn-chart, .settings-block,
.profile-hero, .notif-card, .support-thread, .screen-empty, .home-empty,
.ovpn-preview-card, .upload-zone {
  background: var(--paper) !important;
  border: 1px solid var(--stroke) !important;
  border-radius: calc(var(--r) + 4px) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.hero-card, .home-hero, .home-hero-glow {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* ——— Auth: brand-first composition ——— */
.auth-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px 0 12px;
  min-height: min(72dvh, 640px);
}
.auth-atmosphere {
  position: absolute;
  inset: -10% -40% auto;
  height: 280px;
  background:
    radial-gradient(closest-side, rgba(147, 51, 234, 0.4), transparent 70%),
    radial-gradient(closest-side at 80% 40%, rgba(31, 107, 255, 0.16), transparent 65%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}
.auth-kicker {
  position: relative;
  z-index: 1;
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-brand {
  position: relative;
  z-index: 1;
  font-size: clamp(3.2rem, 13vw, 4.1rem) !important;
  line-height: 0.92 !important;
  margin: 8px 0 8px !important;
}
.auth-line {
  position: relative;
  z-index: 1;
  margin: 0 0 22px;
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 20ch;
}
.auth-panel {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  padding: 18px 16px 16px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid var(--stroke) !important;
  border-radius: 28px !important;
}
.auth-hero { display: none !important; }
.auth-sub { display: none !important; }
.install-banner {
  margin: 16px 0 0 !important;
  background: #fff !important;
  border: 1px solid var(--stroke) !important;
  color: var(--ink) !important;
}
.auth-install-slot .install-banner b { font-size: 0.9rem; }
.auth-install-slot .section-hint { font-size: 0.8rem !important; }

/* ——— Home ——— */
.home-stage {
  padding: 6px 0 10px;
  margin-bottom: 8px;
}
.home-brand {
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-brand .logo-badge { width: 36px !important; height: 36px !important; border-radius: 12px !important; }
.home-status-title {
  font-family: var(--display);
  font-size: clamp(2.4rem, 10vw, 3rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--ink);
}
.home-status-title.is-on { color: var(--ink); }
.home-status-title.is-on::after {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-left: 0.18em;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 6px rgba(147, 51, 234, 0.25);
  vertical-align: 0.12em;
  animation: pulse-dot 2.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.85); opacity: 0.7; }
}
.home-meta-line {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 22px;
}
.home-hero, .home-hero-row, .home-hero-meta, .home-greet, .home-name, .home-handle, .home-pill {
  /* rebuilt via JS classes; soften leftovers */
}
.home-pill {
  display: none !important;
}

.app-header--home {
  display: flex;
  justify-content: flex-end;
  background: transparent !important;
  border: none !important;
  margin: 0 0 4px !important;
  padding: 0 !important;
}
.home-header-brand { display: none !important; }
.app-header {
  background: transparent !important;
  border: none !important;
  margin-bottom: 10px !important;
}

/* Quick actions — not card grid soup */
.home-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
  margin: 0 0 18px;
}
.home-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 118px;
  padding: 18px 16px !important;
  margin: 0 !important;
  border-radius: 26px !important;
  border: 1px solid var(--stroke) !important;
  background: #fff !important;
  color: var(--ink) !important;
  text-align: left;
  box-shadow: none !important;
  transition: transform 0.18s ease, background 0.18s ease;
}
.home-action:active { transform: scale(0.985); }
.home-action--primary {
  background: var(--ink) !important;
  color: #f7f5f0 !important;
  border-color: transparent !important;
  grid-row: span 2;
  min-height: 246px;
  justify-content: space-between;
}
.home-action--primary .ha-val { color: var(--lime) !important; }
.home-action--primary .ha-lbl { color: rgba(247, 245, 240, 0.65) !important; }
.ha-ico { opacity: 0.9; }
.ha-val {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.ha-lbl { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

.home-bento { display: none !important; } /* replaced by home-actions */

.support-entry {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0 0 14px !important;
  padding: 16px 18px !important;
  border-radius: 22px !important;
  background: transparent !important;
  border: 1px dashed rgba(16, 20, 24, 0.18) !important;
  box-shadow: none !important;
}

.home-sub {
  padding: 20px 18px !important;
  margin-top: 6px !important;
}
.home-sub-head h2 {
  font-family: var(--display);
  font-size: 1.35rem !important;
}

/* Controls */
input, select, .field-select {
  background: #fff !important;
  border: 1px solid rgba(16, 20, 24, 0.12) !important;
  color: var(--ink) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
}
input:focus, select:focus {
  border-color: var(--ink) !important;
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.45) !important;
}

.btn {
  background: var(--ink) !important;
  color: var(--lime) !important;
  border: none !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
}
.btn:active { transform: scale(0.985); }
.btn-ghost, .btn-sm.btn-ghost {
  background: transparent !important;
  border: 1px solid var(--stroke) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}
.btn-danger {
  background: rgba(214, 69, 69, 0.08) !important;
  border: 1px solid rgba(214, 69, 69, 0.28) !important;
  color: var(--bad) !important;
}

.tabs {
  background: rgba(16, 20, 24, 0.05) !important;
  border-radius: 16px !important;
  padding: 4px !important;
}
.tabs button {
  background: transparent !important;
  border: none !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  margin: 0 !important;
  font-weight: 600 !important;
}
.tabs button.active {
  background: #fff !important;
  color: var(--ink) !important;
}

/* Nav — строго fixed к низу экрана (не relative в потоке страницы) */
.nav {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  max-width: none !important;
  height: calc(var(--nav-h) + var(--safe-b)) !important;
  margin: 0 !important;
  z-index: 100 !important;
  background: rgba(16, 20, 24, 0.96) !important;
  border: none !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 0 !important;
  backdrop-filter: blur(16px);
  box-shadow: 0 -8px 28px rgba(16, 20, 24, 0.18) !important;
  padding: 8px 10px calc(8px + var(--safe-b)) !important;
  display: flex !important;
  align-items: flex-start !important;
}
.nav.hidden { display: none !important; }
.nav button {
  color: rgba(247, 245, 240, 0.55) !important;
  font-size: 0.62rem !important;
  font-weight: 600 !important;
  gap: 3px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}
.nav button.active {
  color: var(--lime) !important;
}
.nav .nav-badge, .nav-support-badge {
  background: var(--lime) !important;
  color: var(--lime-ink) !important;
}

/* VPN */
.screen-head { margin: 2px 0 16px !important; }
.screen-title { font-size: 2.1rem !important; margin: 0 0 4px !important; }
.vpn-protocol-tabs {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin-bottom: 16px !important;
}
.vpn-protocol-tab {
  margin: 0 !important;
  border-radius: 18px !important;
  border: 1px solid var(--stroke) !important;
  background: #fff !important;
  color: var(--muted) !important;
  padding: 14px 12px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
.vpn-protocol-tab.active {
  background: var(--ink) !important;
  color: var(--lime) !important;
  border-color: transparent !important;
}
.vpn-connect-badge {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.vpn-section-label {
  margin: 20px 0 10px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted) !important;
}
.vpn-tile, .bento, .wallet-quick-btn {
  background: #fff !important;
  border: 1px solid var(--stroke) !important;
  border-radius: 20px !important;
  box-shadow: none !important;
  color: var(--ink) !important;
}
.vpn-tile--primary {
  background: var(--ink) !important;
  border-color: transparent !important;
  color: #f7f5f0 !important;
}
.vpn-tile--primary .vpn-tile-title { color: #f7f5f0 !important; }
.vpn-tile--primary .vpn-tile-sub { color: rgba(247, 245, 240, 0.6) !important; }
.vpn-tile--primary .vpn-tile-ico { color: var(--lime) !important; }
.vpn-tile-ico, .bento-ico { color: var(--ink) !important; }
.vpn-tile-ico.cyan, .bento-ico.cyan { color: var(--signal) !important; }
.vpn-tile-ico.accent, .bento-ico.accent { color: var(--ink) !important; }

/* Wallet */
.wallet-card {
  background: var(--ink) !important;
  color: #f7f5f0 !important;
  border: none !important;
  border-radius: 28px !important;
  padding: 22px !important;
  box-shadow: none !important;
}
.wallet-card-label, .wallet-card-id { color: rgba(247, 245, 240, 0.55) !important; }
.wallet-card-amount { color: var(--lime) !important; font-size: 2.3rem !important; }
.wallet-card-amount small {
  margin-left: 0.25em;
  font-size: 0.45em;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0;
  color: rgba(247, 245, 240, 0.65) !important;
  vertical-align: 0.35em;
}
.wallet-page { display: flex; flex-direction: column; gap: 14px; }
.badge.ok { background: rgba(147, 51, 234, 0.18) !important; color: var(--ink) !important; }
.badge.warn { background: rgba(196, 122, 18, 0.15) !important; color: #8a5a10 !important; }
.badge.bad { background: rgba(214, 69, 69, 0.12) !important; color: var(--bad) !important; }
.migration-banner-title { font-family: var(--display) !important; font-size: 1.25rem !important; margin: 0 0 4px !important; }
/* app-overrides раньше поднимал nav над home-indicator и «топил» его */
.nav { bottom: 0 !important; }

/* Telegram */
.tg-hero { padding: 4px 0 8px; }
.tg-hero h1 {
  font-family: var(--display);
  font-size: 2.3rem;
  letter-spacing: -0.045em;
  margin: 8px 0 8px;
}
.tg-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px;
  border-radius: 22px;
  background: var(--ink);
  border: none;
  margin: 14px 0;
}
.tg-code {
  font-family: var(--display);
  font-size: 2rem;
  letter-spacing: 0.2em;
  font-weight: 800;
  color: var(--lime);
}
.tg-steps { color: var(--ink-soft); line-height: 1.55; padding-left: 1.1rem; }
.tg-linked {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid rgba(147, 51, 234, 0.45);
  color: var(--ink);
  font-weight: 700;
}

/* Logo badge */
.logo-badge {
  border: 1px solid rgba(16, 20, 24, 0.12) !important;
  box-shadow: none !important;
  background:
    var(--logo-fill) center 40% / cover no-repeat,
    linear-gradient(145deg, #1a1f24 0%, #0d1114 60%, #152018 100%) !important;
}
.logo-badge::after {
  background: linear-gradient(160deg, rgba(147, 51, 234, 0.12) 0%, transparent 50%) !important;
}

.switch { background: rgba(16, 20, 24, 0.12) !important; }
.switch.on { background: var(--ink) !important; }
.switch.on i { background: var(--lime) !important; }

.toast {
  background: var(--ink) !important;
  color: var(--lime) !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 32px rgba(16, 20, 24, 0.25) !important;
}

.notif-btn {
  background: #fff !important;
  border: 1px solid var(--stroke) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}

/* Motion — только локальные, без сдвига всего #app (ломает scroll/screenshot) */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-brand, .home-status-title, .home-action, .auth-panel {
  animation: rise-in 0.4s ease both;
}
.home-action:nth-child(1) { animation-delay: 0.04s; }
.home-action:nth-child(2) { animation-delay: 0.08s; }
.home-action:nth-child(3) { animation-delay: 0.12s; }

/* Сессия / QR / история */
.session-widget { margin: 0 0 14px; padding: 14px 16px; }
.session-widget-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.session-widget-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.session-widget-grid span { display: block; font-size: 0.72rem; color: var(--muted2); margin-bottom: 2px; }
.session-widget-grid b { font-size: 0.88rem; font-weight: 700; word-break: break-all; }
.qr-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(16,20,24,.45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
}
.qr-sheet { width: min(420px, 100%); padding: 20px; text-align: center; }
.qr-box { display: flex; justify-content: center; margin: 12px auto; }
.qr-box img, .qr-box canvas { border-radius: 12px; }
.conn-list { display: flex; flex-direction: column; gap: 8px; }
.conn-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  font-size: 0.84rem; padding: 10px 0; border-bottom: 1px solid var(--stroke);
}
.conn-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conn-ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }
.conn-meta { color: var(--muted2); font-size: 0.76rem; line-height: 1.35; word-break: break-word; }
.conn-time { color: var(--muted2); white-space: nowrap; font-size: 0.76rem; flex-shrink: 0; }
.tg-id-line { margin: 8px 0 0; font-size: 0.84rem; }
.quiet-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quiet-row .field-select { flex: 1; min-width: 90px; }
.dev-name { margin-bottom: 8px; }

/* Локации VPN */
.loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 20, 24, 0.06);
  border: 1px solid var(--stroke);
  font-size: 0.78rem;
  color: var(--ink);
}
.loc-chip b { font-weight: 700; letter-spacing: 0.04em; }
.loc-chip--sm { margin-top: 0; padding: 4px 10px; font-size: 0.72rem; }
.home-loc { margin-top: 4px; }
.loc-picker { margin: 8px 0 14px; }
.loc-picker-empty { margin: 8px 0; font-size: 0.82rem; }
.loc-picker-grid {
  display: grid;
  gap: 8px;
}
.loc-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.loc-card:active { transform: scale(0.985); }
.loc-card.is-selected {
  border-color: var(--ink);
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.18), #fff 60%);
}
.loc-card-code {
  grid-row: 1 / span 2;
  font-family: Syne, Outfit, sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  min-width: 2.2rem;
}
.loc-card-name {
  font-size: 0.9rem;
  font-weight: 600;
}
.loc-card-tag {
  font-size: 0.72rem;
  color: var(--muted2);
}

@media (max-width: 360px) {
  .home-actions { grid-template-columns: 1fr; }
  .home-action--primary { grid-row: auto; min-height: 140px; }
  .nav button { font-size: 0.58rem !important; }
}
