* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #020405;
  --bg-deep: #000204;
  --card: rgba(4, 16, 12, 0.72);
  --card-strong: rgba(2, 12, 9, 0.9);
  --line: rgba(0, 255, 100, 0.2);
  --line-strong: rgba(0, 255, 100, 0.38);
  --green: rgb(0, 255, 100);
  --green-soft: rgb(0, 190, 76);
  --green-dim: rgb(0, 115, 45);
  --cyan: rgb(0, 205, 255);
  --amber: rgb(255, 190, 60);
  --red: rgb(235, 75, 75);
  --text: rgba(220, 255, 232, 0.92);
  --muted: rgba(133, 210, 157, 0.68);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 12px 34px rgba(0, 255, 100, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --panel-width: min(92vw, 430px);
}

html {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 20% 15%, rgba(0, 255, 100, 0.10), transparent 28rem),
    radial-gradient(circle at 86% 6%, rgba(0, 180, 255, 0.11), transparent 22rem),
    linear-gradient(135deg, #000 0%, #021006 45%, #000204 100%);
  overflow-x: hidden;
  overflow-y: auto;
  cursor: auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  color: var(--text);
  touch-action: manipulation;
}

button,
input,
label {
  font: inherit;
}

button,
label,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
label:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(0.75rem, 2.5vw, 1.25rem);
  padding: calc(0.75rem + var(--safe-top)) clamp(0.75rem, 3vw, 2rem) calc(0.85rem + var(--safe-bottom));
  overflow-x: clip;
}

.glass-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(7, 22, 17, 0.76), rgba(2, 8, 7, 0.72));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

#top-nav {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 999px;
  padding: 0.5rem 0.6rem 0.5rem 0.95rem;
  z-index: 80;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-lockup strong {
  color: var(--green);
  font-size: clamp(0.86rem, 3vw, 1.05rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 18px rgba(0, 255, 100, 0.28);
}

.brand-kicker {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.icon-btn,
.nav-action,
.workflow-actions button,
#attach-btn,
.tool-btn,
.send-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.44);
  color: var(--green);
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icon-btn:active,
.nav-action:active,
.workflow-actions button:active,
#attach-btn:active,
.tool-btn:active,
.send-btn:active {
  transform: scale(0.97);
}

.icon-btn:hover,
.nav-action:hover,
.workflow-actions button:hover,
#attach-btn:hover,
.tool-btn:hover,
.send-btn:hover {
  border-color: rgba(0, 255, 100, 0.7);
  background: rgba(0, 255, 100, 0.08);
  box-shadow: 0 0 22px rgba(0, 255, 100, 0.12);
}

.speak-btn {
  color: var(--cyan);
  border-color: rgba(0, 205, 255, 0.42);
}

.desktop-nav {
  min-width: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 34px;
  padding: 0 0.85rem;
  border: 1px solid rgba(0, 255, 100, 0.15);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  color: var(--muted);
  font-size: clamp(0.68rem, 0.75vw, 0.78rem);
  font-weight: 850;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.status-pill.live {
  color: var(--green);
  border-color: rgba(0, 255, 100, 0.34);
  box-shadow: var(--shadow-soft);
}

.status-pill.live::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 14px rgba(0, 255, 100, 0.8);
}

#face-area {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: clamp(360px, 68svh, 760px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 135, 90, 0.13), transparent 52%),
    linear-gradient(180deg, rgba(0, 7, 8, 0.95), rgba(0, 1, 3, 0.98));
  isolation: isolate;
}

#face-area::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(0, 255, 100, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 100, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, #000 35%, transparent 78%);
  opacity: 0.75;
  z-index: 0;
}

#face-area::after {
  content: "";
  position: absolute;
  inset: auto 10% -12% 10%;
  height: 28%;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(0, 255, 100, 0.14), transparent 68%);
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
}

.face-hud {
  position: absolute;
  left: clamp(0.85rem, 3vw, 1.6rem);
  right: clamp(0.85rem, 3vw, 1.6rem);
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: rgba(130, 235, 165, 0.58);
  font-size: clamp(0.62rem, 2.2vw, 0.78rem);
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.face-hud-top { top: clamp(0.9rem, 3vw, 1.4rem); }
.face-hud-bottom { bottom: clamp(3.1rem, 7vw, 4rem); }

#face-canvas {
  display: block;
  position: relative;
  z-index: 1;
  width: min(100%, 76svh, 760px);
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 0 32px rgba(0, 255, 100, 0.16));
}

