:root {
  /* Colors.light.blueBright in the app — the native blue of the tab bar and every score. */
  --blue: #008AFF;
  /* Colors.light.blueDeep — same hue, dark enough for small text on white (4.9:1). */
  --blue-ink: #0072C3;
  --blue-soft: rgba(0, 138, 255, 0.08);
  --blue-line: rgba(0, 138, 255, 0.28);
  --bg: #FFFFFF;
  --bezel: #1B1B1D;
  --titanium: #8E8E93;
  --error: #D70015;

  /* Screen width drives the whole device; height follows the iPhone 15 Pro ratio. */
  --w: min(72vw, 280px);
  --ratio: 2.168;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--blue);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: max(32px, env(safe-area-inset-top)) 16px 24px;
  display: grid;
  gap: 48px;
  justify-items: center;
}

/* ---------- copy + form ---------- */

.copy {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.wordmark { display: block; width: 124px; height: auto; margin: 0 auto 28px; }

h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 9vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--blue);
}

.lede {
  margin: 0 0 28px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--blue-ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input[type="email"] {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  border: 1.5px solid var(--blue-line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--blue);
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="email"]::placeholder { color: rgba(0, 114, 195, 0.5); font-weight: 500; }
input[type="email"]:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
input[aria-invalid="true"] { border-color: var(--error); }

button {
  height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #FFFFFF;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 24px -10px rgba(0, 138, 255, 0.7);
  transition: transform .12s ease, opacity .15s, filter .15s;
}
button:hover { filter: brightness(1.06); }
button:active { transform: scale(0.97); }
button:disabled { opacity: .6; cursor: default; transform: none; }
button:focus-visible { outline: 3px solid var(--blue-line); outline-offset: 3px; }

.note {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--blue-ink);
}
.note.is-error { color: var(--error); }

.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.done {
  padding: 22px 20px;
  border-radius: 24px;
  background: var(--blue-soft);
  outline: none;
  animation: rise .45s cubic-bezier(.2, .9, .3, 1.2);
}
.done-title { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--blue); }
.done-body { margin: 0; color: var(--blue-ink); }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- device ---------- */

.device-wrap { display: grid; justify-items: center; gap: 20px; }

.device {
  --bez: calc(var(--w) * 0.04);
  position: relative;
  width: calc(var(--w) + var(--bez) * 2);
  padding: var(--bez);
  border-radius: calc(var(--w) * 0.155 + var(--bez));
  background: var(--bezel);
  /* Thin titanium rim around the black bezel, then a soft floor shadow. */
  box-shadow:
    0 0 0 1.5px #3A3A3D,
    0 0 0 3px #C7C7CC,
    0 40px 80px -30px rgba(0, 40, 90, 0.35),
    0 18px 30px -18px rgba(0, 0, 0, 0.25);
}

.btn {
  position: absolute;
  width: 3px;
  background: #B8B8BD;
  border-radius: 2px;
}
.btn-action { left: -4.5px; top: 17%; height: 5%; }
.btn-up     { left: -4.5px; top: 25%; height: 9%; }
.btn-down   { left: -4.5px; top: 36%; height: 9%; }
.btn-power  { right: -4.5px; top: 28%; height: 14%; }

.screen {
  position: relative;
  width: var(--w);
  height: calc(var(--w) * var(--ratio));
  border-radius: calc(var(--w) * 0.155);
  overflow: hidden;
  background: #F2F2F4;
  /* Safari needs this to clip transformed children to the radius. */
  isolation: isolate;
}

.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity .6s ease, transform .9s cubic-bezier(.2, .8, .2, 1);
}
.shot.is-active { opacity: 1; transform: none; }

.dots { display: flex; gap: 8px; }
.dots button {
  width: 8px; height: 8px; padding: 0;
  border-radius: 999px;
  background: var(--blue-line);
  box-shadow: none;
  transition: width .3s ease, background .3s ease;
}
.dots button[aria-selected="true"] { width: 22px; background: var(--blue); }
.dots button:hover { filter: none; }

/* ---------- footer ---------- */

.foot {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px max(28px, env(safe-area-inset-bottom));
  font-size: 14px;
  color: var(--blue-ink);
}
.foot a { color: var(--blue-ink); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- wider screens ---------- */

@media (min-width: 560px) {
  .field {
    flex-direction: row;
    padding: 6px;
    border: 1.5px solid var(--blue-line);
    border-radius: 999px;
    transition: border-color .15s, box-shadow .15s;
  }
  .field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
  .field input[type="email"] { height: 50px; border: 0; box-shadow: none; padding-left: 18px; }
  .field:has(input[aria-invalid="true"]) { border-color: var(--error); }
  .field button { height: 50px; }
}

@media (min-width: 900px) {
  :root { --w: clamp(240px, calc((100svh - 150px) / 2.3), 320px); }

  .page {
    min-height: calc(100svh - 60px);
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 72px;
    padding-top: 40px;
  }
  .copy { text-align: left; max-width: 520px; justify-self: start; }
  .wordmark { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .shot, .done, button, .dots button { transition: none; animation: none; }
}
