/* ==========================================================================
   Vizualizér klimatizácií — celoobrazovková aplikácia nad fotoaparátom
   Písmo a farby nadväzujú na zvyšok webu (Poppins, #202020, akcent #0a5c8a).
   ========================================================================== */
:root {
  --ar-font: Poppins, "Trebuchet MS", "Lucida Sans Unicode", Arial, Helvetica, sans-serif;
  --ar-dark: #202020;
  --ar-accent: #0a5c8a;
  --ar-line: rgba(255, 255, 255, .16);
  --ar-glass: rgba(18, 18, 18, .76);
  --ar-radius: 70px;
  --ar-top: env(safe-area-inset-top, 0px);
  --ar-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: #111;
  color: #fff;
  font-family: var(--ar-font);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
h1, h2 { font-weight: 400; margin: 0; }
p, ol { margin: 0; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- tlačidlá ---------- */
.ar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid #fff;
  border-radius: var(--ar-radius);
  background: transparent;
  color: #fff;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.ar-btn--light { background: #fff; color: var(--ar-dark); }
.ar-btn--ghost { border-color: transparent; }
.ar-btn--block { width: 100%; }
.ar-btn:disabled { opacity: .55; cursor: default; }

.ar-icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 17px;
  text-decoration: none;
}
.ar-icon-btn svg { width: 20px; height: 20px; }

/* ---------- scéna ---------- */
.ar-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #161616;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ar-stage::after {                /* záblesk pri odfotení */
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease-out;
}
.ar-stage.is-flash::after { opacity: .75; transition: none; }

.ar-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ar-media--contain { object-fit: contain; }

.ar-unit {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;          /* natáča sa okolo stredu cez translate(-50%,-50%) v JS */
  pointer-events: none;
  will-change: transform;
}
.ar-unit img { display: block; width: 100%; height: 100%; }
.ar-unit__rozmer {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  padding: 6px 11px;
  border-radius: var(--ar-radius);
  background: rgba(0, 0, 0, .62);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .25s;
}
.ar-unit.is-active .ar-unit__rozmer { opacity: 1; }

.ar-reticle {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  pointer-events: none;
}
.ar-reticle::before,
.ar-reticle::after {
  content: "";
  position: absolute;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
}
.ar-reticle::before { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.ar-reticle::after { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; }

/* ---------- horná lišta a štítky ---------- */
.ar-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--ar-top) + 10px) 16px 18px;
  background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.ar-top > * { pointer-events: auto; }
.ar-top__title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.ar-top__title span {
  display: block;
  overflow: hidden;
  font-size: 12px;
  opacity: .75;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ar-chips {
  position: fixed;
  top: calc(var(--ar-top) + 66px);
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
.ar-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--ar-line);
  border-radius: var(--ar-radius);
  background: rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  pointer-events: auto;
}
.ar-chip svg { width: 16px; height: 16px; flex: none; }
.ar-chip--quiet { pointer-events: none; }

