@font-face {
  font-family: "Cinzel";
  src: url("font/Cinzel-Bold.ttf") format("truetype");
  font-weight: 700;
}
#screenImage { position: fixed; left: 0; top: 0; width: 320px; height: 180px; opacity: 0.02; pointer-events: none; z-index: -1; }

:root {
  --ink: #e8e4da;
  --ink-dim: #a39f94;
  --panel: rgba(20, 19, 17, 0.62);
  --panel-line: rgba(220, 214, 200, 0.22);
  --field: rgba(45, 43, 39, 0.72);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
#boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #070605;
  color: #ede6d1;
  font-family: "Segoe UI", sans-serif;
  text-align: center;
}
#boot.hide { display: none; }
html, body {
  height: 100%;
  background: #000;
  color: var(--ink);
  font-family: "EB Garamond", Georgia, serif;
  overflow: hidden;
  user-select: none;
}

/* ---------- film frame / sprockets ---------- */
.film-frame {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  border: none;
  box-shadow: none;
}
.film-frame::before,
.film-frame::after {
  content: "";
  position: fixed;
  left: 22px;
  right: 22px;
  height: 12px;
  background: rgba(10, 9, 8, 0.94);
  z-index: 51;
  pointer-events: none;
}
.film-frame::before { top: 0; }
.film-frame::after { bottom: 0; }
.sprockets {
  position: fixed; top: 0; bottom: 0; width: 22px;
  background: rgba(10, 9, 8, 0.94);
  overflow: hidden;
  z-index: 51;
  pointer-events: none;
}
.sprockets::before {
  content: "";
  position: absolute;
  top: -24px;
  bottom: -24px;
  left: 6px;
  width: 9px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 13px,
    rgba(237, 230, 209, 0.78) 13px 20px
  );
  animation: reel 2s linear infinite;
}
@keyframes reel {
  to { transform: translateY(20px); }
}
.sprockets.left { left: 0; }
.sprockets.right { right: 0; }
#sizeReadout {
  position: fixed;
  left: 34px;
  bottom: 18px;
  z-index: 70;
  color: rgba(237, 230, 209, 0.8);
  font-family: "Segoe UI", sans-serif;
  font-size: 13px;
  letter-spacing: 0.4px;
  pointer-events: none;
}

/* subtle moving grain over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: 40;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
  animation: grain 0.5s steps(3) infinite;
}
@keyframes grain {
  0%{transform:translate(0,0)} 33%{transform:translate(-4px,2px)} 66%{transform:translate(3px,-3px)} 100%{transform:translate(0,0)}
}

/* ---------- titlebar ---------- */
.titlebar {
  position: fixed; top: 0; left: 0; right: 0; height: 48px;
  display: flex; align-items: center; justify-content: center;
  z-index: 80;
}
.tb-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
.dev { display: none; }
.tb-title .dev { font-size: 15px; letter-spacing: 2px; color: var(--ink-dim); }
.tb-controls {
  position: fixed; top: 10px; right: 26px;
  display: flex; gap: 8px;
  z-index: 81;
}
.tb-btn {
  width: 36px; height: 28px;
  background: transparent; border: none; color: var(--ink);
  font-size: 16px; cursor: pointer; border-radius: 3px;
  pointer-events: auto;
}
.tb-btn:hover { background: rgba(255,255,255,0.1); color: var(--ink); }
#winClose:hover { background: #7a2d2d; color: #fff; }

/* ---------- stages ---------- */
.stage { position: fixed; inset: 0; z-index: 10; }
.stage.hidden { display: none; }

#srcVideo { display: none; }

/* ---------- login: 3D canvas ---------- */
#tvCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.cam-hud {
  position: fixed;
  left: 34px;
  top: 28px;
  z-index: 60;
  pointer-events: none;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(232, 236, 242, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  background: rgba(8, 10, 14, 0.45);
  border: 1px solid rgba(220, 214, 200, 0.18);
  padding: 8px 10px;
  min-width: 210px;
}
.cam-hud .cam-hint {
  margin-top: 4px;
  color: rgba(180, 188, 198, 0.75);
  font-size: 11px;
}

