* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-white);
  font-family: var(--font-family);
}

body {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

/* Screens outside the 480px mobile frame get a neutral surround so the
   "device" reads clearly on a wide desktop viewport. */
html {
  background: #050505;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.screen {
  min-height: 100vh;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.screen--gradient {
  background: var(--gradient-focal);
}

.screen--black {
  background: var(--color-bg);
}

/* Wide/desktop viewport: every single-panel screen (any screen that isn't
   one of the split "phone + field reading" stage-mode layouts handled in
   stage-layout.css) gets the same decorative iPhone-style frame — bezel,
   side buttons, home indicator — around its centered 400px column, instead
   of just sitting there as a plain rectangle on the neutral dark surround.

   Deliberately absent below 900px: on an actual phone at mobile width the
   device's own physical bezel already frames the content, so a drawn one
   would be a frame inside a frame — it only earns its place once the
   viewport is wide enough that the "device" needs to visually read as an
   object on a plain background. (body.stage-mode in stage-layout.css
   differs because its mobile layout stacks a phone panel next to a
   separate scene panel, so its frame also has to mark "this one is the
   phone" — a need these single-panel screens don't have.) Don't extend
   this to mobile by reusing stage-mode's single shared fixed height as-is:
   these 9 screens split roughly 5 short (splash/bluetooth-off/connect/
   connect-device/index) vs. 4 full (onboarding/scan/device-home/
   smartsense-select), a wider spread than stage-mode's own 6 screens —
   re-measure all 9 first or the short screens will show a lot of dead
   space inside an oversized frame.

   The rules below also intentionally duplicate body.stage-mode's desktop
   block in stage-layout.css (same colors, radii, shadows, button
   geometry) — see the comment there for why it's two blocks, not one.
   Change one, check the other. */
@media (min-width: 900px) {
  body:not(.stage-mode) {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
  }
  body:not(.stage-mode) .device-frame {
    position: relative;
    width: 400px;
    max-width: 400px;
    /* explicit height (not just margin) so .screen below has something
       definite to fill at 100% — .screen's own min-height:100vh would
       otherwise win over an unconstrained height and push the frame taller
       than the viewport, clipping/overflowing past the top or bottom. */
    height: calc(100vh - 80px);
    margin: 40px auto;
  }
  body:not(.stage-mode) .screen {
    height: 100%;
    min-height: 0;
    border-radius: 40px;
    overflow: hidden;
    box-shadow:
      0 0 0 16px #050505,
      0 0 0 18px rgba(255, 255, 255, 0.16),
      0 24px 60px rgba(0, 0, 0, 0.6);
  }
  body:not(.stage-mode) .device-frame__home-indicator {
    position: absolute;
    bottom: 9px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.55);
    z-index: 20;
    pointer-events: none;
  }
  body:not(.stage-mode) .device-frame__btn {
    position: absolute;
    width: 4px;
    background: linear-gradient(90deg, #454f5e, #250c06 45%, #5e5245);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7);
    z-index: 5;
  }
  /* .screen's bezel (box-shadow above) runs 0-18px out from the screen
     edge — buttons need to sit out in that band, not hugging the screen's
     own border, or they read as "on the glass" instead of "on the case". */
  body:not(.stage-mode) .device-frame__btn--vol-up,
  body:not(.stage-mode) .device-frame__btn--vol-down {
    left: -10px;
    border-radius: 0 3px 3px 0;
  }
  body:not(.stage-mode) .device-frame__btn--vol-up { top: 96px; height: 40px; }
  body:not(.stage-mode) .device-frame__btn--vol-down { top: 146px; height: 40px; }
  body:not(.stage-mode) .device-frame__btn--power {
    right: -10px;
    top: 118px;
    height: 56px;
    border-radius: 3px 0 0 3px;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.divider {
  height: 1px;
  width: 100%;
  background: var(--color-white-30);
  border: none;
}
