/* ============ HION cabinet — dark glass theme ============ */
:root {
  --bg: #05060f;
  --accent1: #6366f1;
  --accent2: #22d3ee;
  --ok: #34d399;
  --bad: #f87171;
  --text: #e8eaf6;
  --muted: #8b90ad;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-border: rgba(255, 255, 255, 0.09);
  --radius: 24px;
  --font: -apple-system, "SF Pro Display", "Segoe UI", Roboto, Inter, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
}

/* ---------- фоновые пятна ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob {
  position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%;
  filter: blur(90px); opacity: 0.32; will-change: transform;
}
.b1 { background: var(--accent1); top: -18vmax; left: -12vmax; animation: drift1 26s ease-in-out infinite alternate; }
.b2 { background: var(--accent2); bottom: -20vmax; right: -14vmax; animation: drift2 32s ease-in-out infinite alternate; }
.b3 { background: #a855f7; top: 30%; left: 45%; width: 38vmax; height: 38vmax; opacity: 0.18; animation: drift3 22s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(9vmax, 12vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-10vmax, -9vmax) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-14vmax, 8vmax) scale(1.2); } }
.noise {
  position: absolute; inset: 0; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- стекло ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* ---------- экраны ---------- */
.screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s 0.45s;
  visibility: hidden;
  position: absolute; inset: 0; overflow-y: auto;
}
.screen.active { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 4px; }

#screen-app { justify-content: flex-start; padding-top: max(20px, env(safe-area-inset-top)); }
.wrap { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- логин ---------- */
.login-card { width: 100%; max-width: 380px; padding: 36px 28px; text-align: center; animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(0.97); } }
.logo.big { display: flex; justify-content: center; margin-bottom: 14px; filter: drop-shadow(0 6px 24px rgba(99, 102, 241, 0.55)); animation: logoFloat 5s ease-in-out infinite alternate; }
@keyframes logoFloat { to { transform: translateY(-6px); } }
#login-brand { font-size: 30px; font-weight: 800; letter-spacing: 0.14em; background: linear-gradient(90deg, var(--accent2), var(--accent1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hint { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 10px 0 22px; }

.otp { display: flex; gap: 8px; justify-content: center; margin-bottom: 22px; }
.otp input {
  width: 46px; height: 56px; text-align: center; font-size: 24px; font-weight: 700;
  color: var(--text); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border); border-radius: 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s; caret-color: var(--accent2);
}
.otp input:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18); transform: translateY(-2px); }
.otp.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.login-error { color: var(--bad); font-size: 13px; margin-top: 14px; min-height: 18px; text-align: center; }
.login-bot-link { display: inline-block; margin-top: 16px; color: var(--accent2); font-size: 14px; text-decoration: none; opacity: 0.9; }
.login-bot-link:hover { opacity: 1; text-decoration: underline; }

/* ---------- кнопки ---------- */
.btn {
  border: none; cursor: pointer; color: #fff; font-weight: 600; font-family: var(--font);
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  border-radius: 16px; padding: 14px 22px; font-size: 15px; width: 100%;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 8px 26px rgba(99, 102, 241, 0.4);
}
.btn:active { transform: scale(0.96); }
.btn:hover { box-shadow: 0 10px 34px rgba(99, 102, 241, 0.55); }
.btn.small { width: auto; padding: 10px 18px; font-size: 13px; border-radius: 12px; }
.btn.ghost { background: rgba(255, 255, 255, 0.08); box-shadow: none; border: 1px solid var(--glass-border); }
.btn:disabled { opacity: 0.55; cursor: default; }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); color: var(--text);
  border: 1px solid var(--glass-border); border-radius: 12px; transition: background 0.2s, transform 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- шапка ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: 0.1em; }
.brand svg { filter: drop-shadow(0 3px 12px rgba(99, 102, 241, 0.5)); }

