:root {
  --bg: #04070c;
  --ink: #dff3ff;
  --dim: #5f869c;
  --cyan: #38bdf8;
  --teal: #2dd4bf;
  --line: rgba(56, 189, 248, 0.18);
  --display: "Orbitron", system-ui, sans-serif;
  --body: "Chakra Petch", -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(70% 42% at 50% 0%, rgba(34, 211, 238, 0.13), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* Ambient dust belongs to the whole handset, not just the reactor. The canvas
   sits behind every screen and never takes a touch. */
.ambient-dust {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.58;
}

.pair-screen,
.guest-screen,
.app {
  position: relative;
  z-index: 1;
}

button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* Pairing */
.pair-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.pair-inner { width: 100%; max-width: 340px; text-align: center; }

.pair-reactor {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 30px;
  display: grid;
  place-items: center;
}

.pair-reactor .core {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle, #d8fbff, #38bdf8 55%, #0b3b52 100%);
  box-shadow: 0 0 34px rgba(56, 189, 248, 0.75), 0 0 70px rgba(56, 189, 248, 0.35);
}

.pair-reactor .ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.pair-reactor .ring-1 {
  inset: 12px;
  border-top-color: rgba(125, 231, 255, 0.9);
  animation: spin 9s linear infinite;
}

.pair-reactor .ring-2 {
  inset: 0;
  border-style: dashed;
  border-color: rgba(56, 189, 248, 0.2);
  animation: spin 26s linear infinite reverse;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pair-inner h1 {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.36em;
  font-weight: 600;
  margin: 0 0 14px;
}

.pair-copy {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--dim);
  margin: 0 0 24px;
}

.pair-form { display: flex; flex-direction: column; gap: 10px; }

.pair-form input {
  background: rgba(8, 17, 26, 0.9);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px;
  text-align: center;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.42em;
  outline: none;
}

.pair-form input:focus { border-color: var(--cyan); }

.pair-form input.pair-name {
  padding: 12px;
  font-family: var(--body);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-transform: none;
}

.pair-form input.pair-name::placeholder {
  color: var(--dim);
  letter-spacing: 0.1em;
}

.pair-form button {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.94), rgba(14, 148, 196, 0.92));
  color: #031018;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.24em;
  font-weight: 700;
  padding: 15px;
  border-radius: 2px;
}

.pair-error {
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.5;
  min-height: 18px;
  margin-top: 14px;
}

/* Guest tracker */
.guest-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
}

.guest-inner {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.guest-kicker {
  margin: 0 0 22px;
  color: var(--teal);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.24em;
}

.guest-reactor {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
}

.guest-core {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #d8fbff, #2dd4bf 55%, #0b3b52 100%);
  box-shadow: 0 0 30px rgba(45, 212, 191, 0.6), 0 0 62px rgba(45, 212, 191, 0.24);
}

.guest-ring {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(45, 212, 191, 0.34);
  border-radius: 50%;
  animation: spin 24s linear infinite reverse;
}

.guest-inner h1 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.3em;
  font-weight: 600;
}

.guest-copy {
  margin: 0 0 20px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.65;
}

.guest-who {
  margin: -8px 0 14px;
  color: var(--dim);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.guest-who strong {
  color: var(--teal);
  font-weight: 600;
}

.guest-card {
  margin: 0 0 16px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(8, 17, 26, 0.82);
  text-align: left;
}

.guest-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink);
}

.guest-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 rgba(45, 212, 191, 0);
}

.guest-dot.on {
  background: var(--teal);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.7);
}

.guest-dot.live {
  background: var(--teal);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.4; }
}

#guestMeta {
  margin: 9px 0 0;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.5;
}

.guest-primary,
.guest-secondary,
.guest-leave {
  width: 100%;
  border-radius: 2px;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.guest-primary {
  margin: 0 0 10px;
  padding: 15px;
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.96), rgba(13, 148, 136, 0.94));
  color: #031018;
  font-size: 11px;
}

.guest-primary.stop {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fca5a5;
}

.guest-secondary {
  margin: 0 0 12px;
  padding: 11px;
  border: 1px solid var(--line);
  color: var(--cyan);
  background: transparent;
  font-size: 8px;
}

.guest-note {
  min-height: 16px;
  margin: 0 0 8px;
  color: #fca5a5;
  font-size: 11px;
  line-height: 1.5;
}

.guest-privacy {
  margin: 0 0 20px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.6;
}

.guest-leave {
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #94a3b8;
  background: transparent;
  font-size: 8px;
}

.guest-systems {
  margin: 0 0 14px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(6, 16, 22, 0.72);
  text-align: left;
}

.guest-systems-head {
  margin-bottom: 8px;
  color: var(--teal);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.guest-system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  color: var(--dim);
  font-size: 10px;
}

