/* === Bazowe === */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #111;
  overflow: hidden; 
  -webkit-tap-highlight-color: transparent;
}

/* Jasnoszary gradient tła */
body {
  background: linear-gradient(180deg, #f7f7f7 0%, #e6e6e6 100%);
}

/* WebGL pełnoekranowo */
#webgl-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}
#webgl-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* === Nagłówek === */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: transparent;
}
header h1 {
  margin: 0;
  padding: 0;
  line-height: 1;
  display: block;
  font-size: 18px;
  letter-spacing: .4px;
  color: #111;
}
nav a {
  color: #111;
  margin: 0 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  opacity: .9;
  transition: color .25s, opacity .25s, text-decoration-color .25s;
}
nav a:hover {
  color: #222;
  opacity: 1;
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,.2);
}

/* === Treść === */
#content {
  position: fixed;
  top: 72px;
  left: 0; right: 0; bottom: 0;
  padding: 20px;
  overflow: hidden;
}

/* === Wrapper dla całości (pokrętła + state-controls) === */
#controls-wrapper {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0) + 16px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 20px;
  z-index: 9999;
}

/* === Blok przycisków kształtów === */
#state-controls.ctrls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px; /* większy oddech */
  padding: 0; /* padding zbędny, bo caption i shapes mają własne */
  background: none;
  border: none;
}

/* === Caption (napis nad przyciskami) === */
#state-controls .caption {
  display: inline-block;
  width: 700px;
  padding: 10px 16px;

  background: rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px;

  text-align: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; /* <- możesz zmieniać */
  font-weight: 600;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0.5px; /* lepsza czytelność */
  color: #0f172a;
  opacity: .95;

  user-select: none;
  pointer-events: none;
  transition: opacity .25s ease;
}
#state-controls .caption.fade-out { opacity: 0; }

/* === Przyciski kształtów === */
#state-controls .shapes {
  display: flex;
  gap: 10px;
  padding: 18px 24px;

  background: rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 20px;
}

#state-controls button {
  appearance: none;
  border: 0;
  padding: 8px 12px;
  border-radius: 12px;
  font: 600 12px/1.1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #111;
  background: rgba(255,255,255,.92);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  transition: transform .12s ease, background-color .2s ease, color .2s ease, opacity .2s, box-shadow .2s ease;
}
#state-controls button:hover {
  background: #f2f2f2;
  transform: translateY(-1px);
}
#state-controls button.active {
  background: #3f3f3f;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.18) inset, 0 2px 10px rgba(0,0,0,.10);
}
#state-controls button:focus-visible {
  outline: 2px solid #bdbdbd;
  outline-offset: 2px;
}
#state-controls .icon { font-size: 14px; line-height: 1; opacity: .85; }
#state-controls .label { font-size: 12px; }
#state-controls button.active .icon { opacity: 1; }

/* === Oddzielne karty z pokrętłami === */
.knob-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;

  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
}
.knob-card label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: 4px;
  color: #222;
  text-transform: uppercase;
}

/* === Gałka – metaliczna, mniejsza === */
.dial {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f4f4f4, #bcbcbc 70%);
  border: 1px solid #999;
  box-shadow:
    inset -5px -5px 10px rgba(255,255,255,0.8),
    inset 5px 5px 10px rgba(0,0,0,0.25),
    3px 6px 12px rgba(0,0,0,0.3);
  --angle: 0deg;
}

/* czerwony marker – mała kropka */
.dial::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 6px;
  height: 6px;
  background: radial-gradient(circle at 30% 30%, #ff4444, #a80000);
  border-radius: 50%;
  transform-origin: 50% 24px; /* odległość od środka */
  transform: rotate(var(--angle));
  box-shadow: 0 0 3px rgba(0,0,0,.5);
}

/* Podziałki na zewnątrz gałki */
.dial .ticks {
  position: absolute;
  inset: -12px; /* wychodzi poza gałkę */
  border-radius: 50%;
  background: conic-gradient(
    from -135deg,
    #666 0deg 2deg,
    transparent 2deg 18deg
  );
  mask-image: radial-gradient(circle, transparent 70%, black 72%);
  -webkit-mask-image: radial-gradient(circle, transparent 70%, black 72%);
  pointer-events: none;
  opacity: 0.9;
}

.ctrls {
  transition: transform 0.4s ease, opacity 0.4s ease;
  transform: translateY(0);
  opacity: 1;
}

.ctrls.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}



/* === Ukrywanie całego bloku kontrolek (pokrętła + przyciski) === */
#controls-wrapper {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  z-index: 9999;
  transition: transform 0.6s ease, opacity 0.5s ease;
  opacity: 1;
}

/* 🚀 Ukrycie: płynny zjazd w dół i fade-out */
#controls-wrapper.hidden {
  transform: translateX(-50%) translateY(100%);
  opacity: 0;
  pointer-events: none;
}

/* === Napis nawigacyjny - obrócony na krawędzi === */
.nav-title {
  position: fixed;
  top: 50px; /* Pod logo */
  left: 20px; /* Odstęp od lewej krawędzi */
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #111;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  z-index: 10000;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  background: none;
  transform: translateX(-20px); /* Start poza ekranem */
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.nav-title.visible {
  opacity: 0.9;
  transform: translateX(0); /* Końcowa pozycja */
}

.nav-title.test-visible {
  opacity: 1;
  color: #111;
  background: none;
  transform: translateX(0);
}

:root {
  --nav-color-mix: 0; /* 0 = ciemna, 1 = jasna */
}

nav a,
header h1 {
  color: color-mix(
    in srgb,
    #111 calc((1 - var(--nav-color-mix)) * 100%),
    #f2f2f2 calc(var(--nav-color-mix) * 100%)
  );
}



/* === Mobile === */
@media (max-width: 640px) {
  .dial {
    width: 52px;
    height: 52px;
  }
  .dial::after {
    width: 5px;
    height: 5px;
    transform-origin: 50% 20px;
  }
  .dial .ticks { inset: -10px; }
}









/* === DEFAULT NAV === */
header,
nav a {
  color: #111;
}

/* === APPLICATIONS ACTIVE === */
body.nav-invert header,
body.nav-invert nav a {
  color: #ffffff;
}

.logo {
  color: #111;
  transition: color 0.35s ease;
}

body.nav-invert .logo {
  color: #ffffff;
}

body.nav-invert .nav-title {
  opacity: 0.9;
  transform: translateX(0);
  color: #fff; /* jawnie */
}

