/* ==========================================================================
   TAJEMNICA STAREGO PODWÓRKA - style
   ========================================================================== */

:root {
  --tlo:        #10151c;
  --panel:      #1a2230;
  --panel-jasny:#222d3d;
  --tekst:      #e8eef6;
  --przygaszony:#9fb0c4;
  --zloto:      #ffc861;
  --zloto-ciemne:#c9922f;
  --zielen:     #7ddc8a;
  --czerwien:   #ff7b7b;
  --cien:       0 10px 30px rgba(0,0,0,.45);
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--tlo);
  color: var(--tekst);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ======================================================== EKRANY PEŁNE */

.ekran {
  position: fixed; inset: 0; z-index: 60;
  display: none;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(120% 90% at 50% 0%, #1d2b3a 0%, #0d1219 60%, #080b10 100%);
}
.ekran.widoczny { display: grid; animation: pojaw .5s ease; }

@keyframes pojaw { from { opacity: 0; } to { opacity: 1; } }

.tytul-tresc { max-width: 640px; text-align: center; }

.nadtytul {
  letter-spacing: .22em; text-transform: uppercase;
  font-size: 12px; color: var(--zloto); margin-bottom: 14px;
}

.tytul-tresc h1 {
  font-size: clamp(34px, 7vw, 62px);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff 20%, var(--zloto) 130%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

.podtytul { color: var(--przygaszony); font-size: 16px; line-height: 1.6; margin-bottom: 28px; }

.tytul-postacie { display: flex; gap: 18px; justify-content: center; margin-bottom: 30px; }
.tytul-postacie figure { width: 92px; }
.tytul-postacie img {
  width: 92px; height: 92px; object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--zloto-ciemne);
  box-shadow: var(--cien);
}
.tytul-postacie figcaption { margin-top: 8px; font-size: 13px; font-weight: 600; }
.tytul-postacie small { display: block; font-weight: 400; font-size: 11px; color: var(--przygaszony); margin-top: 2px; }

.tytul-przyciski { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

button.duzy {
  padding: 14px 30px;
  font-size: 16px; font-weight: 700;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--zloto), var(--zloto-ciemne));
  color: #23180a;
  box-shadow: 0 6px 18px rgba(255,200,97,.25);
  transition: transform .15s, box-shadow .15s;
}
button.duzy:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(255,200,97,.35); }
button.duzy.pomocniczy {
  background: transparent; color: var(--tekst);
  border: 2px solid #40506a; box-shadow: none;
}
button.duzy.pomocniczy:hover { border-color: var(--zloto); }
.ukryty { display: none !important; }

.sterowanie { margin-top: 26px; font-size: 12.5px; color: var(--przygaszony); line-height: 1.9; }
kbd {
  background: #2b3648; border: 1px solid #3d4b63; border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 7px; font-size: 11px; font-family: inherit;
}

/* ============================================================= SCENA */

#gra { position: fixed; inset: 0; }

#scena {
  position: absolute; inset: 0;
  overflow: hidden;
  background: #05070a;
  cursor: grab;
  user-select: none;
  transition: filter .25s, opacity .25s;
}
#scena:active { cursor: grabbing; }
#scena.zaciemnij { opacity: .15; filter: blur(6px); }

/* wymiary #pano ustawia skrypt (przeliczPanorame) */
#pano { position: absolute; top: 0; left: 0; will-change: transform; }
#pano-img { height: 100%; width: 100%; display: block; pointer-events: none; }
#hotspoty { position: absolute; inset: 0; }

/* winieta, żeby UI było czytelne */
#scena::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5,8,14,.72) 0%, transparent 18%, transparent 62%, rgba(5,8,14,.8) 100%);
}

/* boczne strzałki - rozglądanie */
.obrot {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 12;
  width: 52px; height: 96px;
  font-size: 40px; line-height: 1;
  color: rgba(255,255,255,.85);
  background: rgba(10,15,22,.42);
  backdrop-filter: blur(4px);
  transition: background .2s, color .2s;
}
.obrot:hover { background: rgba(10,15,22,.72); color: var(--zloto); }
#obrot-lewo  { left: 0;  border-radius: 0 14px 14px 0; }
#obrot-prawo { right: 0; border-radius: 14px 0 0 14px; }

/* ========================================================== HOTSPOTY */

.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  z-index: 8;
}
.hotspot .hs-opis {
  position: absolute; top: 100%; left: 50%;
  transform: translate(-50%, 8px);
  white-space: nowrap;
  font-size: 12.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(8,12,18,.85);
  border: 1px solid rgba(255,255,255,.14);
  opacity: 0; transition: opacity .18s, transform .18s;
  pointer-events: none;
}
.hotspot:hover .hs-opis { opacity: 1; transform: translate(-50%, 4px); }

