html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #000;
}

#pano {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 0;
  transition: filter 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.scene-hotspot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  padding: 13px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(22, 28, 24, 0.9);
  color: #fff;
  cursor: pointer;
  font: 700 14px/1 "Segoe UI", Arial, sans-serif;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(16, 197, 96, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.scene-hotspot:hover {
  transform: translateY(-2px);
  background: rgba(26, 36, 29, 0.95);
}

.scene-hotspot:active {
  transform: scale(0.97);
}

.scene-hotspot--primary {
  min-width: 212px;
  padding: 17px 26px;
  border-color: rgba(16, 197, 96, 0.34);
  background: linear-gradient(145deg, rgba(31, 54, 40, 0.96), rgba(17, 29, 22, 0.98));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.34),
    0 0 24px rgba(16, 197, 96, 0.24);
}

.scene-hotspot--primary:hover {
  background: linear-gradient(145deg, rgba(36, 64, 47, 0.98), rgba(19, 34, 25, 0.98));
  border-color: rgba(16, 197, 96, 0.48);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.36),
    0 0 28px rgba(16, 197, 96, 0.28);
}

.scene-hotspot--back {
  background: rgba(28, 31, 40, 0.9);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(96, 129, 255, 0.18);
}

.scene-hotspot__label {
  pointer-events: none;
  letter-spacing: 0.02em;
}

.scene-hotspot--primary .scene-hotspot__label {
  font-size: 16px;
}

body.camera-view-active #pano {
  filter: blur(8px);
}

#pano-overlay {
  pointer-events: none; /* żeby nie blokował sterowania */
}

.phone-shell {
  position: fixed;
  right: 28px;
  bottom: 28px;
  left: auto;
  top: auto;
  z-index: 30;
  pointer-events: none;
  --phone-width: 320px;
  --phone-height: 650px;
  transition: left 0.72s ease, top 0.72s ease, right 0.72s ease, bottom 0.72s ease, transform 0.72s ease;
  transform-origin: center center;
}
/*------------------------Camera related styles------------------------ */
.phone-shell.camera-active {
  /* transform and positioning are animated via JS for a smooth motion */
  pointer-events: auto;
}

.phone-shell.camera-active .app-shell {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.phone-screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #020809;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease 0.1s, visibility 0.3s ease 0.1s;
  display: flex;
  flex-direction: column;
}

.phone-shell.camera-active .phone-screen {
  opacity: 1;
  visibility: visible;
}

.phone-shell.dashboard-active .phone-frame,
.phone-shell.dashboard-active .phone-screen {
  background: #0d1117;
}

.phone-shell.dashboard-active .back-btn {
  top: 4cqi;
  right: 4cqi;
  bottom: auto;
  width: 12cqi;
  height: 12cqi;
  border-radius: 50%;
  font-size: 5cqi;
  z-index: 8;
}

.phone-shell.dashboard-active .switch-cam-btn,
.phone-shell.dashboard-active .prev-img-btn,
.phone-shell.dashboard-active .next-img-btn,
.phone-shell.dashboard-active .image-feed,
.phone-shell.dashboard-active .rec-label,
.phone-shell.dashboard-active .camera-status,
.phone-shell.dashboard-active .take-photo-btn,
.phone-shell.dashboard-active .zoom-in-btn,
.phone-shell.dashboard-active .zoom-out-btn,
.phone-shell.dashboard-active .camera-date,
.phone-shell.dashboard-active .camera-location,
.phone-shell.dashboard-active .camera-flash,
.phone-shell.dashboard-active .video-feed {
  display: none !important;
}