#status-label {
  position: absolute;
  left: clamp(1rem, 4vw, 2rem);
  right: clamp(1rem, 4vw, 2rem);
  bottom: clamp(1rem, 3vw, 1.4rem);
  z-index: 2;
  text-align: center;
  font-size: clamp(0.72rem, 2.6vw, 0.95rem);
  font-weight: 800;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 180, 220, 0.52);
  letter-spacing: clamp(0.11em, 0.7vw, 0.22em);
  pointer-events: none;
}

#panel {
  position: fixed;
  inset: calc(0.65rem + var(--safe-top)) 0 calc(5.3rem + var(--safe-bottom)) auto;
  z-index: 100;
  width: var(--panel-width);
  max-width: calc(100vw - 1rem);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem;
  border-radius: 24px 0 0 24px;
  overflow: hidden;
  transform: translateX(calc(100% + 1rem));
  transition: transform 240ms cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}

body.panel-open #panel {
  transform: translateX(0);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 0 0 auto;
  padding: 0.2rem 0.15rem 0;
}

.panel-head strong {
  display: block;
  color: var(--green);
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-kicker {
  display: block;
  margin-bottom: 0.1rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#panel-close-btn {
  flex: 0 0 auto;
}

.panel-grip {
  width: 44px;
  height: 4px;
  margin: 0 auto 0.1rem;
  border-radius: 999px;
  background: rgba(0, 255, 100, 0.28);
  flex: 0 0 auto;
}

.panel-card {
  min-width: 0;
  border: 1px solid rgba(0, 255, 100, 0.14);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.24);
  padding: clamp(0.75rem, 2.4vw, 1rem);
}

#system-card {
  flex: 0 0 auto;
  padding: 0.62rem 0.7rem;
}

.system-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

#clock {
  font-size: clamp(1.05rem, 3.8vw, 1.45rem);
  font-weight: 900;
  color: var(--green);
  text-shadow: 0 0 18px rgba(0, 255, 65, 0.22);
  line-height: 1;
  letter-spacing: -0.02em;
}

#date,
#weather-location {
  font-size: clamp(0.58rem, 2vw, 0.68rem);
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.weather-stack {
  min-width: 0;
  text-align: right;
}

.system-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.48rem;
}

.system-metrics div {
  min-width: 0;
  flex: 1 1 5.8rem;
  padding: 0.38rem 0.48rem;
  border: 1px solid rgba(0, 255, 100, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
}

.system-metrics span,
.system-metrics strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-metrics span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.system-metrics strong {
  margin-top: 0.12rem;
  color: var(--text);
  font-size: clamp(0.64rem, 2.1vw, 0.72rem);
}

.device-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.48rem;
}

.device-status span {
  flex: 1 1 5.8rem;
  min-width: 0;
  padding: 0.32rem 0.45rem;
  border: 1px solid rgba(0, 205, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 35, 46, 0.2);
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-status span.ready {
  color: var(--cyan);
  border-color: rgba(0, 205, 255, 0.34);
}

.device-status span.error {
  color: var(--red);
  border-color: rgba(235, 75, 75, 0.42);
}

.browser-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border-color: rgba(0, 205, 255, 0.2);
  background: linear-gradient(180deg, rgba(0, 32, 38, 0.42), rgba(0, 0, 0, 0.24));
}

.browser-head,
.browser-url-row,
.browser-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.browser-head {
  justify-content: space-between;
}

.browser-head strong {
  display: block;
  color: var(--cyan);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.browser-status {
  flex: 0 0 auto;
  border: 1px solid rgba(235, 75, 75, 0.4);
  border-radius: 999px;
  padding: 0.32rem 0.5rem;
  color: var(--red);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.browser-status.online {
  color: var(--green);
  border-color: rgba(0, 255, 100, 0.42);
  box-shadow: 0 0 16px rgba(0, 255, 100, 0.1);
}

#tandem-url-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(0, 205, 255, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  padding: 0 0.8rem;
}

#tandem-url-input::placeholder {
  color: rgba(120, 205, 230, 0.46);
}

.browser-actions .tool-btn,
.browser-url-row .tool-btn {
  min-height: 42px;
  flex: 1 1 auto;
}

.browser-url-row .tool-btn {
  flex: 0 0 auto;
}

.browser-active {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#tandem-preview {
  display: none;
  width: 100%;
  max-height: min(24svh, 190px);
  object-fit: contain;
  border: 1px solid rgba(0, 205, 255, 0.24);
  border-radius: 14px;
  background: #000;
}

#tandem-preview.ready {
  display: block;
}

.browser-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
  scrollbar-width: thin;
}