/* obiekty - pulsująca kropka */
.hs-kropka {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 0 6px rgba(255,255,255,.18), 0 0 18px rgba(255,255,255,.5);
  animation: puls 2.1s ease-in-out infinite;
}
@keyframes puls {
  0%,100% { transform: scale(1);   box-shadow: 0 0 0 6px rgba(255,255,255,.16), 0 0 16px rgba(255,255,255,.45); }
  50%     { transform: scale(1.2); box-shadow: 0 0 0 12px rgba(255,255,255,.05), 0 0 24px rgba(255,255,255,.7); }
}
.hs-obiekt:hover .hs-kropka { background: var(--zloto); animation-play-state: paused; transform: scale(1.25); }

/* postacie - portret w kółku */
.hs-portret {
  width: 62px; height: 62px; border-radius: 50%;
  background-size: cover; background-position: center;
  border: 3px solid var(--zloto);
  box-shadow: 0 0 0 5px rgba(255,200,97,.18), var(--cien);
  animation: unosi 3.4s ease-in-out infinite;
}
@keyframes unosi { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.hs-postac:hover .hs-portret { box-shadow: 0 0 0 9px rgba(255,200,97,.28), var(--cien); }

/* przejścia - strzałka z etykietą */
.hs-przejscie {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(12,18,26,.55);
  border: 2px solid rgba(255,255,255,.5);
  backdrop-filter: blur(3px);
  transition: background .2s, border-color .2s, transform .2s;
}
.hs-przejscie .strzalka { font-size: 26px; color: #fff; line-height: 1; }
.hs-przejscie:hover {
  background: rgba(255,200,97,.9);
  border-color: #fff;
  transform: translate(-50%, -50%) scale(1.12);
}
.hs-przejscie:hover .strzalka { color: #20180a; }
.hs-przejscie .hs-opis { opacity: .85; }
.hs-przejscie.w-lewo  { animation: mrugaLewo 2.6s ease-in-out infinite; }
.hs-przejscie.w-prawo { animation: mrugaPrawo 2.6s ease-in-out infinite; }
@keyframes mrugaLewo  { 0%,100% { margin-left: 0; } 50% { margin-left: -8px; } }
@keyframes mrugaPrawo { 0%,100% { margin-left: 0; } 50% { margin-left: 8px; } }

/* =============================================================== HUD */

#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
  pointer-events: none;
}
#nazwa-lokacji {
  font-size: 15px; font-weight: 700; letter-spacing: .04em;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(8,12,18,.6);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
#hud nav { display: flex; gap: 8px; pointer-events: auto; }
#hud nav button {
  position: relative;
  width: 46px; height: 46px; border-radius: 14px;
  font-size: 19px;
  background: rgba(8,12,18,.6);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  transition: background .18s, transform .18s;
}
#hud nav button:hover { background: rgba(255,200,97,.22); transform: translateY(-2px); }
.odznaka {
  position: absolute; top: -5px; right: -5px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px;
  background: var(--zloto); color: #23180a;
  font-size: 11px; font-weight: 800; line-height: 20px;
}

/* ============================================================ DIALOG */

#dialog {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 18px;
  display: none;
}
#dialog.widoczny { display: block; animation: wjazd .3s cubic-bezier(.2,.9,.3,1); }
@keyframes wjazd { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.dialog-ramka {
  max-width: 900px; margin: 0 auto;
  display: flex; gap: 18px; align-items: flex-start;
  padding: 18px 22px;
  border-radius: 18px;
  background: rgba(14,20,29,.94);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--cien);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.dialog-ramka.narracja { font-style: italic; }

.dialog-portret {
  flex: 0 0 auto;
  width: 82px; height: 82px; border-radius: 14px;
  background-size: cover; background-position: center;
  border: 2px solid var(--zloto);
}
.dialog-tresc { flex: 1; min-width: 0; }
.dialog-imie { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.dialog-tekst { font-size: 17px; line-height: 1.62; }
.dialog-dalej { margin-top: 10px; font-size: 12px; color: var(--przygaszony); text-align: right; animation: pulsujTekst 1.6s infinite; }
@keyframes pulsujTekst { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

.dialog-opcje { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.opcja {
  text-align: left;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--panel-jasny);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 15px;
  transition: background .16s, border-color .16s, transform .16s;
}
.opcja:hover { background: rgba(255,200,97,.16); border-color: var(--zloto); transform: translateX(4px); }

/* ============================================================ PANELE */

.panel {
  position: absolute; top: 74px; right: 18px; z-index: 40;
  width: min(370px, calc(100vw - 36px));
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 18px;
  background: rgba(20,27,38,.97);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--cien);
  backdrop-filter: blur(10px);
  display: none;
}
.panel.widoczny { display: block; animation: wjazdPanel .22s ease; }
@keyframes wjazdPanel { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel h2 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 17px; margin-bottom: 14px;
}
.panel h3 {
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--zloto); margin: 18px 0 8px;
}
.panel h3:first-of-type { margin-top: 0; }
.zamknij { font-size: 15px; color: var(--przygaszony); padding: 4px 8px; border-radius: 8px; }
.zamknij:hover { background: rgba(255,255,255,.1); color: var(--tekst); }

.panel ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.panel li { display: flex; gap: 12px; font-size: 14px; line-height: 1.5; }
.panel .pusto { color: var(--przygaszony); font-style: italic; font-size: 13.5px; }

#lista-ekwipunku li {
  padding: 11px 13px; border-radius: 12px;
  background: var(--panel-jasny);
  border: 1px solid rgba(255,255,255,.07);
}
#lista-ekwipunku .ikona { font-size: 24px; line-height: 1.2; }
#lista-ekwipunku strong { display: block; margin-bottom: 3px; }
#lista-ekwipunku em { font-style: normal; font-size: 12.5px; color: var(--przygaszony); }

