  :root {
    --orange: #fb923c;
    --pink: #ec4899;
    --teal: #14b8a6;
    --bg: #fffaf6;
    --bg-soft: #fff1e8;
    --card: #ffffff;
    --text: #2b1b24;
    --muted: #6f5a66;
    --line: #f3dfd3;
    --shadow: 0 10px 30px rgba(236, 72, 153, 0.12);
    --ha-bg: #f4f4f6;
    --ha-card: #ffffff;
    --ha-text: #1c1c1e;
    --ha-muted: #6b6b73;
    --ha-accent: #0b8bd4;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #17111a;
      --bg-soft: #21172a;
      --card: #231a2b;
      --text: #f8eef4;
      --muted: #c3aebb;
      --line: #3a2c40;
      --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
      --ha-bg: #111111;
      --ha-card: #1c1c1c;
      --ha-text: #e8e8e8;
      --ha-muted: #9b9b9b;
      --ha-accent: #03a9f4;
    }
  }
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    margin: 0;
    font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; }
  .wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
  .gradient-text {
    background: linear-gradient(120deg, var(--orange), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  /* Nav */
  nav {
    position: sticky; top: 0; z-index: 10;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    border-bottom: 1px solid var(--line);
  }
  nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; text-decoration: none; }
  .brand img { width: 34px; height: 34px; }
  nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; font-weight: 700; color: var(--muted); }
  nav ul a { text-decoration: none; }
  nav ul a:hover { color: var(--pink); }
  @media (max-width: 720px) { nav ul li:not(:last-child) { display: none; } }

  /* Buttons */
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 22px; border-radius: 999px;
    font-weight: 800; text-decoration: none; font-size: 1rem;
    transition: transform .15s ease, box-shadow .15s ease;
  }
  .btn:hover { transform: translateY(-2px); }
  .btn-primary { background: linear-gradient(120deg, var(--orange), var(--pink)); color: #fff; box-shadow: 0 8px 20px rgba(236, 72, 153, .35); }
  .btn-ghost { border: 2px solid var(--line); background: var(--card); }

  /* Hero */
  .hero { position: relative; overflow: hidden; padding: 72px 0 88px; }
  .hero::before {
    content: ""; position: absolute; inset: -40% -10% auto auto; width: 720px; height: 720px;
    background: radial-gradient(circle, rgba(251, 146, 60, .28), rgba(236, 72, 153, .16) 45%, transparent 70%);
    pointer-events: none;
  }
  .hero .wrap { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
  @media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; gap: 48px; } .hero { padding-top: 48px; } }
  .pill {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--line); border-radius: 999px;
    padding: 6px 14px; font-weight: 700; font-size: .9rem; color: var(--muted);
  }
  .pill b { color: var(--teal); }
  h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1.08; margin: 18px 0 18px; font-weight: 900; letter-spacing: -0.02em; }
  .lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 30px; max-width: 34em; }
  .cta { display: flex; flex-wrap: wrap; gap: 12px; }
  .small { font-size: .9rem; color: var(--muted); margin-top: 18px; }

  /* Home Assistant mock */
  .mock { position: relative; }
  .ha {
    background: var(--ha-bg); border-radius: 22px; padding: 16px;
    box-shadow: var(--shadow); border: 1px solid var(--line);
    font-family: Roboto, system-ui, sans-serif; color: var(--ha-text);
  }
  .ha-head { display: flex; align-items: center; gap: 12px; padding: 6px 8px 14px; }
  .ha-head img { width: 40px; height: 40px; }
  .ha-head .t { font-weight: 600; font-size: 1.05rem; }
  .ha-head .s { font-size: .82rem; color: var(--ha-muted); }
  .ha-card { background: var(--ha-card); border-radius: 14px; padding: 6px 4px; margin-bottom: 12px; }
  .ha-card h4 { margin: 10px 14px 4px; font-size: .95rem; font-weight: 600; }
  .row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; font-size: .93rem; }
  .row .ic { width: 26px; text-align: center; font-size: 1.1rem; }
  .row .n { flex: 1; }
  .row .v { color: var(--ha-muted); text-align: right; }
  .row .v.ok { color: #43a047; font-weight: 600; }
  .row .press { color: var(--ha-accent); font-weight: 600; }
  .row .box { border-bottom: 2px solid var(--ha-muted); padding: 2px 6px; min-width: 96px; text-align: right; color: var(--ha-text); }
  .toast {
    margin: 14px 18px 0;
    background: #323232; color: #fff; border-radius: 12px; padding: 14px 16px;
    font-family: Roboto, system-ui, sans-serif; font-size: .9rem; line-height: 1.4;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
    animation: pop .6s ease-out 1s both;
  }
  .toast b { color: #ffb4d6; }
  .toast-caption { margin: 8px 18px 0; font-size: .85rem; color: var(--muted); text-align: center; animation: pop .6s ease-out 1.3s both; }
  @keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .toast, .toast-caption { animation: none; } }
  @media (max-width: 520px) { .toast, .toast-caption { margin-left: 0; margin-right: 0; } }

  /* Sections */
  section { padding: 84px 0; }
  .soft { background: var(--bg-soft); }
  .kicker { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: .8rem; color: var(--pink); }
  h2 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); line-height: 1.15; margin: 8px 0 14px; font-weight: 900; letter-spacing: -0.01em; }
  .sub { color: var(--muted); font-size: 1.1rem; max-width: 40em; margin: 0 0 40px; }

  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
  .feature { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
  .feature .e {
    width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem;
    background: linear-gradient(135deg, rgba(251, 146, 60, .18), rgba(236, 72, 153, .18));
    margin-bottom: 14px;
  }
  .feature h3 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 800; }
  .feature p { margin: 0; color: var(--muted); }

  .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
  @media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
  .step { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px 24px; }
  .step::before {
    counter-increment: step; content: counter(step);
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--orange), var(--pink)); color: #fff; font-weight: 900;
    margin-bottom: 14px;
  }
  .step h3 { margin: 0 0 6px; font-weight: 800; }
  .step p { margin: 0; color: var(--muted); }

  .split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
  @media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
  .log { background: var(--ha-card); color: var(--ha-text); border-radius: 18px; padding: 10px 20px; box-shadow: var(--shadow); border: 1px solid var(--line); font-family: Roboto, system-ui, sans-serif; }
  .log .day { font-weight: 600; margin: 12px 0 4px; font-size: .95rem; }
  .entry { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid color-mix(in srgb, var(--ha-muted) 25%, transparent); font-size: .93rem; }
  .entry:last-child { border-bottom: 0; }
  .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; flex: none; }
  .entry .when { margin-left: auto; color: var(--ha-muted); white-space: nowrap; }
  .entry b { font-weight: 600; }

  .check { list-style: none; padding: 0; margin: 0; }
  .check li { padding-left: 34px; position: relative; margin: 12px 0; }
  .check li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: .8rem; }

  .install { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 36px; box-shadow: var(--shadow); }
  .install ol { margin: 0 0 24px; padding-left: 22px; }
  .install li { margin: 10px 0; }
  code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 2px 7px;
    overflow-wrap: anywhere;
  }

  details { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; margin-bottom: 12px; }
  summary { font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
  summary::-webkit-details-marker { display: none; }
  summary::after { content: "+"; color: var(--pink); font-size: 1.3rem; line-height: 1; }
  details[open] summary::after { content: "–"; }
  details p { color: var(--muted); margin: 12px 0 0; }

  footer { padding: 40px 0 56px; color: var(--muted); border-top: 1px solid var(--line); }
  footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
  footer a { font-weight: 700; }

/* Guide */
.lang-switch { display: inline-flex; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.lang-switch button {
  font: inherit; font-weight: 800; font-size: .85rem; border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: linear-gradient(120deg, var(--orange), var(--pink)); color: #fff; }
nav .right { display: flex; align-items: center; gap: 22px; }
html[data-lang="en"] [lang="sv"], html[data-lang="sv"] [lang="en"] { display: none !important; }

.guide-hero { padding: 56px 0 24px; }
.guide-hero .lead { margin-bottom: 0; }
.guide { display: grid; grid-template-columns: 230px 1fr; gap: 48px; padding: 32px 0 80px; align-items: start; }
.guide > * { min-width: 0; }
@media (max-width: 900px) { .guide { grid-template-columns: 1fr; gap: 24px; } }
.toc { position: sticky; top: 88px; font-weight: 700; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 6px 14px; color: var(--muted); text-decoration: none; margin-left: -2px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--pink); border-left-color: var(--pink); }
@media (max-width: 900px) {
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 8px; border: 0; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; margin: 0; background: var(--card); font-size: .9rem; }
}
.task { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px 28px; margin-bottom: 18px; box-shadow: var(--shadow); scroll-margin-top: 88px; }
.task h2 { font-size: 1.35rem; margin: 0 0 6px; display: flex; gap: 12px; align-items: center; }
.task h2 .e { font-size: 1.4rem; }
.task > p { color: var(--muted); margin: 0 0 12px; }
.task ol, .task ul { margin: 8px 0; padding-left: 22px; }
.task li { margin: 6px 0; }
.tip { margin-top: 14px; padding: 12px 16px; border-radius: 14px; background: var(--bg-soft); border: 1px solid var(--line); font-size: .95rem; }
.tip b:first-child { color: var(--pink); }
pre {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  overflow-x: auto; font-size: .85rem; line-height: 1.5; margin: 10px 0 0;
}
pre code { background: none; border: 0; padding: 0; }
.ui { font-weight: 800; }
