*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }
html { background: #050505; }

body {
	font-family: "Inter", "Segoe UI", system-ui, sans-serif;
	background: #050505;
	color: #f2f2f2;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
}

a { color: #e59407; text-decoration: none; }
a:hover { color: #ffb020; }

/* ── Фоновый слой с коэффициентами ── */
.cf-bg {
	position: fixed; inset: 0; z-index: 0;
	overflow: hidden; pointer-events: none;
	background:
		radial-gradient(ellipse at 50% -10%, rgba(145,62,248,0.18) 0%, transparent 55%),
		radial-gradient(ellipse at 15% 105%, rgba(52,180,255,0.12) 0%, transparent 50%),
		radial-gradient(ellipse at 90% 80%, rgba(192,23,180,0.10) 0%, transparent 45%),
		#050505;
}
.cf-bg span {
	position: absolute;
	font-weight: 800;
	white-space: nowrap;
	opacity: 0;
	animation: cf-drift linear infinite;
	will-change: transform, opacity;
}
.cf-bg .low { color: #34b4ff; }
.cf-bg .mid { color: #913ef8; }
.cf-bg .high { color: #c017b4; }

@keyframes cf-drift {
	0%   { transform: translate3d(0, 24px, 0) scale(0.94); opacity: 0; }
	18%  { opacity: 0.20; }
	78%  { opacity: 0.16; }
	100% { transform: translate3d(0, -60px, 0) scale(1.04); opacity: 0; }
}

/* На десктопе анимация фона отключается вместе с остальными эффектами */
html.perf-lite .cf-bg span { animation: none; opacity: 0.13; }

@media (prefers-reduced-motion: reduce) {
	.cf-bg span { animation: none; opacity: 0.13; }
}

/* ── Auth ── */
.page-auth {
	position: relative;
	display: flex; align-items: center; justify-content: center;
	min-height: 100dvh;
	padding: 24px 16px;
	background-color: #050505;
}
.page-auth .auth-card { position: relative; z-index: 1; }

.auth-card, .admin-panel {
	width: 100%; max-width: 400px;
	background: rgba(17,17,17,0.92);
	border: 1px solid #222;
	border-radius: 16px; padding: 28px 24px;
	box-shadow: 0 24px 60px rgba(0,0,0,0.65);
}

.brand { text-align: center; margin-bottom: 24px; }
.brand-dot {
	display: inline-block; width: 10px; height: 10px; border-radius: 50%;
	background: #28a909; margin-bottom: 12px;
	box-shadow: 0 0 12px rgba(40,169,9,0.6);
}
.brand h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.brand p { font-size: 13px; color: #888; }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { font-size: 12px; color: #aaa; }
.auth-form input {
	height: 48px; border: 1px solid #2a2a2a; border-radius: 12px;
	background: #0a0a0a; color: #fff; padding: 0 14px; font-size: 16px;
}
.auth-form input:focus { outline: none; border-color: #a855f7; }
.auth-form button, .btn-start, .btn-danger {
	height: 48px; border: 0; border-radius: 12px;
	background: linear-gradient(135deg, #28a909, #36cb12);
	color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
	transition: transform 0.15s, box-shadow 0.15s;
}
.auth-form button:hover, .btn-start:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 6px 24px rgba(40,169,9,0.35);
}
.auth-form button:disabled, .btn-start:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.form-error { color: #ff6b6b; font-size: 13px; text-align: center; }
.form-success { color: #8dff73; font-size: 13px; text-align: center; margin-bottom: 12px; }
.auth-hint { margin-top: 16px; text-align: center; font-size: 12px; color: #666; }

/* ── App layout ── */
.page-app {
	min-height: 100vh; display: flex; flex-direction: column;
	background:
		radial-gradient(ellipse at 50% -10%, rgba(168,85,247,0.12) 0%, transparent 55%),
		radial-gradient(ellipse at 80% 100%, rgba(40,169,9,0.06) 0%, transparent 40%),
		#050505;
}

.topbar {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 16px; border-bottom: 1px solid #161616;
	background: #080808;
	position: sticky; top: 0; z-index: 10;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }

.live-dot {
	width: 9px; height: 9px; border-radius: 50%;
	background: #555; flex-shrink: 0;
	transition: background 0.3s, box-shadow 0.3s;
}
.live-dot.online {
	background: #28a909;
	box-shadow: 0 0 0 3px rgba(40,169,9,0.2);
	animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
	0%, 100% { box-shadow: 0 0 0 3px rgba(40,169,9,0.2); }
	50% { box-shadow: 0 0 0 6px rgba(40,169,9,0.08); }
}

.topbar-title { font-size: 14px; font-weight: 700; }
.topbar-sub { font-size: 11px; color: #666; margin-top: 1px; }
.topbar-link { font-size: 13px; color: #666; padding: 6px 10px; }

.app-main {
	flex: 1; display: flex; flex-direction: column; align-items: center;
	gap: 12px; padding: 16px 12px 24px;
	max-width: 440px; margin: 0 auto; width: 100%;
	position: relative; z-index: 1;
}

/* ── Main card ── */
.signal-card {
	width: 100%; position: relative; overflow: hidden;
	background: linear-gradient(160deg, #141414 0%, #0d0d0d 100%);
	border: 1px solid #252525; border-radius: 24px;
	padding: 20px 16px 18px; text-align: center;
	min-height: 520px;
}

.card-glow {
	position: absolute; inset: -1px; border-radius: 24px; pointer-events: none;
	background: linear-gradient(135deg, rgba(168,85,247,0.15), transparent 40%, rgba(40,169,9,0.1));
	opacity: 0.6;
}

.phase-badge {
	display: inline-flex; align-items: center; gap: 7px;
	background: #0a0a0a; border: 1px solid #222;
	border-radius: 999px; padding: 6px 14px;
	font-size: 11px; font-weight: 600; text-transform: uppercase;
	letter-spacing: 0.06em; color: #888; margin-bottom: 16px;
	position: relative; z-index: 1;
}

.phase-dot {
	width: 7px; height: 7px; border-radius: 50%; background: #555;
}
.phase-loading .phase-dot { background: #e59407; animation: pulse-dot 1s infinite; }
.phase-flight .phase-dot { background: #28a909; animation: pulse-dot 1s infinite; }
.phase-finish .phase-dot { background: #ff6b6b; }

/* ── Analysis panel ── */
.analysis-panel {
	position: absolute; z-index: 5;
	left: 12px; right: 12px; top: 56px;
	background: #0a0a0a; border: 1px solid #1e1e1e;
	border-radius: 16px; padding: 16px;
	text-align: left;
	box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}

.signal-card.analyzing .cf-hero,
.signal-card.analyzing .stats-grid,
.signal-card.analyzing .confidence-row,
.signal-card.analyzing .signal-actions,
.signal-card.analyzing .flight-panel {
	opacity: 0.35;
	transition: opacity 0.25s ease;
}

.analysis-title {
	font-size: 13px; font-weight: 700; color: #ccc;
	margin-bottom: 14px; text-align: center;
}

.analysis-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.step {
	display: flex; align-items: center; gap: 10px;
	font-size: 12px; color: #555; transition: color 0.3s;
}
.step.active { color: #fff; font-weight: 600; }
.step.done { color: #28a909; }

.step-icon {
	width: 18px; height: 18px; border-radius: 50%;
	border: 2px solid #333; flex-shrink: 0;
	transition: border-color 0.3s, background 0.3s;
}
.step.active .step-icon {
	border-color: #a855f7;
	border-top-color: transparent;
	animation: spin 0.7s linear infinite;
}
.step.done .step-icon {
	border-color: #28a909; background: #28a909;
}

.analysis-bar {
	height: 4px; background: #1a1a1a; border-radius: 4px; overflow: hidden;
	margin-bottom: 10px;
}
.analysis-bar-fill {
	height: 100%; width: 0;
	background: linear-gradient(90deg, #a855f7, #28a909);
	border-radius: 4px; transition: width 0.4s ease;
}

.analysis-meta {
	display: flex; justify-content: space-between;
	font-size: 11px; color: #555;
}

/* ── CF Hero ── */
.cf-hero {
	position: relative; z-index: 1; margin-bottom: 16px;
	min-height: 148px;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	transition: opacity 0.25s ease;
}

.cf-label {
	font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
	color: #666; margin-bottom: 10px;
}

.cf-display {
	display: flex; align-items: baseline; justify-content: center;
	gap: 4px; width: 80%; max-width: 100%;
	min-height: 110px; margin: 0 auto;
}

.cf-value {
	font-size: clamp(56px, 16vw, 88px);
	font-weight: 800; line-height: 1;
	width: 100%; text-align: center;
	font-variant-numeric: tabular-nums;
	font-synthesis: none;
	letter-spacing: -0.03em;
	font-family: "Inter", "Segoe UI", system-ui, sans-serif;
	color: #fff;
	transition: opacity 0.25s ease;
}

.cf-value.ready,
.cf-value.empty {
	font-size: clamp(56px, 16vw, 88px);
	font-weight: 800;
}

.cf-value.standby-pulse {
	animation: standby-pulse 1.4s ease-in-out infinite;
}

@keyframes standby-pulse {
	0%, 100% { opacity: 0.35; }
	50% { opacity: 0.75; }
}

.cf-value.low { color: #34b4ff; }
.cf-value.mid { color: #913ef8; }
.cf-value.high { color: #c017b4; }

.cf-unit {
	font-size: clamp(24px, 6vw, 32px);
	color: #444; font-weight: 800;
}

/* ── Flight tracker ── */
.flight-panel {
	position: relative; z-index: 1;
	background: #0a0a0a; border: 1px solid #1a3a1a;
	border-radius: 16px; padding: 14px; margin-bottom: 14px;
	text-align: left;
}

.flight-head {
	display: flex; flex-direction: column; align-items: center; gap: 6px;
	font-size: 12px; color: #888; margin-bottom: 12px; text-align: center;
}
.flight-head strong {
	font-size: clamp(36px, 14vw, 56px);
	width: 80%; max-width: 100%;
	min-height: 1.05em;
	color: #36cb12; font-weight: 800;
	font-variant-numeric: tabular-nums;
	font-synthesis: none;
	letter-spacing: -0.03em;
	font-family: "Inter", "Segoe UI", system-ui, sans-serif;
	line-height: 1;
}

.flight-track {
	position: relative; height: 28px; margin-bottom: 8px;
}

.flight-progress {
	height: 6px; background: #1a1a1a; border-radius: 6px;
	overflow: hidden; margin-top: 11px;
}
.flight-progress-fill {
	height: 100%; width: 0;
	background: linear-gradient(90deg, #28a909, #36cb12);
	border-radius: 6px;
	transition: none;
}
.flight-progress-fill.hot {
	background: #36cb12;
}

.flight-plane {
	position: absolute; top: 0; left: 0;
	font-size: 18px;
	transition: none;
}

.flight-foot {
	display: flex; justify-content: space-between;
	font-size: 11px; color: #666;
}
.flight-foot strong { color: #aaa; }

/* ── Stats grid ── */
.stats-grid {
	display: grid; grid-template-columns: repeat(3, 1fr);
	gap: 8px; margin-bottom: 14px; position: relative; z-index: 1;
}

.stat-box {
	background: #0a0a0a; border: 1px solid #1c1c1c;
	border-radius: 14px; padding: 10px 8px;
}

.stat-icon {
	font-size: 11px; margin-bottom: 4px;
}
.stat-icon-trust { color: #a855f7; }
.stat-icon-next { color: #e59407; }
.stat-icon-round { color: #6ea8ff; }

.stat-key {
	font-size: 10px; color: #555; text-transform: uppercase;
	letter-spacing: 0.04em; margin-bottom: 4px;
}
.stat-val {
	font-size: clamp(15px, 5vw, 22px); font-weight: 800; color: #fff;
}
.stat-val.cf-hist.low { color: #34b4ff; }
.stat-val.cf-hist.mid { color: #913ef8; }
.stat-val.cf-hist.high { color: #c017b4; }
.stats-history .stat-box { text-align: center; }
.confidence-row {
	display: flex; justify-content: space-between; align-items: center;
	background: #0a0a0a; border: 1px solid #1c1c1c; border-radius: 12px;
	padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: #888;
	position: relative; z-index: 1;
}
.confidence-row strong { color: #8dff73; font-size: 16px; }

/* ── Signals ── */
.signal-actions {
	display: flex; flex-direction: column; gap: 8px;
	margin-bottom: 14px; position: relative; z-index: 1;
}

.signal {
	position: relative; border-radius: 14px; padding: 12px 14px;
	overflow: hidden; text-align: left;
}

.signal-pulse {
	position: absolute; inset: 0; opacity: 0.15;
	animation: signal-pulse 1.5s ease-in-out infinite;
}

@keyframes signal-pulse {
	0%, 100% { transform: scale(1); opacity: 0.1; }
	50% { transform: scale(1.02); opacity: 0.2; }
}

.signal-bet {
	background: rgba(40,169,9,0.12); border: 1px solid rgba(40,169,9,0.4);
}
.signal-bet .signal-pulse { background: #28a909; }

.signal-cashout {
	background: rgba(229,148,7,0.12); border: 1px solid rgba(229,148,7,0.4);
}
.signal-cashout .signal-pulse { background: #e59407; }

.signal-wait {
	background: rgba(80,80,80,0.12); border: 1px solid #333;
}

.signal-body { position: relative; z-index: 1; }
.signal-body strong {
	display: block; font-size: 15px; font-weight: 800;
	letter-spacing: 0.04em; margin-bottom: 2px;
}
.signal-bet .signal-body strong { color: #8dff73; }
.signal-cashout .signal-body strong { color: #ffb020; }
.signal-wait .signal-body strong { color: #aaa; }
.signal-body span { font-size: 11px; color: #777; }

/* ── Start button ── */
.btn-start {
	width: 100%; position: relative; z-index: 1;
	height: 52px; font-size: 16px;
	box-shadow: 0 4px 20px rgba(40,169,9,0.25);
}

.btn-start-loader {
	display: inline-block; width: 22px; height: 22px;
	border: 2px solid rgba(255,255,255,0.3);
	border-top-color: #fff; border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.signal-card.loading .cf-value { opacity: 0.55; }

/* Desktop / mouse: lighter effects (gradient text & blur are slow on many laptops) */
html.perf-lite .cf-value.standby-pulse { animation: none; opacity: 0.55; }
html.perf-lite .live-dot.online { animation: none; }
html.perf-lite .phase-loading .phase-dot,
html.perf-lite .phase-flight .phase-dot { animation: none; }
html.perf-lite .signal-pulse { animation: none; display: none; }
html.perf-lite .card-glow { display: none; }
html.perf-lite .step.active .step-icon { animation: none; border-color: #a855f7; }

/* ── Trust bar ── */
.trust-bar {
	width: 100%; display: flex; justify-content: center; gap: 16px;
	flex-wrap: wrap; padding: 4px 0;
}

.trust-item {
	display: flex; align-items: center; gap: 6px;
	font-size: 11px; color: #555;
}

.trust-dot {
	width: 6px; height: 6px; border-radius: 50%; background: #333;
}
.trust-dot.on { background: #28a909; box-shadow: 0 0 6px rgba(40,169,9,0.5); }

/* ── Admin ── */
.admin-wrap { width: 100%; max-width: 520px; }
.admin-create { margin-bottom: 20px; }
.keys-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.key-row {
	display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
	background: #0a0a0a; border: 1px solid #222; border-radius: 10px; padding: 12px;
}
.key-row strong { display: block; font-size: 16px; }
.key-row small { color: #666; font-size: 11px; }
.invite-url { font-size: 11px; color: #555; word-break: break-all; margin-top: 4px; }
.btn-danger { height: 36px; padding: 0 14px; font-size: 13px; background: #8b1e1e; flex-shrink: 0; }
.btn-danger:hover { background: #a82828; }

@media (max-width: 360px) {
	.stats-grid { gap: 6px; }
	.stat-val { font-size: 14px; }
}
