@import url("https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&family=Unbounded:wght@500;700&display=swap");

:root {
  --ink: #14213d;
  --ink-2: #4a5873;
  --paper: #eef1ee;
  --sheet: #ffffff;
  --line: #c9d1cc;
  --line-soft: #dde3df;
  --cobalt: #2648d9;
  --cobalt-dark: #1b36a8;
  --target: #f2c230;
  --night: #0e1a2b;
  --ok: #1f8a5b;
  --warn: #b7791f;
  --bad: #c2373a;
  --r-s: 6px;
  --r-m: 10px;
  --font: "Onest", "Segoe UI", system-ui, sans-serif;
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 5vw, 52px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 17px; font-family: var(--font); font-weight: 700; letter-spacing: 0; }
p { margin: 0 0 1em; }
a { color: var(--cobalt); }
small, .muted { color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--target); outline-offset: 2px; }

button, .btn {
  font: 600 14px/1 var(--font);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: var(--r-s); border: 1px solid var(--cobalt);
  background: var(--cobalt); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--cobalt-dark); border-color: var(--cobalt-dark); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { background: var(--sheet); border-color: var(--ink-2); }
button.danger { background: transparent; color: var(--bad); border-color: #e7b9ba; }
button.danger:hover { background: #fbeeee; }
button.small { padding: 7px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
button svg, .btn svg { width: 18px; height: 18px; }

input, select, textarea {
  font: 15px/1.3 var(--font); color: var(--ink);
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--sheet);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px #2648d933; }
input[type=color] { padding: 2px; height: 38px; width: 46px; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--cobalt); }
input[type=range] { padding: 0; accent-color: var(--cobalt); border: 0; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 5px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .auto { flex: 0 0 auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f6f8f7; }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line-soft); color: var(--ink); }
.tag.ok { background: #dcf1e6; color: var(--ok); }
.tag.warn { background: #fbefd6; color: var(--warn); }
.tag.bad { background: #f8dfe0; color: var(--bad); }
.tag.blue { background: #e1e7fb; color: var(--cobalt); }

.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); padding: 20px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--night); color: #fff; padding: 12px 18px; border-radius: var(--r-s); font-weight: 500;
  z-index: 1000; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }

dialog { border: 0; border-radius: var(--r-m); padding: 0; max-width: min(520px, calc(100% - 32px)); width: 100%; color: var(--ink); }
dialog::backdrop { background: #0e1a2b99; }
dialog .dlg { padding: 24px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* хотспоты — общие для редактора и просмотрщика */
.hs {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; cursor: pointer; user-select: none;
  will-change: transform;
}
.hs-badge { display: grid; place-items: center; transition: transform .15s; }
.hs-badge svg { width: 56%; height: 56%; }
.hs:hover .hs-badge { transform: scale(1.1); }
.hs-badge.bg-circle { border-radius: 50%; }
.hs-badge.bg-square { border-radius: 22%; }
.hs-badge.bg-drop { border-radius: 50% 50% 50% 0; rotate: -45deg; }
.hs-badge.bg-drop svg { rotate: 45deg; }
.hs-floor .hs-badge { transform: perspective(240px) rotateX(58deg); border-radius: 50%; }
.hs-floor:hover .hs-badge { transform: perspective(240px) rotateX(58deg) scale(1.1); }
.hs-label {
  margin-top: 6px; font: 600 13px/1.2 var(--font); color: #fff; background: #0e1a2bcc;
  padding: 4px 8px; border-radius: 4px; white-space: nowrap;
}
.hs.anim-pulse .hs-badge { animation: hs-pulse 1.8s ease-out infinite; }
.hs.anim-bounce .hs-badge { animation: hs-bounce 1.6s ease-in-out infinite; }
.hs.anim-appear { animation: hs-appear .5s ease-out both; }
@keyframes hs-pulse { 0% { box-shadow: 0 0 0 0 #ffffff99; } 70% { box-shadow: 0 0 0 16px #ffffff00; } 100% { box-shadow: 0 0 0 0 #ffffff00; } }
@keyframes hs-bounce { 50% { translate: 0 -6px; } }
@keyframes hs-appear { from { opacity: 0; scale: .6; } }
.hs.selected .hs-badge { outline: 3px solid var(--target); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .hs.anim-pulse .hs-badge, .hs.anim-bounce .hs-badge, .hs.anim-appear { animation: none; }
}

.pano-wrap { position: relative; overflow: hidden; background: var(--night); touch-action: none; }
.pano-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.pano-wrap canvas:active { cursor: grabbing; }
.pano-wrap .hs-layer { position: absolute; inset: 0; pointer-events: none; }
.pano-wrap .hs-layer .hs { pointer-events: auto; }
.pano-fade { position: absolute; inset: 0; background: var(--night); opacity: 0; pointer-events: none; transition: opacity .25s; }
.pano-fade.on { opacity: 1; }
.pano-info {
  position: absolute; max-width: 320px; background: var(--sheet); color: var(--ink); border-radius: var(--r-m);
  padding: 14px 16px; box-shadow: 0 8px 30px #0e1a2b55; z-index: 5; font-size: 14px;
}
.pano-info .x { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: var(--ink-2); font-size: 20px; padding: 4px 8px; }
.pano-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #cfd8e6; text-align: center; padding: 20px; }
