/* HomeDesk. Palette: a house at dusk with one lamp left on. */
:root {
  --dusk: #1b242f;
  --dusk-deep: #10161d;
  --wall: #232e3a;
  --edge: #3a4958;
  --lamp: #f4b942;
  --lamp-pale: #ffe3a1;
  --paper: #eef1f4;
  --mist: #9aa8b7;
  --alarm: #f08a7b;
  --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--dusk);
  color: var(--paper);
  font: 400 1rem/1.5 var(--ui);
  -webkit-text-size-adjust: 100%;
}

button, select, input, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

[hidden] { display: none !important; }

/* ------------------------------------------------------------- sign in */

body.login {
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 16vh 1.25rem 3rem;
  background: linear-gradient(180deg, var(--dusk-deep) 0%, var(--dusk) 55%, #202b37 100%);
}

.door { width: min(100%, 21rem); }

/* the lit window: the one bright thing on the page */
.pane {
  position: relative;
  width: 5.5rem;
  height: 7rem;
  margin: 0 0 2.25rem;
  border: 5px solid #0b1016;
  border-radius: 2.75rem 2.75rem 2px 2px;
  background: linear-gradient(170deg, var(--lamp-pale) 0%, var(--lamp) 70%);
  box-shadow: 0 0 70px 14px rgba(244, 185, 66, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: lamp-on 1.1s ease-out both;
}
.pane::before, .pane::after { content: ""; position: absolute; background: #0b1016; }
.pane::before { left: calc(50% - 2px); top: 0; bottom: 0; width: 4px; }
.pane::after { top: 46%; left: 0; right: 0; height: 4px; }

@keyframes lamp-on {
  0% { background: #2c3947; box-shadow: none; }
  40% { background: #2c3947; box-shadow: none; }
  48% { background: var(--lamp); }
  54% { background: #6b5a34; box-shadow: none; }
  100% { background: linear-gradient(170deg, var(--lamp-pale) 0%, var(--lamp) 70%); }
}

.door h1 {
  margin: 0;
  font: 400 2.5rem/1.1 var(--display);
  letter-spacing: -0.01em;
}

.lede { margin: 0.5rem 0 2rem; color: var(--mist); }

.door label { display: block; margin: 0 0 0.35rem; font-size: 0.875rem; color: var(--mist); }

.door input {
  display: block;
  width: 100%;
  margin: 0 0 1.1rem;
  padding: 0.65rem 0.75rem;
  background: var(--dusk-deep);
  border: 1px solid var(--edge);
  border-radius: 4px;
  font-size: 1rem;
}
.door input:focus-visible { outline-offset: 0; border-color: var(--lamp); }

#code { letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }

.door button {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 4px;
  background: var(--lamp);
  color: #1c1503;
  font-weight: 600;
  cursor: pointer;
}
.door button:hover { background: var(--lamp-pale); }
.door button:disabled { background: var(--edge); color: var(--mist); cursor: default; }

.problem { margin: 0 0 1rem; color: var(--alarm); font-size: 0.9375rem; }

/* -------------------------------------------------------------- viewer */

body.viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  background: var(--dusk-deep);
  overflow: hidden;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--wall);
  border-bottom: 1px solid #0b1016;
  font-size: 0.875rem;
}

.where { display: flex; align-items: center; gap: 0.5rem; margin-right: auto; min-width: 0; }
.where strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state { color: var(--mist); white-space: nowrap; }

.lamp { flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--edge); }
.lamp.on { background: var(--lamp); box-shadow: 0 0 8px 1px rgba(244, 185, 66, 0.6); }

.bar select, .bar button, .menu summary {
  height: 2rem;
  padding: 0 0.65rem;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.bar select { padding-right: 0.3rem; background: var(--wall); }
.bar button:hover, .menu summary:hover, .bar select:hover { border-color: var(--mist); }
.bar button:disabled { color: var(--mist); border-color: var(--edge); cursor: default; }

.mode { display: flex; }
.mode button { border-radius: 0; }
.mode button:first-child { border-radius: 4px 0 0 4px; border-right: 0; }
.mode button:last-child { border-radius: 0 4px 4px 0; }
.mode button[aria-pressed="true"] { background: var(--edge); border-color: var(--edge); }
.mode #mode-control[aria-pressed="true"] { background: var(--lamp); border-color: var(--lamp); color: #1c1503; font-weight: 600; }

.menu { position: relative; }
.menu summary { display: flex; align-items: center; list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--mist); }
.menu.off summary { color: var(--mist); cursor: default; }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 5;
  display: grid;
  gap: 0.25rem;
  min-width: 15rem;
  padding: 0.4rem;
  background: var(--wall);
  border: 1px solid var(--edge);
  border-radius: 6px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}
.menu-list button { width: 100%; border-color: transparent; text-align: left; }
.menu-list button:hover { background: var(--edge); border-color: transparent; }
.menu-list kbd { float: right; margin-left: 1.5rem; color: var(--mist); font: inherit; }

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  background: var(--dusk-deep);
}

.screen {
  position: relative;
  line-height: 0;
  background: #000;
  box-shadow: 0 0 0 1px #000, 0 18px 50px rgba(0, 0, 0, 0.5);
}
.screen.waiting { visibility: hidden; }
/* amber frame = your mouse and keyboard are live on the laptop */
.screen.driving { box-shadow: 0 0 0 3px var(--lamp), 0 18px 50px rgba(0, 0, 0, 0.5); }

#canvas { display: block; width: 100%; height: 100%; outline: none; }
.screen.driving #canvas { touch-action: none; }

.pointer {
  position: absolute;
  width: 16px;
  height: 22px;
  margin: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}
.pointer svg { display: block; width: 100%; height: 100%; }

.notice {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(30rem, calc(100% - 2rem));
  margin: 0;
  padding: 1rem 1.25rem;
  background: rgba(16, 22, 29, 0.94);
  border-left: 3px solid var(--lamp);
  line-height: 1.5;
}

/* shown only in full screen, where the top bar is out of sight */
.leave-full {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  height: 1.9rem;
  padding: 0 0.8rem;
  background: var(--wall);
  border: 1px solid var(--mist);
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  opacity: 0.6;
}
.leave-full:hover, .leave-full:focus-visible { opacity: 1; }

/* off-screen box that summons a phone's keyboard */
.typing {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  resize: none;
}

/* tablets and phones: drop the labels, keep every control within reach */
@media (max-width: 60rem) {
  .where strong, .state { display: none; }
  .where { margin-right: 0; }
  .bar { position: relative; gap: 0.35rem; padding: 0.35rem 0.5rem; }
  .bar select, .bar button, .menu summary { padding: 0 0.5rem; }
  .bar select:disabled { display: none; }
  .menu { position: static; }
  .menu-list { left: 0.5rem; right: 0.5rem; top: calc(100% + 0.25rem); min-width: 0; }
  .stage { padding: 4px; }
}

/* phone held upright: keep the picture at the top, clear of the on-screen keyboard */
@media (max-width: 40rem) and (orientation: portrait) {
  .stage { place-items: start center; }
}

@media (hover: hover) and (pointer: fine) {
  .touch-only { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pane { animation: none; }
}