.browser-tab {
  flex: 0 0 auto;
  max-width: 12rem;
  border: 1px solid rgba(0, 255, 100, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  padding: 0.34rem 0.55rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-tab.active {
  color: var(--green);
  border-color: rgba(0, 255, 100, 0.38);
}

#weather-info {
  font-size: clamp(0.7rem, 2.3vw, 0.82rem);
  color: var(--green-soft);
  font-weight: 750;
}

.comms-card {
  flex: 1 1 auto;
  min-height: clamp(180px, 34svh, 460px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-color: rgba(0, 205, 255, 0.22);
  background: linear-gradient(180deg, rgba(0, 16, 18, 0.58), rgba(0, 0, 0, 0.28));
}

#comms-header {
  flex: 0 0 auto;
  padding: 0.72rem 0.85rem 0.6rem;
  border-bottom: 1px solid rgba(0, 205, 255, 0.2);
  color: var(--cyan);
  font-size: clamp(0.72rem, 2.3vw, 0.84rem);
  font-weight: 900;
  letter-spacing: 0.12em;
}

#comms-header::after {
  content: "LIVE CHAT CONTEXT";
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
}

#log-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.8rem;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 100, 0.35) transparent;
  background:
    linear-gradient(rgba(0, 255, 100, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(0, 205, 255, 0.08), transparent 55%);
  background-size: 100% 26px, auto;
}

#log-container::-webkit-scrollbar {
  width: 6px;
}

#log-container::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 100, 0.3);
  border-radius: 999px;
}

.log-empty {
  height: 100%;
  min-height: 10rem;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: clamp(0.78rem, 2.6vw, 0.9rem);
  letter-spacing: 0.08em;
  line-height: 1.55;
  padding: 1rem;
}


.log-entry {
  width: fit-content;
  max-width: 94%;
  min-width: min(12rem, 100%);
  border: 1px solid rgba(0, 255, 100, 0.17);
  background: linear-gradient(145deg, rgba(0, 35, 14, 0.34), rgba(0, 0, 0, 0.28));
  margin: 0 0 0.62rem;
  padding: 0.68rem 0.72rem;
  border-radius: 16px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.log-entry.role-user {
  margin-left: auto;
  border-color: rgba(0, 205, 255, 0.34);
  background: linear-gradient(145deg, rgba(0, 80, 105, 0.36), rgba(0, 0, 0, 0.28));
}

.log-entry.role-tio,
.log-entry.role-assistant {
  margin-right: auto;
  border-color: rgba(0, 255, 100, 0.28);
  background: linear-gradient(145deg, rgba(0, 45, 18, 0.44), rgba(0, 0, 0, 0.28));
}

.log-entry.role-system,
.log-entry.role-external {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-color: rgba(133, 210, 157, 0.12);
  background: rgba(0, 0, 0, 0.18);
}

.log-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 100%;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.84rem, 2.8vw, 0.96rem);
  line-height: 1.5;
}

.log-meta {
  font-size: 0.6rem;
  color: rgba(133, 210, 157, 0.72);
  margin-bottom: 0.32rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.log-bright { color: var(--green); }
.log-green  { color: var(--green-soft); }
.log-dim    { color: var(--green-dim); }
.log-red    { color: var(--red); }
.log-amber  { color: var(--amber); }
.log-blue   { color: var(--cyan); }

.log-media {
  width: 100%;
  max-width: 100%;
  max-height: min(42svh, 260px);
  object-fit: contain;
  border: 1px solid rgba(0, 255, 100, 0.22);
  border-radius: 12px;
  margin-top: 0.55rem;
  background: #000;
}

audio.log-media {
  max-height: none;
}

.log-file {
  display: block;
  margin-top: 0.55rem;
  padding: 0.75rem;
  border: 1px dashed rgba(0, 255, 100, 0.34);
  border-radius: 12px;
  color: var(--green);
  text-decoration: none;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.workflow-card {
  border-color: rgba(255, 180, 40, 0.65);
  box-shadow: 0 0 18px rgba(255, 180, 40, 0.08);
}

.workflow-title {
  color: var(--amber);
  font-weight: 850;
  margin-bottom: 0.4rem;
  overflow-wrap: anywhere;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.workflow-actions button {
  flex: 1 1 8rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
}

.workflow-actions button.reject {
  border-color: rgba(235, 75, 75, 0.58);
  color: var(--red);
}

.workflow-actions button:disabled {
  opacity: 0.38;
  cursor: default;
}

#chat-form {
  flex: 0 0 auto;
  padding: 0.65rem;
}

#chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

#file-input {
  display: none;
}

#camera-preview {
  display: none;
  width: 100%;
  max-height: min(34svh, 220px);
  margin-bottom: 0.5rem;
  object-fit: cover;
  border: 1px solid rgba(0, 205, 255, 0.28);
  border-radius: 14px;
  background: #000;
}

