* { margin: 0; padding: 0; box-sizing: border-box; }

body, html {
  background-color: #000;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden; width: 100vw; height: var(--tg-vh, 100vh);
}

/* ФИКС ДЛЯ TELEGRAM AR */
html.ar-mode, body.ar-mode { background: transparent !important; background-color: transparent !important; }
.a-canvas { background-color: transparent !important; }
.hidden { display: none !important; }

/* === Базовый сканер камеры === */
#scanner-container {
  position: fixed; top: 0; left: 0; width: 100vw; height: var(--tg-vh, 100vh); z-index: 10;
}
#reader { width: 100%; height: 100%; border: none !important; }
#reader video { object-fit: cover !important; width: 100% !important; height: 100% !important; }

/* === ИНТЕРФЕЙС СКАНЕРА === */
#scanner-ui {
  position: fixed; top: 0; left: 0; width: 100vw; height: var(--tg-vh, 100vh); z-index: 11;
}

/* === Статическая Рамка Сканера (с затемнением фона) === */
.scanner-frame-container {
  position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; pointer-events: none; z-index: 2;
  overflow: hidden;
}

.scanner-frame {
  position: relative; width: 280px; height: 280px; border-radius: 20px;
  /* box-shadow создает идеальное затемнение вокруг прозрачного центра */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7); 
}

.corner {
  position: absolute; width: 40px; height: 40px; border: 3px solid rgba(255, 255, 255, 0.8);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}
.corner-tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 16px; }
.corner-tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 16px; }
.corner-bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 16px; }
.corner-br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 16px; }

/* === Бегущая строка (Микс типографики) === */
.marquee-container {
  position: absolute; bottom: 35px; width: 100%; overflow: hidden;
  white-space: nowrap; padding: 14px 0; pointer-events: none; z-index: 2;
  background: rgba(0, 0, 0, 0.2); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255,255,255,0.08); border-bottom: 1px solid rgba(255,255,255,0.08);
}
.marquee-content {
  display: inline-block; white-space: nowrap; color: #FFFFFF;
  animation: marquee 14s linear infinite;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
}

/* Шрифтовые классы */
.m-bold { font-family: sans-serif; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; font-size: 15px; }
.m-serif-i { font-family: "Georgia", serif; font-style: italic; font-size: 16px; opacity: 0.9; }
.m-mono { font-family: monospace; font-weight: 300; letter-spacing: -0.5px; font-size: 15px; opacity: 0.8; }
.m-serif { font-family: "Times New Roman", serif; font-size: 17px; }

@keyframes marquee {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

/* === Стекломорфизм (Glassmorphism) === */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 4000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  transition: opacity 0.4s ease;
}
.glassmorphism {
  background: rgba(20, 20, 30, 0.4);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  border-radius: 24px !important;
}
.glass-btn {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: #fff !important; text-shadow: 0 0 5px rgba(255,255,255,0.3);
  backdrop-filter: blur(5px); transition: all 0.2s ease !important;
}
.glass-btn:active { background: rgba(255, 255, 255, 0.25) !important; transform: scale(0.96); }

/* Остальные стили админки и загрузки */
.modal-box {
  background: #262626; border-radius: 16px; padding: 30px 24px; width: 100%; max-width: 340px; border: 1px solid #444;
}
.modal-box h3 { color: #fff; margin-bottom: 14px; font-size: 17px; }
.modal-box input {
  width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #555;
  background: #1A1A1A; color: #fff; font-size: 15px; margin-bottom: 16px;
}
.modal-box input:focus { outline: none; border-color: #4CAF50; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; }

.loading-container {
  position: fixed; top: 0; left: 0; width: 100%; height: var(--tg-vh, 100vh);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background-color: #1A1A1A; z-index: 1000;
}
.spinner {
  width: 50px; height: 50px; border: 3px solid #333; border-top-color: #fff;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#ar-container { position: fixed; top: 0; left: 0; width: 100%; height: var(--tg-vh, 100vh); z-index: 1; }
a-scene { width: 100%; height: 100%; }

/* Админка (кнопка и панель) */
.admin-button {
  position: fixed; top: 80px; right: 15px; width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%; color: white; font-size: 18px; line-height: 1;
  backdrop-filter: blur(6px); z-index: 5000; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.admin-panel {
  position: fixed; top: 0; left: 0; width: 100%; height: var(--tg-vh, 100vh);
  background: rgba(26, 26, 26, 0.98); color: white; z-index: 6000; padding: 24px; overflow-y: auto;
}
.admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.admin-card { background: #333; padding: 15px; border-radius: 8px; border: 1px solid #555; display: flex; flex-direction: column; gap: 10px; }
.admin-action-btn { background: #444; color: white; border: none; padding: 10px; border-radius: 8px; font-size: 15px; cursor: pointer; }
.create-btn { background: #4CAF50; font-weight: bold; }
.close-btn { background: #F44336; width: 100%; margin-top: 20px;}
.delete-btn { background: #F44336; padding: 6px; font-size: 13px; margin-top: 5px;}
.admin-file-group { display: flex; flex-direction: column; gap: 8px; background: #2A2A2A; padding: 15px; border-radius: 8px; }
.admin-text { font-size: 14px; color: #aaa; margin: 0; }