@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/PlusJakartaSans-Variable.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-canvas: #f3efe6;
  --bg-shell: #f8f5ed;
  --surface-card: #faf8f3;
  --surface-elevated: #ffffff;
  --surface-tile: #efece4;
  --surface-tile-hover: #e7e2d6;
  --avatar-bg: #eae6dc;
  --border-hairline: #e2ddd2;
  --border-tile: #ddd7ca;
  --border-strong: #cfc8b8;

  --ink-primary: #17181a;
  --ink-secondary: #4a4842;
  --ink-muted: #6e6a61;

  --cam-shell: #181b20;
  --cam-viewport: #0f1115;
  --cam-btn: #21252c;
  --cam-btn-hover: #2a3039;
  --cam-btn-border: #323842;
  --cam-hud: #cfd5df;

  --accent: #c85332;
  --accent-hover: #b34526;
  --accent-soft: rgba(200, 83, 50, 0.14);

  --online-bg: #ebf3ec;
  --online-border: #cfe2d2;
  --online-ink: #1d7a46;

  --offline-bg: #f8efe4;
  --offline-border: #e8d4ba;
  --offline-ink: #b45309;

  --guard-bg: #fceceb;
  --guard-border: #f0c2be;
  --guard-ink: #c53030;

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-shell: 28px;
  --radius-card: 22px;
  --radius-tile: 16px;
  --radius-pill: 999px;

  --shadow-shell: 0 18px 48px rgba(23, 24, 26, 0.06), 0 2px 8px rgba(23, 24, 26, 0.03);
  --shadow-tab: 0 1px 4px rgba(23, 24, 26, 0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  background: var(--ink-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 16px;
}

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

/* Auth Gate */
.auth-screen {
  min-height: calc(100dvh - 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 26px;
  box-shadow: var(--shadow-shell);
  padding: 36px 30px 32px;
  display: grid;
  gap: 18px;
  text-align: center;
}

.auth-avatar-wrap {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--avatar-bg);
  border: 1px solid var(--border-tile);
  overflow: hidden;
}

.auth-avatar-wrap img {
  display: block;
  width: 84px;
  height: 84px;
  object-fit: cover;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink-primary);
}

.auth-sub {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.auth-err {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--guard-ink);
  min-height: 1.2em;
}

.auth-input {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-pill);
  border: 1px solid #dcd6c8;
  background: var(--surface-elevated);
  padding: 0 20px;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  text-align: center;
  color: var(--ink-primary);
}

.auth-btn {
  min-height: 48px;
  font-size: 0.95rem;
}

/* Studio Shell */
.app-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  background: var(--bg-shell);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-shell);
  overflow: hidden;
}

/* Topbar */
.topbar {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-hairline);
  padding: 13px 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--avatar-bg);
  border: 1px solid var(--border-tile);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-avatar img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.brand-title {
  font-size: 1.72rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink-primary);
}

.presence-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid var(--online-border);
  background: var(--online-bg);
  color: var(--ink-secondary);
}

.presence-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--online-ink);
  flex-shrink: 0;
}

.presence-pill .state-word {
  color: var(--online-ink);
  font-weight: 700;
}

.presence-pill.offline {
  background: var(--offline-bg);
  border-color: var(--offline-border);
}

.presence-pill.offline .dot {
  background: var(--offline-ink);
}

.presence-pill.offline .state-word {
  color: var(--offline-ink);
}

/* Segmented Navigation */
.seg-nav {
  display: inline-flex;
  align-items: center;
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 2px;
}

.nav-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 17px;
  min-height: 40px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.nav-tab:hover {
  color: var(--ink-primary);
}

