/* The desktop shell measures space around the original phone. */
body.demo-console {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  --demo-ink: #36303e;
  --demo-muted: #675e72;
  --demo-edge: #e7dfee;
  --demo-glass: rgb(255 255 255 / 5%);
  --demo-glass-highlight: linear-gradient(150deg, rgb(255 255 255 / 11%), transparent 60%);
  --demo-glass-edge: rgb(255 255 255 / 26%);
  --demo-glass-shadow: inset 0 1px 2px rgb(255 255 255 / 18%),
    0 4px 12px -6px rgb(60 44 96 / 12%);
  --demo-glass-blur: blur(3px) saturate(106%);
  --demo-hover: rgb(255 255 255 / 16%);
  --demo-active: rgb(146 103 195 / 13%);
  color: var(--demo-ink);
  background: #e9e3f9 url("hifi/demo-console-background.png") center / cover no-repeat;
}

@media (prefers-reduced-motion: no-preference) {
  body.demo-console {
    background-image: url("hifi/demo-console-flow.svg"), url("hifi/demo-console-background.png");
  }
}

.demo-console header.demo-top {
  position: relative;
  z-index: 4;
  filter: none;
  height: auto;
  min-height: 64px;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px clamp(16px, 2vw, 38px);
  gap: 12px;
  background: transparent;
}
.demo-brand,
.demo-top-actions { display: flex; align-items: center; gap: 12px; }
.demo-brand { gap: 16px; white-space: nowrap; }
.demo-brand > span { padding-inline-start: 16px; border-inline-start: 1px solid var(--demo-edge); }
/* Keep the logo's visible pixels inside the crop, including its antialiased edges. */
.demo-brand-mark { position: relative; width: 79px; aspect-ratio: 1600 / 440; overflow: hidden; flex: none; }
.demo-brand-mark img { position: absolute; width: 114%; height: auto; max-width: none; top: -92.05%; left: -8.19%; }
.demo-brand > span { color: #625b6d; font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.demo-top-actions { gap: 7px; min-width: 0; }
.demo-top-button, .demo-model, .demo-toggle {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--demo-edge);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  white-space: nowrap;
  font-size: 12px;
  text-decoration: none;
}
.demo-top-button, .demo-toggle { flex: none; }
.demo-model { min-width: 0; color: var(--demo-muted); background: transparent; border-color: transparent; }
.demo-model > span { overflow: hidden; text-overflow: ellipsis; max-width: 136px; }
.demo-top-button svg { width: 16px; height: 16px; flex: none; }
.demo-model i { width: 6px; height: 6px; border-radius: 50%; background: #aaa1b2; flex: none; }
.demo-model[data-state="real"] i { background: #54866f; }
.demo-model[data-state="unverified"] i { background: #a183b0; }
.demo-model:is([data-state="limit"], [data-state="offline"]) i { background: #a56b41; }
.demo-toggle { display: none; }

.demo-console .demo-workspace {
  display: grid;
  --demo-left-width: clamp(218px, 18vw, 302px);
  --demo-right-width: clamp(256px, 22vw, 326px);
  grid-template-columns: minmax(0, 1fr);
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.demo-rail, .demo-inspector {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 23px clamp(16px, 1.5vw, 28px);
  scrollbar-width: thin;
}
.demo-region-header h1, .demo-region-header h2 { margin: 0 0 19px; font-size: 19px; font-weight: 650; letter-spacing: .02em; }
.demo-group { margin-bottom: 15px; }
.demo-group h3 { margin: 0 0 7px 2px; font-size: 11.5px; color: var(--demo-muted); font-weight: 600; letter-spacing: .035em; }
.demo-scene {
  display: grid;
  width: 100%;
  min-height: 38px;
  grid-template-columns: 17px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  text-align: left;
  margin-bottom: 5px;
  padding: 6px 11px;
  border-radius: 999px;
}
.demo-scene svg { width: 16px; height: 16px; color: #6c5986; }
.demo-scene:is(:disabled, [aria-disabled="true"]) { color: #6e6875; }
.demo-hint { font-size: 10px; color: #6e607c; }
.demo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.demo-console .demo-workspace > .demo-stage {
  position: relative;
  inset-block-start: -22px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  overflow: hidden;
}
.demo-preview-meta { display: flex; justify-content: center; align-items: baseline; gap: 14px; margin: 0 0 10px; font-size: 11px; color: #6a6274; white-space: nowrap; }
.demo-preview-meta b { font-size: 12px; color: #4c4357; font-weight: 600; }
.demo-scale { margin-inline-start: 7px; font-variant-numeric: tabular-nums; }
.demo-preview-space { display: grid; place-items: center; align-self: stretch; min-width: 0; min-height: 0; }
.demo-phone-frame { position: relative; width: 0; height: 0; }

/* Scale the Apple iPhone 18 Pro Max dimensional drawing to Hilove's 440 px active display.
   The corner radius approximates the front outline in Apple's user guide. */
.demo-device {
  --demo-screen-width: 440px;
  --demo-screen-height: 956px;
  --demo-mm: calc(var(--demo-screen-width) / 72.86);
  --demo-key-depth: calc(0.45 * var(--demo-mm));
  --demo-glass-inset: calc(1.20 * var(--demo-mm));
  --demo-body-corner: calc(14.5 * var(--demo-mm));
  --demo-screen-corner: calc(var(--demo-body-corner) - 2.56 * var(--demo-mm));
  position: absolute;
  inset: 0 auto auto 0;
  width: calc(77.98 * var(--demo-mm) + 2 * var(--demo-key-depth));
  height: calc(163.43 * var(--demo-mm));
  transform: scale(var(--demo-phone-scale, 0));
  transform-origin: top left;
}
.demo-device::before,
.demo-device::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.demo-device::before {
  inset: 0 var(--demo-key-depth);
  border-radius: var(--demo-body-corner);
  background: linear-gradient(150deg, #f6f6f5 0%, #d1d2d5 21%, #dfe1e3 49%, #a7a9ae 81%, #c9cacf 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 64%),
    inset 0 0 0 2px rgb(82 87 96 / 15%),
    0 24px 53px -22px rgb(67 47 88 / 28%),
    0 8px 19px -8px rgb(58 38 81 / 18%);
}
.demo-device::after {
  inset: var(--demo-glass-inset) calc(var(--demo-key-depth) + var(--demo-glass-inset));
  border-radius: calc(var(--demo-body-corner) - var(--demo-glass-inset));
  background: #1c1d20;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 15%);
}
.demo-device-detail {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.demo-device-key {
  position: absolute;
  top: calc((var(--key-center) - var(--key-length) / 2) * var(--demo-mm));
  height: calc(var(--key-length) * var(--demo-mm));
  width: calc(var(--demo-key-depth) + 1px);
  border-radius: 2px;
  background: linear-gradient(90deg, #9b9ea4, #d6d7da 65%);
}
.demo-device-action,
.demo-device-volume-up,
.demo-device-volume-down { left: 0; }
.demo-device-action { --key-center: 34.28; --key-length: 6.90; }
.demo-device-volume-up { --key-center: 48.43; --key-length: 11.20; }
.demo-device-volume-down { --key-center: 62.63; --key-length: 11.20; }
.demo-device-side {
  --key-center: 55.53;
  --key-length: 17.70;
  right: 0;
  background: linear-gradient(270deg, #9b9ea4, #d6d7da 65%);
}
.demo-device-camera {
  --key-center: 111.82;
  --key-length: 17.10;
  right: var(--demo-key-depth);
  width: 2px;
  background: #a3a6ab;
  box-shadow: inset 1px 0 rgb(255 255 255 / 66%);
}
.demo-device-receiver {
  position: absolute;
  left: 50%;
  top: calc(var(--demo-glass-inset) + 1px);
  width: calc(24.82 * var(--demo-mm));
  height: calc(0.46 * var(--demo-mm));
  transform: translateX(-50%);
  border-radius: 3px;
  background: #303236;
  box-shadow: inset 0 1px rgb(0 0 0 / 65%);
}
.demo-console .demo-device > .phone {
  position: absolute;
  inset: calc((100% - var(--demo-screen-height)) / 2) auto auto calc((100% - var(--demo-screen-width)) / 2);
  z-index: 2;
  width: var(--demo-screen-width);
  height: var(--demo-screen-height);
  max-width: none;
  border-radius: var(--demo-screen-corner);
  overflow: hidden;
}
.demo-device #phoneSurface .island {
  top: calc((7.91 - 6.07 / 2 - 2.56) * var(--demo-mm));
  width: calc(15.68 * var(--demo-mm));
  height: calc(6.07 * var(--demo-mm));
}
.demo-device #phoneSurface:is([data-hifi], :has(#launchWelcome:not([hidden]))) .island { background: #1c1d20; }
.demo-phone-frame #screen { overscroll-behavior: contain; }

.demo-glass {
  padding: 14px;
  margin-bottom: 11px;
  border-radius: 20px;
}
.demo-block-title { display: flex; justify-content: space-between; align-items: baseline; gap: 7px; }
.demo-block-title h3 { margin: 0; font-size: 13px; font-weight: 650; }
.demo-tag { display: inline-block; flex: none; padding: 3px 6px; border-radius: 8px; font-size: 10px; background: rgb(222 203 241 / 40%); color: #5e4c75; }
.demo-specs { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; }
.demo-specs div { display: grid; grid-template-columns: 75px minmax(0, 1fr); gap: 7px; padding: 4px 0; }
.demo-specs dt { color: var(--demo-muted); }
.demo-specs dd { margin: 0; font-variant-numeric: tabular-nums; }
.demo-disclosure { margin: 4px 0 0; color: #5e4c75; font-size: 11px; }
.demo-disclosure summary { padding: 4px 0; cursor: pointer; }
.demo-disclosure ul { list-style: none; margin: 3px 0 5px; padding-left: 0; }
.demo-disclosure li { display: flex; justify-content: space-between; padding-block: 2px; }
.demo-data-note, .demo-scene-note { margin: 7px 0 0; font-size: 11px; color: #695e74; line-height: 1.55; }
.demo-console .demo-select, .demo-panel-button { width: 100%; max-width: none; min-height: 32px; margin-top: 8px; padding: 0 8px; border-radius: 999px; color: #544463; font-size: 12px; }
.demo-panel-button { text-align: center; }

.demo-console :is(.demo-glass, .demo-top-button, .demo-toggle, .demo-scene, .demo-panel-button, .demo-select, :where(.demo-advanced) button) {
  background: var(--demo-glass-highlight) var(--demo-glass);
  border: 1px solid var(--demo-glass-edge);
  box-shadow: var(--demo-glass-shadow);
  -webkit-backdrop-filter: var(--demo-glass-blur);
  backdrop-filter: var(--demo-glass-blur);
}
.demo-console .demo-glass { background-color: rgb(255 255 255 / 13%); }
.demo-console :is(.demo-top-button, .demo-toggle, .demo-scene, .demo-panel-button, .demo-select, .demo-advanced button) {
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.demo-console :is(.demo-top-button, .demo-toggle, .demo-scene, .demo-panel-button, .demo-select, .demo-advanced button, .demo-model):focus-visible {
  outline: 2px solid #7955a3;
  outline-offset: 2px;
}
.demo-console :is(.demo-top-button, .demo-toggle, .demo-scene, .demo-panel-button, .demo-select, .demo-advanced button):hover:not(:disabled, [aria-disabled="true"], [aria-pressed="true"], .active) {
  background-color: var(--demo-hover);
  border-color: rgb(255 255 255 / 39%);
}
.demo-console :is(.demo-top-button, .demo-toggle, .demo-scene, .demo-panel-button, .demo-advanced button):active:not(:disabled, [aria-disabled="true"]) {
  box-shadow: inset 0 1px 3px rgb(58 37 76 / 8%);
}
.demo-console :is(.demo-top-button, .demo-scene)[aria-pressed="true"],
.demo-console .demo-advanced .step.active {
  background-color: var(--demo-active);
  border-color: rgb(142 97 185 / 19%);
  color: #553a78;
}
@media (prefers-reduced-motion: reduce) {
  .demo-console :is(.demo-top-button, .demo-toggle, .demo-scene, .demo-panel-button, .demo-select, .demo-advanced button) { transition: none; }
}

.demo-advanced { position: fixed; width: min(680px, calc(100vw - 30px)); max-height: calc(100dvh - 46px); color: #393442; border: 1px solid #e4dbec; border-radius: 17px; padding: 0; background: #fcfafc; }
.demo-advanced::backdrop { background: #32283e35; }
.demo-advanced[open] { box-shadow: 0 18px 55px rgb(60 40 75 / 15%); }
.demo-advanced .annotation { background: #fff; }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .demo-advanced[open] { background: rgb(252 249 254 / 89%); }
  .demo-advanced > header {
    background: rgb(252 249 254 / 81%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}
.demo-advanced > header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; z-index: 1; background: #fcfafc; border-bottom: 1px solid #ebe5ef; }
.demo-advanced h2 { font-size: 17px; margin: 0; }
.demo-advanced > header button { font-size: 24px; width: 33px; height: 33px; border-radius: 50%; }
.demo-advanced :is(.step, .branch) { border-radius: 12px; }
.demo-advanced-content { padding: 14px 20px 21px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.demo-advanced-status { margin: 0 0 10px; font-size: 11px; line-height: 1.5; color: #675d72; }
.demo-drawer-shade { display: none; }

.demo-side {
  position: absolute;
  inset-block: 0;
  z-index: 3;
  min-width: 0;
  min-height: 0;
  width: min(var(--demo-side-width), 86vw);
  pointer-events: none;
}
.demo-side-left { --demo-side-width: var(--demo-left-width); inset-inline-start: 0; }
.demo-side-right { --demo-side-width: var(--demo-right-width); inset-inline-end: 0; }
.demo-side-panel { height: 100%; }
.demo-console:not(.demo-nav-pinned) .demo-side-panel {
  visibility: hidden;
  opacity: 0;
  transition: opacity 140ms ease, visibility 0s 140ms;
}
.demo-edge {
  display: none;
  position: absolute;
  inset-block: 0;
  width: 12px;
  pointer-events: auto;
}
.demo-side-left .demo-edge { inset-inline-start: 0; }
.demo-side-right .demo-edge { inset-inline-end: 0; }

.demo-console[data-drawer="scenes"] .demo-rail,
.demo-console[data-drawer="data"] .demo-inspector {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}
.demo-console:is([data-drawer="scenes"], [data-drawer="data"]) .demo-drawer-shade {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  z-index: 2;
  background: rgb(226 216 244 / 26%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

@media (any-hover: hover) and (any-pointer: fine) {
  .demo-console:not(.demo-nav-pinned, [data-drawer="scenes"], [data-drawer="data"]) .demo-edge { display: block; }
  .demo-console:not(.demo-nav-pinned, [data-drawer="scenes"], [data-drawer="data"]) .demo-side:hover .demo-side-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
  }
}

.demo-console.demo-nav-pinned .demo-workspace {
  grid-template-columns: var(--demo-right-width) minmax(0, 1fr) var(--demo-right-width);
}
.demo-nav-pinned .demo-side {
  position: static;
  width: 100%;
  max-width: var(--demo-side-width);
  pointer-events: auto;
  z-index: auto;
}

@media (max-width: 820px), (hover: none) {
  .demo-console:not(.demo-nav-pinned) .demo-toggle { display: inline-flex; }
}
@media (max-width: 820px) {
  .demo-console.demo-nav-pinned .demo-workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) clamp(110px, 28dvh, 215px);
  }
  .demo-nav-pinned .demo-workspace > .demo-stage { grid-column: 1 / -1; grid-row: 1; }
  .demo-nav-pinned .demo-side {
    grid-row: 2;
    max-width: none;
  }
  .demo-nav-pinned .demo-side-panel { padding: 12px; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-console:not(.demo-nav-pinned) .demo-side-panel { transition: none; }
}
@media (max-width: 960px) {
  .demo-brand > span { display: none; }
}
@media (max-width: 820px) {
  .demo-top-button > span { display: none; }
}
@media (max-width: 620px) {
  .demo-console header.demo-top { min-height: 52px; padding: 7px 9px; gap: 5px; }
  .demo-brand-mark { width: 59px; }
  .demo-top-actions { gap: 3px; }
  .demo-top-button, .demo-model, .demo-toggle { padding-inline: 5px; min-height: 30px; font-size: 10px; }
  .demo-console .demo-workspace > .demo-stage { inset-block-start: -6px; padding: 7px 9px; }
  .demo-preview-meta { gap: 7px; margin: 0 0 7px; }
  .demo-preview-meta b { white-space: normal; }
  .demo-model { padding-inline: 3px; }
  .demo-model > span { max-width: 67px; }
  .demo-advanced-content { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .demo-advanced[open] { animation: demo-appear 150ms ease-out both; }
  @keyframes demo-appear { from { opacity: .6; } to { opacity: 1; } }
}