.guest-system-row:first-of-type { border-top: 0; }
.guest-system-copy { min-width: 0; flex: 1; }
.guest-system-row strong { display: block; color: var(--ink); font-weight: 500; }
.guest-system-row small {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  font-size: 8px;
  line-height: 1.4;
}
.guest-system-row .ok { color: var(--teal); }
.guest-system-row .bad { color: #fbbf24; }
.guest-system-fix {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid rgba(45, 212, 191, 0.42);
  border-radius: 2px;
  color: var(--teal);
  background: transparent;
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.14em;
}

/* App */
.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.bar-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bar-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.link-state {
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.18em;
  color: var(--teal);
  white-space: nowrap;
}

.link-state.offline { color: #f87171; }

.window-chip {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--cyan);
  border: 1px solid var(--line);
  padding: 8px 8px;
  border-radius: 2px;
}

.window-chip.active {
  color: #031018;
  border-color: rgba(45, 212, 191, 0.7);
  background: var(--teal);
}

/* Live position is a privacy switch, not a normal window launcher. It stays
   visibly on while the phone is reporting so nobody has to guess. */
.location-chip.active {
  color: var(--teal);
  border-color: rgba(45, 212, 191, 0.62);
  background: rgba(45, 212, 191, 0.1);
  box-shadow: inset 0 0 12px rgba(45, 212, 191, 0.1), 0 0 12px rgba(45, 212, 191, 0.12);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
}

.dot.online { background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.dot.offline { background: #f87171; }

.bar-title {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.3em;
}

.voice-chip {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.18em;
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 8px 10px;
  border-radius: 2px;
}

.voice-chip.on { color: var(--teal); border-color: rgba(45, 212, 191, 0.4); }

/* The reactor above the transcript. It runs the HUD's own shader now, so the
   extra height gives the dust rim and woven core room to read. */
.reactor {
  position: relative;
  flex: 0 0 auto;
  height: clamp(250px, 33vh, 305px);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(65% 70% at 50% 45%, rgba(25, 196, 196, 0.08), transparent 72%);
  overflow: hidden;
}

.reactor canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  transition: filter 0.35s ease;
}

/* A CSS stand-in for WebViews with no usable WebGL context. It is hidden when
   the shader links, so the authored reactor is never drawn twice. */
.orb-fallback {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
}
.orb-fallback-on .orb-fallback { display: grid; }
.orb-fallback i,
.orb-fallback b {
  position: absolute;
  display: block;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.orb-fallback i:nth-child(1) {
  width: min(78%, 245px);
  aspect-ratio: 1;
  border: 2px solid rgba(104, 248, 255, 0.82);
  box-shadow: 0 0 9px #19d8d2, inset 0 0 18px rgba(25, 216, 210, 0.32);
  filter: blur(0.4px);
}
.orb-fallback i:nth-child(2) {
  width: min(58%, 182px);
  aspect-ratio: 1;
  border: 1px solid rgba(73, 226, 234, 0.55);
  box-shadow: 0 0 8px rgba(25, 216, 210, 0.4);
}
.orb-fallback i:nth-child(3) {
  width: min(40%, 126px);
  aspect-ratio: 1;
  border: 1px solid rgba(73, 226, 234, 0.32);
}
.orb-fallback::before {
  content: '';
  position: absolute;
  width: min(106%, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  background-image: radial-gradient(circle, rgba(190, 255, 255, 0.85) 0 1px, transparent 1.5px);
  background-size: 17px 19px;
  -webkit-mask-image: radial-gradient(circle, transparent 0 54%, #000 62%, #000 84%, transparent 90%);
  mask-image: radial-gradient(circle, transparent 0 54%, #000 62%, #000 84%, transparent 90%);
  opacity: 0.6;
}
.orb-fallback b {
  width: 4px;
  height: 4px;
  background: #d7fdff;
  box-shadow: 0 0 8px 2px #19d8d2;
}
.orb-dust {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.reactor-status { z-index: 3; }

.reactor-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  text-align: center;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.32em;
  color: #35586b;
  transition: color 0.3s ease;
}

.reactor.live .reactor-status { color: var(--teal); }

.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty {
  margin: auto;
  text-align: center;
  color: #4c7286;
  font-size: 13px;
  line-height: 1.7;
  padding: 0 24px;
}

.empty-title {
  display: block;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--teal);
  margin-bottom: 12px;
}

.msg { max-width: 88%; animation: rise 0.25s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.msg .who {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.24em;
  color: #4c7286;
  margin-bottom: 5px;
}

.msg .body {
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.55;
  border-radius: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.assistant { align-self: flex-start; }
.msg.assistant .body {
  background: rgba(9, 22, 32, 0.92);
  border: 1px solid var(--line);
  border-left: 2px solid var(--teal);
}

.msg.user { align-self: flex-end; text-align: right; }
.msg.user .body {
  background: rgba(56, 189, 248, 0.13);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.msg .body.error { color: #fca5a5; border-left-color: #f87171; }

.msg .tool {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  border: 1px solid var(--line);
  padding: 3px 6px;
  border-radius: 2px;
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(4, 10, 16, 0.94);
  backdrop-filter: blur(12px);
}

.composer input {
  flex: 1;
  min-width: 0;
  background: rgba(8, 17, 26, 0.9);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 13px 12px;
  font-size: 15px;
  outline: none;
}

.composer input:focus { border-color: var(--cyan); }

.mic {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--dim);
  flex: 0 0 auto;
}

.mic svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.mic.live {
  color: var(--teal);
  border-color: var(--teal);
  background: rgba(45, 212, 191, 0.14);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); }
}

.send {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.94), rgba(14, 148, 196, 0.92));
  color: #031018;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 700;
  padding: 14px 13px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.send:disabled { opacity: 0.5; }

/* --------------------------------------------------------- app updates */

.update-popup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(1, 5, 9, 0.8);
  backdrop-filter: blur(9px);
  animation: callFade 0.25s ease;
}

.update-card {
  width: min(360px, 100%);
  padding: 20px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background:
    linear-gradient(145deg, rgba(11, 30, 41, 0.98), rgba(3, 12, 19, 0.99));
  box-shadow: 0 0 54px rgba(45, 212, 191, 0.12);
}

.update-kicker {
  color: var(--teal);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.28em;
}

.update-card h2 {
  margin: 9px 0 0;
  color: #efffff;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.update-card h2 span { color: var(--teal); font-size: 11px; letter-spacing: 0.1em; }
.update-copy { margin: 12px 0 8px; color: #a9dce3; font-size: 12px; line-height: 1.55; }
.update-note { margin: 0; color: #5f869c; font-size: 10px; line-height: 1.45; }
.update-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.update-actions button {
  border: 1px solid var(--line);
  padding: 9px 12px;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.14em;
  cursor: pointer;
}
.update-later { background: transparent; color: #5f869c; }
.update-now { background: rgba(45, 212, 191, 0.12); color: var(--teal); border-color: rgba(45, 212, 191, 0.5) !important; }

/* ------------------------------------------------------------- calls */

.call-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 7, 11, 0.94);
  backdrop-filter: blur(18px);
  animation: callFade 0.25s ease both;
}

.call-screen.hidden { display: none; }

@keyframes callFade { from { opacity: 0; } }

.call-sheet { width: min(360px, 100%); text-align: center; }

.call-reactor {
  position: relative;
  width: 138px;
  height: 138px;
  margin: 0 auto 26px;
  display: grid;
  place-items: center;
}

.call-core {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, #e2ffff 0%, rgba(56, 189, 248, 0.7) 36%, rgba(14, 116, 144, 0.1) 72%);
  box-shadow: 0 0 34px rgba(56, 189, 248, 0.75), 0 0 90px rgba(45, 212, 191, 0.32);
  animation: callBreathe 2.2s ease-in-out infinite;
}

.call-ring {
  position: absolute;
  border: 1px solid rgba(125, 231, 255, 0.5);
  border-radius: 50%;
}

.call-ring.ring-a {
  inset: 10px;
  border-style: dashed;
  animation: callSpin 16s linear infinite;
}

.call-ring.ring-b {
  inset: -6px;
  border-style: dotted;
  border-color: rgba(56, 189, 248, 0.24);
  animation: callSpin 24s linear infinite reverse;
}

@keyframes callBreathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes callSpin { to { transform: rotate(360deg); } }

.call-kicker {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.34em;
  color: var(--teal);
  margin-bottom: 12px;
}

.call-sheet h2 {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.32em;
  color: var(--ink);
  margin-bottom: 10px;
}

.call-reason {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}

.call-message {
  min-height: 18px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #6f9aab;
}

.call-message:empty { display: none; }

.call-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
}

.call-button {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px 12px;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.18em;
  background: rgba(8, 17, 26, 0.9);
}

.call-button.answer {
  color: #031018;
  border-color: rgba(45, 212, 191, 0.7);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.95), rgba(13, 148, 136, 0.9));
}

.call-button.decline {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
}

.call-hint {
  margin-top: 18px;
  font-size: 11px;
  color: #4c7286;
}

.call-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  background: rgba(4, 10, 16, 0.94);
}

.call-bar.hidden { display: none; }

.call-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
  animation: pulse 1.4s ease-in-out infinite;
}

.call-status {
  flex: 1;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--teal);
}

