/* ===== Тёмный «жёсткий» дизайн + стекло (glassmorphism) + IT-паутина ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg0: #030303;
  --bg1: #0c0505;
  --bg2: #140707;
  --glass:      rgba(20, 12, 12, 0.55);
  --glass-strong: rgba(38, 20, 20, 0.65);
  --border:     rgba(255, 80, 70, 0.28);
  --border-hard: rgba(255, 59, 48, 0.55);
  --txt:      #f2ecea;
  --muted:    rgba(242, 236, 234, 0.55);
  --red:      #ff2d24;
  --red-deep: #8f0a05;
  --shadow:   0 0 0 1px rgba(255,45,36,0.08), 0 10px 40px rgba(0,0,0,0.8);
  --radius:   16px; /* чуть жёстче, чем 22 */
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--txt);
  min-height: 100vh;
  background:
    radial-gradient(1100px 650px at 85% -10%, rgba(255,45,36,0.28), transparent 60%),
    radial-gradient(900px 600px at -5% 105%, rgba(140,8,4,0.35), transparent 55%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 42%, var(--bg2));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ==== IT-паутина: сетка линий с узлами ЗА стеклом ==== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg stroke='%23ffffff' stroke-opacity='0.055' fill='none' stroke-width='1'%3E%3Cpath d='M0 110 H220 M110 0 V220'/%3E%3Cpath d='M0 0 L220 220 M220 0 L0 220'/%3E%3Cpath d='M0 55 L220 165 M0 165 L220 55'/%3E%3C/g%3E%3Cg fill='%23ff2d24' fill-opacity='0.35'%3E%3Ccircle cx='110' cy='110' r='4'/%3E%3Ccircle cx='0' cy='0' r='3'/%3E%3Ccircle cx='220' cy='0' r='3'/%3E%3Ccircle cx='0' cy='220' r='3'/%3E%3Ccircle cx='220' cy='220' r='3'/%3E%3Ccircle cx='110' cy='0' r='2.5'/%3E%3Ccircle cx='0' cy='110' r='2.5'/%3E%3Ccircle cx='220' cy='110' r='2.5'/%3E%3Ccircle cx='110' cy='220' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: .7;
}
/* вертикальные «лучи» — усиление паутины */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255,45,36,0.035) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(0deg,   rgba(255,45,36,0.04) 0 1px, transparent 1px 90px);
  mix-blend-mode: screen;
}

.screen, .glass { position: relative; z-index: 1; }

/* ===== Панели-стекло (жёстче: тень красная, скругление меньше) ==== */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.glass.card {
  padding: 24px 20px;
  width: min(400px, 92vw);
  text-align: center;
}

.glass.panel { padding: 16px; }

/* ===== Экраны ==== */
.screen { padding: 16px; max-width: 820px; margin: 0 auto; }
.screen.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.screen.hidden { display: none !important; }

