:root {
  --bg-1: #f5f3ef;
  --bg-2: #d4e4f3;
  --ink: #1e2a35;
  --panel: rgba(255, 255, 255, 0.76);
  --line: rgba(30, 42, 53, 0.2);
  --accent: #146356;
  --accent-strong: #0f4c42;
  --hotspot: rgba(20, 99, 86, 0.28);
  --hotspot-active: rgba(20, 99, 86, 0.48);
  --highlight-color: rgb(0, 128, 0);
  --highlight-border-soft: rgba(0, 128, 0, 0.12);
  --highlight-fill-soft: rgba(0, 128, 0, 0.03);
  --highlight-fill-strong: rgba(0, 128, 0, 0.06);
  --highlight-border-strong: rgba(0, 128, 0, 0.9);
  --highlight-ring: rgba(0, 128, 0, 0.38);
  --highlight-label-ring: rgba(0, 128, 0, 0.22);
}

* {
  box-sizing: border-box;
}

.navigator-page {
  margin: 0;
  min-height: 0;
  overflow-x: hidden;
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, #ffffffb8 0%, transparent 45%),
    radial-gradient(circle at 90% 5%, #c8def8 0%, transparent 30%),
    linear-gradient(140deg, var(--bg-1), var(--bg-2));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.layout {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0;
  align-items: center;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px rgba(30, 42, 53, 0.12);
  overflow: hidden;
  animation: enter 520ms ease both;
}

.panel-head {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  background: #ffffffad;
}

.top-link:hover,
.top-link:focus-visible {
  border-color: var(--accent);
  outline: none;
}

h1,
h2 {
  margin: 0;
  font-family: "Syne", "Trebuchet MS", sans-serif;
  letter-spacing: 0.02em;
}

p {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
}

.floorplan-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  background: #f3f7fb;
}

.floorplan-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.selectable {
  cursor: crosshair;
}

.hotspot {
  position: absolute;
  border: 2px solid var(--accent-strong);
  background: var(--hotspot);
  border-radius: 8px;
  cursor: pointer;
  color: transparent;
  transition: transform 140ms ease, background-color 140ms ease;
  touch-action: none;
  pointer-events: auto;
}

.hotspot:hover,
.hotspot:focus-visible,
.hotspot.active {
  transform: translateY(-1px);
  background: var(--hotspot-active);
  outline: none;
}

.hotspot.active:not(.hotspot-polygon) {
  cursor: move;
}

.hotspot-polygon {
  border: none;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
}

.hotspot-polygon-surface {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent-strong);
  background: var(--hotspot);
  pointer-events: none;
}

.hotspot-polygon:hover,
.hotspot-polygon:focus-visible,
.hotspot-polygon.active {
  transform: none;
  background: transparent;
  outline: none;
}

.hotspot-polygon:hover .hotspot-polygon-surface,
.hotspot-polygon:focus-visible .hotspot-polygon-surface,
.hotspot-polygon.active .hotspot-polygon-surface {
  background: var(--hotspot-active);
}

.hotspot-label {
  position: absolute;
  left: 0.4rem;
  top: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.7);
  padding: 0.12rem 0.3rem;
  border-radius: 999px;
  pointer-events: none;
}

.hotspot-label-floating {
  transform: translate(-8px, -22px);
}

.hotspot-label-centroid {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.hotspot-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(30, 42, 53, 0.2);
  pointer-events: auto;
}

.hotspot.active .hotspot-handle {
  display: block;
}

.hotspot:not(.active) .hotspot-handle,
.hotspot:not(.active) .hotspot-label {
  display: none;
}

.hotspot-polygon:not(.active) .hotspot-label {
  display: inline-block;
}

.navigator-page .hotspot {
  border-color: var(--highlight-border-soft);
  background: var(--highlight-fill-soft);
}

.navigator-page .hotspot:hover,
.navigator-page .hotspot:focus-visible,
.navigator-page .hotspot.active {
  background: var(--highlight-fill-strong);
}

.navigator-page .hotspot.active {
  border-color: var(--highlight-border-strong);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 5px var(--highlight-ring);
}

.navigator-page .hotspot-polygon-surface {
  border-color: var(--highlight-border-soft);
  background: var(--highlight-fill-soft);
}