.call-mini {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 9px;
}

.call-mini.end { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); }

.car-mode {
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.18em;
  color: #041016;
  background: var(--teal);
  border-radius: 2px;
  padding: 4px 6px;
}

.call-history {
  margin: 0 0 14px;
  border: 1px solid rgba(56, 189, 248, 0.16);
  background: rgba(5, 14, 21, 0.72);
}

.call-history.hidden { display: none; }

.call-history-title {
  padding: 7px 9px 5px;
  color: var(--dim);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.2em;
}

.call-history-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 9px 7px;
  border-top: 1px solid rgba(56, 189, 248, 0.1);
  color: #c7e6f2;
  font-size: 10px;
  line-height: 1.35;
}

.call-history-row .outcome {
  flex: 0 0 auto;
  color: var(--teal);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.call-history-row.missed .outcome { color: #fca5a5; }
.call-history-row .reason { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.call-notice {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid rgba(45, 212, 191, 0.34);
  color: var(--teal);
  background: rgba(45, 212, 191, 0.07);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.18em;
}

/* ------------------------------------------------ the PC's boot, on a phone */

.boot {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 24px;
  background: #03070b;
  transition: opacity 0.5s ease, filter 0.5s ease;
}

.boot.closing { opacity: 0; filter: blur(10px); pointer-events: none; }

.boot-bar { width: min(320px, 100%); transition: opacity 0.4s ease; }
.boot.stage-2 .boot-bar,
.boot.stage-3 .boot-bar,
.boot.stage-4 .boot-bar { opacity: 0.28; filter: blur(0.6px); }

.boot-frame { border: 1px solid var(--line); padding: 10px 12px; }

.boot-title {
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--teal);
}

.boot-dots { opacity: 0.6; }

.boot-seg { display: flex; gap: 3px; margin-top: 10px; }
.boot-seg i {
  flex: 1;
  height: 5px;
  background: rgba(56, 189, 248, 0.13);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}
.boot-seg i.on { background: var(--cyan); box-shadow: 0 0 6px rgba(56, 189, 248, 0.8); }

.boot-log {
  min-height: 96px;
  margin-top: 12px;
  font-size: 10.5px;
  line-height: 1.7;
  color: #4c7286;
}
.boot-log div { animation: bootLineIn 0.25s ease both; }
.boot-log div::before { content: '\203a  '; opacity: 0.5; }
@keyframes bootLineIn { from { opacity: 0; transform: translateX(-8px); } }

.boot-stage {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.boot-stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  /* Short on purpose: these are three different pictures in the same square,
     so a long cross-fade reads as two of them overlapping. */
  transition: opacity 0.22s ease-out;
}

.boot.stage-2 .boot-rings,
.boot.stage-3 .boot-suit,
.boot.stage-4 .boot-reactor { opacity: 1; }

/* Beat 2 — reticle rings, the name resolving last. */
.boot-rings circle { transform-box: fill-box; transform-origin: center; }
.boot.stage-2 .boot-rings circle { animation: bootRingIn 0.7s ease both; }
.boot.stage-2 .boot-rings circle:nth-of-type(2) { animation-delay: 0.08s; }
.boot.stage-2 .boot-rings circle:nth-of-type(3) { animation-delay: 0.16s; }
.boot.stage-2 .boot-rings circle:nth-of-type(4) { animation-delay: 0.24s; }
.boot.stage-2 .boot-rings circle:nth-of-type(5) { animation-delay: 0.34s; }
.boot-name {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.42em;
  fill: var(--ink);
}
.boot.stage-2 .boot-name { animation: bootNameIn 0.9s ease both 0.45s; }
@keyframes bootRingIn {
  from { opacity: 0; transform: rotate(-40deg) scale(1.15); }
  to { opacity: 1; transform: none; }
}
@keyframes bootNameIn {
  from { opacity: 0; letter-spacing: 0.9em; }
  to { opacity: 1; letter-spacing: 0.42em; }
}

/* Beat 3 — the suit schematic. */
.boot-figure {
  fill: none;
  stroke: rgba(125, 231, 255, 0.85);
  stroke-width: 1.2;
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
}
.boot.stage-3 .boot-figure { animation: bootDraw 1.3s ease forwards; }
.boot-callout { animation: none; }
.boot.stage-3 .boot-callout { animation: bootFadeIn 0.5s ease both 0.25s; }
.boot-tag {
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.18em;
  fill: #4c7286;
}
@keyframes bootDraw { to { stroke-dashoffset: 0; } }
@keyframes bootFadeIn { from { opacity: 0; } }

/* Beat 4 — the reactor lighting up. */
.boot-reactor { filter: drop-shadow(0 0 18px rgba(56, 189, 248, 0.55)); }
.boot-r-ticks {
  fill: none;
  stroke: rgba(56, 189, 248, 0.5);
  stroke-width: 3;
  stroke-dasharray: 2 8;
  transform-box: fill-box;
  transform-origin: center;
}
.boot.stage-4 .boot-r-ticks { animation: spin 14s linear infinite; }
.boot-r-ring { fill: none; stroke: rgba(56, 189, 248, 0.5); stroke-width: 1; }
.boot-r-ring.dim { stroke: rgba(56, 189, 248, 0.22); }
.boot-r-tri { fill: rgba(56, 189, 248, 0.1); stroke: rgba(125, 231, 255, 0.85); stroke-width: 1.4; }
.boot-r-tri.dim { fill: none; stroke: rgba(125, 231, 255, 0.4); }
.boot-r-v { fill: none; stroke: #d8fbff; stroke-width: 1.6; }
.boot.stage-4 .boot-reactor { animation: bootReactorIn 0.9s ease both; }
@keyframes bootReactorIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------- windows */

.window-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(2, 7, 11, 0.74);
  backdrop-filter: blur(9px);
}

.window-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
}

.window-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 3px;
  background: rgba(4, 13, 20, 0.97);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

.window-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--teal);
}