.phone-shell.dashboard-active .phone-dashboard-demo {
  --dashboard-phone-top-safe: clamp(14px, 6.25cqi, 20px);
  --dashboard-phone-right-safe: 0px;
  --dashboard-phone-bottom-safe: 0px;
  --dashboard-phone-left-safe: 0px;
  transform: rotate(-90deg);
  transform-origin: center center;
  width: calc(var(--dashboard-frame-height, var(--phone-height)) - var(--dashboard-phone-top-safe) - var(--dashboard-phone-bottom-safe));
  height: calc(var(--dashboard-frame-width, var(--phone-width)) - var(--dashboard-phone-left-safe) - var(--dashboard-phone-right-safe));
  left: calc(((var(--dashboard-frame-width, var(--phone-width)) - var(--dashboard-frame-height, var(--phone-height))) + var(--dashboard-phone-top-safe) + var(--dashboard-phone-bottom-safe) + var(--dashboard-phone-left-safe) - var(--dashboard-phone-right-safe)) / 2);
  top: calc(((var(--dashboard-frame-height, var(--phone-height)) - var(--dashboard-frame-width, var(--phone-width))) + var(--dashboard-phone-top-safe) - var(--dashboard-phone-bottom-safe) + var(--dashboard-phone-left-safe) + var(--dashboard-phone-right-safe)) / 2);
}

.back-btn {
  position: absolute;
  bottom: 4.6875cqi;
  right: 7.25cqi;
  width: 42cqi;
  height: 10cqi;
  border: none;
  background: rgb(0,0,0,0.6);
  color: #fff;
  border-radius: 2.5cqi;
  cursor: pointer;
  font-size: 5cqi;
  z-index: 5;
  transition: width 0.3s ease, right 0.3s ease, background 0.2s ease, transform 0.1s ease;
}

.back-btn.split {
  right: 7.75cqi;
  width: 20cqi;
}

.back-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}

.back-btn:active {
  transform: scale(0.95);
}

.switch-cam-btn {
  position: absolute;
  bottom: 4.6875cqi;
  left: 7.25cqi;
  width: 42cqi;
  height: 10cqi;
  border: none;
  background: rgb(0,0,0,0.6);
  color: #fff;
  border-radius: 2.5cqi;
  cursor: pointer;
  font-size: 5cqi;
  z-index: 5;
  transition: width 0.3s ease, left 0.3s ease, background 0.2s ease, transform 0.1s ease;
}

.switch-cam-btn.split {
  left: 7.75cqi;
  width: 20cqi;
}

.switch-cam-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}

.switch-cam-btn:active {
  transform: scale(0.95);
}

.prev-img-btn {
  position: absolute;
  bottom: 4.6875cqi;
  left: 29.25cqi;
  width: 20cqi;
  height: 10cqi;
  border: none;
  background: rgb(0,0,0,0.6);
  color: #fff;
  border-radius: 2.5cqi;
  cursor: pointer;
  font-size: 5cqi;
  z-index: 5;
  display: none;
  transition: background 0.2s ease, transform 0.1s ease;
}

.prev-img-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}

.prev-img-btn:active {
  transform: translateX(-1cqi) scale(0.95);
}

.next-img-btn {
  position: absolute;
  bottom: 4.6875cqi;
  right: 29.25cqi;
  width: 20cqi;
  height: 10cqi;
  border: none;
  background: rgb(0,0,0,0.6);
  color: #fff;
  border-radius: 2.5cqi;
  cursor: pointer;
  font-size: 5cqi;
  z-index: 5;
  display: none;
  transition: background 0.2s ease, transform 0.1s ease;
}

.next-img-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}

.next-img-btn:active {
  transform: translateX(1cqi) scale(0.95);
}

.image-feed {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
  display: none;
  z-index: 1;
}

.image-feed img {
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  height: 300cqi;
  cursor: grab;
  filter: grayscale(100%);
  transform-origin: top left;
  transform: rotate(-90deg) translateX(-100%);
  transition: opacity 0.3s ease;
}

.image-feed img:active {
  cursor: grabbing;
}

.rec-label {
  position: absolute;
  bottom: 26.5625cqi;
  left: 3.125cqi;
  display: inline-flex;
  align-items: center;
  gap: 2.5cqi;
  color: #ff5b5b;
  z-index: 5;
  font-size: 4.0625cqi;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-90deg);
}

.rec-dot {
  width: 3.125cqi;
  height: 3.125cqi;
  border-radius: 50%;
  background: #ff3b3b;
  box-shadow: 0 0 2.5cqi rgba(255, 59, 59, 0.85);
  animation: blink-rec 1s steps(1, end) infinite;
}

