/* Home Assistant simulation — Lovelace dark (Oscar setup, no official demo) */
.page--ha-sim {
  padding-bottom: 4rem;
}

.ha-sim-hero {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(5.5rem, 12vw, 7rem) 1.5rem 1.25rem;
  text-align: center;
}

.ha-sim-hero__eyebrow {
  margin: 0.75rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.ha-sim-hero__title {
  margin: 0 0 0.85rem;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.ha-sim-hero__lead {
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 40rem;
}

.ha-sim-stage {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.ha-sim-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 0 auto 1rem;
  padding: 0.7rem 1rem;
  max-width: 42rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, #03a9f4 35%, transparent);
  background: color-mix(in srgb, #03a9f4 12%, #111317);
  color: #e8eaed;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.ha-sim-banner__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #03a9f4;
  box-shadow: 0 0 0 4px color-mix(in srgb, #03a9f4 25%, transparent);
  flex-shrink: 0;
}

.ha-sim-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ha-sim-modes {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.ha-sim-mode {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

.ha-sim-mode.is-active {
  background: color-mix(in srgb, #03a9f4 18%, transparent);
  color: var(--fg);
}

.ha-sim-badge {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #03a9f4;
}

.ha-sim-viewport {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.ha-sim-footnote {
  margin: 1.1rem auto 0;
  max-width: 42rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.ha-sim-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  padding: 0 1rem 2rem;
}

/* Device chrome */
.ha-device {
  position: relative;
  width: 100%;
}

.ha-device--phone {
  max-width: 390px;
  margin: 0 auto;
  padding: 12px;
  border-radius: 36px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.ha-phone-bezel {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 3;
  width: 108px;
  height: 22px;
  border-radius: 999px;
  background: #0a0a0a;
  pointer-events: none;
}

.ha-device--desktop {
  max-width: 1060px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f1115;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.4);
}

.ha-desk-chrome {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  background: #1a1d24;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ha-desk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a3f4a;
}

.ha-desk-dot:nth-child(1) { background: #ff5f57; }
.ha-desk-dot:nth-child(2) { background: #febc2e; }
.ha-desk-dot:nth-child(3) { background: #28c840; }

.ha-desk-url {
  margin-left: 0.75rem;
  flex: 1;
  font-size: 0.72rem;
  color: #9aa0a6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ha-screen {
  position: relative;
  background: #111317;
  overflow: hidden;
}

.ha-device--phone .ha-screen {
  border-radius: 28px;
  min-height: 720px;
  height: 720px;
}

.ha-device--desktop .ha-screen {
  min-height: 78vh;
  height: 78vh;
}

/* Lovelace app shell */
.ha-app {
  display: flex;
  height: 100%;
  min-height: inherit;
  color: #e8eaed;
  font-family: Roboto, "Segoe UI", system-ui, sans-serif;
  background: #111317;
}

.ha-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.55rem;
  background: #1c1c1c;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.ha-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

.ha-sidebar__logo {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #03a9f4;
  color: #031018;
  font-size: 0.65rem;
  font-weight: 800;
}

.ha-sidebar__item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #bdc1c6;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.ha-sidebar__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.ha-sidebar__item.is-active {
  background: color-mix(in srgb, #03a9f4 18%, transparent);
  color: #03a9f4;
}

.ha-sidebar__item.is-disabled,
.ha-phone-tab.is-disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.ha-sidebar__foot {
  margin-top: auto;
  padding: 0.75rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #9aa0a6;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ha-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #111317;
}

.ha-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, #17191e 0%, #111317 100%);
}

.ha-header__titles h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #fff;
}

.ha-header__banner {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: #03a9f4;
  font-weight: 600;
}

.ha-views {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ha-view {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9aa0a6;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.ha-view.is-active {
  background: #03a9f4;
  color: #031018;
}

.ha-grid {
  flex: 1;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  padding: 1rem;
  align-content: start;
}

.ha-device--phone .ha-grid {
  grid-template-columns: 1fr;
  padding: 0.85rem 0.85rem 4.5rem;
}

.ha-card {
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 0.95rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ha-card.is-active {
  border-color: color-mix(in srgb, #03a9f4 40%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, #03a9f4 18%, transparent),
    0 8px 24px rgba(0, 0, 0, 0.22);
}

.ha-card--wide {
  grid-column: 1 / -1;
}

.ha-card__head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.ha-card__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1rem;
}

.ha-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.ha-card__sub,
.ha-card__meta {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: #9aa0a6;
}

.ha-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ha-toggle {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border-radius: 999px;
  background: #2a2a2a;
  color: #e8eaed;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
}

.ha-toggle__knob {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #444;
  position: relative;
  transition: background 0.15s;
}

.ha-toggle__knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.ha-toggle.is-on .ha-toggle__knob {
  background: #03a9f4;
}

.ha-toggle.is-on .ha-toggle__knob::after {
  transform: translateX(18px);
}

.ha-pills,
.ha-actions,
.ha-scenes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ha-pill,
.ha-btn,
.ha-scene {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #2a2a2a;
  color: #e8eaed;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.ha-pill:hover,
.ha-btn:hover,
.ha-scene:hover,
.ha-climate__btn:hover {
  border-color: color-mix(in srgb, #03a9f4 45%, transparent);
}

.ha-pill.is-selected,
.ha-btn--primary,
.ha-scene.is-active {
  background: #03a9f4;
  border-color: #03a9f4;
  color: #031018;
}

.ha-scene {
  flex: 1;
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.ha-meter {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ha-meter__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9aa0a6;
}

.ha-meter__row strong {
  color: #e8eaed;
  font-weight: 600;
}

.ha-meter__track {
  height: 6px;
  border-radius: 999px;
  background: #2f2f2f;
  overflow: hidden;
}

.ha-meter__track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0288d1, #03a9f4);
}

.ha-climate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ha-climate__btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #2a2a2a;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

.ha-climate__temp {
  text-align: center;
}

.ha-climate__temp strong {
  display: block;
  font-size: 1.8rem;
  font-weight: 500;
  color: #fff;
  line-height: 1;
}

.ha-climate__temp span {
  font-size: 0.7rem;
  color: #9aa0a6;
}

.ha-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
  box-shadow: 0 0 0 4px rgba(102, 102, 102, 0.2);
}

.ha-status-dot.is-on {
  background: #28c840;
  box-shadow: 0 0 0 4px rgba(40, 200, 64, 0.2);
}

.ha-toast {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%) translateY(12px);
  z-index: 20;
  min-width: min(320px, calc(100% - 2rem));
  max-width: calc(100% - 2rem);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: #1c1c1c;
  border: 1px solid color-mix(in srgb, #03a9f4 35%, transparent);
  color: #e8eaed;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.ha-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ha-device--phone .ha-toast {
  bottom: 4.6rem;
}

.ha-phone-tabs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.15rem;
  padding: 0.45rem 0.4rem 0.7rem;
  background: #1c1c1c;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ha-phone-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9aa0a6;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.2rem;
  border-radius: 10px;
  cursor: pointer;
}

.ha-phone-tab span {
  font-size: 0.95rem;
}

.ha-phone-tab.is-active {
  color: #03a9f4;
  background: color-mix(in srgb, #03a9f4 12%, transparent);
}

.ha-empty {
  grid-column: 1 / -1;
  margin: 2rem 0;
  text-align: center;
  color: #9aa0a6;
}

@media (max-width: 700px) {
  .ha-sim-hero {
    padding: calc(5rem + env(safe-area-inset-top, 0px)) 1rem 1rem;
  }

  .ha-sim-hero__title {
    font-size: clamp(1.85rem, 8vw, 2.6rem);
  }

  .ha-sim-banner {
    font-size: 0.8rem;
    padding: 0.6rem 0.75rem;
  }

  .ha-sim-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .ha-sim-modes {
    width: 100%;
    justify-content: stretch;
  }

  .ha-sim-mode {
    flex: 1;
    text-align: center;
  }

  .ha-device--desktop .ha-screen {
    height: 70vh;
    min-height: 520px;
  }

  .ha-device--phone {
    max-width: 100%;
    padding: 8px;
    border-radius: 28px;
  }

  .ha-device--phone .ha-screen {
    height: min(72vh, 640px);
    min-height: 520px;
  }

  .ha-sidebar {
    display: none;
  }

  .ha-device--desktop .ha-app {
    flex-direction: column;
  }

  .ha-sim-cta {
    flex-direction: column;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .ha-sim-cta .showcase-cta {
    width: 100%;
    text-align: center;
  }
}