.window-close {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 6px 8px;
}

.window-close:active { color: var(--ink); border-color: var(--cyan); }

.window-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.window-note {
  padding: 18px 10px;
  color: #6f9aab;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.window-note.error { color: #fca5a5; }

/* Geo locator: one phone at a time on a dark raster basemap. Tiles carry the
   whole map, so this needs no library and no key. */
.geo { display: flex; flex-direction: column; gap: 10px; }
.geo-map {
  position: relative;
  height: clamp(210px, 40vh, 320px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #061019;
}
.geo-tiles { position: absolute; inset: 0; }
.geo-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: saturate(0.78) contrast(1.04) brightness(0.94);
}
.geo-halo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(45, 212, 191, 0.45);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.16), rgba(45, 212, 191, 0.03) 62%, transparent 72%);
  pointer-events: none;
}
.geo-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 1px solid rgba(94, 234, 212, 0.7);
  border-radius: 50%;
  background: rgba(4, 13, 20, 0.7);
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.45);
  pointer-events: none;
}
.geo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px var(--teal);
  animation: geo-ping 2.4s ease-out infinite;
}
@keyframes geo-ping {
  0%, 100% { transform: scale(1); opacity: 1; }
  55% { transform: scale(0.7); opacity: 0.65; }
}
.geo-tools { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; }
.geo-tools button {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 2px;
  background: rgba(4, 13, 20, 0.86);
  color: var(--cyan);
  font-family: var(--display);
  font-size: 11px;
  line-height: 1;
}
.geo-tools button:disabled { opacity: 0.35; }
/* Past zoom 16 the basemap becomes satellite imagery, so name the layer. */
.geo-mode {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 3px 5px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  border-radius: 2px;
  background: rgba(4, 13, 20, 0.82);
  color: var(--teal);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.16em;
  pointer-events: none;
}
.geo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px;
  background: rgba(4, 10, 16, 0.88);
  text-align: center;
}
.geo-empty p { margin: 0; color: #8fb4c2; font-size: 11px; line-height: 1.55; }
.geo-empty button {
  border: 1px solid rgba(45, 212, 191, 0.5);
  border-radius: 2px;
  padding: 9px 12px;
  background: rgba(45, 212, 191, 0.1);
  color: var(--teal);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.14em;
}
.geo-empty button:disabled { opacity: 0.5; }
.geo-attrib {
  position: absolute;
  left: 6px;
  bottom: 4px;
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(4, 10, 16, 0.7);
  color: #7f9fae;
  font-size: 7px;
  letter-spacing: 0.06em;
  pointer-events: none;
}
.geo-devices { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.geo-devices::-webkit-scrollbar { display: none; }
.geo-device {
  flex: 0 0 auto;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 8px;
  color: #9fc4cf;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.1em;
}
.geo-device.active { color: #031018; border-color: rgba(45, 212, 191, 0.7); background: var(--teal); }
.geo-readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border: 1px solid var(--line);
  background: rgba(56, 189, 248, 0.14);
}
.geo-readout > div { min-width: 0; padding: 9px 10px; background: #050f17; }
.geo-readout span {
  display: block;
  margin-bottom: 4px;
  color: var(--dim);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.16em;
}
.geo-readout strong { color: #d8f2f7; font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.geo-readout strong.bad { color: #fca5a5; }
.geo-note { margin: 0; color: #6f9aab; font-size: 10px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) {
  .geo-dot { animation: none; }
}

/* Today: tasks and routines from the PC, actionable on the phone. */
.today { display: flex; flex-direction: column; gap: 2px; }
.today-brief {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.05);
  padding: 11px 12px;
  margin-bottom: 10px;
}
.today-brief > div { flex: 1; min-width: 0; }
.today-brief-copy {
  margin: 5px 0 0;
  color: #9fc4cf;
  font-size: 11px;
  line-height: 1.5;
}
.today-heading {
  padding: 10px 2px 6px;
  color: var(--teal);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.18em;
}
.today-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
}
.today-copy { flex: 1; min-width: 0; }
.today-title { color: #d8f2f7; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.today-meta {
  margin-top: 3px;
  color: #6f9aab;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.1em;
}
.today-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.today-action {
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: rgba(56, 189, 248, 0.08);
  color: var(--cyan);
  border-radius: 2px;
  padding: 7px 8px;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.12em;
}
.today-action:disabled { opacity: 0.45; }
.today-empty { color: #6f9aab; font-size: 11px; line-height: 1.5; margin: 4px 0 10px; }

.cam-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cam-choice {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 8px;
}

.cam-choice.active {
  color: var(--teal);
  border-color: rgba(45, 212, 191, 0.55);
  background: rgba(45, 212, 191, 0.1);
}

.cam-view {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}

.cam-view img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cam-status {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  line-height: 1.35;
  padding: 4px 6px;
  color: #bfffe4;
  background: rgba(2, 12, 10, 0.78);
  border: 1px solid rgba(62, 242, 168, 0.4);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.cam-status.bad { color: #fca5a5; border-color: rgba(248, 113, 113, 0.45); }
.cam-status.low {
  color: #ffd28a;
  border-color: rgba(255, 193, 94, 0.5);
  background: rgba(24, 16, 2, 0.86);
}

/* Smart home, shown beside the cameras on a wall tablet. */
.home { display: flex; flex-direction: column; gap: 2px; }
.home-heading {
  padding: 12px 2px 6px;
  color: var(--teal);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.18em;
}
.home-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
}
.home-name { flex: 1; min-width: 0; color: #d8f2f7; font-size: 12px; overflow-wrap: anywhere; }
.home-type {
  margin-top: 2px;
  color: #5f869c;
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.1em;
}
.home-state {
  flex: 0 0 auto;
  max-width: 48%;
  color: var(--teal);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-align: right;
  overflow-wrap: anywhere;
}
.home-state.off { color: #5f869c; }

/* Motion notifications stay above the transcript until dismissed, with the two
   actions the alert is actually for. */
.camera-notice {
  position: relative;
  margin: 0 0 10px;
  padding: 12px 13px;
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-left: 3px solid var(--teal);
  background: rgba(5, 28, 29, 0.94);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}
.camera-notice-title {
  color: var(--teal);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.14em;
}
.camera-notice-meta { margin-top: 3px; color: #8fb6c3; font-size: 11px; }
.camera-notice-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.camera-notice-actions button {
  border: 1px solid rgba(56, 189, 248, 0.38);
  background: rgba(56, 189, 248, 0.09);
  color: var(--cyan);
  border-radius: 2px;
  padding: 8px 10px;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.12em;
}
.camera-notice-actions button.live { border-color: rgba(45, 212, 191, 0.55); color: var(--teal); }
.camera-notice-actions button.dismiss { margin-left: auto; color: var(--dim); border-color: var(--line); }

.replay-copy { margin: 0 0 10px; color: #7fa7b5; font-size: 11px; line-height: 1.5; }
.replay-video {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 210px);
  background: #000;
  border: 1px solid var(--line);
}
.replay-empty { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.mail-summary {
  margin-bottom: 8px;
  color: #6f9aab;
  font-size: 11px;
  line-height: 1.5;
}

.mail-list { display: flex; flex-direction: column; gap: 6px; }

.mail-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 2px;
  background: rgba(8, 17, 26, 0.8);
}

.mail-row.unread { border-left-color: var(--teal); }
.mail-row:active { background: rgba(56, 189, 248, 0.1); }

.mail-from {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.mail-time { color: #4c7286; font-size: 9px; font-weight: 400; white-space: nowrap; }
.mail-subject { margin-top: 3px; color: #9bc4d4; font-size: 11px; line-height: 1.4; }
.mail-body { margin: 4px 0 12px; color: #cfe6e3; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.window-back { margin-bottom: 10px; }

.mail-bills {
  margin: 0 0 12px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  background: linear-gradient(180deg, rgba(38, 25, 8, 0.72), rgba(10, 16, 23, 0.82));
}

.mail-bills-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  color: #f6c667;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.mail-bills-total {
  color: #ffe6a6;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0;
  text-align: right;
}

.mail-bill {
  display: block;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  color: inherit;
  border: 0;
  border-top: 1px solid rgba(245, 158, 11, 0.16);
  background: rgba(255, 255, 255, 0.015);
}

.mail-bill:active { background: rgba(245, 158, 11, 0.1); }

.mail-bill-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.mail-bill-sender { color: #e8d5ae; font-size: 11px; font-weight: 600; }
.mail-bill-amount { color: #ffd27a; font-family: var(--display); font-size: 14px; white-space: nowrap; }
.mail-bill-subject { margin-top: 2px; color: #c7b58f; font-size: 10px; line-height: 1.35; }
.mail-bill-meta { margin-top: 4px; color: #a38b5e; font-size: 9px; line-height: 1.35; }

.mail-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 10px 0 4px;
}

.mail-images-label {
  grid-column: 1 / -1;
  color: #7fb7c9;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.mail-image {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: #000;
}

.mail-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #000;
}

.mail-image figcaption {
  padding: 5px 7px;
  color: #6795a6;
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(6, 14, 21, 0.92);
}

/* On a tablet, use the width. A phone-shaped column floating in the middle of a
   tablet wasted most of the screen and made the transcript look like a demo. */
/* A wall-mounted tablet runs the same companion with ?wall=1. The dashboard
   replaces the conversation with the smart-home and camera surfaces and keeps
   the close/exit controls reachable. */
.wall-exit {
  display: none;
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 31;
  padding: 9px 11px;
  border: 1px solid rgba(56, 189, 248, 0.38);
  border-radius: 2px;
  background: rgba(3, 12, 18, 0.9);
  color: var(--cyan);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.14em;
}

body.wall .app { visibility: hidden; }
body.wall .window-layer {
  padding: 0;
  background:
    radial-gradient(70% 60% at 50% 0%, rgba(34, 211, 238, 0.09), transparent 70%),
    #02060a;
  backdrop-filter: none;
  align-items: stretch;
  justify-content: stretch;
}
body.wall .window-stack {
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  gap: 1px;
  overflow: hidden;
  background: rgba(56, 189, 248, 0.18);
}
body.wall .window-card {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-height: 100dvh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: rgba(3, 12, 18, 0.97);
}
body.wall .window-card[data-window="home"] { flex: 0 1 34%; }
body.wall .window-card[data-window="cameras"],
body.wall .window-card[data-window="replay"] { flex: 1 1 66%; }
body.wall .window-head {
  padding: 15px 17px;
  font-size: 10px;
  background: rgba(3, 14, 20, 0.98);
}
body.wall .window-body { padding: 15px 17px; }
body.wall .cam-picker { gap: 8px; margin-bottom: 14px; }
body.wall .cam-choice { font-size: 9px; padding: 9px 11px; }
body.wall .cam-view { max-height: calc(100dvh - 170px); }
body.wall .home-row { padding: 13px 4px; }
body.wall .home-name { font-size: 14px; }
body.wall .home-state { font-size: 9px; }
body.wall .wall-exit { display: block; }

/* Notices cannot live in the transcript while wall mode hides the app. */
.wall-notice {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(520px, 90vw);
  padding: 10px 14px;
  border: 1px solid rgba(45, 212, 191, 0.5);
  background: rgba(3, 18, 20, 0.96);
  color: var(--teal);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-align: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.wall-camera-notice {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 50;
  width: min(390px, 90vw);
  margin: 0;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
}

@media (orientation: portrait) {
  body.wall .window-stack { flex-direction: column; }
  body.wall .window-card[data-window="home"] { flex: 0 1 38%; }
  body.wall .window-card[data-window="cameras"],
  body.wall .window-card[data-window="replay"] { flex: 1 1 62%; }
  body.wall .cam-view { max-height: none; }
}

@media (min-width: 720px) {
  .app {
    max-width: none;
    margin: 0;
    border-left: 0;
    border-right: 0;
  }
  .thread { width: 100%; max-width: 980px; margin: 0 auto; }
  .window-stack { width: min(720px, 100%); }
}

/* Landscape phones and tablets: the reactor becomes the left column and the
   conversation gets the rest, instead of the reactor eating half the height. */
@media (orientation: landscape) and (min-width: 560px) {
  .app {
    display: grid;
    grid-template-columns: minmax(220px, 34vw) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    max-width: none;
    width: 100%;
    margin: 0;
    border: 0;
  }
  .bar { grid-column: 1 / -1; grid-row: 1; }
  .reactor {
    grid-column: 1;
    grid-row: 2;
    height: auto;
    min-height: 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
  .thread {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 18px 20px;
  }
  .call-bar { grid-column: 1 / -1; grid-row: 3; }
  .native-tools { grid-column: 1 / -1; grid-row: 4; }
  .composer { grid-column: 1 / -1; grid-row: 5; }

  .window-layer { align-items: flex-end; justify-content: flex-end; }
  .window-stack {
    flex-direction: row;
    align-items: stretch;
    width: auto;
    max-width: min(900px, 84vw);
    max-height: calc(100dvh - 24px);
  }
  .window-card { width: min(420px, 39vw); }
}

@media (orientation: landscape) and (max-height: 430px) {
  .bar { padding-top: 9px; padding-bottom: 9px; }
  .composer { padding-top: 7px; }
  .window-card { max-height: calc(100dvh - 16px); }
}

/* Small phones: the three header actions still fit without squeezing the
   status line off the edge. */
/* On a narrow handset the action row cannot share the line with the live
   ONLINE/OFFLINE label: the LOC chip would sit on top of it. Give the actions
   their own row instead of hiding the connection state. */
@media (max-width: 480px) {
  .bar { flex-wrap: wrap; gap: 7px 10px; }
  .bar-left { flex: 1 1 100%; }
  .bar-actions { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; row-gap: 5px; }
}

@media (max-width: 380px) {
  .bar { padding-left: 10px; padding-right: 10px; gap: 6px 8px; }
  .bar-left { gap: 6px; }
  .bar-title { font-size: 9px; letter-spacing: 0.22em; }
  .bar-actions { gap: 4px; }
  .window-chip { padding: 7px 6px; }
  .voice-chip { padding: 7px 7px; font-size: 7px; }
}

/* Native-only call setup. Hidden in a browser, and hidden by the page as
   soon as the APK reports that both call permissions are already granted. */
.native-tools {
  display: flex;
  gap: 6px;
  padding: 0 16px 8px;
  justify-content: flex-end;
}
.native-tools.hidden { display: none; }
.native-tools button {
  appearance: none;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: rgba(56, 189, 248, 0.06);
  color: rgba(201, 253, 255, 0.72);
  font: inherit;
  font-size: 8px;
  letter-spacing: 0.16em;
  padding: 5px 8px;
}
.native-tools button:active {
  background: rgba(56, 189, 248, 0.18);
}

/* ------------------------------------------------ wall tablet: orb surface */

/* The old wall mode hid the app and opened two windows. The tablet surface is
   now the orb itself: voice only, with a small dock for the things you pull up
   on demand. The windows still exist above it, so HOME and CAMS behave like
   sheets rather than replacing the wall. */
body.wall .app {
  visibility: visible;
  display: block;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  margin: 0;
  border: 0;
  background: transparent;
}
body.wall .bar,
body.wall .thread,
body.wall .native-tools { display: none; }
body.wall .reactor {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100dvh;
  border: 0;
}
body.wall .reactor .orb-dust { display: block; }
body.wall .reactor-status {
  bottom: max(182px, calc(env(safe-area-inset-bottom) + 172px));
  font-size: 9px;
}
body.wall .composer {
  position: fixed;
  left: 50%;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 86px));
  z-index: 20;
  display: block;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
}
body.wall .composer input,
body.wall .composer .send,
body.wall .photo-btn { display: none; }
body.wall .mic {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(3, 14, 20, 0.72);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.16);
}
body.wall .mic.live {
  border-color: var(--teal);
  box-shadow: 0 0 34px rgba(45, 212, 191, 0.38);
}
body.wall .wall-exit { display: none; }

.wall-dock {
  display: none;
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  gap: 5px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 3px;
  background: rgba(3, 11, 17, 0.78);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}
body.wall .wall-dock { display: flex; }
/* Do not float the dock over the pairing screen. */
body.wall .app.hidden ~ .wall-dock { display: none; }
.wall-dock button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: rgba(207, 250, 254, 0.72);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.13em;
  padding: 9px 11px;
}
.wall-dock button:hover,
.wall-dock button:active {
  border-color: rgba(56, 189, 248, 0.38);
  background: rgba(56, 189, 248, 0.1);
  color: #eaffff;
}
.wall-dock button[data-wall="lock"] { color: #ffd28a; }
.wall-dock button[data-wall="exit"] { color: #ff9c9c; }
.wall-dock button.wall-off { display: none; }

body.wall.locked .wall-dock,
body.wall.locked .composer,
body.wall.locked .reactor-status { opacity: 0; pointer-events: none; }

.wall-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 5, 8, 0.72);
  backdrop-filter: blur(7px);
}
.wall-sheet.hidden { display: none; }
.wall-sheet-card {
  width: min(390px, 92vw);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: rgba(3, 13, 20, 0.98);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.wall-sheet-kicker,
.wall-lock-kicker {
  margin: 0 0 5px;
  color: var(--teal);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.26em;
}
.wall-sheet h2 {
  margin: 0 0 18px;
  color: #effeff;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.16em;
}
.wall-sheet-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 18px;
}
.wall-sheet-group label,
.wall-sheet-toggle,
.wall-sheet-select {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c9edf2;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.12em;
}
.wall-sheet-group label,
.wall-sheet-toggle {
  padding: 9px 10px;
  border: 1px solid rgba(56, 189, 248, 0.16);
  background: rgba(56, 189, 248, 0.04);
}
.wall-sheet input[type="checkbox"] { accent-color: #2dd4bf; }
.wall-sheet-select { justify-content: space-between; margin-bottom: 12px; }
.wall-sheet-select select {
  flex: 1;
  max-width: 150px;
  background: #071721;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 2px;
  color: #eaffff;
  font: inherit;
  padding: 7px;
}
.wall-sheet-note {
  margin: 14px 0 16px;
  color: #7196a2;
  font-size: 11px;
  line-height: 1.5;
}
.wall-sheet-done {
  width: 100%;
  padding: 11px;
  border: 1px solid rgba(45, 212, 191, 0.55);
  border-radius: 2px;
  background: rgba(45, 212, 191, 0.16);
  color: var(--teal);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.wall-readiness {
  margin: 14px 0;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: rgba(56, 189, 248, 0.035);
}
.wall-readiness-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
  color: #9bd4df;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.16em;
}
.wall-readiness-head button,
.wall-readiness-actions button {
  padding: 6px 8px;
  border: 1px solid rgba(45, 212, 191, 0.3);
  background: rgba(45, 212, 191, 0.06);
  color: var(--teal);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.1em;
}
.wall-readiness-list { display: grid; gap: 0; }
.wall-readiness-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.07);
}
.wall-readiness-row:last-child { border-bottom: 0; }
.wall-readiness-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: #ffb45e;
  box-shadow: 0 0 6px rgba(255, 180, 94, 0.45);
}
.wall-readiness-row.ok .wall-readiness-dot {
  background: #65f0b0;
  box-shadow: 0 0 6px rgba(101, 240, 176, 0.45);
}
.wall-readiness-row b {
  display: block;
  color: #d8f2f7;
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.wall-readiness-row small { display: block; margin-top: 2px; color: #6f9aaa; font-size: 9px; line-height: 1.35; }
.wall-readiness-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 10px; }

.wall-lock {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background:
    radial-gradient(45% 45% at 50% 44%, rgba(34, 211, 238, 0.06), transparent 75%),
    #000;
  cursor: pointer;
}
.wall-lock.hidden { display: none; }
.wall-lock-inner { text-align: center; }
.wall-lock-time {
  display: block;
  color: #dffcff;
  font-family: var(--display);
  font-size: clamp(58px, 13vw, 150px);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 0 40px rgba(34, 211, 238, 0.16);
}
.wall-lock-date {
  margin: 12px 0 0;
  color: #6da6b3;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.26em;
}
.wall-lock-note {
  margin-top: 30px;
  color: #3f6b78;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.photo-btn {
  width: 38px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--dim);
}
.photo-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.photo-btn.busy { color: var(--teal); border-color: var(--teal); }
.photo-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid rgba(45, 212, 191, 0.32);
  background: rgba(45, 212, 191, 0.06);
}
.photo-pending img {
  width: 54px;
  height: 42px;
  object-fit: cover;
  border: 1px solid rgba(45, 212, 191, 0.3);
}
.photo-pending span { flex: 1; color: #a9dce4; font-size: 11px; line-height: 1.4; }
.photo-pending button {
  border: 0;
  background: none;
  color: #ff9c9c;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.12em;
}
.bubble-photo {
  display: block;
  max-width: min(220px, 62vw);
  max-height: 220px;
  margin: 4px 0 10px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  object-fit: cover;
}

.photo-inbox { display: grid; gap: 12px; }
.photo-inbox-note { margin: 0; color: #6494a3; font-family: var(--display); font-size: 7px; letter-spacing: 0.1em; line-height: 1.5; }
.photo-inbox-empty { margin: 0; color: #7196a2; font-size: 12px; line-height: 1.5; }
.photo-inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.photo-inbox-item { margin: 0; border: 1px solid rgba(56, 189, 248, 0.16); background: rgba(56, 189, 248, 0.04); overflow: hidden; }
.photo-inbox-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-inbox-item figcaption { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: center; padding: 6px 7px; }
.photo-inbox-item figcaption span { color: #c9edf2; font-size: 10px; }
.photo-inbox-item figcaption small { color: #6494a3; font-size: 8px; }
.photo-inbox-item figcaption button { grid-column: 1 / -1; justify-self: start; border: 0; background: none; padding: 0; color: #ff9c9c; font-family: var(--display); font-size: 7px; letter-spacing: 0.1em; }
.photo-inbox-item.expired::after { content: 'LINK EXPIRED · REOPEN'; display: block; padding: 8px; color: #ffb45e; font-family: var(--display); font-size: 7px; letter-spacing: 0.08em; }

/* Music, on the players Spotify already knows about. */
.music { display: grid; gap: 14px; }
.music-now {
  padding: 13px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: rgba(56, 189, 248, 0.05);
}
.music-kicker,
.music-label {
  display: block;
  color: #6494a3;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}
.music-title { color: #eaffff; font-size: 16px; }
.music-artist { color: #97c5cf; font-size: 12px; margin-top: 3px; }
.music-device { color: #4f8594; font-size: 10px; margin-top: 4px; }
.music-row { display: flex; gap: 8px; align-items: stretch; }
.music-row select,
.music-row input {
  min-width: 0;
  flex: 1;
  padding: 11px 10px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 2px;
  background: #071721;
  color: #eaffff;
  font: inherit;
  font-size: 13px;
}
.music-row button,
.music-controls button {
  padding: 9px 12px;
  border: 1px solid rgba(45, 212, 191, 0.38);
  border-radius: 2px;
  background: rgba(45, 212, 191, 0.08);
  color: var(--teal);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.12em;
}
.music-row button:disabled,
.music-controls button:disabled { opacity: 0.4; }
.music-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.music-note { color: #7196a2; font-size: 11px; line-height: 1.5; }
.music-error { color: #ff9c9c; }
.music-results { display: grid; gap: 5px; }
.music-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 2px;
  background: rgba(56, 189, 248, 0.04);
  color: #d9fbff;
  font: inherit;
  text-align: left;
}
.music-result:hover,
.music-result:active { border-color: rgba(45, 212, 191, 0.5); background: rgba(45, 212, 191, 0.08); }
.music-result-name { font-size: 13px; }
.music-result-kind { color: #6494a3; font-size: 10px; }
.music-rooms { display: grid; gap: 6px; }
.music-room-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.music-room { padding: 7px 9px; border: 1px solid rgba(56, 189, 248, 0.2); border-radius: 2px; background: rgba(56, 189, 248, 0.04); color: #b9e8ef; font-family: var(--display); font-size: 8px; letter-spacing: 0.08em; }
.music-room.active { border-color: rgba(45, 212, 191, 0.55); background: rgba(45, 212, 191, 0.12); color: var(--teal); }
.music-room-empty { color: #5f869c; font-size: 10px; line-height: 1.4; }
.music-room-form { margin-top: 0; }
body.wall .photo-pending { display: none; }

@media (max-width: 520px) {
  .wall-dock { gap: 3px; padding: 5px; }
  .wall-dock button { padding: 8px 7px; font-size: 8px; }
  .wall-sheet-group { grid-template-columns: 1fr; }
}