.nav-tab.active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  font-weight: 700;
  box-shadow: var(--shadow-tab);
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-roam,
.btn-sleep,
.btn-sentinel {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: var(--radius-pill);
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-roam:hover,
.btn-sleep:hover,
.btn-sentinel:hover {
  background: var(--surface-tile-hover);
  border-color: var(--border-strong);
}

.btn-roam:active,
.btn-sleep:active,
.btn-sentinel:active {
  transform: translateY(1px);
}

.btn-roam.active {
  background: var(--online-bg);
  border-color: var(--online-border);
  color: var(--online-ink);
}

.btn-sleep.sleeping {
  background: #232b44;
  border-color: #3f4e7a;
  color: #e8eeff;
}

.btn-sentinel.armed {
  background: var(--guard-bg);
  border-color: var(--guard-border);
  color: var(--guard-ink);
}

.wifi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.wifi-lbl {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 5px;
}

.wifi-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-tile);
  background: var(--surface-page);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.wifi-rescue-note {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-tile);
  border: 1px solid var(--border-subtle);
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.wifi-saved-section {
  margin-top: 8px;
  margin-bottom: 8px;
  display: grid;
  gap: 8px;
}

.wifi-saved-list {
  display: grid;
  gap: 8px;
}

.wifi-saved-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 13px;
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
}

.wifi-saved-row.is-active {
  background: var(--online-bg);
  border-color: var(--online-border);
}

.wifi-saved-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.wifi-saved-ssid {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.wifi-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--surface-elevated);
  border: 1px solid var(--border-tile);
  color: var(--ink-secondary);
}

.wifi-badge.active {
  background: #d9f2e1;
  border-color: #b0dfc0;
  color: var(--online-ink);
}

.wifi-saved-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.btn-mini-accent,
.btn-mini-sec {
  appearance: none;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-mini-accent {
  background: var(--accent);
  color: #ffffff;
}

.btn-mini-accent:hover {
  background: var(--accent-hover);
}

.btn-mini-sec {
  background: var(--surface-elevated);
  border-color: var(--border-tile);
  color: var(--ink-primary);
}

.btn-mini-sec:hover {
  background: var(--surface-tile-hover);
}

/* Family, Visual Messenger & Photo Diary */
.family-list,
.deliveries-list {
  display: grid;
  gap: 10px;
}

.family-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 15px;
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  flex-wrap: wrap;
}

.family-card-info {
  display: grid;
  gap: 4px;
  min-width: 180px;
  flex: 1;
}

.family-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.family-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink-primary);
}

.family-role {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.bio-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
}

.bio-badge.ok {
  background: var(--online-bg);
  border: 1px solid var(--online-border);
  color: var(--online-ink);
}

.bio-badge.pending {
  background: var(--offline-bg);
  border: 1px solid var(--offline-border);
  color: var(--offline-ink);
}

.bio-badge.voice {
  background: #e9effa;
  border: 1px solid #c6d6f3;
  color: #264d8c;
}

.family-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.delivery-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
}

.delivery-row.done {
  opacity: 0.72;
}

.delivery-meta {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
}

.delivery-msg {
  font-size: 0.9rem;
  color: var(--ink-primary);
  line-height: 1.38;
}

.diary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.diary-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.diary-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #14161a;
}

