: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);
  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; }

/* ✅ NOWE: stan aktywny (np. tryb przesuwania) */
.btn.active{
  outline: 2px solid rgba(58,160,255,.45);
  background: rgba(58,160,255,.16);
}

.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;
}

.viewer{
  position:relative;
  border-radius: var(--radius);
  overflow:hidden;
  border:none;
  background: #05070c;
  box-shadow: var(--shadow);
  flex:1;
}

/* FIX TOUCH */
.viewer,
.viewer canvas,
.overlay{
  touch-action: none;
}

.viewer canvas{
  position:absolute;
  inset:0;
  z-index: 1;
}
.overlay{
  position:absolute;
  inset:0;
  pointer-events:auto;
  z-index: 2;
}

.hotspot{
  z-index: 10;
  position:absolute;
transform: translate(-50%, -100%);
  transform-origin: 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;
}

/* ✅ Skala x2 TYLKO dla SVG */
.hotspot.has-svg.scale2 .svgImg{
  transform: scale(2);
  transform-origin: 50% 100%;
}

.hotspot .dot{
  width:6px; height:6px; border-radius:999px;
  background: rgba(255,255,255,.85);
}

/* Tooltip */
.hotspot.tip-open{ z-index: 9998; }

.hotspot .tooltip{
  position:absolute;
  left:50%;
  top:-10px;
  transform: none !important;
  width: max-content;
  max-width: 280px;
  white-space: normal;
  overflow-wrap: anywhere;
  background: rgba(21, 43, 69, 0.95);
  padding:20px 35px;
  border-radius: 12px;
  color: #e8eef6;
  opacity:0;
  visibility:hidden;
  transition: opacity .12s ease, transform .12s ease;
  pointer-events:auto;
  z-index: 9999;
}

.hotspot .tooltip h6{
  margin:0;
  font-size:13px;
  font-weight:700;
  line-height:1.15;
  color:#fff;
}
.hotspot .tooltip p{
margin: 10px 0 5px 0;
    font-size: 12px;
    line-height: 1.25;
    color: rgba(232, 238, 246, .92);
    text-align: justify;
}
.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;
}

/* X */
.hotspot .tooltip .tipClose{
  position:absolute;
  top:8px;
  right:8px;
  width:22px;
  height:22px;
  display:none;
  place-items:center;

  border-radius:999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.25);
  color: rgba(255,255,255,.92);
  cursor:pointer;
  user-select:none;
  line-height:1;
  font-weight:700;
}
.hotspot .tooltip .tipClose:hover{
  background: rgba(0,0,0,.38);
}
.hotspot.tip-pinned .tooltip .tipClose{
  display:grid;
}

/* Tooltip tylko na click */
.hotspot:hover .tooltip{
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate(-50%,-100%) !important;
}
.hotspot.tip-open .tooltip{
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate(-50%,-112%) !important;
}

/* SVG jako IMG */
.hotspot.has-svg{
  background: transparent;
  border: none;
  box-shadow: none;
  min-width: 0;
  min-height: 0;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
}
.hotspot .icon{
  display:grid;
  place-items:center;
  transform: none;
}
.hotspot .icon .svgImg{
  width: 54px;
  height: 54px;
  display:block;
  pointer-events:none;
  user-select:none;
  will-change: transform;
}

.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; }
.viewerHeader {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 50;
    background-color: white;
    padding: 5px 15px;
    border-radius: 10px;
}

/* ✅ PLAN: hotspot pomocniczy (niewidoczny, tylko do zaznaczenia na liście) */
.hotspot.planHotspot{pointer-events:auto;}
.hotspot.planHotspot .icon{display:none;}
