/* ---------------------------------------------------------------
   Prototyp "Obłożenie siłowni".
   Ekran w ramce telefonu — na desktopie wygląda jak mockup apki,
   na telefonie ramka znika i zostaje sama aplikacja.
   --------------------------------------------------------------- */

:root {
  --bg:        #07090c;
  --screen:    #0e1216;
  --card:      #161b22;
  --card-2:    #1d232c;
  --line:      #262d38;
  --text:      #f4f7fa;
  --text-dim:  #8a94a3;

  --low:       #22c55e;
  --mid:       #f59e0b;
  --high:      #ef4444;
  --accent:    #4f8cff;

  /* kolor bieżącego poziomu ruchu — ustawiany z JS */
  --level:     var(--text-dim);

  --radius:    18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  min-height: 100vh;
}

/* --- scena z poświatą w kolorze obłożenia --- */
.stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  overflow: hidden;
}
.glow {
  position: fixed;
  inset: -30% 0 auto;
  height: 70vh;
  background: radial-gradient(circle at 50% 40%, var(--level), transparent 62%);
  opacity: .18;
  filter: blur(60px);
  transition: opacity .8s, background .8s;
  pointer-events: none;
}

/* --- ramka telefonu --- */
.phone {
  position: relative;
  width: 100%;
  max-width: 390px;
  height: min(844px, calc(100vh - 56px));
  background: var(--screen);
  border: 10px solid #14181e;
  border-radius: 46px;
  box-shadow: 0 40px 90px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.phone__notch {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 128px; height: 26px;
  background: #14181e;
  border-radius: 0 0 16px 16px;
  z-index: 4;
}

.statusbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 26px 4px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.statusbar__icons { display: flex; align-items: center; gap: 5px; }
.statusbar svg { fill: currentColor; }

/* --- przewijana zawartość ekranu --- */
.screen {
  flex: 1;
  overflow-y: auto;
  /* Bez tego rosnąca lista odbić spycha zawartość i ekran sam odjeżdża. */
  overflow-anchor: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

/* --- nagłówek apki --- */
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-header__brand { display: flex; align-items: center; gap: 10px; }
.app-header__brand strong { display: block; font-size: 14px; font-weight: 650; }
.app-header__brand small { display: block; font-size: 11px; color: var(--text-dim); }
.logo {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), #2f5fd0);
  font-size: 15px; font-weight: 700;
}
.badge-demo {
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
}

/* --- sekcja "teraz" --- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 4px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-dim); letter-spacing: .02em; }

.ring-wrap { position: relative; width: 210px; height: 210px; margin: 2px 0; }
.ring { width: 100%; height: 100%; }
.ring__track {
  fill: none;
  stroke: rgba(255,255,255,.06);
  stroke-width: 13;
}
.ring__value {
  fill: none;
  stroke: var(--level);
  stroke-width: 13;
  stroke-linecap: round;
  transition: stroke-dashoffset .9s cubic-bezier(.4,0,.2,1), stroke .6s;
  filter: drop-shadow(0 0 9px var(--level));
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0;
}
.ring-center__label { font-size: 12px; color: var(--text-dim); }
.ring-center__value {
  font-size: 60px; font-weight: 700; line-height: 1.05;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}
.ring-center__unit { font-size: 13px; color: var(--text-dim); margin-top: -2px; }

.status {
  font-size: 15px; font-weight: 650;
  color: var(--level);
  background: color-mix(in srgb, var(--level) 14%, transparent);
  border-radius: 999px;
  padding: 6px 16px;
  transition: color .5s, background .5s;
}
.status-note { font-size: 12px; color: var(--text-dim); }

/* --- karty --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card__head .muted { white-space: nowrap; }
.card__title { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
.muted { font-size: 11px; color: var(--text-dim); }
.muted--tiny { font-size: 10px; opacity: .8; }

/* --- podgląd bramki na żywo --- */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--low);
  box-shadow: 0 0 0 0 rgba(34,197,94,.7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.feed { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.feed li {
  display: flex; align-items: center; gap: 9px;
  background: var(--card-2);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  animation: slide-in .4s ease-out both;
}
.feed .arrow {
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.feed .arrow--in  { background: rgba(34,197,94,.16); color: var(--low); }
.feed .arrow--out { background: rgba(138,148,163,.16); color: var(--text-dim); }
.feed .card-no { font-variant-numeric: tabular-nums; }
.feed .what { color: var(--text-dim); }
.feed time { margin-left: auto; color: var(--text-dim); font-variant-numeric: tabular-nums; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } }

/* --- wykres prognozy --- */
.chart-wrap { width: 100%; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; fill: var(--text-dim); font-size: 11px; }
.chart .val { fill: var(--text); font-size: 11px; font-weight: 600; }
.chart .best-label { fill: var(--text); font-size: 10px; font-weight: 600; }

.tip {
  font-size: 14px; font-weight: 600;
  background: rgba(79,140,255,.1);
  border: 1px solid rgba(79,140,255,.28);
  border-radius: 12px;
  padding: 12px 14px;
}
.tip strong { color: var(--accent); }

/* --- progi powiadomienia --- */
.chips { display: flex; gap: 8px; }
.chip {
  flex: 1;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.chip:active { transform: scale(.97); }
.chip[aria-checked="true"] { border-color: var(--accent); background: rgba(79,140,255,.16); }

.btn {
  font: inherit; font-size: 15px; font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0; border-radius: 12px;
  padding: 13px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:disabled { opacity: .3; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(.98); }

.confirm {
  font-size: 13px; font-weight: 600;
  color: var(--low);
  background: rgba(34,197,94,.1);
  border-radius: 12px;
  padding: 11px 13px;
}

/* --- ankieta --- */
.question { display: flex; flex-direction: column; gap: 9px; }
.question__text { font-size: 13px; }
.options { display: flex; flex-direction: column; gap: 7px; }
.option {
  font: inherit; font-size: 13px; text-align: left;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, opacity .3s, transform .1s;
}
.option:active { transform: scale(.99); }
.option[aria-pressed="true"] { border-color: var(--accent); background: rgba(79,140,255,.16); font-weight: 600; }
.question--answered .option { cursor: default; }
.question--answered .option:not([aria-pressed="true"]) { opacity: .35; }

.footer { text-align: center; padding: 2px 8px 6px; }
.footer p { font-size: 10px; color: var(--text-dim); }

/* --- powiadomienie push --- */
.push {
  position: absolute;
  top: 14px; left: 12px; right: 12px;
  z-index: 6;
  display: flex; align-items: center; gap: 11px;
  background: rgba(38,45,56,.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.6);
  animation: push-in .45s cubic-bezier(.2,1.1,.4,1) both;
}
.push--out { animation: push-out .35s ease-in both; }
.push__icon {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), #2f5fd0);
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
}
.push__title { font-size: 12px; font-weight: 650; }
.push__title span { font-weight: 400; color: var(--text-dim); margin-left: 4px; }
.push__text { font-size: 12px; color: #dbe2ea; }
@keyframes push-in  { from { opacity: 0; transform: translateY(-70px) scale(.94); } }
@keyframes push-out { to   { opacity: 0; transform: translateY(-70px) scale(.94); } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- na telefonie ramka znika, zostaje sama apka --- */
@media (max-width: 520px) {
  .stage { padding: 0; align-items: stretch; }
  .phone {
    max-width: none;
    height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .phone__notch { display: none; }
  .statusbar { display: none; }
  .screen { padding-top: max(14px, env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