/* soft room dim around the TV glow */
.room-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 15;
  background: radial-gradient(ellipse 62% 58% at 50% 58%,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,0) 46%,
    rgba(4,4,8,0.35) 78%,
    rgba(2,2,5,0.62) 100%);
}

/* login form overlay — pinned to the TV glass by a JS matrix3d homography.
   left/top/width/height + transform are driven from app.js; matrix3d does all
   placement & perspective skew, so the box lives at 0,0 and maps from its own
   top-left corner. Clean greyscale B&W look: translucent grey fields, white
   text, a subtle overlay panel. */
.login-form {
  position: absolute;
  left: 0; top: 0;
  display: none; flex-direction: column;
  gap: 0.6em;
  z-index: 20;
  transform-origin: 0 0;
  backface-visibility: hidden;
  will-change: transform, opacity;
  padding: 1.2em 1.4em;
  overflow: hidden;
  background: rgba(20, 20, 22, 0.32);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.3em;
  backdrop-filter: blur(1px);
  font-size: 15px;
}

.signin-title {
  position: relative; z-index: 2;
  font-family: "Cinzel", serif;
  font-weight: 600;
  text-align: center;
  font-size: 1.25em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f2f2f2;
  margin-bottom: 0.3em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.vfield-wrap { position: relative; z-index: 2; display: block; width: 100%; }
.vfield-wrap .vfield { width: 100%; display: block; }
.vfield {
  position: relative; z-index: 2;
  background: rgba(40, 40, 44, 0.72);
  border: 1px solid rgba(255,255,255,0.28);
  color: #ffffff;
  padding: 0.55em 0.75em;
  font-family: "Segoe UI", Georgia, sans-serif;
  font-size: 1em; letter-spacing: 0.2px;
  outline: none;
  border-radius: 0.22em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
  transition: background 0.15s, border-color 0.15s;
}
.vfield::placeholder { color: rgba(255,255,255,0.6); }
.vfield:focus {
  background: rgba(150, 150, 154, 0.5);
  border-color: rgba(255,255,255,0.35);
}
.vfield.wide { width: 100%; }

.remember {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 0.5em;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.92em; color: #e8e8e8;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.remember input { display: none; }
.remember .box {
  width: 1.15em; height: 1.15em;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(130,130,134,0.42);
  display: inline-block; position: relative; border-radius: 0.18em;
  flex: none;
}
.remember input:checked + .box {
  background: rgba(200,200,204,0.75);
  border-color: rgba(255,255,255,0.6);
}
.remember input:checked + .box::after {
  content: "\2713"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85em; color: #1a1a1a; font-weight: 700;
}

.vbtn {
  position: relative; z-index: 2;
  margin-top: 0.2em;
  background: rgba(130, 130, 134, 0.42);
  border: 1px solid rgba(255,255,255,0.16);
  color: #ffffff;
  padding: 0.65em;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1em; letter-spacing: 0.5px;
  cursor: pointer; border-radius: 0.22em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: background 0.15s, border-color 0.15s;
}
.vbtn:hover {
  background: rgba(155, 155, 159, 0.55);
  border-color: rgba(255,255,255,0.35);
}
.vbtn:active { transform: translateY(1px); }

.login-msg {
  position: relative; z-index: 2;
  text-align: center; font-size: 0.82em; color: #ff8a8a; min-height: 1.2em;
  font-family: "EB Garamond", Georgia, serif;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}


/* ---------- dashboard ---------- */
.bg-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
}
.bg-tint {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.72));
}
.dash-wrap {
  position: absolute; inset: 0;
  padding: 58px 26px 26px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 5;
}
.dash-header { display: flex; align-items: center; justify-content: space-between; }
.dash-brand {
  font-family: "Cinzel", serif; font-size: 20px; letter-spacing: 3px;
  text-transform: uppercase;
}
.dash-brand .dev { font-size: 13px; color: var(--ink-dim); }
.dash-userbar { display: flex; align-items: center; gap: 10px; }
.dash-user { color: var(--ink-dim); font-size: 13px; margin-right: 4px; }
.dash-chip {
  background: var(--panel); border: 1px solid var(--panel-line);
  color: var(--ink); padding: 6px 14px; font-family: "EB Garamond", serif;
  font-size: 12px; cursor: pointer; border-radius: 2px;
}
.dash-chip:hover { background: rgba(60,58,53,0.8); }

