/* Śniarzędzia i blokady (scenes/dream/layers/tools*.js). Wszystko jest ołówkiem: cienka kreska w kolorze grafitu,
   bez wypełnień i ramek. Złoto dostaje tylko narzędzie wzięte do ręki i słowo „zawiąż”. */

/* ---------------------------------------------------------------- kreska rysunków */

.tool-icon,
.gate-art,
.knot-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tool-icon path,
.tool-icon circle,
.gate-art path,
.knot-art path {
  vector-effect: non-scaling-stroke;
  stroke-width: 1.35px;
}

.tool-icon .soft,
.gate-art .soft,
.knot-art .soft {
  stroke-width: 0.9px;
  opacity: 0.5;
}

.tool-icon .dot {
  fill: currentColor;
  stroke: none;
}

/* ---------------------------------------------------------------- warstwa świata */

.layer-tools {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out);
}

.layer-tools.is-away {
  opacity: 0;
}

/* Znalezisko: leży w mroku niewidoczne. Z bliższej kamery stuknięcie w mrok słabo rozjaśnia zarys
   na kilka sekund; kursor nad takim zarysem dopowiada go do końca. Z daleka (.is-far) nie ma go wcale. */
.tool-find {
  position: absolute;
  color: var(--pencil);
  opacity: 0;
  transition: opacity 1.6s var(--ease-out);
}

.tool-find.is-lit {
  opacity: 0.4;
  transition-duration: 0.7s;
  filter: drop-shadow(0 0 6px rgba(207, 198, 182, 0.2));
}

.tool-find.is-lit.is-near {
  opacity: 0.82;
  transition-duration: 0.35s;
}

.layer-tools.is-far .tool-find {
  opacity: 0;
  transition-duration: 0.6s;
}

/* Fala, której gracz nie wywołał: cienki, miękki krąg. Początek drogi wygasza animacja (tools.js). */
.find-wave {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(
    circle closest-side,
    rgba(207, 198, 182, 0) 90%,
    rgba(207, 198, 182, 0.05) 94.5%,
    rgba(207, 198, 182, 0.15) 97.4%,
    rgba(207, 198, 182, 0.04) 99%,
    rgba(207, 198, 182, 0) 100%
  );
  will-change: transform, opacity;
}

.dream-viewport.over-find:not(.is-dragging) {
  cursor: pointer;
}

/* ---------------------------------------------------------------- blokady */

.gate-mark {
  position: absolute;
  color: var(--pencil);
  transition: opacity 0.8s var(--ease-out);
}

.gate-mark.is-leaving {
  opacity: 0;
}

.gate-art {
  opacity: 0.34;
  transition: opacity 0.5s var(--ease-out);
}

.gate-mark.is-near .gate-art {
  opacity: 0.6;
}

/* Znak leży wprost na tle mapy (wersja 5): żadnej czarnej plamy ani kafelka pod spodem.
   Głębia: mgła wiruje do środka. */
.gate-mark.is-opening {
  transition: none;
}

.gate-mark.is-opening .gate-art {
  animation: none;
}

.gate-swirl {
  transform-box: view-box;
  transform-origin: 50% 50%;
}

.gate-swirl-outer {
  animation: gate-swirl 64s linear infinite;
}

.gate-swirl-inner {
  animation: gate-swirl 30s linear infinite, gate-sink 9s ease-in-out infinite alternate;
  animation-composition: add;
}

@keyframes gate-swirl {
  to {
    transform: rotate(360deg);
  }
}

@keyframes gate-sink {
  from {
    scale: 1;
  }
  to {
    scale: 0.82;
  }
}

/* Węzeł: dwa luźne końce nitki, które się mijają. */
.gate-mark[data-gate='knot'] .gate-art {
  opacity: 0.5;
}

.gate-mark[data-gate='knot'].is-near .gate-art {
  opacity: 0.8;
}

.gate-end-a {
  animation: gate-sway 7s ease-in-out infinite alternate;
}

.gate-end-b {
  animation: gate-sway 8.5s ease-in-out infinite alternate-reverse;
}

@keyframes gate-sway {
  from {
    transform: translate(-3px, 2px);
  }
  to {
    transform: translate(4px, -3px);
  }
}

/* Dal: nic nie widać, tylko słabe pierścienie, jak od dźwięku. */
.gate-ring {
  transform-box: view-box;
  transform-origin: 50% 50%;
  opacity: 0.3;
  animation: gate-ring 7.5s linear infinite;
}

.gate-ring-0 {
  scale: 0.42;
}

.gate-ring-1 {
  scale: 0.72;
  animation-delay: -2.5s;
}

.gate-ring-2 {
  animation-delay: -5s;
}

