:root {
  --bg: #12100c;
  --panel: rgba(24, 27, 27, .78);
  --panel-solid: #191c1c;
  --ink: #fff4df;
  --muted: #b9aa92;
  --line: rgba(255, 244, 223, .16);
  --gold: #e4ad53;
  --mint: #68d2aa;
  --red: #e15c4f;
  --blue: #7eb6ff;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Avenir Next, Trebuchet MS, Verdana, sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(228, 173, 83, .32), transparent 28%),
    radial-gradient(circle at 88% 72%, rgba(104, 210, 170, .2), transparent 32%),
    linear-gradient(145deg, #140f0a, #1d2021 56%, #0b1714);
}
body:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
  position: relative;
}
.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  animation: rise .5s ease both;
}
.brand-head {
  display: grid;
  gap: 10px;
}
.brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
}
.home-logo {
  width: min(300px, 66vw);
  filter: drop-shadow(0 14px 30px rgba(0,0,0,.28));
}
.kicker {
  margin: 0;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: 12px;
  font-weight: 800;
}
h1 {
  margin: 0;
  font-family: Georgia, Cambria, serif;
  font-size: clamp(42px, 8vw, 86px);
  line-height: .88;
  letter-spacing: -.06em;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 14px;
}
.camera-card, .control-card, .login-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 26px 90px rgba(0,0,0,.42);
}
.camera-card {
  border-radius: 26px;
  padding: 10px;
  animation: rise .55s .04s ease both;
}
.camera-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  padding: 6px 7px 10px;
  font-weight: 800;
  font-size: 14px;
}
#liveVideo, #snapshot {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  background: #030303;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
}
#liveVideo { min-height: 300px; }
#snapshot { display: none; object-fit: contain; }
.control-card {
  border-radius: 26px;
  padding: 16px;
  display: grid;
  gap: 10px;
  align-content: start;
  animation: rise .55s .1s ease both;
}
.label {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  font-size: 14px;
}
.action {
  width: 100%;
  min-height: 76px;
  border: 0;
  border-radius: 20px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  color: #15100a;
  box-shadow: 0 18px 38px rgba(0,0,0,.24);
}
.action span { display: block; font-size: 21px; font-weight: 950; letter-spacing: -.03em; }
.action:disabled { opacity: .55; cursor: wait; }
.action:active, .ghost:active, .tiny:active, .submit:active { transform: translateY(1px); }
.door { background: linear-gradient(135deg, #ffe2a1, var(--gold)); }
.gate { background: linear-gradient(135deg, #a9f3db, var(--mint)); }
.status {
  min-height: 40px;
  display: none;
  place-items: center;
  border-radius: 15px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(0,0,0,.2);
  font-weight: 900;
}
.status.show { display: grid; }
.status.busy { color: var(--blue); }
.status.ok { color: var(--mint); }
.status.bad { color: var(--red); }
.ghost, .tiny {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255,255,255,.06);
  cursor: pointer;
  font-weight: 900;
}
.ghost { min-height: 38px; padding: 0 15px; border-radius: 999px; }
.tiny { min-height: 30px; padding: 0 11px; border-radius: 999px; color: var(--muted); font-size: 13px; }
.page-login { display: grid; place-items: center; padding: 14px; overflow-x: hidden; }
.login-shell { width: min(100%, 400px); position: relative; animation: rise .55s ease both; }
.login-card { border-radius: 26px; padding: 24px; }
.login-logo { width: min(260px, 76vw); margin-bottom: 18px; }
.hint { color: var(--muted); line-height: 1.55; margin: 16px 0 24px; }
.login-card form { display: grid; gap: 11px; }
.login-card label { display: grid; gap: 7px; color: #ddceb8; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.login-card input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  outline: none;
  color: var(--ink);
  background: rgba(0,0,0,.26);
}
.login-card input:focus { border-color: rgba(228,173,83,.9); box-shadow: 0 0 0 4px rgba(228,173,83,.13); }
.submit {
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  color: #18100a;
  cursor: pointer;
  font-weight: 950;
  background: linear-gradient(135deg, #ffe2a1, var(--gold));
}
.error {
  display: none;
  color: #ff8a80;
  border: 1px solid rgba(255,138,128,.35);
  border-radius: 15px;
  padding: 11px 13px;
  background: rgba(255,138,128,.1);
  font-weight: 900;
}
.error.show { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.99); } to { opacity: 1; transform: none; } }
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .hero { align-items: start; }
}
@media (max-width: 460px) {
  body { background-attachment: fixed; }
  .wrap { width: min(100% - 18px, 1120px); padding: 10px 0; }
  .hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin-bottom: 10px; }
  .brand-head { gap: 6px; }
  .home-logo { width: min(210px, 66vw); }
  .kicker { font-size: 10px; letter-spacing: .16em; }
  .grid { gap: 10px; }
  .camera-card, .control-card, .login-card { border-radius: 20px; }
  .camera-card { padding: 7px; }
  .camera-top { padding: 4px 5px 7px; font-size: 12px; }
  #liveVideo, #snapshot { border-radius: 14px; }
  #liveVideo { min-height: 0; height: auto; aspect-ratio: 4 / 3; }
  .control-card { padding: 10px; gap: 8px; }
  .label { font-size: 12px; }
  .action { min-height: 58px; border-radius: 16px; padding: 11px 13px; }
  .action span { font-size: 18px; }
  .status { min-height: 34px; border-radius: 13px; font-size: 13px; }
  .ghost { min-height: 34px; padding: 0 12px; font-size: 13px; }
  .tiny { min-height: 28px; padding: 0 10px; font-size: 12px; }
  .page-login { min-height: 100svh; padding: 10px; place-items: center; }
  .login-shell { width: min(100%, 360px); }
  .login-card { border-radius: 20px; padding: 18px; }
  .login-logo { width: min(220px, 72vw); margin-bottom: 14px; }
  .login-card form { gap: 9px; }
  .login-card label { gap: 5px; font-size: 11px; }
  .login-card input { min-height: 44px; border-radius: 13px; font-size: 16px; }
  .submit { min-height: 46px; border-radius: 13px; }
  .hint { margin: 10px 0 14px; font-size: 13px; }
  .error { padding: 9px 11px; border-radius: 12px; font-size: 13px; }
}
@media (max-width: 360px) {
  .home-logo { width: 190px; }
  .action span { font-size: 17px; }
  .login-card { padding: 15px; }
}
@media (min-width: 461px) and (max-width: 820px) {
  .control-card {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
  .label, .status {
    grid-column: 1 / -1;
  }
}