.diary-body {
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.diary-cap {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.35;
}

.diary-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

@media (max-width: 780px) {
  .wifi-grid {
    grid-template-columns: 1fr;
  }
}

.mobile-tabs-bar {
  display: none;
}

/* Main Content Area */
.main-wrap {
  padding: 16px 22px 18px;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.audio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.col-stack {
  display: grid;
  gap: 14px;
}

/* Pocket Boo ("Boo nel Telefono" Living Pomeranian Avatar Stage) */
.pocket-boo-card {
  background: #faf8f3;
  border: 1.5px solid #e3dac8;
  border-radius: var(--radius-card);
  padding: 15px 18px 18px;
  display: grid;
  gap: 12px;
  box-shadow: 0 10px 26px rgba(180, 110, 45, 0.08);
}

.pboo-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.pboo-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pboo-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: #fff3e3;
  border: 1px solid #efd5b2;
  color: #9a4b17;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.pboo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d96b27;
  box-shadow: 0 0 0 3px rgba(217, 107, 39, 0.2);
}

.pboo-speaker-sel {
  min-height: 32px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-tile);
  background: var(--surface-elevated);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.pboo-stage {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.pboo-avatar-frame {
  --mouth-open: 0;
  appearance: none;
  border: 3px solid #ecdcc4;
  padding: 0;
  width: 224px;
  height: 224px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: #faf8f3;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(150, 92, 38, 0.14);
  animation: pbooBreath 3.8s ease-in-out infinite;
  transition: transform 0.22s ease, border-color 0.2s ease;
}

.pboo-avatar-frame:hover {
  border-color: var(--accent);
}

.pboo-avatar-frame.listening {
  border-color: var(--accent);
  transform: rotate(-6deg) scale(1.03);
  animation: none;
}

.pboo-avatar-frame.speaking {
  border-color: #d96b27;
}

.pboo-avatar-frame.petted {
  animation: pbooWiggle 0.55s ease;
}

.pboo-avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Natural fur-toned blinking eyelids aligned to Cane Boo's button eyes */
.pboo-lid {
  position: absolute;
  top: 40.2%;
  width: 9.8%;
  height: 9.6%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #d69859 0%, #b57339 75%, #7e4920 100%);
  transform-origin: center top;
  transform: scaleY(0);
  transition: transform 0.09s ease-in-out;
  pointer-events: none;
}

.pboo-lid.left {
  left: 33.7%;
}

.pboo-lid.right {
  left: 56.6%;
}

.pboo-avatar-frame.blinking .pboo-lid {
  transform: scaleY(1.04);
}

/* Real-time voice-reactive Pomeranian puppy mouth + pink tongue */
.pboo-mouth {
  position: absolute;
  left: 50%;
  top: 60.2%;
  width: calc(9% + (var(--mouth-open) * 7%));
  height: calc(0% + (var(--mouth-open) * 9.5%));
  transform: translate(-50%, -25%);
  background: #2b1812;
  border-radius: 25% 25% 55% 55%;
  overflow: hidden;
  opacity: calc(var(--mouth-open) * 1.35);
  pointer-events: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55);
}

.pboo-tongue {
  position: absolute;
  left: 50%;
  bottom: -12%;
  width: 72%;
  height: 68%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #f27c8d 0%, #ff9aa8 100%);
  border-radius: 48% 48% 50% 50%;
}

.pboo-emoji-float {
  position: absolute;
  right: 14%;
  top: 10%;
  font-size: 1.55rem;
  color: #e23e57;
  text-shadow: 0 2px 6px rgba(255, 255, 255, 0.9);
  animation: pbooFloatUp 1.1s ease-out forwards;
  pointer-events: none;
}

.pboo-bubble {
  width: 100%;
  background: var(--surface-elevated);
  border: 1px solid #e5decb;
  border-radius: 18px;
  padding: 12px 15px;
  display: grid;
  gap: 5px;
}

.pboo-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
}

.pboo-bubble p {
  font-size: 0.93rem;
  line-height: 1.46;
  color: var(--ink-primary);
}