@keyframes gate-ring {
  0% {
    scale: 0.16;
    opacity: 0;
  }
  22% {
    opacity: 0.75;
  }
  100% {
    scale: 1.16;
    opacity: 0;
  }
}

[data-motion='quiet'] .gate-swirl,
[data-motion='quiet'] .gate-end-a,
[data-motion='quiet'] .gate-end-b,
[data-motion='quiet'] .gate-ring {
  animation: none;
}

.dream-viewport.over-gate:not(.is-dragging) {
  cursor: pointer;
}

/* ---------------------------------------------------------------- nitka */

.thread-lines {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  /* Ciemna otoczka: jasna kreska ma być czytelna także na jasnym obrazie. */
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 3px rgba(0, 0, 0, 0.7));
}

.thread-line {
  fill: none;
  stroke: var(--pencil);
  stroke-width: 1.7px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.75;
}

.thread-line.is-caught {
  stroke: var(--ink);
  opacity: 0.95;
}

.thread-knot {
  position: absolute;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  color: var(--pencil);
  opacity: 0.7;
  transition: opacity 0.6s var(--ease-out);
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 3px rgba(0, 0, 0, 0.7));
}

.thread-knot.is-fresh {
  width: 68px;
  height: 68px;
  color: var(--ink);
  opacity: 1;
}

.thread-knot.is-fresh path {
  stroke-width: 1.7px;
}

.thread-knot.is-arriving {
  opacity: 0;
  transition: none;
}

/* ---------------------------------------------------------------- pas (lewy dolny róg, nad cichą linijką) */

.dream-ui > .tool-belt {
  position: absolute;
  left: calc(max(40px, 4.1vw) - 8px);
  bottom: 68px;
  display: flex;
  gap: 6px;
  transition: opacity 0.45s var(--ease-out);
}

.dream-ui > .tool-belt.is-away,
.dream-ui > .tool-belt.is-empty {
  opacity: 0;
  pointer-events: none;
}

.tool-sign {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--pencil);
  opacity: 0.6;
  cursor: pointer;
  transition:
    opacity 0.3s var(--ease-out),
    color 0.3s var(--ease-out);
}

.tool-sign:hover,
.tool-sign:focus-visible {
  opacity: 1;
  outline: none;
}

.tool-sign.is-armed {
  color: var(--gold);
  opacity: 1;
}

.tool-sign.is-arriving {
  opacity: 0;
  transition: none;
}

/* Somnoskop poza nocą koniunkcji: przygaszony i bez gwiazdki. */
.tool-sign.is-waiting {
  opacity: 0.26;
  cursor: default;
}

.tool-sign.is-waiting:hover,
.tool-sign.is-waiting:focus-visible {
  opacity: 0.4;
}

.tool-find .tool-star,
.tool-sign.is-waiting .tool-star {
  display: none;
}

.tool-sign .tool-star {
  stroke: var(--gold);
}

/* Znalezisko w locie do pasa. */
.dream-ui > .tool-flight {
  position: absolute;
  color: var(--ink);
  pointer-events: none;
}

.tool-flight .tool-star {
  display: none;
}

/* Narzędzie w ręku: mały znak jedzie przy kursorze. */
.dream-ui > .tool-cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  color: var(--gold-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
}

.dream-ui > .tool-cursor.is-on {
  opacity: 0.95;
}

.tool-cursor .tool-star {
  display: none;
}

.dream-viewport.tool-armed:not(.is-dragging) {
  cursor: crosshair;
}

.dream-viewport.tool-armed.over-gate:not(.is-dragging),
.dream-viewport.tool-armed.over-find:not(.is-dragging) {
  cursor: pointer;
}

/* ---------------------------------------------------------------- karty (wędka, supeł) */

.tool-card {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.tool-card-body {
  padding: 18px 24px;
  /* Jak karta miejsca przy szczelinie: ciemna chmura o rozmytym brzegu zamiast pudełka. */
  background: rgba(13, 11, 9, 0.9);
  border-radius: 40px;
  box-shadow: 0 0 46px 34px rgba(13, 11, 9, 0.9);
}

.rod-card {
  width: min(270px, 72vw);
}

.rod-crumbs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 15px;
}

/* Okruch to czyjeś słowa, nie akcja: zwykłe pismo zamiast kapitalików. */
.rod-crumb.word {
  font: 400 var(--size-small) / 1.3 var(--font-read);
  font-variant-caps: normal;
  font-feature-settings: normal;
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
}

/* Łowienie (tools-rod.js): przezroczysta warstwa łapie wciśnięcie myszy, na niej okruch na nitce nad studnią. */
.dream-ui > .rod-wait {
  position: absolute;
  inset: 0;
  z-index: 30;
  cursor: default;
  touch-action: none;
}

.rod-wait[data-phase='bite'] {
  cursor: grab;
}