.ar-toast {
  position: fixed;
  top: calc(var(--ar-top) + 114px);
  left: 50%;
  z-index: 7;
  width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 13.5px;
  line-height: 1.45;
  text-align: center;
  transform: translate(-50%, -6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.ar-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- spodný panel ---------- */
.ar-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 14px 0 calc(var(--ar-bottom) + 14px);
  border-radius: 20px 20px 0 0;
  background: var(--ar-glass);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.ar-models,
.ar-options {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 16px;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}
.ar-models::-webkit-scrollbar,
.ar-options::-webkit-scrollbar { display: none; }
.ar-models { scroll-snap-type: x proximity; scroll-padding: 0 16px; }

.ar-model {
  flex: none;
  width: 104px;
  padding: 8px 9px 9px;
  border: 1px solid var(--ar-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  text-align: left;
  scroll-snap-align: start;
}
.ar-model.is-active { border-color: #fff; background: #fff; color: var(--ar-dark); }
.ar-model__img {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin-bottom: 6px;
}
.ar-model__img img { max-width: 100%; max-height: 40px; }
.ar-model__brand {
  display: block;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .6;
}
.ar-model__name { display: block; font-size: 13px; line-height: 1.25; }

.ar-options { align-items: center; gap: 8px; padding-top: 12px; }
.ar-options:empty { display: none; }
.ar-opt {
  flex: none;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: var(--ar-radius);
  background: transparent;
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
}
.ar-opt.is-active { border-color: #fff; background: #fff; color: var(--ar-dark); }
.ar-swatch {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25);
}
.ar-swatch.is-active { border-color: #fff; box-shadow: inset 0 0 0 3px var(--ar-dark); }
.ar-sep { flex: none; width: 1px; height: 24px; background: var(--ar-line); }

.ar-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 0;
  color: rgba(255, 255, 255, .72);
  font-size: 12.5px;
  line-height: 1.35;
}
.ar-info span:last-child { text-align: right; }

.ar-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 0;
}
.ar-actions .ar-btn { padding-inline: 12px; font-size: 13.5px; }
.ar-actions .ar-btn:last-child { justify-self: end; }
.ar-actions .ar-btn:first-child { justify-self: start; }
.ar-shutter {
  position: relative;
  width: 66px;
  height: 66px;
  padding: 0;
  border: 4px solid #fff;
  border-radius: 50%;
  background: transparent;
}
.ar-shutter::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
}
.ar-shutter:active::after { transform: scale(.88); }

/* ---------- karty spodného panela ---------- */
.ar-tabs {
  display: flex;
  gap: 4px;
  margin: 0 16px 12px;
  padding: 4px;
  border-radius: var(--ar-radius);
  background: rgba(255, 255, 255, .08);
}
.ar-tab {
  flex: 1;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--ar-radius);
  background: transparent;
  color: rgba(255, 255, 255, .75);
  font-size: 13.5px;
  line-height: 1.2;
}
.ar-tab.is-active { background: #fff; color: var(--ar-dark); }
.ar-karta { min-height: 156px; }

.ar-poloha {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
}
.ar-dpad {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 4px;
  touch-action: none;
}
.ar-dpad button,
.ar-kruh {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ar-dpad button { border-radius: 12px; }
.ar-dpad button:active,
.ar-kruh:active { background: rgba(255, 255, 255, .28); }
.ar-dpad svg { width: 22px; height: 22px; }
.ar-dpad [data-posun="0,-1"] { grid-area: 1 / 2; }
.ar-dpad [data-posun="-1,0"] { grid-area: 2 / 1; }
.ar-dpad [data-stred] { grid-area: 2 / 2; border-color: #fff; background: #fff; color: var(--ar-dark); }
.ar-dpad [data-posun="1,0"] { grid-area: 2 / 3; }
.ar-dpad [data-posun="0,1"] { grid-area: 3 / 2; }
.ar-poloha__vpravo {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 10px;
}
.ar-btn--sm { min-height: 40px; padding: 8px 14px; font-size: 13px; }
.ar-krok {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.ar-krok__tlacidla { display: flex; gap: 6px; }
.ar-kruh {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}
.ar-prepinac {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: rgba(255, 255, 255, .8);
  font-size: 12.5px;
  line-height: 1.35;
}
.ar-prepinac input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #fff;
}

.ar-uhly {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 0 16px;
}
.ar-slider {
  display: grid;
  grid-template-columns: 96px 1fr 46px;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  font-size: 13px;
}
.ar-slider input { width: 100%; margin: 0; accent-color: #fff; }
.ar-slider output { text-align: right; font-variant-numeric: tabular-nums; }
.ar-uhly__spodok {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  color: rgba(255, 255, 255, .6);
  font-size: 12px;
  line-height: 1.35;
}
.ar-uhly__spodok .ar-btn { flex: none; }

/* ---------- meranie ---------- */
.ar-measure {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 18px 16px calc(var(--ar-bottom) + 16px);
  border-radius: 20px 20px 0 0;
  background: var(--ar-glass);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  font-size: 14px;
}
.ar-measure__actions,
.ar-panel__actions,
.ar-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.ar-measure__actions .ar-btn,
.ar-panel__actions .ar-btn { flex: 1 1 140px; }

/* ---------- dialógy ---------- */
.ar-panel {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--ar-bottom) + 16px);
  z-index: 8;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 18px;
  background: #1c1c1c;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.ar-panel h2 { font-size: 18px; line-height: 1.3; }
.ar-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.ar-panel__head output { font-size: 22px; }
.ar-panel__note {
  margin-top: 12px;
  color: rgba(255, 255, 255, .65);
  font-size: 13px;
  line-height: 1.5;
}
.ar-panel input[type="range"] { width: 100%; accent-color: #fff; }
.ar-steps {
  margin-top: 12px;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.5;
}
.ar-steps li + li { margin-top: 6px; }

.ar-result {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(var(--ar-top) + 16px) 16px calc(var(--ar-bottom) + 16px);
  background: rgba(10, 10, 10, .96);
}
.ar-result img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
}
.ar-result__actions { justify-content: center; margin-top: 0; }
.ar-result__actions .ar-btn { flex: 1 1 150px; max-width: 320px; }

/* ---------- úvod ---------- */
.ar-intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  padding: calc(var(--ar-top) + 20px) 20px calc(var(--ar-bottom) + 28px);
  background: #111;
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
}
.ar-intro__inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 460px;
  min-height: 100%;
  margin: 0 auto;
}
.ar-intro__back {
  align-self: flex-start;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, .7);
  font-size: 13px;
  text-decoration: none;
}
.ar-intro__wall {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  max-width: 100%;
  margin-bottom: 28px;
  border-radius: 18px;
  background: radial-gradient(120% 90% at 30% 15%, #f4f2ed 0%, #dedad2 65%, #cdc8be 100%);
}
.ar-intro__wall img {
  position: absolute;
  left: 21%;
  top: 34%;
  width: 58%;
  filter: drop-shadow(0 8px 9px rgba(0, 0, 0, .22));
}
.ar-intro__dim {
  position: absolute;
  left: 21%;
  top: 19%;
  width: 58%;
  padding-top: 5px;
  border-top: 1px solid rgba(32, 32, 32, .7);
  color: var(--ar-dark);
  font-size: 12px;
  line-height: 1;
  text-align: center;
}
.ar-intro__dim::before,
.ar-intro__dim::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 1px;
  height: 11px;
  background: rgba(32, 32, 32, .7);
}
.ar-intro__dim::before { left: 0; }
.ar-intro__dim::after { right: 0; }
.ar-intro__frame {                  /* rohy hľadáčika */
  --c: rgba(32, 32, 32, .55);
  position: absolute;
  inset: 8%;
  background:
    linear-gradient(var(--c), var(--c)) left top / 24px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 2px 24px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 24px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 2px 24px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 24px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 2px 24px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 24px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 2px 24px no-repeat;
}
.ar-eyebrow {
  display: block;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, .6);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.ar-intro h1 { font-size: clamp(26px, 7vw, 34px); line-height: 1.18; }
.ar-intro__lead {
  margin-top: 14px;
  color: rgba(255, 255, 255, .78);
  font-size: 15px;
}
.ar-intro__actions {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}
.ar-intro__error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(177, 39, 4, .22);
  border: 1px solid rgba(255, 120, 90, .45);
  font-size: 13.5px;
}
.ar-intro__note {
  margin-top: 18px;
  color: rgba(255, 255, 255, .5);
  font-size: 12.5px;
}

/* ---------- širšie obrazovky ---------- */
@media (min-width: 760px) {
  .ar-sheet {
    left: 50%;
    right: auto;
    bottom: 16px;
    width: 720px;
    border-radius: 20px;
    transform: translateX(-50%);
  }
  .ar-measure {
    left: 50%;
    right: auto;
    bottom: 16px;
    width: 520px;
    border-radius: 20px;
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ar-toast, .ar-stage::after, .ar-unit__rozmer { transition: none; }
}