.camera-status {
  position: absolute;
  top: 21.875cqi;
  left: 5.625cqi;
  z-index: 5;
  color: #fff;
  font-size: 4.0625cqi;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-90deg);
}

.take-photo-btn {
  position: absolute;
  top: 50%;
  right: 4.6875cqi;
  width: 15cqi;
  height: 15cqi;
  border: 0.9375cqi solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  transform: translateY(-50%);
  transition: transform 0.14s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.take-photo-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 1.25cqi rgba(255, 255, 255, 0.08);
}

.take-photo-btn:active {
  transform: translateY(-50%) scale(0.94);
}

.take-photo-btn-inner {
  width: 8.125cqi;
  height: 8.125cqi;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 0 0 0.9375cqi rgba(0, 0, 0, 0.1);
}

.camera-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

.camera-flash.active {
  animation: camera-flash 240ms ease-out;
}

.zoom-in-btn, .zoom-out-btn {
  position: absolute;
  left: 5.625cqi;
  z-index: 5;
  width: 7.5cqi;
  height: 7.5cqi;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 5cqi;
  transform: rotate(-90deg);
  display: none;
  transition: background 0.2s ease, transform 0.1s ease;
}

.zoom-in-btn:hover, .zoom-out-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}

.zoom-in-btn:active, .zoom-out-btn:active {
  transform: rotate(-90deg) scale(0.95);
}

.zoom-in-btn { top: 33cqi; }
.zoom-out-btn { top: 43cqi; }

.camera-date {
  position: absolute;
  top: 17.1875cqi;
  right: 10.3125cqi;
  z-index: 5;
  color: #fff;
  font-size: 4.0625cqi;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-90deg);
  transform-origin: right center;
}

.camera-location {
  position: absolute;
  bottom: 19cqi; /* Anchors the start of the text */
  right: 10.3125cqi;
  z-index: 5;
  color: #fff;
  font-size: 4.0625cqi;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-90deg) translateX(100%);
  transform-origin: right center;
}

.corner-bracket {
  position: absolute;
  width: 9.375cqi;
  height: 9.375cqi;
  border-color: rgba(255, 255, 255, 0.7);
  border-style: solid;
  z-index: 2;
}
.corner-bracket.top-left {
  top: 15.625cqi;
  left: 4.6875cqi;
  border-width: 0.9375cqi 0 0 0.9375cqi;
}
.corner-bracket.top-right {
  top: 15.625cqi;
  right: 4.6875cqi;
  border-width: 0.9375cqi 0.9375cqi 0 0;
}
.corner-bracket.bottom-left {
  bottom: 18.75cqi;
  left: 4.6875cqi;
  border-width: 0 0 0.9375cqi 0.9375cqi;
}
.corner-bracket.bottom-right {
  bottom: 18.75cqi;
  right: 4.6875cqi;
  border-width: 0 0.9375cqi 0.9375cqi 0;
}

.video-feed {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 25% 20%, rgba(43, 255, 168, 0.08), transparent 18%),
              radial-gradient(circle at 80% 32%, rgba(32, 163, 255, 0.06), transparent 12%),
              linear-gradient(180deg, #081311 0%, #021111 35%, #041a1b 100%);
  overflow: hidden;
}

.video-feed video {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100cqi * 650 / 320);
  height: 100cqi;
  transform-origin: top left;
  transform: rotate(-90deg) translateX(-100%);
  object-fit: cover;
}

.video-feed::before,
.image-feed::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 100% 18px;
  opacity: 0.35;
  animation: scanlines 0.8s linear infinite;
  z-index: 1;
  pointer-events: none;
}

.video-feed::after,
.image-feed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.03), transparent 20%);
  opacity: 0.22;
  mix-blend-mode: screen;
  animation: noise 0.28s steps(2) infinite;
  z-index: 1;
  pointer-events: none;
}

@keyframes blink-rec {
  0%, 40%, 100% { opacity: 1; }
  45%, 95% { opacity: 0.25; }
}