.rod-wait[data-phase='haul'] {
  cursor: grabbing;
}

.rod-float {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.rod-thread {
  fill: none;
  stroke: var(--pencil);
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
  transition: stroke 160ms ease;
}

.rod-thread.is-taut {
  stroke: var(--gold);
  stroke-width: 1.8px;
}

.rod-hook {
  fill: var(--gold);
}

.rod-bait {
  fill: var(--gold);
  font: 400 14px var(--font-voice, var(--font-read));
  paint-order: stroke;
  stroke: rgba(8, 7, 6, 0.92);
  stroke-width: 4px;
}

.dream-ui > .rod-chip {
  position: absolute;
  font: 400 var(--size-small) / 1.3 var(--font-read);
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
}

.knot-card {
  width: min(380px, 84vw);
}

.knot-sentence {
  margin: 0;
  font: 400 var(--size-read) / 1.5 var(--font-read);
  color: var(--ink-dim);
}

.knot-name {
  color: var(--ink);
}

.knot-actions {
  display: flex;
  gap: 30px;
  margin-top: 16px;
}

/* ---------------------------------------------------------------- żywa kreska (ui/boil.js) */

/* Rysunki ołówkiem drgają jak animacja poklatkowa: filtr przerysowuje kreskę kilka razy na sekundę. */
.tool-icon,
.knot-art {
  filter: url(#pencil-boil);
}

.gate-art {
  filter: url(#pencil-boil-wide);
}

/* ---------------------------------------------------------------- nazwa narzędzia w cichej linijce */

.hint-name {
  font-weight: 600;
  color: var(--gold);
}

/* ---------------------------------------------------------------- plansza znaleziska (layers/found.js) */

.dream-ui > .found-plate {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse 70% 62% at 50% 50%, rgba(6, 5, 4, 0.74) 0%, rgba(6, 5, 4, 0.5) 55%, rgba(6, 5, 4, 0.34) 100%);
  opacity: 0;
  pointer-events: auto;
  cursor: default;
  transition: opacity 0.9s var(--ease-out);
}

.dream-ui > .found-plate[hidden] {
  display: none;
}

.dream-ui > .found-plate.is-on {
  opacity: 1;
}

.found-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(78vw, 520px);
  text-align: center;
  transform: translateY(10px);
  transition: transform 1.4s var(--ease-out);
}

.found-plate.is-on .found-card {
  transform: none;
}

.found-art {
  width: 104px;
  height: 104px;
  color: var(--gold);
  filter: drop-shadow(0 0 14px rgba(232, 200, 154, 0.22));
}

.found-art .tool-icon path,
.found-art .tool-icon circle {
  stroke-width: 1.7px;
}

.found-kicker {
  margin-top: 26px;
  color: var(--ink-faint);
  letter-spacing: 0.32em;
}

.found-name {
  margin-top: 8px;
  font: 400 var(--size-title) / 1.15 var(--font-read);
  color: var(--gold);
}

.found-line {
  margin: 14px 0 0;
  font: 400 var(--size-read) / 1.5 var(--font-read);
  color: var(--ink-dim);
}

@media (prefers-reduced-motion: reduce) {
  .dream-ui > .found-plate,
  .found-card {
    transition-duration: 0.01s;
    transform: none;
  }
}

/* ---------------------------------------------------------------- mrużki: ćma i oczy (layers/wisp.js) */

/* Podstawa (.mruzek, nitka) jest w dream-dark.css; tu tylko to, czym różnią się dwa nowe rodzaje. */
.mruzek-vein {
  stroke-width: 1.1;
  opacity: 0.5;
}

/* Ćma w locie nie jest celem kliknięcia: klik przechodzi przez nią do mroku. Łapie się ją, gdy siedzi. */
.mruzek-kind-moth.is-flying {
  pointer-events: none;
}

.mruzek-kind-moth::before {
  left: -24px;
  top: -24px;
  width: 48px;
  height: 48px;
}

/* Oczy: pole trafienia to owal wokół pary oczu. */
.mruzek-kind-eyes::before {
  left: -46px;
  top: -34px;
  width: 92px;
  height: 68px;
}

.mruzek-kind-eyes {
  transition: opacity 0.5s var(--ease-out);
}

.mruzek-kind-eyes.is-away {
  opacity: 0 !important;
  pointer-events: none;
}

.mruzek-eyes .mruzek-body {
  stroke-width: 1.4;
}

.mruzek-pupil {
  fill: var(--ink);
  stroke: none;
}

.mruzek-kind-eyes.is-close .mruzek-drawing {
  filter: drop-shadow(0 0 8px rgba(232, 200, 154, 0.55));
}

.mruzek-kind-eyes.is-close .mruzek-body {
  stroke: var(--gold);
}