/* ===== Верхняя панель ==== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 14px;
}
.page-title { font-size: 18px; font-weight: 700; flex: 1; text-align: center; letter-spacing: 1px;
  text-transform: uppercase; }

/* ===== Кнопки-стекло (жёсткие, углы острые) ==== */
.glass-btn {
  width: 100%; padding: 14px 18px; margin-top: 10px;
  font-size: 15px; font-weight: 700; letter-spacing: .4px;
  color: var(--txt);
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 10px; /* жёстче */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: transform .06s ease, background .18s ease, border-color .18s ease;
}
.glass-btn:active { transform: scale(.97); }
.glass-btn.primary { background: linear-gradient(135deg, #e0140c, #7a0703); border-color: var(--border-hard); }
.glass-btn.primary:active { background: linear-gradient(135deg, #ff2d24, #a30c05); }
.glass-btn.danger  { background: linear-gradient(135deg, #d00d1e, #6e0410); border-color: var(--border-hard); }

.glass-chip {
  padding: 9px 14px; font-size: 13px; font-weight: 700; letter-spacing: .3px; color: var(--txt);
  background: var(--glass); border: 1px solid var(--border); border-radius: 8px;
  backdrop-filter: blur(14px); cursor: pointer; white-space: nowrap;
  transition: border-color .15s;
}
.glass-chip:active { border-color: var(--border-hard); }

/* ===== Поля-стекло ==== */
.glass-input {
  width: 100%; padding: 13px 16px; margin-top: 10px;
  font-size: 15px; color: var(--txt);
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border); border-radius: 10px;
  outline: none;
  transition: border-color .2s;
}
.glass-input::placeholder { color: var(--muted); }
.glass-input:focus { border-color: var(--border-hard); }

/* ===== Заголовки/текст ==== */
.brand { font-size: 42px; font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(95deg, #ff6b5e, #ff2d24 60%, #8f0a05);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(255,45,36,.25); }
.subtitle { color: var(--muted); margin: 8px 0 18px; font-size: 13px; letter-spacing: .5px; }
.divider { display:flex; align-items:center; gap:10px; margin: 14px 0 4px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content:""; flex:1; height:1px; background: var(--border); }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; }
.msg { padding: 12px; border-radius: 10px; margin-top: 14px; font-size: 14px; }
.msg.ok { background: rgba(48,209,88,0.14); color:#a8f5c0; }
.msg.err { background: rgba(255,45,36,0.18); color:#ffb3ae; }

.login-link { display:block; margin-top: 14px; font-size: 13px; color: var(--muted);
  cursor: pointer; text-decoration: underline dotted; }
.login-link:hover { color: var(--red); }

/* ===== Список объектов ==== */
.list { display: flex; flex-direction: column; gap: 12px; }
.object-row {
  display: flex; align-items: center; gap: 12px;
  padding: 18px; cursor: pointer;
  border-left: 3px solid var(--red);
  transition: transform .06s, border-color .15s;
}
.object-row:active { transform: scale(.98); border-left-color: #ff6b5e; }
.object-row .cam-count { margin-left:auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
.object-row .arrow { color: var(--muted); font-size: 20px; }

/* ===== Сетка камер ==== */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.camera-tile {
  padding: 20px; cursor: pointer; text-align: center;
  display:flex; flex-direction:column; align-items:center; gap:8px;
  border-top: 2px solid var(--red);
}
.camera-tile:active { transform: scale(.96); }
.camera-tile .icon { font-size: 34px; opacity: .9; }
.camera-tile.off { opacity: .5; }
.camera-tile .status { font-size: 12px; color: var(--muted); }

/* ===== Камера: видео и архив ==== */
.live-panel { margin-bottom: 14px; text-align:center; }
.live-panel video { width: 100%; max-height: 60vh; border-radius: 10px; background:#000;
  border: 1px solid var(--border); }
.archive-panel { text-align:center; }
.row { display:flex; gap:8px; align-items:center; }
.row .glass-input { flex:1; }
.segments { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:12px; }
.segment-chip {
  padding: 8px 12px; font-size: 13px; font-weight:600;
  background: var(--glass); border:1px solid var(--border); border-radius: 8px; cursor:pointer;
}
.segment-chip video { display:block; width:100%; border-radius:10px; margin-top:4px; }

/* ===== Админ-панель ==== */
.panel { display:grid; gap:14px; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); }
.panel .glass.card { text-align:left; }
.code-result { margin-top:14px; padding:14px; border-radius:10px; font-weight:700; letter-spacing:2px;
  background: rgba(0,0,0,0.55); border:1px dashed var(--border-hard); word-break: break-all; }
.grant-list { margin-top:10px; display:flex; flex-direction:column; gap:6px; }
.grant-item { display:flex; justify-content:space-between; align-items:center; gap:8px;
  padding:8px 12px; background: var(--glass); border-radius:10px; font-size:14px; }
.rename-list { margin-top:10px; display:flex; flex-direction:column; gap:10px; }
.rename-row { display:flex; gap:8px; align-items:center; }
.rename-row .glass-input { flex:1; margin-top:0; }
.hidden { display: none !important; }
.number { width: 90px; text-align:center; }