@keyframes scanlines {
  from { background-position: 0 0; }
  to { background-position: 0 18px; }
}

@keyframes noise {
  0%, 100% { opacity: 0.22; }
  50% { opacity: 0.1; }
}

@keyframes camera-flash {
  0% { opacity: 0; }
  18% { opacity: 0.9; }
  100% { opacity: 0; }
}
/*-----------------------Camera related styles end------------------------*/
.phone-frame {
  position: relative;
  width: min(var(--phone-width), 85vw, calc((100vh - 80px) * 320 / 650));
  container-type: inline-size;
  height: auto;
  aspect-ratio: 320/650;
  border-radius: 28px;
  background: #111;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 6px 20px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255,255,255,0.08);
  overflow: hidden;
  pointer-events: auto;
}

.phone-notch {
  position: absolute;
  top: 3.125cqi;
  left: 50%;
  transform: translateX(-50%);
  width: 34.375cqi;
  height: 5.625cqi;
  background: #0a0a0a;
  border-radius: 0 0 4.375cqi 4.375cqi;
  z-index: 5;
}

.app-shell {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: rgba(8, 8, 8, 0.92);
  color: #fff;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-header {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 10px;
  border-bottom: 1px solid #125D34;
  background: linear-gradient(to bottom, rgba(20,20,20,0.96), rgba(20,20,20,0.88));
  box-sizing: border-box;
}

.app-header-logo {
  display: block;
  width: min(110px, 46%);
  max-height: 42px;
  object-fit: contain;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.hamburger {
  position: relative;
  width: 18px;
  height: 12px;
  display: inline-block;
}

.hamburger::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 5px 0 #fff, 0 10px 0 #fff;
}

.phone-shell.minimized {
  transform: scale(0.22) !important;
  transform-origin: bottom right !important;
}
.phone-shell.minimized .phone-frame {
  cursor: grab;
}
.phone-shell.minimized.dragging .phone-frame {
  cursor: grabbing;
}
.phone-shell.dragging {
  transition: none !important;
}
.phone-shell.minimized .phone-frame:hover {
  box-shadow: 0 0 0 12px rgba(255, 255, 255, 0.1);
}
.phone-shell.minimized .app-shell,
.phone-shell.minimized .phone-screen {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.info-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d7f2d7;
  color: #1b1b1b;
  font-size: 12px;
  font-weight: 700;
}

.app-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 18px 5% 80px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Webkit Scrollbar Styling */
.app-content::-webkit-scrollbar {
  width: 6px;
}

.app-content::-webkit-scrollbar-track {
  background: transparent;
}

.app-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.app-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app-content.garage-controls-active {
  align-items: stretch;
  padding-bottom: 22px;
}

.card-grid {
  width: 100%;
  display: grid;
  gap: 14px;
}

.card-grid.garage-controls {
  min-height: 100%;
  grid-template-rows: auto 1fr auto;
}

.two-cards {
  grid-template-columns: repeat(2, 1fr);
}

.app-card {
  --app-card-accent: #0BA755;
  --app-card-dark: #062315;
  --app-card-deep: #0a3320;
  --app-card-glow: rgba(11, 167, 85, 0.16);
  --app-card-hover-glow: rgba(11, 167, 85, 0.26);
  --app-card-icon-bg: rgba(11, 167, 85, 0.11);
  --app-card-active-ring: rgba(11, 167, 85, 0.22);
  --app-card-icon-filter: brightness(0) saturate(100%) invert(47%) sepia(92%) saturate(630%) hue-rotate(104deg) brightness(91%) contrast(91%);
  aspect-ratio: 1 / 1;
  border: 1px solid var(--app-card-accent);
  border-radius: 13px;
  background: linear-gradient(90deg, var(--app-card-dark) 0%, var(--app-card-deep) 46%, var(--app-card-glow) 100%);
  color: #dce2df;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 14px 10px 16px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

#toggleBlinds {
  --app-card-accent: #4da3ff;
  --app-card-dark: #0a1c2f;
  --app-card-deep: #112f4d;
  --app-card-glow: rgba(77, 163, 255, 0.16);
  --app-card-hover-glow: rgba(77, 163, 255, 0.27);
  --app-card-icon-bg: rgba(77, 163, 255, 0.12);
  --app-card-active-ring: rgba(77, 163, 255, 0.22);
  --app-card-icon-filter: brightness(0) saturate(100%) invert(63%) sepia(47%) saturate(3991%) hue-rotate(185deg) brightness(102%) contrast(101%);
}