/* ---------- герой: орб ---------- */
.hero { padding: 26px 20px 24px; text-align: center; }
.hero-status { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; }
.hero-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.6s infinite; }
.hero-status.ok::before { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.hero-status.bad::before { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
@keyframes blink { 50% { opacity: 0.35; } }

.orb { position: relative; width: 210px; height: 210px; margin: 22px auto 14px; }
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(99, 102, 241, 0.5); opacity: 0;
  animation: pulse 3.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.r2 { animation-delay: 1.05s; } .r3 { animation-delay: 2.1s; }
@keyframes pulse { 0% { transform: scale(0.62); opacity: 0.9; } 70% { opacity: 0.25; } 100% { transform: scale(1.25); opacity: 0; } }

.orb-core { position: absolute; inset: 22px; border-radius: 50%; padding: 3px; background: conic-gradient(from 0deg, var(--accent1), var(--accent2), #a855f7, var(--accent1)); animation: spin 7s linear infinite; box-shadow: 0 0 44px rgba(99, 102, 241, 0.45), inset 0 0 30px rgba(34, 211, 238, 0.12); }
@keyframes spin { to { transform: rotate(360deg); } }
.orb-core::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #1a1d3a, #0a0c1d 70%); }
.power {
  position: absolute; inset: 3px; border-radius: 50%; border: none; cursor: pointer;
  background: transparent; color: #fff; display: grid; place-items: center;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 1;
}
.power:hover { transform: scale(1.05); }
.power:active { transform: scale(0.9); }
.power svg { filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.8)); transition: transform 0.3s; }
.orb-core.loading .power svg { animation: spin 1.1s linear infinite; }
.hero-sub { color: var(--muted); font-size: 13px; min-height: 18px; transition: color 0.3s; }

/* ---------- серверы ---------- */
.section-title { font-size: 14px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; margin: 6px 2px -4px; }
.section-title.small { font-size: 11px; margin: 0 0 6px; }
.servers { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; }
.servers::-webkit-scrollbar { display: none; }
.server {
  flex: 0 0 auto; min-width: 118px; padding: 14px 16px; cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.25s, background 0.25s;
  user-select: none;
}
.server:active { transform: scale(0.95); }
.server .flag { display: block; margin-bottom: 6px; }
.server .flag svg { width: 30px; height: 21px; border-radius: 5px; display: block; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
.server .name { font-weight: 600; font-size: 14px; }
.server .ping { font-size: 11px; color: var(--ok); margin-top: 3px; }
.server.selected { border-color: var(--accent2); background: rgba(34, 211, 238, 0.1); box-shadow: 0 0 22px rgba(34, 211, 238, 0.18); }

/* ---------- статистика ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { padding: 16px 18px; }
.stat-top { display: flex; justify-content: space-between; align-items: baseline; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.stat-value { font-size: 17px; font-weight: 800; }
.bar { height: 7px; background: rgba(255, 255, 255, 0.08); border-radius: 6px; margin: 12px 0 8px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent1), var(--accent2)); transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1); }
.bar-fill.alt { background: linear-gradient(90deg, #a855f7, var(--accent1)); }
.stat-note { font-size: 12px; color: var(--muted); }

/* ---------- подписка ---------- */
.sub-card { padding: 18px; }
.sub-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.sub-url {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px;
  color: var(--accent2); word-break: break-all; line-height: 1.45;
  max-height: 3.2em; overflow: hidden; opacity: 0.9;
}
.sub-hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 12px; }

/* ---------- приложения ---------- */
.apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.app { padding: 16px 10px; text-align: center; cursor: pointer; color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 600; line-height: 1.35; border: 1px solid var(--glass-border); background: var(--glass); border-radius: var(--radius); backdrop-filter: blur(24px); transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.25s; font-family: var(--font); }
.app small { color: var(--muted); font-weight: 500; }
.app:hover { border-color: rgba(34, 211, 238, 0.4); }
.app:active { transform: scale(0.94); }
.app-emoji { font-size: 24px; display: block; margin-bottom: 8px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0 4px; }

/* ---------- модалка ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(3, 4, 12, 0.6); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card { width: min(320px, 88vw); padding: 24px; text-align: center; transform: scale(0.92); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.modal.open .modal-card { transform: scale(1); }
.modal-card h3 { margin-bottom: 16px; font-size: 17px; }
.qr-holder { background: #fff; padding: 12px; border-radius: 16px; display: inline-block; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); background: rgba(20, 22, 40, 0.92);
  border: 1px solid var(--glass-border); backdrop-filter: blur(16px);
  color: var(--text); padding: 12px 20px; border-radius: 14px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 86vw; text-align: center; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(52, 211, 153, 0.45); }
.toast.err { border-color: rgba(248, 113, 113, 0.45); }

/* ---------- скелетоны ---------- */
.skeleton { position: relative; overflow: hidden; color: transparent !important; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.09), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (min-width: 700px) { .wrap { max-width: 500px; } .hero { padding: 34px 26px 30px; } }
