/* ============================================================
   Laboratorium wisnia.dev — wspólne style eksperymentów
   Pełnoekranowe płótno + pływający panel ze szkła (jedyna warstwa
   z rozmyciem — treść pod spodem zostaje czysta).
   ============================================================ */

:root {
  --bg: #000;
  --glass: rgba(28, 28, 30, 0.72);
  --glass-solid: #1c1c1e;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f5f7;
  --muted: #a1a1a6;        /* 7,4:1 na #1c1c1e */
  --accent: #ff375f;       /* wiśnia — tylko akcje i stan */
  --accent-ink: #fff;
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- górny pasek ---------- */
.lab-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  pointer-events: none;
}
.lab-bar a {
  pointer-events: auto;
  text-decoration: none;
  font-weight: 600; font-size: 14px;
  padding: 9px 14px; border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--line);
  min-height: 40px; display: inline-flex; align-items: center;
}
.lab-home span { color: var(--accent); }

/* ---------- panel ---------- */
.lab-panel {
  position: fixed; z-index: 2;
  top: 72px; right: 16px;
  width: 340px;
  max-height: calc(100dvh - 92px);
  display: flex; flex-direction: column;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lab-panel-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 18px 6px;
}
.lab-panel-head > div { flex: 1; min-width: 0; }
.lab-kicker {
  display: block;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent);
  margin-bottom: 2px;
}
.lab-panel h1 {
  margin: 0;
  font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em;
}
.lab-toggle {
  flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.1); color: var(--text);
  display: none; place-items: center; cursor: pointer;
}
.lab-toggle svg { transition: transform .25s ease; }
.lab-panel[data-open="true"] .lab-toggle svg { transform: rotate(180deg); }

.lab-panel-body {
  overflow-y: auto;
  padding: 4px 18px 18px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.lab-lead { margin: 6px 0 14px; color: var(--muted); }

/* ---------- kontrolki ---------- */
.lab-controls { display: grid; gap: 14px; }
.ctl-label { font-size: 13px; color: var(--muted); }
.ctl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.ctl-value { font: 600 13px/1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; margin: 0;
  background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--p, 50%), rgba(255,255,255,.18) var(--p, 50%));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%; margin-top: -10px;
  background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.45);
}

.ctl-seg { display: grid; gap: 6px; }
.seg {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 2px; border-radius: 10px;
  background: rgba(118, 118, 128, 0.24);
}
.seg-btn {
  flex: 1 1 auto; min-height: 32px;
  border: 0; border-radius: 8px; padding: 6px 10px;
  background: transparent; color: var(--text);
  font: 500 13px/1.1 var(--font); cursor: pointer;
  white-space: nowrap;
}
.seg-btn[aria-checked="true"] { background: #636366; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.3); }

.ctl-select { display: grid; gap: 6px; }
.ctl-select select {
  min-height: 40px; border-radius: 10px; padding: 0 12px;
  background: rgba(118,118,128,.24); color: var(--text);
  border: 0; font: 15px var(--font);
}

.ctl-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-lab {
  flex: 1 1 auto; min-height: 40px;
  border: 0; border-radius: 999px; padding: 8px 16px;
  background: rgba(255,255,255,.12); color: var(--text);
  font: 600 14px var(--font); cursor: pointer;
}
.btn-lab:hover { background: rgba(255,255,255,.18); }
.btn-lab-primary { background: var(--accent); color: var(--accent-ink); }
.btn-lab-primary:hover { background: #ff5577; }

.ctl-readout {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.ctl-readout + .ctl-readout { margin-top: -14px; }
.ctl-readout-value { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.ctl-hint { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- nauka ---------- */
.lab-science {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.lab-science summary {
  cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  min-height: 32px;
}
.lab-science summary::-webkit-details-marker { display: none; }
.lab-science summary::after { content: "+"; font-size: 20px; color: var(--muted); }
.lab-science[open] summary::after { content: "−"; }
.lab-science p, .lab-science li { color: var(--muted); font-size: 14px; }
.lab-science strong { color: var(--text); }
.lab-science .eq {
  font: 14px/1.5 var(--mono); color: var(--text);
  background: rgba(255,255,255,.06); border-radius: 10px;
  padding: 10px 12px; overflow-x: auto; white-space: nowrap;
}
.lab-science ul { padding-left: 18px; }

.lab-nav {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 16px; font-size: 13px;
}
.lab-nav a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.lab-nav a:hover { color: var(--text); }

.lab-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding: 12px 14px;
  border-radius: 14px; text-decoration: none;
  background: rgba(255, 55, 95, 0.14);
  border: 1px solid rgba(255, 55, 95, 0.35);
  font-size: 13px; color: var(--muted);
}
.lab-cta b { display: block; color: var(--text); font-size: 15px; }
.lab-cta-phone { font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 8px 12px; white-space: nowrap; font-size: 14px; }

.lab-toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3; pointer-events: none;
  padding: 10px 16px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  font-size: 14px; color: var(--text);
  transition: opacity .4s ease;
  max-width: calc(100vw - 32px); text-align: center;
}
.lab-toast[hidden] { display: block; opacity: 0; }

.noscript {
  position: fixed; inset: auto 16px 16px; z-index: 4;
  padding: 16px; border-radius: 16px; background: var(--glass-solid);
}

/* ---------- telefon: panel jako arkusz od dołu ---------- */
@media (max-width: 760px) {
  .lab-panel {
    top: auto; right: 8px; left: 8px; bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 62dvh;
    border-radius: 22px;
  }
  .lab-panel-head { padding: 12px 14px 8px; }
  .lab-panel h1 { font-size: 19px; }
  .lab-toggle { display: grid; }
  .lab-panel[data-open="false"] .lab-panel-body { display: none; }
  .lab-panel[data-open="false"] .lab-panel-head { padding-bottom: 12px; }
  .lab-panel-body { padding: 0 14px 14px; }
  .lab-toast { bottom: 96px; }
}

@media (prefers-reduced-transparency: reduce) {
  .lab-bar a, .lab-panel, .lab-toast { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