.mini-przycisk {
  display: block; margin-top: 10px;
  padding: 8px 14px; border-radius: 9px;
  background: var(--zloto); color: #23180a;
  font-size: 13px; font-weight: 700;
}
.mini-przycisk:hover { filter: brightness(1.1); }

#lista-zadan .ptaszek { color: var(--zloto); font-weight: 700; }
#lista-zadan .zrobione { color: var(--przygaszony); text-decoration: line-through; }
#lista-zadan .zrobione .ptaszek { color: var(--zielen); text-decoration: none; }

.notes li {
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255,200,97,.09);
  border-left: 3px solid var(--zloto);
  font-size: 13.5px; font-style: italic;
}

/* ============================================================ KŁÓDKA */

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: none; place-items: center;
  padding: 20px;
  background: rgba(4,7,11,.8);
  backdrop-filter: blur(6px);
}
.modal.widoczny { display: grid; animation: pojaw .25s ease; }

.modal-tresc {
  position: relative;
  width: min(340px, 100%);
  padding: 26px;
  border-radius: 20px;
  text-align: center;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: var(--cien);
}
.modal-tresc h2 { font-size: 19px; margin-bottom: 18px; }
.zamknij-klodke {
  position: absolute; top: 12px; right: 12px;
  font-size: 15px; color: var(--przygaszony);
  padding: 4px 8px; border-radius: 8px;
}
.zamknij-klodke:hover { background: rgba(255,255,255,.1); color: var(--tekst); }

#kod-pola { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
#kod-pola .cyfra {
  width: 62px; height: 78px;
  display: grid; place-items: center;
  font-size: 38px; font-weight: 800;
  border-radius: 12px;
  background: #0d1219;
  border: 2px solid #3a4759;
  color: var(--zloto);
}
#kod-pola.trzesie { animation: trzesienie .45s; }
@keyframes trzesienie {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px); } 40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(6px); }
}

#klodka-info { font-size: 13px; color: var(--przygaszony); min-height: 36px; line-height: 1.5; margin-bottom: 12px; }
#klodka-info.ok  { color: var(--zielen); font-weight: 700; }
#klodka-info.zle { color: var(--czerwien); }

#klawiatura { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
#klawiatura button {
  padding: 15px 0;
  font-size: 19px; font-weight: 700;
  border-radius: 12px;
  background: var(--panel-jasny);
  border: 1px solid rgba(255,255,255,.09);
  transition: background .14s, transform .14s;
}
#klawiatura button:hover { background: rgba(255,200,97,.22); transform: translateY(-2px); }
#klawiatura .wyczysc { color: var(--czerwien); }

/* ============================================================ TOASTY */

#toasty {
  position: absolute; left: 50%; top: 78px; z-index: 45;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 999px;
  background: rgba(20,27,38,.96);
  border: 1px solid var(--zloto);
  box-shadow: var(--cien);
  font-size: 14px; font-weight: 600;
  animation: toastWjazd .3s cubic-bezier(.2,.9,.3,1);
  transition: opacity .5s, transform .5s;
}
.toast span { font-size: 18px; }
.toast.znika { opacity: 0; transform: translateY(-12px); }
@keyframes toastWjazd { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

/* ============================================================ MOBILE */

@media (max-width: 760px) {
  .dialog-ramka { padding: 14px 16px; gap: 12px; }
  .dialog-portret { width: 58px; height: 58px; }
  .dialog-tekst { font-size: 15.5px; }
  .hs-portret { width: 52px; height: 52px; }
  .hs-przejscie { width: 54px; height: 54px; }
  .hs-przejscie .strzalka { font-size: 22px; }
  .obrot { width: 42px; height: 78px; font-size: 32px; }
  #hud { padding: 10px 12px; }
  #hud nav button { width: 42px; height: 42px; font-size: 17px; }
  #nazwa-lokacji { font-size: 13px; padding: 7px 12px; }
  .panel { top: 62px; right: 12px; left: 12px; width: auto; }
  .tytul-postacie img { width: 72px; height: 72px; }
  .tytul-postacie figure { width: 72px; }
}

/* gdy dialog otwarty - hotspoty nie przeszkadzają */
body.dialog-otwarty .hotspot { opacity: .35; pointer-events: none; }
