@font-face { font-family: RostelecomBasis; src: url(../assets/fonts/RostelecomBasis-Regular.otf) format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: RostelecomBasis; src: url(../assets/fonts/RostelecomBasis-Medium.otf) format('opentype'); font-weight: 500; font-display: swap; }
@font-face { font-family: RostelecomBasis; src: url(../assets/fonts/RostelecomBasis-Bold.otf) format('opentype'); font-weight: 700; font-display: swap; }

:root {
	--violet: #7700ff;
	--orange: #ff4f12;
	--dark: #101828;
	--navy: #273a64;
	--white: #fff;
	--text: #101828;
	--muted: #5b6475;
	--card: rgba(255, 255, 255, 0.08);
	--line: rgba(255, 255, 255, 0.14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
	font-family: RostelecomBasis, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	background: var(--dark);
	color: var(--white);
	overscroll-behavior: none;
}
[hidden] { display: none !important; }

/* ---------- Стартовый экран ---------- */
#menu {
	min-height: 100%;
	padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
	background:
		radial-gradient(120% 60% at 100% 0%, rgba(119, 0, 255, 0.55), transparent 60%),
		radial-gradient(90% 50% at 0% 100%, rgba(255, 79, 18, 0.28), transparent 60%),
		var(--dark);
	max-width: 640px;
	margin: 0 auto;
}
.top { padding: 4px 0 8px; }
.logo { height: 34px; width: auto; }
.hero h1 { font-size: 28px; line-height: 1.12; margin: 18px 0 8px; font-weight: 700; }
.hero p { margin: 0 0 8px; font-size: 17px; opacity: 0.92; }
.hero .proto {
	font-size: 14px; opacity: 0.8; border-left: 3px solid var(--orange);
	padding: 4px 0 4px 10px; margin-top: 14px;
}
.error {
	background: rgba(255, 79, 18, 0.18); border: 1px solid var(--orange);
	border-radius: 12px; padding: 10px 12px; margin: 12px 0; font-size: 15px;
}
.modes { display: grid; gap: 12px; margin: 18px 0; }
.mode {
	background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
}
.mode.rec { border-color: var(--violet); background: rgba(119, 0, 255, 0.18); }
.mode.na { opacity: 0.55; }
.mode-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mode-h b { font-size: 17px; }
.badge { font-size: 12px; white-space: nowrap; padding: 3px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
.mode.rec .badge { background: var(--violet); }
.mode p { font-size: 14px; line-height: 1.4; opacity: 0.85; margin: 8px 0 12px; }
.mode p.note { color: #ffb08f; opacity: 1; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
	font: 500 16px/1 RostelecomBasis, system-ui, sans-serif; color: inherit; background: rgba(255, 255, 255, 0.1);
	text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.ghost { background: transparent; }
.ql-img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: rgba(255, 255, 255, 0.15); }

.diag { margin-top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.diag summary { cursor: pointer; font-weight: 500; }
.diag table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.diag td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.diag td.yes { color: #7dffb0; white-space: nowrap; }
.diag td.no { color: #ff9a7a; white-space: nowrap; }
.diag td.ua { font-size: 11px; opacity: 0.7; word-break: break-all; }
.diag textarea { width: 100%; height: 160px; font-size: 11px; margin-bottom: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
#foot { margin-top: 16px; font-size: 12px; opacity: 0.6; line-height: 1.5; }
#foot a { color: inherit; }
.legacy { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.legacy summary { cursor: pointer; font-weight: 500; }
.legacy .mode { margin-top: 12px; }
#xr8canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: none; }

/* ---------- Сцена ---------- */
#stage { position: fixed; inset: 0; display: none; background: #000; }
body.in-scene #stage { display: block; }
body.in-scene { overflow: hidden; }
#stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: none; }
.bg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mindar-container { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.mindar-container video { position: absolute; }
.mindar-container canvas { position: absolute; }

/* ---------- Интерфейс поверх сцены ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; color: #fff; }
#ui > * { pointer-events: auto; }
#ui > .hud { pointer-events: none; }
.hud { display: none; position: absolute; left: 0; right: 0; padding: 12px 16px; }
body.in-scene .hud { display: flex; }
.hud-top { top: 0; padding-top: max(12px, env(safe-area-inset-top)); gap: 10px; align-items: flex-start; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
#hint {
	flex: 1; background: rgba(16, 24, 40, 0.72); border-radius: 14px; padding: 10px 12px;
	font-size: 15px; line-height: 1.3; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.round {
	width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; font-size: 18px;
	background: rgba(16, 24, 40, 0.72); color: #fff;
}
.hud-bottom {
	bottom: 0; padding-bottom: max(18px, env(safe-area-inset-bottom));
	display: none; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; pointer-events: none;
}
body.in-scene .hud-bottom { display: grid; }
.hud-bottom > * { pointer-events: auto; }
#btnLeft { grid-column: 1; justify-self: start; }
#btnShot { grid-column: 2; }
#btnRight { grid-column: 3; justify-self: end; }
.pill {
	min-height: 44px; padding: 0 14px; border-radius: 22px; border: 0; font: 500 14px/1 RostelecomBasis, system-ui, sans-serif;
	background: rgba(16, 24, 40, 0.72); color: #fff;
}
.shutter {
	width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: var(--violet);
	box-shadow: 0 0 0 3px rgba(119, 0, 255, 0.5);
}
.shutter:active { transform: scale(0.94); }

.sheet {
	position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center;
	background: rgba(16, 24, 40, 0.55); padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
	animation: fade 0.25s ease;
}
.card {
	position: relative; width: 100%; max-width: 460px; max-height: 92vh; overflow: auto;
	background: #fff; color: var(--text); border-radius: 22px; padding: 20px 18px 18px;
	animation: rise 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.card h2 { margin: 6px 0 10px; font-size: 24px; line-height: 1.15; }
.card p { font-size: 15px; line-height: 1.4; color: var(--muted); }
.card ol { padding-left: 20px; font-size: 15px; line-height: 1.45; }
.card .note { color: var(--orange); }
.card .disclaimer { font-size: 12px; color: #8a92a3; margin-bottom: 0; }
.card .x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f0f1f5; font-size: 16px; color: var(--text); }
.logo-s { height: 24px; width: auto; }
.code {
	margin: 12px 0; padding: 14px; border: 2px dashed var(--violet); border-radius: 14px; text-align: center;
	font: 700 26px/1.1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 1px; color: var(--violet);
	user-select: all; -webkit-user-select: all;
}
.card .btn { width: 100%; }
.card .btn:not(.primary) { color: var(--text); border-color: #d8dbe3; }
.photo-card img { width: 100%; max-height: 62vh; object-fit: contain; background: #101828; border-radius: 14px; display: block; }
.photo-card .small { font-size: 12px; margin: 8px 0; }
.photo-card .row .btn { flex: 1; width: auto; }

#toast {
	position: absolute; left: 50%; bottom: calc(120px + env(safe-area-inset-bottom)); transform: translateX(-50%);
	background: rgba(16, 24, 40, 0.88); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center;
}

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
