/* Living colony view (owner prototype) */
.kc-cview {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1400;
  background: #0b0e14;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
/* Cinema mode: portrait viewports render the whole view rotated 90deg so
   the panorama always plays in landscape, even under iOS rotation lock.
   The host box becomes (100dvh x 100vw) and is rotated into place; children
   keep laying out in the host's own landscape space. */
.kc-cview--rot {
  inset: auto;
  top: 0;
  left: 0;
  width: 100vh;
  width: 100dvh;
  height: 100vw;
  transform: rotate(90deg) translateY(-100%);
  transform-origin: top left;
}
/* screen-top notch maps to the host's left edge, home bar to its right */
.kc-cview--rot .kc-cview-head {
  padding: 10px 14px;
  padding-left: calc(14px + env(safe-area-inset-top, 0px));
  padding-right: calc(14px + env(safe-area-inset-bottom, 0px));
}
.kc-cview--rot .kc-cview-nav--prev { left: env(safe-area-inset-top, 0px); }
.kc-cview--rot .kc-cview-nav--next { right: env(safe-area-inset-bottom, 0px); }
.kc-cview--rot .kc-cview-hint { bottom: 18px; }

.kc-cview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.kc-cview-canvas:active { cursor: grabbing; }

/* global grade: vignette + unified lighting gradient over the composition */
.kc-cview-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 100% at 50% 42%, rgba(0,0,0,0) 58%, rgba(4,6,12,0.42) 100%),
    linear-gradient(118deg, rgba(255,196,120,0.10) 0%, rgba(0,0,0,0) 34%, rgba(24,42,74,0.16) 100%);
}

.kc-cview-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  pointer-events: none;
}
.kc-cview-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(228,236,248,0.92);
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kc-cview-proto {
  font-style: normal;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border: 1px solid rgba(160,200,255,0.5);
  border-radius: 999px;
  color: rgba(190,218,255,0.9);
  background: rgba(16,24,40,0.55);
}
.kc-cview-close {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(10,14,24,0.55);
  color: rgba(235,240,250,0.95);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.kc-cview-close:hover { background: rgba(30,40,64,0.75); }

.kc-cview-chips {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.kc-cview-chip {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: rgba(230,238,250,0.95);
  background: rgba(9,13,22,0.58);
  border: 1px solid rgba(150,180,230,0.28);
  border-radius: 999px;
  padding: 3px 10px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  will-change: transform;
}
.kc-cview-chip b {
  font-weight: 700;
  margin-left: 4px;
  color: rgba(180,220,255,0.95);
}
.kc-cview-chip b.kc-cview-chip-empty {
  color: rgba(210,205,190,0.75);
  font-weight: 500;
  font-style: italic;
}
.kc-cview-chip--zone {
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 0.62rem;
  border-radius: 6px;
  border-color: rgba(190,205,235,0.3);
}
.kc-cview-chip--survey {
  border-style: dashed;
  border-color: rgba(160,210,255,0.55);
}
.kc-cview-chip--survey b { color: rgba(170,215,255,0.9); }

/* edge arrows: snap the camera to the previous/next structure */
.kc-cview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(150,180,230,0.28);
  background: rgba(9,13,22,0.45);
  color: rgba(230,238,250,0.9);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 0.35s ease, background 0.2s ease;
}
.kc-cview-nav--prev {
  left: 0;
  border-left: none;
  border-radius: 0 14px 14px 0;
  padding-right: 5px;
}
.kc-cview-nav--next {
  right: 0;
  border-right: none;
  border-radius: 14px 0 0 14px;
  padding-left: 5px;
}
.kc-cview-nav:hover { background: rgba(30,40,64,0.7); }
.kc-cview-nav.off { opacity: 0.15; pointer-events: none; }

.kc-cview-hint {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(225,232,244,0.85);
  background: rgba(9,13,22,0.55);
  border: 1px solid rgba(150,180,230,0.25);
  border-radius: 999px;
  padding: 6px 14px;
  pointer-events: none;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 0.8s ease;
  animation: kc-cview-hint-pulse 2.4s ease-in-out infinite;
}
.kc-cview-hint.gone { opacity: 0; animation: none; }
@keyframes kc-cview-hint-pulse {
  0%, 100% { transform: translateX(-52%); }
  50% { transform: translateX(-48%); }
}

.kc-cview-load {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: rgba(210,222,240,0.9);
}
.kc-cview-load[hidden] { display: none; }

/* turn-your-phone invite: counter-rotated so it reads upright in the hand */
.kc-cview-rotate {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  border: 1px solid rgba(150,180,230,0.3);
  border-radius: 16px;
  background: rgba(9,13,22,0.72);
  color: rgba(230,238,250,0.95);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  transition: opacity 0.6s ease;
}
.kc-cview-rotate[hidden] { display: none; }
.kc-cview-rotate.gone { opacity: 0; }
.kc-cview-rotate svg {
  width: 46px;
  height: 46px;
  animation: kc-cview-rot-wiggle 2.2s ease-in-out infinite;
}
@keyframes kc-cview-rot-wiggle {
  0%, 20%, 100% { transform: rotate(0deg); }
  55%, 75% { transform: rotate(90deg); }
}

.kc-cview--reduced .kc-cview-hint { animation: none; }
.kc-cview--reduced .kc-cview-rotate svg { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .kc-cview-hint { animation: none; }
  .kc-cview-rotate svg { animation: none; }
}