.btn-replay-voice {
  appearance: none;
  border: 1px solid var(--border-tile);
  background: var(--surface-tile);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.73rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.pboo-voice-row {
  width: 100%;
}

.btn-pocket-mic {
  appearance: none;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(200, 83, 50, 0.26);
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-pocket-mic:hover {
  background: var(--accent-hover);
}

.btn-pocket-mic.recording {
  background: #c53030;
  animation: pbooMicPulse 1.1s ease-in-out infinite;
}

.pboo-composer {
  width: 100%;
}

.btn-cam-pocket {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #fde68a;
  font-family: var(--font-sans);
  font-size: 0.73rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  flex-shrink: 0;
}

.chat-mini-boo {
  --mouth-open: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #e6d6bc;
  position: relative;
  flex-shrink: 0;
  background: #faf8f3;
}

.chat-mini-boo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-mini-mouth {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 14%;
  height: calc(var(--mouth-open) * 10%);
  transform: translate(-50%, -25%);
  background: #f07b8c;
  border: 1px solid #2b1812;
  border-radius: 30% 30% 55% 55%;
  opacity: calc(var(--mouth-open) * 1.4);
}

.btn-mic-inline {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-tile);
  background: var(--surface-tile);
  color: var(--ink-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-mic-inline.recording {
  background: #c53030;
  border-color: #c53030;
  color: #ffffff;
  animation: pbooMicPulse 1.1s ease-in-out infinite;
}

@keyframes pbooBreath {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.012); }
}

@keyframes pbooWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-7deg) scale(1.04); }
  75% { transform: rotate(7deg) scale(1.04); }
}

@keyframes pbooFloatUp {
  0% { opacity: 0; transform: translateY(8px) scale(0.7); }
  25% { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-22px) scale(1); }
}

@keyframes pbooMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(197, 48, 48, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(197, 48, 48, 0); }
}

/* Dark Optical Camera Viewfinder (Universal iOS/Android Zero-Collapse Sizing) */
.camera-console {
  background: var(--cam-shell);
  border-radius: var(--radius-card);
  padding: 12px 20px 15px;
  display: grid;
  gap: 10px;
  color: #f3f4f6;
}

.cam-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stream-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: #d1d5db;
  flex-shrink: 0;
}

.stream-badge.live {
  background: rgba(29, 122, 70, 0.28);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #86efac;
}

.stream-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.cam-hud {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--cam-hud);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cam-stage {
  position: relative;
}