#toggleAC {
  --app-card-accent: #F4BC3C;
  --app-card-dark: #30240b;
  --app-card-deep: #4a3510;
  --app-card-glow: rgba(244, 188, 60, 0.15);
  --app-card-hover-glow: rgba(244, 188, 60, 0.25);
  --app-card-icon-bg: rgba(244, 188, 60, 0.12);
  --app-card-active-ring: rgba(244, 188, 60, 0.22);
  --app-card-icon-filter: brightness(0) saturate(100%) invert(78%) sepia(97%) saturate(1084%) hue-rotate(335deg) brightness(101%) contrast(91%);
}

#toggleCamera {
  --app-card-accent: #EC5252;
  --app-card-dark: #2d0d0d;
  --app-card-deep: #4b1515;
  --app-card-glow: rgba(236, 82, 82, 0.15);
  --app-card-hover-glow: rgba(236, 82, 82, 0.25);
  --app-card-icon-bg: rgba(236, 82, 82, 0.12);
  --app-card-active-ring: rgba(236, 82, 82, 0.22);
  --app-card-icon-filter: brightness(0) saturate(100%) invert(48%) sepia(83%) saturate(1199%) hue-rotate(324deg) brightness(96%) contrast(93%);
}

#toggleGarageDoor,
#garageBackToRoom,
#toggleDashboardDemo {
  --app-card-accent: #f472b6;
  --app-card-dark: #311123;
  --app-card-deep: #4b1a35;
  --app-card-glow: rgba(244, 114, 182, 0.16);
  --app-card-hover-glow: rgba(244, 114, 182, 0.26);
  --app-card-icon-bg: rgba(244, 114, 182, 0.12);
  --app-card-active-ring: rgba(244, 114, 182, 0.22);
  --app-card-icon-filter: brightness(0) saturate(100%) invert(62%) sepia(56%) saturate(1455%) hue-rotate(292deg) brightness(101%) contrast(91%);
}

#garageBackToRoom {
  grid-column: 1 / -1;
  align-self: end;
  aspect-ratio: auto;
  min-height: 118px;
}

#toggleDashboardDemo {
  --app-card-accent: #0BA755;
  --app-card-dark: #062315;
  --app-card-deep: #0a3320;
  --app-card-glow: rgba(11, 167, 85, 0.16);
  --app-card-hover-glow: rgba(11, 167, 85, 0.26);
  --app-card-icon-bg: rgba(11, 167, 85, 0.11);
  --app-card-active-ring: rgba(11, 167, 85, 0.22);
}

#openClimate {
  --app-card-accent: #4da3ff;
  --app-card-dark: #0a1c2f;
  --app-card-deep: #112f4d;
  --app-card-glow: rgba(77, 163, 255, 0.16);
  --app-card-hover-glow: rgba(77, 163, 255, 0.27);
  --app-card-icon-bg: rgba(77, 163, 255, 0.12);
  --app-card-active-ring: rgba(77, 163, 255, 0.22);
}

#openConsumption {
  --app-card-accent: #F4BC3C;
  --app-card-dark: #30240b;
  --app-card-deep: #4a3510;
  --app-card-glow: rgba(244, 188, 60, 0.15);
  --app-card-hover-glow: rgba(244, 188, 60, 0.25);
  --app-card-icon-bg: rgba(244, 188, 60, 0.12);
  --app-card-active-ring: rgba(244, 188, 60, 0.22);
}

#openEnergy {
  --app-card-accent: #f472b6;
  --app-card-dark: #311123;
  --app-card-deep: #4b1a35;
  --app-card-glow: rgba(244, 114, 182, 0.16);
  --app-card-hover-glow: rgba(244, 114, 182, 0.26);
  --app-card-icon-bg: rgba(244, 114, 182, 0.12);
  --app-card-active-ring: rgba(244, 114, 182, 0.22);
}