.dash-toolbar { display: flex; gap: 10px; align-items: center; }
.dash-actions { display: flex; gap: 8px; }
.dash-sub { font-size: 11px; color: var(--ink-dim); letter-spacing: 0.5px; }

.dash-startrow { display: flex; align-items: center; gap: 16px; margin: 4px 0 2px; }
.start-btn {
  background: var(--panel); border: 1px solid var(--panel-line);
  color: var(--ink); padding: 7px 22px; font-family: "EB Garamond", serif;
  font-size: 14px; cursor: pointer; border-radius: 2px;
}
.start-btn:hover { background: rgba(60,58,53,0.8); }
.timer { font-family: "Cinzel", serif; font-size: 26px; letter-spacing: 2px; }

.dash-sections { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; overflow-y: auto; }
.dsec {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--panel-line);
  padding: 14px 18px; border-radius: 2px;
  font-family: "Cinzel", serif; font-size: 15px; letter-spacing: 2px;
  text-transform: uppercase;
}
.dsec .toggle {
  width: 30px; height: 30px;
  border: 1px solid var(--panel-line); background: var(--field);
  border-radius: 2px;
}

/* ---------- zoom transition ---------- */
.zooming { animation: none; }
#loginStage.zoom-out { animation: zoomInScreen 1.1s cubic-bezier(0.6,0,0.3,1) forwards; }
#loginStage.zoom-back { animation: zoomOutScreen 1.1s cubic-bezier(0.6,0,0.3,1) forwards; }
@keyframes zoomInScreen {
  0%   { transform: scale(1); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: scale(6); opacity: 0; }
}
@keyframes zoomOutScreen {
  0%   { transform: scale(6); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
#dashStage.fade-in { animation: fadeInDash 0.7s ease forwards; }
@keyframes fadeInDash {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ---------- custom Mickey Mouse cursor everywhere ---------- */
html, body, button, input, label, .stage, .login-form, a, * {
  cursor: url("assets/cursor.cur"), auto !important;
}

/* ---------- TV power-on: button + neon arrow ---------- */
.power-btn, .power-arrow { visibility: hidden; }
.power-btn {
  position: absolute;
  z-index: 30;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.0);
  border: 2px solid rgba(255,255,255,0.0);
  padding: 0;
  transition: box-shadow 0.2s, border-color 0.2s;
  /* position set by JS over the TV's power knob */
}
.power-btn:hover {
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 0 18px rgba(255,255,255,0.55), inset 0 0 10px rgba(255,255,255,0.25);
}
.power-btn .power-icon {
  display: block; width: 100%; height: 100%;
  border-radius: 50%;
}
.power-btn.hidden, .power-arrow.hidden { display: none; }

/* neon white arrow pointing at the power button */
.power-arrow {
  position: absolute;
  z-index: 29;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
  animation: arrowBob 1.1s ease-in-out infinite;
  /* position set by JS, to the right of the power button */
}
.arrow-label {
  font-family: "Cinzel", serif;
  font-size: 12px; letter-spacing: 3px;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255,255,255,0.9), 0 0 16px rgba(180,220,255,0.6);
  margin-bottom: 2px;
}
.arrow-svg { width: 90px; height: 30px; }
@keyframes arrowBob {
  0%,100% { transform: translateX(0); }
  50% { transform: translateX(-10px); }   /* bob toward the knob (left) */
}