#camera-preview.active {
  display: block;
}

#attach-btn,
.tool-btn {
  min-height: 42px;
  padding: 0 0.72rem;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.tool-btn {
  border-color: rgba(0, 205, 255, 0.28);
  color: var(--cyan);
}

.tool-btn.recording {
  color: var(--red);
  border-color: rgba(235, 75, 75, 0.58);
  box-shadow: 0 0 18px rgba(235, 75, 75, 0.16);
}

#file-status {
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#chat-input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 255, 100, 0.22);
  border-radius: 14px;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  padding: 0.78rem 0.9rem;
  outline: none;
}

#chat-input::placeholder {
  color: rgba(120, 190, 145, 0.58);
}

.chat-row {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  min-width: 0;
}

.send-btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 0.95rem;
  border-color: rgba(0, 205, 255, 0.42);
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

#hint {
  flex: 0 0 auto;
  color: var(--muted);
  text-align: center;
  font-size: clamp(0.68rem, 2.2vw, 0.78rem);
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-block: 0.62rem;
}

#hint.recording {
  color: var(--red);
  border-color: rgba(235, 75, 75, 0.34);
}

#hint.processing {
  color: var(--amber);
}

#scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

body.panel-open #scrim {
  opacity: 1;
  pointer-events: auto;
}

#bottom-nav {
  position: sticky;
  bottom: calc(0.65rem + var(--safe-bottom));
  z-index: 70;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.55rem;
  padding: 0.55rem;
  border-radius: 999px;
}

.nav-action {
  min-width: 0;
  padding: 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.icon-btn.danger,
.nav-action.danger {
  color: var(--red);
  border-color: rgba(235, 75, 75, 0.42);
}

.divider,
.bottom-div {
  display: none;
}

@media (min-width: 640px) {
  .app-shell {
    gap: 1rem;
    padding-inline: clamp(1rem, 3vw, 2.25rem);
  }

  #face-area {
    min-height: clamp(480px, 70svh, 820px);
  }
}

@media (min-width: 760px) {
  .desktop-nav {
    display: flex;
  }
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 480px);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    max-width: 1500px;
    margin: 0 auto;
  }

  #top-nav {
    grid-column: 1 / -1;
  }

  #face-area {
    min-height: min(76svh, 820px);
  }

  #panel {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: none;
    transform: none;
    grid-column: 2;
    grid-row: 2;
    border-radius: var(--radius-xl);
    max-height: min(76svh, 820px);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .panel-grip,
  #panel-close-btn,
  #scrim,
  #menu-btn,
  #bottom-nav {
    display: none;
  }
}


@media (min-width: 900px) and (max-height: 720px) {
  #panel {
    gap: 0.42rem;
    padding: 0.55rem;
  }

  .panel-head {
    padding-top: 0;
  }

  #system-card {
    padding: 0.5rem 0.6rem;
  }

  .system-metrics,
  .device-status {
    margin-top: 0.38rem;
  }

  .system-metrics div,
  .device-status span {
    padding: 0.28rem 0.4rem;
  }

  .comms-card {
    min-height: 150px;
  }

  #log-container {
    padding: 0.62rem;
  }

  #chat-form {
    padding: 0.52rem;
  }

  #chat-toolbar {
    margin-bottom: 0.38rem;
  }

  #hint {
    display: none;
  }
}

@media (min-width: 1200px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) minmax(430px, 540px);
    padding: clamp(1.1rem, 2vw, 2rem);
  }

  #face-area,
  #panel {
    max-height: min(82svh, 920px);
  }

  #face-canvas {
    width: min(100%, 74svh, 820px);
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 0.55rem;
  }

  #top-nav {
    min-height: 54px;
    padding-left: 0.55rem;
  }

  .brand-kicker {
    display: none;
  }

  #face-area {
    min-height: calc(100svh - 9.5rem - var(--safe-top) - var(--safe-bottom));
    border-radius: 22px;
  }

  #panel {
    width: calc(100vw - 0.7rem);
    top: calc(0.45rem + var(--safe-top));
    border-radius: 22px 0 0 22px;
  }

  .weather-stack {
    width: 100%;
    text-align: left;
  }

  .face-hud {
    display: none;
  }

  .system-metrics {
    grid-template-columns: 1fr;
  }

  .chat-row {
    flex-direction: column;
  }

  .send-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
