/* =================== Reset i zmienne =================== */
* {
    /*box-sizing: border-box;*/
    margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

:root {
  --text: #fff;
  --accent: #ff6a00;
  --tube-dark: #2a2a2a;
  --tube-light: #dcdcdc;
  --shadow: 0 10px 40px rgba(0,0,0,.5);
  --gap: 0px; /* animowany odstęp */
}

@property --gap {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}

/* =================== Tło i scena =================== */
body {
  position: fixed;        /* nie pozwala „oddychać” wysokości dokumentu */
  inset: 0;               /* top/right/bottom/left: 0 */
  width: 100%;
  height: 100dvh;         /* stabilna wysokość okna */
  font-family: system-ui, Arial, sans-serif;
  color: var(--text);
  background: #000;       /* bez obrazka tutaj */
  display: grid;
  place-items: center;
}

/* Nieruchoma warstwa tła – NIE rusza się przy animacjach layoutu */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("../images/background.svg") center / cover no-repeat;
  transform: translateZ(0);
  will-change: transform;
}



.stage {
  width: min(1080px, 95vw);
  height: 100dvh;                       /* stała, jak viewport */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3.5vw, 40px);        /* było 3.5vh → 3.5vw */
  padding: clamp(12px, 4vw, 48px);      /* było 4vh → 4vw (stabilniej) */
}


/* =================== Tytuły =================== */
.title {
    margin-top:200px;
  width: min(760px, 80vw);
  height: auto;
  filter: drop-shadow(var(--shadow));
  transition: opacity .4s ease, transform .4s ease;
}
.title-results { display: none; }

.state-results .title-choose  { display: none; }
.state-results .title-results { display: block; }

/* =================== Plansza (gap animowany) =================== */
.board {
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  justify-items: center;
  column-gap: var(--gap);
  transition: --gap .6s ease;
}
.state-results .board {
  --gap: clamp(24px, 6vw, 80px);
}

/* =================== Sloty =================== */
.slot {
  width: min(520px, 45vw);
  display: grid;
  grid-template:
    "percent percent" auto
    "product bar"     1fr
    / 1fr auto;
  align-items: end;
  justify-items: center;
  gap: clamp(10px, 2vw, 20px);
  transition: transform .6s ease;
}
.slot-right {
  grid-template:
    "percent percent" auto
    "bar product"     1fr
    / auto 1fr;
}

/* Procenty – pojawiają się płynnie */
.percent {
  grid-area: percent;
  font-weight: 800;
  font-size: clamp(28px, 6.5vw, 64px);
  color: var(--accent);
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
  height: 1.1em;
  transition: opacity .4s ease, transform .4s ease;
}
.state-choose  .percent { opacity: 0; transform: translateY(-4px); }
.state-results .percent { opacity: 1; transform: translateY(0); }

.state-choose  .bar-tube { transform: scaleY(0); }
.state-results .bar-tube { transform: scaleY(1); }

/* =================== Produkt (butelka + podpis) =================== */
.product {
  grid-area: product;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.product img {
  width: min(340px, 34vw);
  height: auto;
  filter: drop-shadow(var(--shadow));
  cursor: pointer;
  transition: transform .6s ease, opacity .6s ease;
  will-change: transform;
}

/* płynny „rozjazd” i zmniejszenie po przejściu w wyniki */
.state-results .slot-left  .product img { transform: translateX(-10px) scale(.75); }
.state-results .slot-right .product img { transform: translateX( 10px) scale(.75); }

.product figcaption {
  font-weight: 600;
  letter-spacing: 1.2px;
  font-size: clamp(14px, 2.6vw, 22px);
  opacity: .95;
}

/* =================== Słupek =================== */
.bar-wrap {
  grid-area: bar;
  height: min(520px, 42dvh);   /* rezerwacja miejsca w pionie (stabilny layout) */
  width: clamp(60px, 10vw, 120px);   /* docelowa szerokość w wynikach */
  display: grid;
  place-items: end center;
  overflow: visible;
  transition: width .6s ease;        /* płynne rozwinięcie szerokości */
}

.state-choose .bar-wrap {
  width: 0px;
}

/* po kliknięciu „wysuwa się” */
.state-results .bar-wrap { height: min(520px, 42vh); }

.bar-tube {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background:
    radial-gradient(120% 60% at 50% 20%, rgba(255,255,255,.35), rgba(255,255,255,0) 55%),
    linear-gradient(180deg, var(--tube-light), var(--tube-dark));
  box-shadow:
    inset 0 0 8px rgba(0,0,0,.45),
    inset 0 -20px 30px rgba(0,0,0,.35),
    0 10px 30px rgba(0,0,0,.35);
  position: relative;
  overflow: hidden;

  transform-origin: bottom;
  transition: transform .6s ease;
}

.bar-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--fill, 0) * 1%);
  background: linear-gradient(180deg, #ff9130, var(--accent));
  transition: height 900ms ease-in-out;
}

/* =================== Responsywność =================== */
@media (max-width: 800px), (max-height: 900px) {
  .board { grid-template-columns: 1fr; }
  .slot  { width: min(520px, 88vw); }
}
