:root{
  --bg:#0b0f17;
  --card:#121a26;
  --muted:#90a4b8;
  --text:#e8eef6;
  --accent:#3aa0ff;
  --danger:#ff4d4d;
  --border: rgba(255,255,255,.10);
  --shadow: 0 12px 30px rgba(0,0,0,.45);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  background:linear-gradient(180deg,#070b12,#0b1220 45%, #060812);
  color:var(--text);
  font:14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.topbar{
  position: sticky; top:0; z-index:10;
  display:flex; gap:16px; align-items:center; justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
  backdrop-filter: blur(8px);
  background: rgba(6,10,18,.72);
}

.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:40px; height:40px; border-radius:12px;
  display:grid; place-items:center;
  background: radial-gradient(circle at 30% 30%, rgba(58,160,255,.35), transparent 55%),
              rgba(255,255,255,.06);
  border:1px solid var(--border);
  font-weight:700;
}
.title{ font-weight:700; letter-spacing:.2px; }
.sub{ color:var(--muted); font-size:12px; }

.layout{
    align-items: start; 
  display:grid;
  grid-template-columns: 420px 1fr;
  gap:14px;
  padding:14px;
}

.sidebar{ 
    display:flex; 
    flex-direction:column; 
    gap:14px; 
max-height: calc(100vh - 110px);  /* to jest Twoje wcześniejsze założenie */
  overflow: auto;
}
.panel{
  background: rgba(255,255,255,.05);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:12px;
}
.panel-h{
  font-weight:700;
  margin-bottom:10px;
  color:#f3f6fb;
}
.field{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.field.inline{ flex:1; }
label{ color: var(--muted); font-size:12px; }
input, textarea{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  color: var(--text);
  outline:none;
}
textarea{ font-family: var(--mono); font-size: 12px; }

.row{ display:flex; gap:10px; align-items:center; }
.mt8{ margin-top:8px; }
.hint{     color: #2b3a49;
    font-size: 14px;
    font-weight: 600;}

.btn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  user-select:none;
}
.btn:hover{ background: rgba(255,255,255,.10); }
.btn.small{ padding:8px 10px; border-radius: 10px; font-size: 12px; }
.btn.primary{ background: rgba(58,160,255,.20); border-color: rgba(58,160,255,.35); }
.btn.primary:hover{ background: rgba(58,160,255,.26); }
.btn.danger{ background: rgba(255,77,77,.16); border-color: rgba(255,77,77,.32); }
.btn.danger:hover{ background: rgba(255,77,77,.22); }
.btn.file{ position:relative; overflow:hidden; }

.list{
  display:flex; flex-direction:column; gap:8px;
  max-height: 220px;
  overflow:auto;
  padding-right:2px;
}
.list.small{ max-height: 150px; }

.item{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  padding:10px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.18);
  cursor:pointer;
}
.item:hover{ background: rgba(0,0,0,.26); }
.item.active{ outline:2px solid rgba(58,160,255,.35); }
.item .name{ font-weight:600; }
.item .meta{ color: var(--muted); font-size: 12px; }

.viewerWrap{
  display:flex; flex-direction:column; gap:10px;
 height: calc(100vh - 110px);
  min-height: 0;
}
.viewerHeader{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgb(255 255 255);
    border-radius: var(--radius);
}

.viewer{
  position:relative;
  border-radius: var(--radius);
  overflow:hidden;
  border:none;
  background: #05070c;
  box-shadow: var(--shadow);
  flex:1;
}
.viewer canvas{
  position:absolute;
  inset:0;
  z-index: 1;
}
.overlay{
  position:absolute;
  inset:0;
  /* overlay musi łapać hover/click na hotspotach, ale nie może zasłaniać UI */
  pointer-events:auto;
  z-index: 2;
}

.hotspot{
  position:absolute;
  transform: translate(-50%,-50%);
  pointer-events:auto;
  cursor:pointer;
  min-width: 16px; min-height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.38);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(58,160,255,.20));
  box-shadow: 0 10px 24px rgba(0,0,0,.45);
  display:grid;
  place-items:center;
}
.hotspot .dot{
  width:6px; height:6px; border-radius:999px;
  background: rgba(255,255,255,.85);
}

/* Tooltip: tytuł + opis + link (max 300px) */
.hotspot .tooltip{
  position:absolute;
  left:50%;
  top:-10px;
  transform: translate(-50%,-100%);

  width: max-content;
  max-width: 300px;
  white-space: normal;
  overflow-wrap: anywhere;

 background-image: linear-gradient(to right, #132941 0%, #0d1f33 100%);

  padding:20px 22px;
  border-radius: 12px;
  color: #e8eef6;
  opacity:0;
  visibility:hidden;
  transition: opacity .12s ease, transform .12s ease;
  pointer-events:auto;          /* ✅ link klikalny */
  z-index: 9999;
}
.hotspot:hover .tooltip,
.hotspot.tip-open .tooltip{
  opacity:0.95;
  visibility:visible;
  transform: translate(-50%,-112%);
}
.hotspot .tooltip h6{
  margin:0;
  font-size:13px;
  font-weight:700;
  line-height:1.15;
  color:#fff;
}
.hotspot .tooltip p{
  margin:6px 0 0;
  font-size:12px;
  line-height:1.25;
  color: rgba(232,238,246,.92);
}
.hotspot .tooltip .tipLink{
  display:block;
  margin:8px 0 0;
  font-size:11px;
  color: rgba(227, 213, 127, 0.95);
  word-break: break-all;
  text-decoration: underline;
}

/* SVG wrapper */
.hotspot.has-svg{
  background: transparent;
  border: none;
  box-shadow: none;
  min-width: 0;
  min-height: 0;
}
.hotspot .svgWrap{
  display:grid;
  place-items:center;
}
.hotspot .svgWrap svg{
  width: 42px;
  height: 42px;
  display:block;
}

.switch{
  position:relative;
  width:44px; height:24px;
}
.switch input{ display:none; }
.slider{
  position:absolute; inset:0;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.08);
}
.slider:before{
  content:"";
  position:absolute; top:50%; left:3px;
  width:18px; height:18px;
  transform: translateY(-50%);
  border-radius:999px;
  background: rgba(255,255,255,.75);
  transition: left .15s ease;
}
.switch input:checked + .slider{
  background: rgba(58,160,255,.25);
  border-color: rgba(58,160,255,.35);
}
.switch input:checked + .slider:before{ left: 22px; }
/* Tooltip ma NIE działać na hover */
.hotspot:hover .tooltip{
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate(-50%,-100%) !important;
}

/* Tooltip działa TYLKO gdy jest .tip-open */
.hotspot .tooltip{
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%,-100%);
  background: rgba(21, 43, 69, 0.95); /* #152b45, 95% */
  pointer-events: auto;
  max-width: 300px;
}

.hotspot.tip-open .tooltip{
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate(-50%,-112%) !important;
}

.hotspot .tooltip a.tipLink{
  display:block;
  text-decoration: underline;
}