.navigator-page .hotspot-polygon:hover .hotspot-polygon-surface,
.navigator-page .hotspot-polygon:focus-visible .hotspot-polygon-surface,
.navigator-page .hotspot-polygon.active .hotspot-polygon-surface {
  background: var(--highlight-fill-strong);
}

.navigator-page .hotspot-polygon.active .hotspot-polygon-surface {
  border-color: var(--highlight-border-strong);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 5px var(--highlight-ring);
}

.navigator-page .hotspot:not(.active) .hotspot-label {
  display: inline-block;
}

.navigator-page .hotspot.active .hotspot-label {
  color: var(--highlight-color);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 1px var(--highlight-label-ring);
}

.hotspot-handle[data-handle="n"] {
  top: -7px;
  left: calc(50% - 6px);
  cursor: ns-resize;
}

.hotspot-handle[data-handle="s"] {
  bottom: -7px;
  left: calc(50% - 6px);
  cursor: ns-resize;
}

.hotspot-handle[data-handle="e"] {
  right: -7px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.hotspot-handle[data-handle="w"] {
  left: -7px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.hotspot-handle[data-handle="ne"] {
  right: -7px;
  top: -7px;
  cursor: nesw-resize;
}

.hotspot-handle[data-handle="nw"] {
  left: -7px;
  top: -7px;
  cursor: nwse-resize;
}

.hotspot-handle[data-handle="se"] {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

.hotspot-handle[data-handle="sw"] {
  left: -7px;
  bottom: -7px;
  cursor: nesw-resize;
}

.polygon-point-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #0f4c42;
  box-shadow: 0 0 0 1px rgba(30, 42, 53, 0.25);
  pointer-events: auto;
  cursor: nwse-resize;
}

.polygon-point-handle:active {
  cursor: nwse-resize;
}

.video-wrap {
  width: 100%;
  min-width: 0;
  background: #0000;
}

.video-wrap > video,
.video-wrap > #youtubePlayer {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 180px;
}

.status-text {
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: #000000;
  background: #1110;
}

video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
}

.room-list {
  margin: 0 1rem 1rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.room-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffffb5;
  padding: 0.65rem 0.75rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.room-button:hover,
.room-button:focus-visible {
  border-color: var(--accent);
  transform: translateX(2px);
  outline: none;
}

.room-button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.editor-layout {
  grid-template-columns: 1.3fr 1fr;
}

.editor-controls {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  align-content: start;
}

.editor-video-settings {
  border-top: 1px solid var(--line);
}

.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.toggle-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffffb5;
  padding: 0.58rem 0.65rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.toggle-button:hover,
.toggle-button:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
  outline: none;
}

.toggle-button.active {
  border-color: var(--accent);
  background: rgba(20, 99, 86, 0.12);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.editor-video-preview {
  display: grid;
  gap: 0.55rem;
}

#editorVideoPreview,
.editor-youtube-wrap {
  width: 100%;
  border-radius: 12px;
  background: #000;
}

#editorVideoPreview {
  margin: 0;
}

.editor-youtube-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

#editorYoutubePreview {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.editor-video-empty {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.85;
}

.field-label {
  font-size: 0.87rem;
  opacity: 0.85;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.58rem 0.65rem;
  background: #fff;
  font: inherit;
  color: var(--ink);
}

textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  resize: vertical;
}

select {
  min-height: 9.5rem;
}

.editor-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.editor-actions.two-up {
  grid-template-columns: 1fr 1fr;
}

.draw-box {
  position: absolute;
  border: 2px dashed var(--accent-strong);
  background: rgba(20, 99, 86, 0.12);
  pointer-events: none;
  touch-action: none;
}

.draw-box.polygon-draft {
  border: 2px solid var(--accent-strong);
  background: rgba(20, 99, 86, 0.2);
}

.hidden {
  display: none;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 961px) {
  .video-wrap {
    padding: 0.65rem 0.75rem 0.75rem;
  }

  .status-text {
    padding: 0 0.1rem 0.5rem;
  }
}

@media (max-width: 960px) and (orientation: portrait) {
  .layout {
    grid-template-columns: 1fr;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .panel-head-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 960px) and (orientation: landscape) {
  body {
    justify-content: flex-start;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  }
}
