:root {
  color-scheme: dark;
  --bg: #090c0b;
  --panel: #111614;
  --panel-2: #171d1a;
  --line: rgba(222, 255, 81, 0.14);
  --line-soft: rgba(255, 255, 255, 0.09);
  --text: #f5f7f4;
  --muted: #99a49e;
  --lime: #dcff51;
  --lime-soft: rgba(220, 255, 81, 0.14);
  --danger: #ff786e;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 20% 10%, #152019 0, transparent 30%), var(--bg); overflow-x: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ambient { position: fixed; width: 34rem; height: 34rem; border-radius: 50%; filter: blur(110px); opacity: .12; pointer-events: none; }
.ambient-one { left: -12rem; top: -12rem; background: var(--lime); }
.ambient-two { right: -15rem; bottom: -16rem; background: #3aa879; }
.shell { position: relative; width: min(1440px, calc(100% - 48px)); margin: 0 auto; min-height: 100vh; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-weight: 850; letter-spacing: .12em; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid rgba(220,255,81,.55); border-radius: 9px; transform: rotate(45deg); }
.brand-mark span { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 20px rgba(220,255,81,.8); }
.eyebrow { margin: 0 0 18px; color: var(--lime); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.pulse-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(220,255,81,.09); }

.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .75fr; align-items: center; gap: clamp(50px, 8vw, 140px); padding: 60px 4vw; }
.login-copy .brand { margin-bottom: clamp(70px, 11vh, 130px); }
.login-copy h1 { max-width: 780px; margin: 0; font-size: clamp(3.15rem, 6.6vw, 7.2rem); line-height: .93; letter-spacing: -.065em; }
.login-copy h1 em { color: var(--lime); font-style: normal; }
.lead { max-width: 590px; margin: 30px 0; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.2rem); line-height: 1.7; }
.feature-row { display: flex; flex-wrap: wrap; gap: 12px; }
.feature-row span { padding: 9px 13px; border: 1px solid var(--line-soft); border-radius: 99px; color: #c5cec9; font-size: .8rem; }

.login-card { position: relative; padding: clamp(28px, 4vw, 52px); border: 1px solid var(--line-soft); border-radius: 28px; background: linear-gradient(145deg, rgba(25,31,28,.94), rgba(12,16,14,.94)); box-shadow: 0 35px 100px rgba(0,0,0,.4); overflow: hidden; }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, transparent, var(--lime), transparent); opacity: .7; }
.card-kicker { color: var(--lime); font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.login-card h2 { margin: 13px 0 7px; font-size: 2rem; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 31px; color: var(--muted); line-height: 1.5; }
label { display: block; margin: 18px 0 8px; color: #dfe5e1; font-size: .78rem; font-weight: 700; }
input { width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid var(--line-soft); border-radius: 12px; outline: 0; background: #0b100e; color: var(--text); transition: border-color .2s, box-shadow .2s; }
input:focus { border-color: rgba(220,255,81,.65); box-shadow: 0 0 0 4px rgba(220,255,81,.08); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 65px; }
.icon-button { position: absolute; top: 6px; right: 7px; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 750; }
.icon-button:hover { color: var(--lime); background: var(--lime-soft); }
.form-error { min-height: 20px; margin: 13px 0 0 !important; color: var(--danger) !important; font-size: .82rem; }
.primary-button { width: 100%; min-height: 53px; margin-top: 9px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 12px; background: var(--lime); color: #11160e; font-weight: 850; transition: transform .2s, box-shadow .2s; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 13px 35px rgba(220,255,81,.18); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.privacy-note { margin: 22px 0 0 !important; text-align: center; font-size: .72rem; color: #77827c !important; }

.dashboard-view { min-height: 100vh; padding: 28px 0 70px; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.device-badge { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line-soft); border-radius: 99px; color: var(--muted); font-size: .75rem; }
.device-badge span { width: 7px; height: 7px; border-radius: 50%; background: #737d77; }
.device-badge.online { color: #ddf5d1; border-color: rgba(138,255,99,.22); background: rgba(108,255,78,.06); }
.device-badge.online span { background: #85ff61; box-shadow: 0 0 14px rgba(133,255,97,.8); }
.secondary-button, .reconnect-button, .video-actions button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(13,17,15,.75); color: #dce2de; font-size: .75rem; font-weight: 750; }
.secondary-button:hover, .reconnect-button:hover, .video-actions button:hover { border-color: rgba(220,255,81,.45); color: var(--lime); }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 55px 0 32px; }
.dashboard-heading .eyebrow { margin-bottom: 10px; }
.dashboard-heading h1 { margin: 0; font-size: clamp(2.3rem, 4.3vw, 4.8rem); letter-spacing: -.055em; }
.muted { color: var(--muted); }
.connection-summary { display: flex; gap: 10px; }
.connection-summary span { padding: 9px 12px; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--muted); font-size: .75rem; }
.global-notice { display: flex; align-items: center; gap: 16px; padding: 19px 21px; border: 1px solid var(--line); border-radius: 14px; background: var(--lime-soft); }
.global-notice.hidden { display: none; }
.global-notice.error { border-color: rgba(255,120,110,.25); background: rgba(255,120,110,.07); }
.global-notice div { display: flex; flex-direction: column; gap: 3px; }
.global-notice small { color: var(--muted); }
.spinner { width: 20px; height: 20px; flex: 0 0 auto; border: 2px solid rgba(220,255,81,.18); border-top-color: var(--lime); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.camera-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr)); gap: 20px; margin-top: 23px; }
.camera-card { overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); box-shadow: 0 20px 50px rgba(0,0,0,.22); }
.video-frame { position: relative; aspect-ratio: 16/9; background: #050706; overflow: hidden; }
.video-frame video { width: 100%; height: 100%; display: block; object-fit: contain; background: #050706; }
.video-scrim { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.38), transparent 24%, transparent 67%, rgba(0,0,0,.55)); }
.live-label { position: absolute; left: 14px; top: 14px; display: none; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 7px; background: rgba(8,12,10,.74); backdrop-filter: blur(9px); font-size: .64rem; font-weight: 850; letter-spacing: .09em; }
.camera-card.playing .live-label { display: flex; }
.live-label span { width: 7px; height: 7px; border-radius: 50%; background: #ff5147; box-shadow: 0 0 9px rgba(255,81,71,.8); }
.camera-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; background: radial-gradient(circle, rgba(30,41,35,.9), rgba(5,7,6,.98)); }
.camera-state b { margin-top: 4px; }
.camera-state small { color: var(--muted); }
.camera-card.playing .camera-state { display: none; }
.camera-state.failed .spinner { display: none; }
.camera-state.failed b { color: var(--danger); }
.video-actions { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 7px; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.camera-card.playing .video-frame:hover .video-actions, .camera-card.playing .video-actions:focus-within { opacity: 1; transform: translateY(0); }
.camera-meta { min-height: 82px; padding: 16px 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.camera-meta h2 { margin: 0 0 5px; font-size: .98rem; }
.camera-meta p { margin: 0; color: var(--muted); font-size: .72rem; }
.reconnect-button { display: none; }
.camera-card.failed .reconnect-button { display: block; }

@media (max-width: 900px) {
  .shell { width: min(100% - 28px, 760px); }
  .login-view { grid-template-columns: 1fr; gap: 42px; padding: 32px 0 60px; }
  .login-copy .brand { margin-bottom: 75px; }
  .login-copy h1 { font-size: clamp(3.25rem, 13vw, 5.9rem); }
  .login-card { max-width: 600px; width: 100%; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 520px); }
  .login-copy .brand { margin-bottom: 55px; }
  .login-copy h1 { font-size: clamp(2.85rem, 14vw, 4.7rem); }
  .feature-row { display: none; }
  .login-card { padding: 26px 20px; }
  .topbar { height: auto; padding: 18px 0; align-items: flex-start; }
  .topbar-actions { align-items: flex-end; flex-direction: column; gap: 7px; }
  .device-badge { height: 33px; }
  .secondary-button { min-height: 32px; }
  .dashboard-heading { padding-top: 37px; }
  .connection-summary { flex-wrap: wrap; }
  .camera-grid { grid-template-columns: 1fr; }
  .video-actions { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
