:root {
  color-scheme: light dark; font: 15px system-ui, sans-serif;
  --surface: #fff; --ink: #282828; --muted: #6b6b6b; --line: #dfdfdf;
  --blue: #1883c8; --blue-ink: #146caa; --active: #e8f5ff; --button-shadow: #dedede;
  --display: #ccefff; --display-ink: #163449;
  color: var(--ink); background: var(--surface);
}
@media (prefers-color-scheme: dark) {
  :root { --surface: #242424; --ink: #f3f3f3; --muted: #b4b4b4; --line: #464646;
    --blue: #71c8ff; --blue-ink: #8dceff; --active: #293f50; --button-shadow: #363636;
    --display: #1d4063; --display-ink: #d7edff; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
body:has(.staff-auth-page[hidden]) { background: var(--surface); }
.staff-auth form { display: grid; gap: 16px; }
.staff-auth-page { color-scheme: light; }
#simulator { max-width: 1460px; margin: auto; padding: 0 40px 20px; }
.workspace-header {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 18px 32px; padding: 20px 0; border-bottom: 1px solid var(--line); z-index: 5;
}
.workspace-header h1 { font-size: 1.1rem; font-weight: 750; letter-spacing: -.025em; margin: 0; white-space: nowrap; }
.sim-controls, .device-controls, .session-controls { display: flex; align-items: center; gap: 5px; }
.sim-controls { flex-wrap: wrap; gap: 10px 18px; }
.session-controls { border-inline-start: 1px solid var(--line); padding-inline-start: 16px; }
.sim-controls button, .sim-controls summary, .sim-controls select {
  min-height: 36px; color: var(--ink); font: 570 .86rem system-ui, sans-serif;
  padding: 6px 10px; background: var(--surface); border: 0; border-radius: 8px;
}
.sim-controls select { width: 100%; border: 1px solid var(--line); }
.sim-controls button:hover:not(:disabled), .sim-controls summary:hover, .tool-menu[open] > summary { background: var(--active); }
.sim-controls button, .sim-controls summary, .sim-controls select { cursor: pointer; }
.sim-controls button:disabled { opacity: .4; cursor: default; }
.sim-controls :focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tool-menu { position: relative; }
.tool-menu > summary { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.tool-menu > summary::-webkit-details-marker { display: none; }
.tool-menu > summary::after {
  content: ''; width: 5px; height: 5px; flex: none; margin-inline-end: 2px; color: var(--muted);
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-1px) rotate(45deg);
}
.tool-menu[open] > summary::after { transform: translateY(1px) rotate(225deg); }
#device-trigger { min-width: 158px; justify-content: space-between; border: 1px solid var(--line); }
.menu-panel {
  position: absolute; inset: calc(100% + 8px) 0 auto auto; min-width: 185px; max-height: min(60vh, 440px);
  overflow: auto; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 28px #0002;
}
.device-controls .menu-panel { right: auto; left: 0; }
.choice-list { display: grid; gap: 3px; list-style: none; margin: 0; padding: 0; }
.choice-list button { width: 100%; text-align: start; }
.choice-list button[aria-pressed=true], .choice-list button[aria-current=true] { background: var(--active); color: var(--blue-ink); }
.build-panel { width: 298px; padding: 14px; }
.build-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.build-heading h2, .release-notes h3 { margin: 0; font-size: .82rem; font-weight: 650; }
.build-navigation { display: flex; gap: 4px; }
.build-navigation button { min-height: 28px; padding: 2px 8px; border: 1px solid var(--line); }
.release-notes { border-top: 1px solid var(--line); margin-top: 13px; padding: 12px 4px 0; }
#release-notes { margin: 7px 0 2px; padding-inline-start: 17px; font-size: .83rem; line-height: 1.5; }
#release-notes li + li { margin-top: 4px; }
.account-panel #logout { width: 100%; min-height: 33px; padding-inline: 10px; text-align: start; color: var(--muted); }
.account-panel .choice-list { border-bottom: 1px solid var(--line); padding-bottom: 7px; margin-bottom: 6px; }
.flag-panel { width: 220px; font-size: .83rem; }
.flag-select { display: grid; gap: 4px; margin-top: 12px; }
.flag-select select { min-height: 32px; font-size: .78rem; }
.workspace { padding-top: 16px; }
.checkbox { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; }
.checkbox input { appearance: none; margin: 0; outline-offset: 2px; width: 29px; height: 17px;
  border-radius: 10px; padding: 2px; background: var(--line); cursor: pointer; }
.checkbox input::before { content: ''; display: block; width: 13px; height: 13px; border-radius: 50%; background: white; }
.checkbox input:checked { background: var(--blue); }
.checkbox input:checked::before { transform: translateX(12px); }
#app-status, #status { margin: 8px 0; color: var(--muted); text-align: center; }
#app-status:empty, #status:empty { display: none; }
#status { text-align: center; }

/* The chassis and camera rotate as a unit. The app receives an upright frame
   sized to the usable screen, clear of model-specific controls and cutouts. */
#device-stage { display: grid; justify-content: center; min-width: 0; padding: 13px 13px 18px; }
#device-viewport, #device-frame { position: relative; }
#device-frame { position: absolute; inset: 0 auto auto 0; transform-origin: top left; --rim: #646970; }
#device-frame[data-model=iphone-17-pro-max] { --rim: #a8a8ad; }
#device-frame[data-model=pixel-9] { --rim: #5e6666; }
#device-frame[data-model=ipad-air-11] { --rim: #6e7884; }
#device-frame[data-model=ipad-pro-13] { --rim: #797b83; }
.hardware-layer { position: absolute; inset: 0 auto auto 0; width: var(--body-width); height: var(--body-height); transform-origin: top left; pointer-events: none; }
#device-frame[data-orientation=landscape] .hardware-layer { transform: translateY(var(--body-width)) rotate(-90deg); }
#device-chassis { background: linear-gradient(145deg, #1c1d20, #090a0c 48%, #202127);
  border: 2px solid var(--rim); border-radius: var(--shell-radius);
  box-shadow: inset 0 0 0 2px #4f5157, 0 5px 15px #0002; }
#device-hardware { z-index: 2; }
#device-screen { position: absolute; z-index: 1; left: var(--screen-left); top: var(--screen-top);
  width: var(--screen-width); height: var(--screen-height); overflow: hidden; border-radius: var(--screen-radius);
  background: var(--display); box-shadow: 0 0 0 1px #050505; }
#app { display: block; position: absolute; inset: 0; border: none; width: 100%; height: 100%; }
.device-status { position: absolute; top: 0; height: var(--safe-top); left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px; color: var(--display-ink);
  font-size: 13px; font-weight: 710; pointer-events: none; }
[data-cutout=island] .device-status { padding-inline: 34px; }
[data-orientation=landscape]:not([data-cutout=tablet]) .device-status { display: none; }
.device-battery { position: relative; width: 20px; height: 9px; padding: 1px; border: 1px solid currentColor; border-radius: 2px; }
.device-battery::before { content: ''; display: block; width: 80%; height: 100%; border-radius: 1px; background: currentColor; }
.device-battery::after { content: ''; position: absolute; right: -3px; top: 2px; width: 2px; height: 3px; border-radius: 1px; background: currentColor; }
.home-indicator { position: absolute; z-index: 1; bottom: 6px; left: 50%; width: 34%; max-width: 135px;
  height: 4px; border-radius: 10px; background: var(--display-ink); opacity: .85; transform: translateX(-50%); pointer-events: none; }
[data-gesture=false] .home-indicator { display: none; }
.front-cutout, .earpiece, .home-key, .device-key { position: absolute; }
.front-cutout, .earpiece, .home-key { display: none; }
.front-cutout { background: #060608; }
.front-cutout::after { content: ''; position: absolute; right: 9%; top: 50%; width: 8px; height: 8px;
  transform: translateY(-50%); border-radius: 50%; background: radial-gradient(circle at 38% 35%, #59678c, #0a1020 60%, #0c0d14); }
[data-cutout=notch] .front-cutout, [data-cutout=island] .front-cutout, [data-cutout=hole] .front-cutout {
  display: block; left: 50%; transform: translateX(-50%);
}
[data-cutout=notch] .front-cutout { top: calc(var(--bezel-y) - 1px); width: 154px; height: 29px; border-radius: 0 0 20px 20px; }
[data-cutout=island] .front-cutout { top: calc(var(--bezel-y) + 12px); width: 124px; height: 36px; border-radius: 23px; }
[data-cutout=hole] .front-cutout { top: calc(var(--bezel-y) + 11px); width: 13px; height: 13px; border-radius: 50%; }
[data-cutout=hole] .front-cutout::after, [data-cutout=tablet] .front-cutout::after, [data-cutout=se] .front-cutout::after { left: 50%; right: auto; transform: translate(-50%, -50%); width: 6px; height: 6px; }
[data-cutout=tablet] .front-cutout { display: block; top: 50%; right: calc(var(--bezel-x) / 2 - 6px); width: 12px; height: 12px; border-radius: 50%; transform: translateY(-50%); }
[data-cutout=se] .earpiece { display: block; left: 50%; top: calc(var(--bezel-y) / 2 - 3px); width: 42px; height: 6px; border-radius: 5px; background: #3e4047; transform: translateX(-50%); }
[data-cutout=se] .front-cutout { display: block; left: calc(50% - 43px); top: calc(var(--bezel-y) / 2 - 5px); width: 10px; height: 10px; border-radius: 50%; }
[data-cutout=se] .home-key { display: block; bottom: calc(var(--bezel-y) / 2 - 24px); left: 50%; width: 48px; height: 48px;
  border: 2px solid #64676c; border-radius: 50%; box-shadow: inset 0 0 0 2px #14161b; transform: translateX(-50%); }
.device-key { width: 4px; height: 45px; border-radius: 4px; background: var(--rim); }
.device-key.volume-up { left: -4px; top: 23%; }
.device-key.volume-down { left: -4px; top: 29%; }
.device-key.action { left: -4px; top: 17%; height: 22px; }
.device-key.power { right: -4px; top: 26%; height: 59px; }
.device-key.camera-control { display: none; right: -4px; top: 69%; height: 40px; }
[data-model=iphone-17-pro-max] .device-key.camera-control { display: block; }
[data-cutout=hole] .device-key.volume-up { left: auto; right: -4px; top: 33%; height: 66px; }
[data-cutout=hole] .device-key.volume-down, [data-cutout=hole] .device-key.action { display: none; }
[data-cutout=hole] .device-key.power { top: 24%; height: 39px; }
[data-cutout=tablet] .device-key.action { display: none; }
[data-cutout=tablet] .device-key.volume-up, [data-cutout=tablet] .device-key.volume-down { left: auto; right: -4px; top: 8%; }
[data-cutout=tablet] .device-key.volume-down { top: 12%; }
[data-cutout=tablet] .device-key.power { top: -4px; right: 8%; width: 44px; height: 4px; }

@media(max-width: 950px) {
  #simulator { padding-inline: 22px; }
  .workspace-header { flex-wrap: wrap; gap: 12px 24px; }
}
@media(max-width: 650px) {
  #simulator { padding: 0 16px 12px; }
  .workspace-header { padding: 16px 0 12px; }
  .sim-controls { position: relative; width: 100%; }
  .session-controls { border: 0; padding-inline-start: 0; }
  .tool-menu { position: static; }
  .tool-menu .menu-panel, .device-controls .menu-panel { width: 100%; max-width: 320px; inset: calc(100% + 8px) auto auto 0; }
  .workspace { padding-top: 10px; }
}

#app-loading { position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--display); color: var(--display-ink); font-weight: 700; }