/* Classic padding-bottom intrinsic container: 100% immune to iOS Safari / WebKit flex/grid height collapse */
.cam-viewport {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 64.5%;
  background: var(--cam-viewport);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cam-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cam-toolbar {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(18, 21, 26, 0.78);
  backdrop-filter: blur(8px);
  padding: 5px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-cam-primary,
.btn-cam-tool {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-cam-primary {
  background: #2b313b;
  color: #f3f4f6;
}

.btn-cam-primary.active {
  background: var(--accent);
  color: #ffffff;
}

.btn-cam-tool {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
}

.btn-cam-tool.active {
  border-color: rgba(251, 191, 36, 0.55);
  color: #fde68a;
}

.btn-cam-primary:hover {
  background: var(--accent-hover);
}

.btn-cam-tool:hover {
  background: rgba(255, 255, 255, 0.16);
}

.neck-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.btn-neck {
  appearance: none;
  min-height: 42px;
  border-radius: 11px;
  background: var(--cam-btn);
  border: 1px solid var(--cam-btn-border);
  color: #f1f3f7;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-neck:hover {
  background: var(--cam-btn-hover);
  border-color: #4b5463;
}

.btn-neck:active {
  transform: translateY(1px);
}

.alert-strip {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #fecaca;
  background: rgba(220, 38, 38, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
}

/* Warm Studio Surfaces */
.panel {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

/* Telemetry Strip */
.telemetry-strip {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 20px;
  padding: 12px 4px;
  display: grid;
  grid-template-columns: 1fr 0.85fr 0.88fr 1.27fr;
}

.tele-cell {
  padding: 2px 6px;
  text-align: center;
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.tele-cell:last-child {
  border-right: 0;
}

.tele-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.tele-val {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
  white-space: nowrap;
}

.tele-val.mono {
  font-family: var(--font-mono);
  font-size: 0.96rem;
}

.tele-val.tier {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Tactile Directional Drive Pad + Posture Grid */
.steps-pills {
  display: inline-flex;
  align-items: center;
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.step-pill {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.step-pill.active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  box-shadow: var(--shadow-tab);
}

.drive-dpad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dpad-spacer {
  pointer-events: none;
}

.dpad-btn {
  appearance: none;
  min-height: 64px;
  padding: 8px 6px;
  border-radius: 15px;
  background: var(--surface-elevated);
  border: 1.5px solid var(--border-strong);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(23, 24, 26, 0.05);
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.dpad-btn:hover {
  background: var(--surface-tile);
  border-color: var(--accent);
}

.dpad-btn:active,
.dpad-btn.triggered {
  transform: translateY(2px);
  background: #ece4d7;
  border-color: var(--accent);
}

.dpad-arrow {
  font-size: 1.05rem;
  line-height: 1;
  color: var(--accent);
}

.dpad-btn span:last-child {
  font-size: 0.82rem;
  font-weight: 700;
}

.dpad-stop {
  background: var(--guard-bg);
  border-color: var(--guard-border);
  color: var(--guard-ink);
}

.dpad-stop .dpad-arrow {
  color: var(--guard-ink);
}

.dpad-stop:hover {
  background: #f9d8d5;
  border-color: var(--guard-ink);
}

.dpad-trot {
  background: var(--surface-tile);
}

.dpad-homing {
  background: var(--online-bg);
  border-color: var(--online-border);
  color: var(--online-ink);
}

.dpad-homing .dpad-arrow {
  color: var(--online-ink);
}

.dpad-homing.searching {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.dpad-homing.searching .dpad-arrow {
  color: #ffffff;
}

.action-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.action-tile {
  appearance: none;
  min-height: 82px;
  padding: 10px 8px;
  border-radius: var(--radius-tile);
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.action-tile svg {
  width: 28px;
  height: 28px;
  stroke: var(--ink-primary);
  stroke-width: 1.95;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.action-tile span {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.action-tile:hover {
  background: var(--surface-tile-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.action-tile:active,
.action-tile.triggered {
  transform: translateY(1px);
  border-color: var(--accent);
  background: #ece5da;
}

/* Audio & Voice Equalizer Studio */
.voice-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.voice-card {
  appearance: none;
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  border-radius: 13px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-sans);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.voice-card:hover {
  background: var(--surface-tile-hover);
}

.voice-card.active {
  background: var(--surface-elevated);
  border: 2px solid var(--accent);
  padding: 8px 9px;
}

.voice-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.voice-tag {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.sliders-stack {
  display: grid;
  gap: 10px;
}

.slider-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.slider-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.slider-row {
  display: grid;
  gap: 4px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-primary);
  background: var(--surface-tile);
  padding: 2px 7px;
  border-radius: 6px;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}

.eq-divider {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  border-top: 1px solid var(--border-hairline);
  padding-top: 8px;
  margin-top: 2px;
}

.audio-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

/* Dark Live Microphone VU Monitor */
.mic-monitor-box {
  background: var(--cam-shell);
  color: #f3f4f6;
  border-radius: 16px;
  padding: 13px 15px;
  display: grid;
  gap: 9px;
}

.mic-monitor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.mic-monitor-nums {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--cam-hud);
}

.vu-track {
  width: 100%;
  height: 10px;
  background: #262b34;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.vu-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #eab308 70%, #ef4444 100%);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

.mic-last-heard {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #cbd5e1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.heard-lbl {
  color: #94a3b8;
}

.heard-txt {
  color: #ffffff;
  font-weight: 600;
}

/* Citofono Chips & Pill Composer */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voice-chip {
  appearance: none;
  min-height: 36px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.voice-chip:hover {
  background: var(--surface-tile-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.pill-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-elevated);
  border: 1px solid #dcd6c8;
  border-radius: var(--radius-pill);
  padding: 5px 6px 5px 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pill-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pill-composer input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.91rem;
  padding: 7px 0;
  outline: none;
}

.pill-composer input::placeholder {
  color: var(--ink-muted);
}

.btn-accent {
  appearance: none;
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-accent:active {
  transform: translateY(1px);
}

.btn-accent:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-secondary {
  appearance: none;
  min-height: 40px;
  padding: 0 15px;
  border-radius: var(--radius-pill);
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--surface-tile-hover);
  border-color: var(--border-strong);
}

/* Single-Column Studio Views (Chat & Memory) */
.single-studio {
  max-width: 820px;
  margin: 0 auto;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
}

.switch-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.chat-stream {
  min-height: 300px;
  max-height: 52dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 2px;
}

.turn-group {
  display: grid;
  gap: 8px;
}

.msg-user {
  justify-self: end;
  max-width: 82%;
  background: var(--surface-tile);
  border: 1px solid var(--border-tile);
  color: var(--ink-primary);
  padding: 10px 15px;
  border-radius: 18px 18px 4px 18px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.msg-boo {
  justify-self: start;
  max-width: 88%;
  background: var(--surface-elevated);
  border: 1px solid var(--border-hairline);
  color: var(--ink-primary);
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  font-size: 0.92rem;
  line-height: 1.5;
  display: grid;
  gap: 6px;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.web-badge {
  background: var(--online-bg);
  border: 1px solid var(--online-border);
  color: var(--online-ink);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
}

.vault-sub {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.mem-list {
  display: grid;
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  background: var(--surface-elevated);
  overflow: hidden;
  max-height: 48dvh;
  overflow-y: auto;
}

.mem-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.mem-row:last-child {
  border-bottom: 0;
}

.mem-person {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 2px;
}

.mem-fact {
  font-size: 0.89rem;
  color: var(--ink-primary);
  line-height: 1.4;
}

.btn-del-mem {
  appearance: none;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border-hairline);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-del-mem:hover {
  border-color: var(--guard-border);
  background: var(--guard-bg);
  color: var(--guard-ink);
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-primary);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  z-index: 60;
}

/* Responsive Breakpoints (Zero display:contents for 100% iOS/Android Image Compatibility) */
@media (max-width: 980px) {
  body {
    padding: 12px;
    display: block;
  }
  .control-grid,
  .audio-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  body {
    padding: 0;
    background: var(--bg-shell);
    display: block;
  }
  .app-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100dvh;
  }
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 12px 15px;
  }
  .topbar .seg-nav {
    display: none;
  }
  .brand-avatar,
  .brand-avatar img {
    width: 48px;
    height: 48px;
  }
  .brand-title {
    font-size: 1.45rem;
  }
  .btn-sentinel {
    padding: 0 13px;
    min-height: 38px;
    font-size: 0.82rem;
  }
  .mobile-tabs-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px 10px 8px;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-hairline);
  }
  .mobile-tabs-bar .nav-tab {
    padding: 8px 2px;
    min-height: 38px;
    font-size: 0.75rem;
    border-radius: 10px;
    background: var(--surface-tile);
  }
  .mobile-tabs-bar .nav-tab.active {
    background: var(--ink-primary);
    color: #ffffff;
  }
  .main-wrap {
    padding: 12px 14px 28px;
  }
}

@media (max-width: 600px) {
  .camera-console {
    padding: 11px 12px 13px;
  }
  .cam-hud {
    font-size: 0.68rem;
  }
  .cam-viewport {
    padding-bottom: 75%;
  }
  .cam-toolbar {
    position: static;
    transform: none;
    width: 100%;
    margin-top: 9px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    border-radius: 12px;
    background: transparent;
    border: 0;
    padding: 0;
  }
  .btn-cam-primary,
  .btn-cam-tool {
    min-height: 42px;
    border-radius: 10px;
    padding: 0 8px;
    font-size: 0.8rem;
  }
  .btn-cam-tool {
    background: var(--cam-btn);
    border: 1px solid var(--cam-btn-border);
  }
  .voice-selector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .slider-grid-2,
  .slider-grid-3 {
    grid-template-columns: 1fr;
  }
  .telemetry-strip {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 10px;
  }
  .tele-cell:nth-child(2) {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
