:root {
  color-scheme: dark;
  --bg: #080d12;
  --text: #eff5fa;
  --muted: #9baab9;
  --accent: #89d8e9;
  --line: #23303c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100svh;
}
main {
  max-width: 620px;
  margin: auto;
  padding: calc(20px + env(safe-area-inset-top)) 24px
    calc(24px + env(safe-area-inset-bottom));
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
a {
  color: var(--accent);
  text-decoration: none;
}
.brand {
  font-size: 15px;
  letter-spacing: 0.22em;
  color: var(--text);
  font-weight: 700;
}
.settings-link {
  font-size: 14px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.message {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  min-height: 21px;
  margin: 0 0 12px;
}
.message:empty {
  min-height: 0;
  margin: 0;
}
.voice-panel {
  text-align: center;
  padding: 32px 0 20px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
h1 {
  font-size: clamp(25px, 6vw, 36px);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 28px 0 10px;
}
h2 {
  font-size: 23px;
  font-weight: 500;
  margin: 12px 0;
}
h3 {
  font-size: 17px;
  font-weight: 500;
}
p {
  line-height: 1.55;
}
#voice-state {
  color: var(--muted);
  margin-bottom: 28px;
}
button,
.button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #14202b;
  color: var(--text);
  border-radius: 16px;
  padding: 14px 20px;
  min-height: 48px;
  display: inline-block;
  text-align: center;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  background: var(--accent);
  color: #07131b;
  border: 0;
  font-weight: 600;
}
#voice-toggle {
  width: 100%;
  max-width: 330px;
  min-height: 60px;
  font-size: 17px;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.voice-orb {
  width: 156px;
  height: 156px;
  border-radius: 50%;
  margin: 34px auto;
  background: radial-gradient(circle at 38% 32%, #223746, #101e2a 65%);
  border: 1px solid #355263;
  box-shadow: 0 0 50px #74cfe910;
  display: grid;
  place-items: center;
}
.orb-core {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px solid #89d8e945;
  background: radial-gradient(circle, #89d8e920, transparent);
}
.voice-orb[data-state="listening"] {
  border-color: var(--accent);
  box-shadow: 0 0 45px #89d8e925;
}
.voice-orb[data-state="speaking"] .orb-core {
  animation: pulse 1.3s ease-in-out infinite;
}
.voice-orb[data-state="thinking"] {
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.55;
    transform: scale(0.94);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
.fineprint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.transcript {
  margin: 28px 0 20px;
  text-align: left;
}
.transcript summary {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
#voice-transcript {
  max-height: 330px;
  overflow: auto;
  font-size: 14px;
  margin-top: 16px;
  overflow-wrap: anywhere;
}
summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
}
summary::-webkit-details-marker {
  display: none;
}
.settings {
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
.settings > details > summary {
  font-size: 13px;
  color: var(--muted);
}
.settings-content {
  padding: 16px 0;
}
.fleet-bar {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
input,
select {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101923;
  color: var(--text);
  padding: 14px;
  min-height: 48px;
}
.access {
  padding: 24px 0;
}
.access > div > p {
  font-size: 14px;
  color: var(--muted);
}
#login {
  text-align: center;
  padding-top: 25px;
}
#loginform {
  max-width: 350px;
  margin: 28px auto;
  text-align: left;
}
#loginform > button {
  width: 100%;
  margin-top: 12px;
}
.passkey-access button {
  width: 100%;
}
.passkey-access {
  margin-bottom: 26px;
}
.passkey-access .fineprint {
  margin: 12px 0;
}
#passkey-message:empty {
  display: none;
}
.passkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  margin-top: 12px;
}
.text-button {
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 13px;
  padding: 12px;
}
.outline,
.button {
  margin: 4px 0;
}
#account-settings a,
#account-settings button {
  display: block;
  width: 100%;
  margin: 10px 0;
}
dialog {
  width: calc(100% - 32px);
  max-width: 430px;
  background: #101923;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
}
dialog::backdrop {
  background: #000a;
}
dialog p {
  overflow-wrap: anywhere;
}
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.action-row button {
  flex: 1;
}
#confirm-dialog h2 {
  font-size: 22px;
}
/* Assistant portrait with state-driven waves. */
.vehicle-voice {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 330px;
  margin: 30px auto 12px;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  isolation: isolate;
}
.assistant-portrait {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px #0008);
  pointer-events: none;
}
.vehicle-glow {
  position: absolute;
  inset: 32% 10% 12%;
  border-radius: 50%;
  background: radial-gradient(ellipse, #71d9f02b, transparent 70%);
  z-index: 0;
}
.voice-wave {
  position: absolute;
  inset: 22% 0% 8%;
  border: 1px solid #89d8e92a;
  border-radius: 50%;
  z-index: 3;
  transform: scale(0.85);
  opacity: 0.5;
}
.wave-two {
  transform: scale(1);
  opacity: 0.3;
}
.wave-three {
  transform: scale(1.12);
  opacity: 0.15;
}
.signal-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  font-size: 9px;
  letter-spacing: 0.24em;
  color: #6d99aa;
}
.vehicle-voice[data-state="listening"] {
  box-shadow: none;
  border: 0;
}
.vehicle-voice[data-state="listening"] .vehicle-glow {
  background: radial-gradient(ellipse, #71d9f04b, transparent 70%);
}
.vehicle-voice[data-state="speaking"] {
  box-shadow: none;
}
.vehicle-voice[data-state="speaking"] .voice-wave {
  animation: voice-wave 1.6s ease-out infinite;
  border-color: #89d8e9bb;
}
.vehicle-voice[data-state="speaking"] .wave-two {
  animation-delay: 0.5s;
}
.vehicle-voice[data-state="speaking"] .wave-three {
  animation-delay: 1s;
}
.vehicle-voice[data-state="thinking"] {
  animation: none;
}
.vehicle-voice[data-state="thinking"] .vehicle-glow {
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes voice-wave {
  0% {
    transform: scale(0.75);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .vehicle-voice .voice-wave,
  .vehicle-voice .vehicle-glow {
    animation: none !important;
  }
}
@media (max-width: 420px) {
  .vehicle-voice {
    height: 210px;
    margin-top: 20px;
  }
  .voice-panel {
    padding-top: 20px;
  }
}

.app-tabs { display:flex; gap:8px; padding:6px; background:#111; border:1px solid var(--line); border-radius:20px; }
.app-tabs button { flex:1; border:0; background:transparent; }
.app-tabs button[aria-selected="true"] { background:#e31937; color:white; }
.rayban { padding:24px 0; --accent:#fff; }
.rb-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.rb-heading h2,.rb-heading h3 { margin:6px 0; }
.rb-mark { font-size:40px; color:#e31937; }
.rb-card { margin:16px 0; padding:22px; border:1px solid #ffffff14; border-radius:24px; background:#111; }
.rb-battery { background:radial-gradient(ellipse at top right,#e3193725,transparent 65%),#101010; }
.rb-battery strong { font-size:56px; letter-spacing:-3px; }
.rb-battery p { margin:8px 0; }
.rb-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.rb-grid button { padding:14px 10px; font-size:14px; background:#1b1b1b; border-color:#ffffff1a; }
.rb-grid b { display:block; font-size:22px; margin-top:6px; }
.rb-card label { display:block; margin:22px 0 10px; }
.rb-card output { float:right; }
.rb-card input[type="range"] { width:100%; accent-color:#e31937; margin-bottom:16px; }
.rb-card ol { padding-left:20px; color:#b5b5b5; line-height:1.65; }
.rb-card li + li { margin-top:10px; }
.rb-unavailable { margin:20px 0; }
.rb-unavailable small { font-size:11px; }
@media(max-width:380px) { .rb-card { padding:16px; } .rb-grid button { font-size:12px; } }

#voice-orb { --pepper-scale:1; --pepper-x:0%; --pepper-energy:0; overflow:hidden; border-radius:28px; }
.assistant-portrait,.pepper-canvas { transform:translateX(var(--pepper-x)) scale(var(--pepper-scale)); transform-origin:50% 38%; transition:transform .7s cubic-bezier(.2,.8,.2,1); }
.pepper-canvas { display:none; position:absolute; height:100%; width:auto; max-width:100%; left:50%; translate:-50% 0; top:0; z-index:2; pointer-events:none; }
.portrait-ready .assistant-portrait { visibility:hidden; }
.portrait-ready .pepper-canvas { display:block; }
#voice-orb[data-state="listening"][data-motion="on"] .pepper-canvas { transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) * 1.025)) rotate(-.6deg); }
#voice-orb[data-state="speaking"][data-motion="on"] .pepper-canvas { transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) + var(--pepper-energy) * .018)); transition:transform .1s linear; }
#voice-orb[data-state="listening"][data-motion="on"] .vehicle-glow { animation:pepper-listening 2.5s ease-in-out infinite; }
#voice-orb[data-motion="off"] .voice-wave,#voice-orb[data-motion="off"] .vehicle-glow { animation:none; }
.pepper-motion-controls { text-align:left; padding:16px; border:1px solid var(--line); border-radius:18px; margin:18px 0; }
.pepper-motion-controls label { display:block; margin-top:16px; font-size:13px; color:var(--muted); }
.pepper-motion-controls .action-row { margin-top:8px; }
.pepper-motion-controls input { min-width:0; width:100%; }
.pepper-motion-controls button { flex:0; }
@keyframes pepper-listening { 50% { opacity:.5; transform:scale(1.07); } }
@media(prefers-reduced-motion:reduce) {
  .assistant-portrait,.pepper-canvas { transition:none!important; }
  #voice-orb .vehicle-glow,#voice-orb .voice-wave { animation:none!important; }
  #voice-orb[data-state] .pepper-canvas { transform:translateX(var(--pepper-x)) scale(var(--pepper-scale)); }
}

#voice-orb { --pepper-flow-scale:1; --pepper-reaction-color:#71d9f0; }
.pepper-canvas,.assistant-portrait { transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) * var(--pepper-flow-scale))); }
#voice-orb[data-state="listening"][data-motion="on"] .pepper-canvas { transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) * var(--pepper-flow-scale))) rotate(-.6deg); }
#voice-orb[data-state="speaking"][data-motion="on"] .pepper-canvas { transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) * var(--pepper-flow-scale) + var(--pepper-energy) * .018)); }
#voice-orb .vehicle-glow { background:radial-gradient(ellipse,color-mix(in srgb,var(--pepper-reaction-color) 35%,transparent),transparent 70%)!important; transition:background .8s,opacity .8s; }
#voice-orb .voice-wave { border-color:color-mix(in srgb,var(--pepper-reaction-color) 65%,transparent); transition:border-color .8s; }
#voice-orb[data-reaction="hot"] { --pepper-reaction-color:#ff875b; }
#voice-orb[data-reaction="cold"] { --pepper-reaction-color:#b3e9ff; }
#voice-orb[data-reaction="music"],#voice-orb[data-reaction="memory"] { --pepper-reaction-color:#bba0ff; }
#voice-orb[data-reaction="confirmed"],#voice-orb[data-reaction="happy"],#voice-orb[data-reaction="charging"] { --pepper-reaction-color:#80e5b6; }
#voice-orb[data-reaction="error"] { --pepper-reaction-color:#f49999; }
#voice-orb[data-reaction="waiting"] { --pepper-reaction-color:#ffd79a; }
#voice-orb[data-motion="on"][data-reaction="cold"] .pepper-canvas { animation:pepper-shiver .25s ease-in-out 10; }
#voice-orb[data-motion="on"][data-reaction="hot"] .pepper-canvas { animation:pepper-warm 1.3s ease-in-out 3; }
#voice-orb[data-motion="on"][data-reaction="music"] .pepper-canvas { animation:pepper-groove .85s ease-in-out 5; }
#voice-orb[data-motion="on"][data-reaction="happy"] .pepper-canvas,#voice-orb[data-motion="on"][data-reaction="confirmed"] .pepper-canvas { animation:pepper-nod .7s ease-in-out 2; }
#voice-orb[data-motion="on"][data-reaction="cancelled"] .pepper-canvas { animation:pepper-no .65s ease-in-out 2; }
#voice-orb[data-motion="on"][data-state="thinking"] .vehicle-glow { animation:pepper-listening 1.5s ease-in-out infinite; }
.pepper-reaction { min-height:22px; margin:8px 0 -8px; font-size:13px; color:var(--muted); }
@keyframes pepper-shiver { 25% { rotate:-.5deg; } 75% { rotate:.5deg; } }
@keyframes pepper-warm { 50% { rotate:1.5deg; } }
@keyframes pepper-groove { 25% { rotate:-2deg; } 75% { rotate:2deg; } }
@keyframes pepper-nod { 50% { translate:-50% 3px; } }
@keyframes pepper-no { 25% { rotate:-1.5deg; } 75% { rotate:1.5deg; } }
@media(prefers-reduced-motion:reduce) {
  #voice-orb .pepper-canvas { animation:none!important; }
  #voice-orb[data-state] .pepper-canvas { transform:translateX(var(--pepper-x)) scale(var(--pepper-scale)); }
}

.pepper-video { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; z-index:3; opacity:0; pointer-events:none; transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) * var(--pepper-flow-scale))); transform-origin:50% 38%; transition:opacity .25s, transform .7s cubic-bezier(.2,.8,.2,1); }
.clip-active .pepper-video { opacity:1; }
.clip-active .pepper-canvas { visibility:hidden; }
#pepper-preview { display:block; width:100%; margin:8px 0 16px; }
@media(prefers-reduced-motion:reduce) { .pepper-video { display:none; } }

/* Pepper itself is the conversation control. */
#voice-toggle[hidden] { display:none; }
#voice-orb[role="button"] { cursor:pointer; touch-action:manipulation; outline-offset:4px; }
#voice-orb[role="button"]:focus-visible { outline:3px solid var(--accent); }
#voice-orb.vehicle-voice { width:100%; max-width:520px; height:auto; aspect-ratio:2 / 3; }
#voice-orb .pepper-canvas { width:100%; height:100%; max-width:none; object-fit:contain; }
#voice-orb .signal-label { pointer-events:none; }
@media(max-width:600px) {
 #voice-orb.vehicle-voice { width:100vw; max-width:none; margin:18px calc(50% - 50vw) 12px; border-radius:0; }
}

/* Keep the outgoing video visible until its replacement can play. */
#voice-orb .pepper-video { transition:opacity var(--pepper-clip-fade,450ms) ease-in-out,transform .7s cubic-bezier(.2,.8,.2,1); }
#voice-orb.clip-active .pepper-video { opacity:0; }
#voice-orb.clip-active .pepper-video.clip-front { opacity:1; }

/* All media layers occupy the same box, including Safari video clones. */
#voice-orb .assistant-portrait,#voice-orb .pepper-canvas,#voice-orb .pepper-video { position:absolute; display:block; left:0; top:0; right:auto; bottom:auto; max-width:none; margin:0; translate:none; object-fit:contain; }
#voice-orb .pepper-canvas { display:none; }
#voice-orb.portrait-ready .pepper-canvas { display:block; }
#voice-orb[data-theme="headscarf"] .pepper-canvas { transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) * var(--pepper-flow-scale) * var(--pepper-breath,1))); }
@media(prefers-reduced-motion:reduce) { #voice-orb .pepper-video { display:none; } }

#voice-orb .pepper-theme-video { z-index:4; opacity:0; }
#voice-orb.theme-video-active .pepper-theme-video { opacity:1; }

/* Videos decode off the visible surface; only composited frames are displayed. */
#voice-orb .pepper-video { width:1px!important; height:1px!important; opacity:0!important; transform:none!important; z-index:-1; }
#pepper-playback-canvas { position:absolute; inset:0; width:100%; height:100%; z-index:4; pointer-events:none; transform:translateX(var(--pepper-x)) scale(var(--pepper-scale)); transform-origin:50% 38%; transition:transform .7s ease; }
#pepper-playback-canvas[hidden] { display:none; }

#device-qr-image {display:block;max-width:100%;height:auto;background:#fff;border-radius:12px;margin:16px auto;}
#device-screen-code,#device-phone-code {font-size:1.8rem;letter-spacing:.2em;}
#device-approval,#device-qr-access {margin-bottom:24px;}

/* Speech energy moves the lips locally; the whole portrait does not bounce per syllable. */
#voice-orb[data-state="speaking"][data-motion="on"] .pepper-canvas {
  animation:none;
  transform:translateX(var(--pepper-x)) scale(calc(var(--pepper-scale) * var(--pepper-flow-scale) * var(--pepper-breath,1)));
  transition:transform .25s ease-out;
}

/* Keep the assistant, rather than decorative orbit rings, as the visual focus. */
#voice-orb .voice-wave,#voice-orb .vehicle-glow { display:none!important; }
