:root {
  color-scheme: light dark;
  --background: #f5f5f7;
  --surface: #fff;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --border: #e8e8ed;
  --accent: #0066cc;
  --button: #0071e3;
  --button-hover: #0068d1;
  --inset: #f5f5f7;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.page {
  width: min(100%, 484px);
  margin: 0 auto;
  padding: 64px 20px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  text-align: center;
}

.build-card {
  padding: 36px 36px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .045), 0 2px 6px rgba(0, 0, 0, .02);
}

p { margin: 0; }

.app-icon {
  display: block;
  margin: 0 auto 16px;
  border-radius: 22.5%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .1);
}

h1 {
  margin: 4px 0 8px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.subtitle { font-size: 15px; color: var(--secondary); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; border-radius: 6px; }

.open-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  margin-top: 28px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--button);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.open-button svg { flex-shrink: 0; }
.open-button:hover { background: var(--button-hover); text-decoration: none; }
.open-button:active { background: var(--button-hover); }
.open-button.expired, .open-button.expired:hover, .open-button.expired:active { background: var(--border); color: var(--secondary); }
.device-note { margin-top: 10px; font-size: 12px; color: var(--secondary); }
.device-note.expired { color: #d70015; }
.notice { display: block; margin-top: 20px; padding: 10px 14px; border-radius: 12px; background: var(--inset); font-size: 13px; font-weight: 500; }

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 20px;
  color: var(--secondary);
  font-size: 12px;
}

.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.scan-section { margin: 0; }

.qr-frame {
  width: min(100%, 224px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #e8e8ed;
  border-radius: 18px;
  background: #fff;
}

/* Keep the original quiet zone and black-on-white contrast, including in dark mode. */
.qr-code { display: block; width: 100%; height: auto; }
figcaption { margin-top: 16px; font-size: 13px; line-height: 1.6; color: var(--secondary); }

.install-section { margin-top: 26px; padding: 16px; border-radius: 16px; background: var(--inset); font-size: 13px; }
.install-section > p:first-child { margin-bottom: 4px; font-weight: 600; }
.install-section a { display: inline-block; padding: 6px 0; font-weight: 500; }
.install-note { margin-top: 2px; font-size: 12px; color: var(--secondary); }
.unavailable { margin-top: 28px; font-size: 15px; color: var(--secondary); }
.detected-os { margin-top: 14px; font-size: 13px; color: var(--secondary); }

.other-versions { margin-top: 22px; text-align: left; font-size: 14px; }
.other-versions summary { cursor: pointer; text-align: center; color: var(--accent); font-weight: 500; }
.other-versions .install-note { margin-top: 8px; text-align: center; }
.other-versions ul { margin: 12px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.install-option { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.install-option span { color: var(--secondary); font-size: 13px; text-align: right; }
.install-option.recommended a { font-weight: 600; }
.install-option.recommended a::after { content: " · Recommended"; color: var(--secondary); font-weight: 400; font-size: 12px; }
.troubleshooting { margin-top: 12px; }
.troubleshooting li { padding: 10px 2px; border-bottom: 1px solid var(--border); color: var(--secondary); font-size: 13px; }

.trust-steps { text-align: left; }
.trust-steps > p:first-child { text-align: center; }
.trust-steps .install-note { text-align: center; }
.trust-intro { margin-top: 14px; }
.trust-steps ol { margin: 8px 0 0; padding-left: 20px; }
.trust-steps li { margin-top: 4px; }
.trust-screenshot { display: block; width: 100%; height: auto; margin-top: 14px; border-radius: 10px; border: 1px solid var(--border); }
footer { margin-top: 22px; font-size: 12px; color: var(--secondary); }

@media (max-width: 480px) {
  .page { padding-top: 24px; padding-left: 16px; padding-right: 16px; }
  .build-card { padding: 28px 24px 20px; border-radius: 24px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #101012;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --secondary: #a1a1a6;
    --border: #38383a;
    --accent: #64b5ff;
    --button: #0071e3;
    --button-hover: #0068d1;
    --inset: #2c2c2e;
  }
}
