@layer base, layout, components, responsive;
@layer base {
  :root {
    --sky: #eaf5fb;
    --paper: #fbfdff;
    --ink: #233b53;
    --blue: #397fae;
    --blue-dark: #2c668f;
    --blue-soft: #dceef8;
    --muted: #61788a;
    --line: #cfe2ed;
    --green: #3f8664;
    --red: #ad4f4b;
    --straw: #d9a552;
    --radius: 20px;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background:
      radial-gradient(circle at 8% 5%, #fff 0 4%, transparent 17%),
      radial-gradient(circle at 95% 24%, #dceef8 0, transparent 25%),
      #f3f9fc;
    color: var(--ink);
    font: 16px/1.6 ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, p { margin: 0; }
  h1, h2, h3 { font-weight: 780; line-height: 1.13; letter-spacing: -.025em; text-wrap: balance; }
  h1 { max-width: 650px; font-size: clamp(2.55rem, 6vw, 4.5rem); letter-spacing: -.045em; }
  h2 { font-size: clamp(1.75rem, 4vw, 2.35rem); }
  h3 { margin-top: 12px; font-size: 1.7rem; }
  a { color: inherit; text-decoration: none; }
  button, input, textarea, summary { font: inherit; }
  button, summary { touch-action: manipulation; }
  button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 3px solid #e89a77;
    outline-offset: 4px;
  }
  ::selection { background: var(--blue); color: white; }
}
@layer layout {
  .shell { width: min(1020px, calc(100% - 48px)); margin-inline: auto; }
  .header { min-height: 108px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
  .main { display: grid; gap: 56px; padding-block: 32px 64px; }
  .intro { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
  .intro-copy { display: grid; gap: 22px; }
  .intro-copy > p:last-child { max-width: 620px; color: var(--muted); font-size: 1.06rem; }
  .hero-art { width: 100%; max-width: 420px; justify-self: end; filter: drop-shadow(0 18px 24px #527b9520); }
  .hero-art svg { display: block; width: 100%; height: auto; }
  .section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
  .section-heading .eyebrow { margin-bottom: 8px; }
  .profiles { display: grid; gap: 20px; }
  .footer { display: flex; justify-content: space-between; gap: 20px; padding-block: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
}
@layer components {
  .brand { display: flex; align-items: center; gap: 10px; color: var(--blue); }
  .brand-bird { width: 45px; height: 45px; flex: none; }
  .brand-name { color: var(--blue-dark); font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
  .brand-name small { display: block; margin-top: 7px; color: var(--muted); font-size: .65rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
  .eyebrow { color: var(--blue); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
  .muted { color: var(--muted); }
  .small { font-size: .85rem; }
  .button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 21px;
    border: 1px solid var(--blue-dark); border-radius: 999px; background: var(--blue-dark); color: white;
    box-shadow: 0 5px 12px #2c668f18; cursor: pointer; font-weight: 700; white-space: nowrap;
    transition: background .15s ease, transform .15s ease;
  }
  .button:hover { background: #245879; transform: translateY(-1px); }
  .button.secondary { border-color: var(--line); background: #ffffffa8; color: var(--blue-dark); box-shadow: none; }
  .button.secondary:hover { background: var(--blue-soft); }
  .button:disabled { cursor: wait; opacity: .65; transform: none; }
  .device-card {
    position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 24px 32px; align-items: center;
    padding: clamp(25px, 5vw, 42px); border-radius: 28px;
    background: linear-gradient(135deg, #397fae, #2c668f); color: white;
    box-shadow: 0 16px 35px #315f7c24;
  }
  .device-card::after {
    content: ""; position: absolute; width: 180px; height: 180px; right: -55px; top: -75px;
    border-radius: 50%; background: #ffffff12; box-shadow: -80px 100px 0 #ffffff08; pointer-events: none;
  }
  .device-card > * { position: relative; z-index: 1; }
  .device-card > div:first-child { display: grid; gap: 12px; }
  .device-card .eyebrow { color: #d5efff; }
  .device-card p:not(.eyebrow) { max-width: 620px; color: #e5f3fa; }
  .device-card .button { border-color: white; background: white; color: var(--blue-dark); }
  .device-card .button:hover { background: #edf8fd; }
  .device-result { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid #ffffff35; }
  .device-result.success { color: #e2f7df; }
  .device-result.warning { color: #ffedba; }
  .device-result.error { color: #ffe0dc; }
  .device-result ul { margin: 10px 0 0; padding-left: 22px; }
  .profile, .routing, .empty {
    padding: clamp(22px, 4vw, 32px); border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper); box-shadow: 0 10px 26px #486c8110;
  }
  .profile { border-top: 4px solid #a9d5eb; }
  .profile-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
  .status-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .85rem; font-weight: 700; }
  .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--straw); box-shadow: 0 0 0 4px #d9a55218; }
  .dot.ok { background: var(--green); box-shadow: 0 0 0 4px #3f866418; }
  .dot.bad { background: var(--red); box-shadow: 0 0 0 4px #ad4f4b18; }
  .dot.pending { background: var(--straw); }
  .checked { margin-top: 18px; color: var(--muted); font-size: .85rem; }
  .icon-button { min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
  .icon-button:hover { color: var(--red); }
  .notice { padding: 13px 16px; border-radius: 12px; background: #fff4dc; overflow-wrap: anywhere; }
  .notice.error { background: #fff0ed; color: #843c38; }
  .profile .notice { margin-top: 16px; }
  details > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; cursor: pointer; color: var(--blue-dark); font-weight: 750; list-style: none; }
  details > summary::-webkit-details-marker { display: none; }
  details > summary::after { content: "+"; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); font-size: 1.25rem; font-weight: 500; }
  details[open] > summary::after { content: "−"; }
  details > summary:hover { color: #245879; }
  .setup { margin-top: 16px; border-top: 1px solid var(--line); }
  .setup > summary { padding-top: 14px; }
  .setup-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; padding-top: 18px; }
  .link-column { min-width: 0; }
  .link-column label, .routing label, .add-form label { display: block; margin-bottom: 10px; font-weight: 700; }
  .copy-row { display: flex; gap: 10px; align-items: stretch; }
  input, textarea {
    width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: white;
    color: var(--ink); padding: 11px 14px;
  }
  input[readonly] { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; text-overflow: ellipsis; }
  textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; }
  .link-column .muted { margin-top: 10px; }
  .qr { width: 160px; height: 160px; border: 8px solid white; border-radius: 16px; box-shadow: 0 5px 18px #486c8118; }
  .routing { display: grid; gap: 16px; background: #f7fcff; }
  .routing > p:not(.eyebrow) { color: var(--muted); }
  .add details { padding-inline: 4px; border-top: 1px solid var(--line); }
  .add summary { padding-block: 16px; }
  .add-form { display: grid; gap: 16px; max-width: 720px; padding-block: 16px 8px; }
  .add-form .button { justify-self: start; }
  .footer-note { color: var(--blue); }
  .header-note { color: var(--muted); font-size: .82rem; }
  .public-main { padding-top: 32px; }
  .help-list { display: grid; gap: 16px; margin: 4px 0 0; padding-left: 24px; color: var(--muted); }
  .help-list strong { color: var(--ink); }
}
@layer responsive {
  @media (max-width: 760px) {
    .intro { grid-template-columns: 1fr; gap: 30px; }
    .hero-art { max-width: 390px; justify-self: center; }
  }
  @media (max-width: 700px) {
    .shell { width: min(100% - 28px, 1020px); }
    .header { min-height: 94px; }
    .header .button { min-height: 42px; padding: 8px 14px; font-size: .82rem; }
    .brand-bird { width: 38px; height: 38px; }
    .brand-name { font-size: 1.65rem; }
    .brand-name small, .header-note { display: none; }
    .main { gap: 42px; padding-block: 24px 44px; }
    .device-card { grid-template-columns: 1fr; border-radius: 22px; }
    .device-card .button { justify-self: start; }
    .setup-body { grid-template-columns: 1fr; }
    .qr { justify-self: center; }
    .copy-row { flex-direction: column; }
    .copy-row .button { align-self: start; }
    .profile-heading { gap: 8px; }
    .footer { flex-direction: column; gap: 5px; }
  }
}
