@page { margin: 0; }

:root {
  --bg: #07090d;
  --card: #12171f;
  --tile: #10151c;
  --line: #223044;
  --text: #e8eef6;
  --muted: #8b97a8;
  --blue: #3b9eff;
  --blue-dim: #1d4f86;
  --orange: #e07a3d;
  --danger: #f07178;
  --ok: #5dcaa5;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen { min-height: 100dvh; }
.screen[hidden], [hidden] { display: none !important; }

/* Login */
#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px 40px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 22px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.logo {
  display: block;
  height: 120px;
  width: auto;
  margin: 0 auto 18px;
}
h1 {
  margin: 0;
  text-align: center;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.lede {
  margin: 6px 0 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #0b0e13;
  color: var(--text);
  border-radius: 10px;
  padding: 14px 12px;
  font-size: 16px;
  outline: none;
}
input[type="password"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.18);
}
button {
  font: inherit;
  cursor: pointer;
}
#login-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--blue);
  color: #041018;
  border: 0;
  border-radius: 10px;
  padding: 14px 12px;
  font-weight: 700;
  font-size: 1rem;
}
#login-btn:active { transform: translateY(1px); }
#login-btn[disabled] { opacity: 0.6; }
.error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.88rem;
  text-align: center;
}
.fine {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
}

/* Cameras */
#screen-cams { padding: 12px 12px 28px; }
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.logo-sm { height: 48px; width: 48px; object-fit: contain; border-radius: 10px; }
.titles { flex: 1; min-width: 0; }
.titles h1 { text-align: left; font-size: 1.05rem; }
.titles p { margin: 2px 0 0; color: var(--muted); font-size: 0.75rem; }
.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
}
.banner {
  background: #1b140e;
  border: 1px solid #5a3a22;
  color: #f0c9a8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  margin: 0 0 12px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}
@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr; max-width: 880px; margin: 0 auto; }
}
.tile {
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}
.frame {
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(180deg, #0c1218 0%, #0a0d12 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.frame img,
.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}
.placeholder {
  text-align: center;
  padding: 12px;
  color: var(--muted);
}
.placeholder strong {
  display: block;
  color: #d7dee8;
  font-size: 0.78rem;
  font-weight: 650;
  margin-bottom: 4px;
}
.placeholder span {
  display: block;
  font-size: 0.68rem;
  line-height: 1.35;
}
.meta {
  padding: 8px 10px 10px;
}
.meta h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 650;
}
.meta p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.mark, .mark-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1px solid #c9a36a;
  color: #e8d5b0;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.95rem;
}
.mark-sm {
  margin: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 0.62rem;
  flex-shrink: 0;
}
.credit {
  margin: 16px 0 0;
  text-align: center;
  color: #6b7583;
  font-size: 0.7rem;
  letter-spacing: 0.01em;
}
.credit-page {
  margin: 22px 8px 4px;
}

.credit a {
  color: #8b97a8;
  text-decoration: none;
}
.credit a:hover { color: #e8eef6; text-decoration: underline; }

.tile { cursor: pointer; }
.tile:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#lightbox[hidden] { display: none !important; }
#lightbox-img,
#lightbox-video {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
#lightbox-video[hidden],
#lightbox-img[hidden] { display: none !important; }
.lb-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#lightbox-hd-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--blue);
  color: #041018;
  border-radius: 999px;
  padding: 2px 8px;
}
#lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 14px;
  color: #e8eef6;
  font-size: 0.95rem;
  font-weight: 650;
}
#lightbox-hint { color: #8b97a8; font-weight: 500; font-size: 0.8rem; }
body.lightbox-on { overflow: hidden; }

.lb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#lightbox-mute {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 650;
  color: #e8eef6;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
#lightbox-mute[aria-pressed="true"] {
  color: var(--muted);
}
#lightbox-mute:active { transform: translateY(1px); }


/* Phone landscape: open camera is full-bleed. Bar overlays video; does not shrink it. */
@media (orientation: landscape) {
  body.lightbox-on #lightbox {
    position: fixed;
    inset: 0;
    padding: 0;
    background: #000;
    overflow: hidden;
  }
  body.lightbox-on #lightbox-img,
  body.lightbox-on #lightbox-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    flex: none;
    background: #000;
  }
  body.lightbox-on #lightbox-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0) 100%);
    padding-top: 28px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
  body.lightbox-on #lightbox-mute {
    min-height: 44px;
    min-width: 44px;
  }
}

#lightbox.lb-wide {
  position: fixed;
  inset: 0;
  padding: 0;
  background: #000;
  overflow: hidden;
}
#lightbox.lb-wide #lightbox-img,
#lightbox.lb-wide #lightbox-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex: none;
  background: #000;
}
#lightbox.lb-wide #lightbox-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0) 100%);
  padding-top: 28px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
}
#lightbox.lb-wide #lightbox-mute {
  min-height: 44px;
  min-width: 44px;
}