#openTarifario {
  --app-card-accent: #0BA755;
  --app-card-dark: #062315;
  --app-card-deep: #0a3320;
  --app-card-glow: rgba(11, 167, 85, 0.16);
  --app-card-hover-glow: rgba(11, 167, 85, 0.26);
  --app-card-icon-bg: rgba(11, 167, 85, 0.11);
  --app-card-active-ring: rgba(11, 167, 85, 0.22);
}

.app-card[hidden] {
  display: none;
}

#toggleLights:not(.active),
#toggleBlinds:not(.active),
#toggleAC:not(.active),
#garageBackToRoom:not(.active),
#toggleGarageDoor:not(.active) {
  border-color: rgba(255, 255, 255, 0.11);
  background: linear-gradient(90deg, #111719 0%, #151d20 58%, rgba(255, 255, 255, 0.03) 100%);
  color: #8f9a96;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

#toggleLights:not(.active) .card-icon,
#toggleBlinds:not(.active) .card-icon,
#toggleAC:not(.active) .card-icon,
#garageBackToRoom:not(.active) .card-icon,
#toggleGarageDoor:not(.active) .card-icon {
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

#toggleLights:not(.active) .card-icon-img,
#toggleBlinds:not(.active) .card-icon-img,
#toggleAC:not(.active) .card-icon-img,
#garageBackToRoom:not(.active) .card-icon-svg,
#toggleGarageDoor:not(.active) .card-icon-img {
  filter: grayscale(1) brightness(0.95) opacity(0.55);
}

#toggleLights:not(.active) .card-label,
#toggleBlinds:not(.active) .card-label,
#toggleAC:not(.active) .card-label,
#garageBackToRoom:not(.active) .card-label,
#toggleGarageDoor:not(.active) .card-label {
  color: #8f9a96;
}

.app-card:hover {
  background: linear-gradient(90deg, var(--app-card-dark) 0%, var(--app-card-deep) 38%, var(--app-card-hover-glow) 100%);
}

#toggleLights:not(.active):hover,
#toggleBlinds:not(.active):hover,
#toggleAC:not(.active):hover,
#garageBackToRoom:not(.active):hover,
#toggleGarageDoor:not(.active):hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(90deg, #151d20 0%, #1a2428 58%, rgba(255, 255, 255, 0.055) 100%);
}

.app-card:active {
  transform: translateY(1px) scale(0.98);
}

.app-card.active {
  background: linear-gradient(90deg, var(--app-card-dark) 0%, var(--app-card-deep) 34%, var(--app-card-hover-glow) 100%);
  color: var(--app-card-accent);
  box-shadow: inset 0 0 0 1px var(--app-card-active-ring);
}

.app-card.active .card-label {
  color: var(--app-card-accent);
}

.card-icon {
  align-self: center;
  width: 78px;
  height: 78px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--app-card-accent);
  background: var(--app-card-icon-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.card-label {
  align-self: end;
  color: #cfd6d3;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.card-icon-img {
  width: 58px;
  height: 58px;
  display: block;
  filter: var(--app-card-icon-filter);
  object-fit: contain;
  object-position: center;
}

.card-icon-svg {
  width: 52px;
  height: 52px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-icon-symbol {
  color: currentColor;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

/* trochę mniejszy telefon na mniejszych ekranach desktopowych; transl.: a slightly smaller phone on smaller desktop screens*/
@media (max-width: 1200px) {
  .phone-shell {
    --phone-width: 290px;
    --phone-height: 590px;
  }
}

/* na bardzo małych ekranach telefon nie powinien zasłaniać wszystkiego; transl.: on very small screens the phone shouldn't cover everything */
@media (max-width: 700px) {
  .phone-shell {
    right: 12px;
    bottom: 12px;
    --phone-width: 220px;
    --phone-height: 450px;
  }

  .phone-frame {
    border-radius: 22px;
  }

  .app-content {
    padding-top: 14px;
  }

  .card-label {
    font-size: 13px;
  }

  .card-icon {
    width: 56px;
    height: 56px;
    border-radius: 15px;
  }

  .card-icon-img {
    width: 42px;
    height: 42px;
  }

  .card-icon-svg {
    width: 40px;
    height: 40px;
  }

  .card-icon-symbol {
    font-size: 34px;
  }
}

#toggleCamera .card-icon-img {
  transform: scale(1.08);
}

@container (max-width: 270px) {
  .two-cards {
    grid-template-columns: 1fr;
  }
  
  .app-content {
    align-items: flex-start;
    padding-bottom: 20px;
  }

  .app-card {
    aspect-ratio: auto;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto;
    padding: 12px 18px;
    justify-items: start;
    min-height: 92px;
  }

  .card-icon {
    width: 58px;
    height: 58px;
  }

  .card-icon-img {
    width: 44px;
    height: 44px;
  }

  .card-icon-svg {
    width: 42px;
    height: 42px;
  }

  .card-icon-symbol {
    font-size: 35px;
  }
  
  .card-label {
    align-self: center;
    text-align: left;
  }
}

/* Settings Menu */
.app-settings-menu {
  position: absolute;
  top: 0;
  left: -100%; /* Start off-screen */
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 15, 0.98);
  backdrop-filter: blur(10px);
  z-index: 10;
  transition: left 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 72px 20px 20px;
  box-sizing: border-box;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.app-settings-menu.open {
  left: 0;
}

.settings-header {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.settings-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  text-align: center;
}

.menu-back-btn,
.close-settings-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
}

.menu-back-btn {
  visibility: hidden;
}

.menu-back-btn.visible {
  visibility: visible;
}

.menu-view {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
}

.menu-view.active {
  display: block;
}

.menu-home-buttons {
  display: grid;
  gap: 14px;
}

.menu-nav-btn {
  border: none;
  border-radius: 18px;
  padding: 18px;
  text-align: left;
  background: linear-gradient(145deg, rgba(53,53,53,0.92), rgba(30,30,30,0.98));
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  box-shadow:
    0 12px 24px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.menu-nav-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(145deg, rgba(62,62,62,0.95), rgba(34,34,34,1));
}

.menu-nav-btn:active {
  transform: scale(0.98);
}

.menu-nav-title {
  font-size: 18px;
  font-weight: 700;
}

.menu-nav-subtitle {
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  line-height: 1.4;
}

.gallery-empty {
  margin: 8px 0 0;
  color: rgba(255,255,255,0.72);
  text-align: center;
}

.gallery-empty[hidden] {
  display: none;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gallery-item {
  margin: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  overflow: hidden;
}

.gallery-media {
  position: relative;
}

.gallery-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #000;
}

.gallery-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.gallery-item:hover .gallery-delete-btn,
.gallery-item:focus-within .gallery-delete-btn {
  opacity: 1;
  transform: scale(1);
}

.gallery-delete-btn:hover {
  background: rgba(185, 28, 28, 0.92);
}

.gallery-delete-btn:active {
  transform: scale(0.94);
}

.gallery-caption {
  padding: 10px 12px 12px;
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.setting-label {
  font-size: 16px;
}

@container (max-width: 270px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #333;
  transition: .4s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider { background-color: #10c560; }
input:checked + .slider:before { transform: translateX(22px); }

/* HUD Customization */
.phone-screen.hud-green .camera-status,
.phone-screen.hud-green .camera-date,
.phone-screen.hud-green .camera-location,
.phone-screen.hud-green .rec-label {
  color: #00FF00; /* Lime green */
}

.phone-screen.hud-green .corner-bracket {
  border-color: #00FF00;
}

.phone-screen.hud-hidden .rec-label,
.phone-screen.hud-hidden .camera-status,
.phone-screen.hud-hidden .camera-date,
.phone-screen.hud-hidden .camera-location,
.phone-screen.hud-hidden .corner-bracket,
.phone-screen.hud-hidden .zoom-in-btn,
.phone-screen.hud-hidden .zoom-out-btn {
  display: none !important; /* Use important to override inline styles from JS */
}
