* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* Embed mode — strip all editor chrome so the iframe shows just the panorama
   and the hotspots. Triggered by ?embed=1 in the URL (set on body via JS). */
body.embed #topbar,
body.embed #floor-pill,
body.embed #editpanel,
body.embed #selection-panel,
body.embed #scene-list { display: none !important; }

/* --- Embed-mode chrome ------------------------------------------------------
   The presentation overlays: brand mark, fullscreen button, drag hint,
   cinematic vignette/fades, and the intro splash. All hidden in editor mode
   so the editor's own chrome can do its job. */

:root {
  --cream: #f2ede1;
  --brass: #d6ccb8;
  --brass-bright: #f3ede1;
  --ink-deep: #0f0d0b;
  --display: "Cormorant Garamond", Georgia, serif;
  --ui-font: "DM Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

.embed-chrome { display: none; }
body.embed .embed-chrome { display: block; }

/* Cinematic overlays (pure decoration) */
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 6;
  background: radial-gradient(120% 90% at 50% 42%, transparent 54%, rgba(11,10,8,.4) 100%);
}
.topfade {
  position: fixed; top: 0; left: 0; right: 0; height: 170px; pointer-events: none; z-index: 6;
  background: linear-gradient(180deg, rgba(11,10,8,.5), transparent);
}
.botfade {
  position: fixed; bottom: 0; left: 0; right: 0; height: 150px; pointer-events: none; z-index: 6;
  background: linear-gradient(0deg, rgba(11,10,8,.46), transparent);
}

/* North Riviera brand mark (bottom-left) */
.brand {
  position: fixed; bottom: 30px; left: 34px; z-index: 20;
  display: flex; flex-direction: column;
  font-family: var(--ui-font); color: var(--cream);
  pointer-events: none;
}
.brand-name {
  font-family: var(--display);
  font-size: 19px; letter-spacing: .2em; color: var(--cream);
}
.brand-rule { width: 34px; height: 1px; background: var(--brass); margin: 6px 0; }
.brand-sub {
  font-size: 9px; letter-spacing: .42em; text-transform: uppercase;
  color: var(--brass-bright); padding-left: .42em;
}

/* Fullscreen toggle (top-right) */
.embed-fullscreen {
  position: fixed; top: 30px; right: 32px; z-index: 20;
}
.rbtn {
  width: 46px; height: 46px; border-radius: 999px;
  color: var(--cream);
  background: rgba(15,13,11,.4);
  border: 1px solid rgba(216,189,142,.28);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.rbtn:hover {
  background: rgba(184,152,102,.22);
  border-color: var(--brass-bright);
  transform: translateY(-1px);
}

/* Drag-to-look helper pill (bottom-center) */
.hint {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--ui-font);
  font-size: 11.5px; letter-spacing: .08em;
  color: rgba(242,237,225,.7);
  background: rgba(15,13,11,.28);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 9px 16px; border-radius: 999px;
  pointer-events: none;
}

/* Intro splash — overlay shown until "play" is clicked */
.intro {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: radial-gradient(90% 90% at 50% 45%, rgba(15,13,11,.74), rgba(11,10,8,.92));
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  transition: opacity .6s ease, visibility .6s;
  font-family: var(--ui-font);
}
.intro[data-on="0"] {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.intro-inner {
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.intro-eyebrow {
  font-size: 10px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--brass-bright); font-weight: 500;
}
.intro-brand {
  font-family: var(--display);
  font-size: 44px; letter-spacing: .2em; color: var(--cream);
  margin-top: 12px; line-height: 1;
}
.intro-rule { width: 54px; height: 1px; background: var(--brass); margin: 20px 0; }
.intro-sub {
  font-family: var(--display); font-style: italic;
  font-size: 19px; color: rgba(242,237,225,.78);
}
.intro-play {
  margin-top: 34px;
  width: 84px; height: 84px; border-radius: 999px;
  color: var(--cream);
  background: rgba(216,189,142,.12);
  border: 1px solid rgba(216,189,142,.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: inline-flex; align-items: center; justify-content: center;
  padding-left: 5px;
  cursor: pointer;
  transition: background .25s, transform .25s, border-color .25s;
}
.intro-play:hover {
  background: rgba(216,189,142,.24);
  border-color: var(--brass-bright);
  transform: scale(1.06);
}
.intro-cta {
  margin-top: 18px;
  font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(242,237,225,.62);
}
#viewer { position: fixed; inset: 0; cursor: grab; }
#viewer.dragging { cursor: grabbing; }
#viewer.edit { cursor: crosshair; }

/* --- Markers (DOM overlay) -------------------------------------------------
 * One per hotspot. Position is updated each animation frame by viewer.js,
 * which projects the marker's 3D world position to screen coords. The
 * marker visual is pure CSS/SVG so we can animate (bob) and use gradients,
 * which Three.js sprites can't do cheaply. */
#markers { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#markers[hidden] { display: none; }

.mk {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 12;
  --brass-bright: #f3ede1;
  --brass: #d6ccb8;
  will-change: left, top;
}
.mk-inner { position: relative; transition: transform .25s ease; }
.mk:hover .mk-inner { transform: translateY(-4px) scale(1.08); }

/* Legibility scrim — soft radial gradient behind the marker so it reads
   against bright walls/floors without a heavy chrome. */
.mk-scrim {
  position: absolute;
  left: 50%; top: 55%;
  width: 150px; height: 110px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(closest-side,
    rgba(10,9,7,0.5),
    rgba(10,9,7,0.28) 45%,
    transparent 72%);
}

/* Arche (Moorish/Andalusian arch portal) — slow breathing glow, brass stroke,
   chevron centered in the arch, floor-anchor ellipse below. */
.s-arche { position: relative; width: 60px; height: 74px; }
.s-arche .arch {
  display: block;
  animation: archBreathe 3.4s ease-in-out infinite;
}
.s-arche .arch path { stroke: url(#cvgrad); }
.s-arche .chev {
  position: absolute; left: 50%; top: 30px;
  transform: translateX(-50%);
  color: var(--brass-bright);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
.s-arche .foot {
  position: absolute; left: 50%; bottom: 4px;
  transform: translate(-50%, 0) rotateX(64deg);
  width: 40px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(243,237,225,.55);
  box-shadow: 0 0 12px rgba(243,237,225,.4);
}
@keyframes archBreathe {
  0%, 100% { opacity: .82; filter: drop-shadow(0 0 6px rgba(243,237,225,.3)); }
  50%      { opacity: 1;   filter: drop-shadow(0 0 13px rgba(243,237,225,.6)); }
}

/* Selected marker (edit mode) — brighter brass + scale */
.mk.selected {
  --brass-bright: #f6e3b8;
  --brass: #d8bd8e;
}
.mk.selected .mk-inner { transform: scale(1.15); }
.mk.selected .s-arche .foot {
  border-color: rgba(246,227,184,.95);
  box-shadow: 0 0 18px rgba(246,227,184,.9);
}


#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > * { pointer-events: auto; }

/* Top bar */
#topbar {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
#scene-label {
  background: rgba(0,0,0,0.55); backdrop-filter: blur(12px);
  padding: 10px 16px; border-radius: 999px;
  font-size: 15px; max-width: 70%;
}
#scene-floor {
  display: inline-block; padding: 2px 8px; margin-right: 8px;
  background: rgba(255,255,255,0.15); border-radius: 999px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
}
#scene-name { font-weight: 500; }

#topbar-actions { display: flex; gap: 6px; }
#topbar-actions button {
  background: rgba(0,0,0,0.55); backdrop-filter: blur(12px);
  color: #fff; border: 0; border-radius: 999px;
  width: 38px; height: 38px; font-size: 18px; cursor: pointer;
}
#topbar-actions button#btn-edit { width: auto; padding: 0 14px; font-size: 13px; }
#topbar-actions button:hover { background: rgba(255,255,255,0.2); }
#topbar-actions button.active { background: #2563eb; }

/* Scene list */
#scene-list {
  position: absolute; top: 70px; right: 16px;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  border-radius: 12px; max-height: 70vh; overflow-y: auto;
  width: 280px;
}
#scene-list[hidden] { display: none; }
#scene-list-inner { padding: 8px; }
.scene-list-floor { padding: 8px 12px 4px; font-size: 11px; text-transform: uppercase; opacity: 0.5; letter-spacing: 0.5px; }
.scene-list-item {
  padding: 8px 12px; cursor: pointer; border-radius: 6px; font-size: 14px;
}
.scene-list-item:hover { background: rgba(255,255,255,0.1); }
.scene-list-item.current { background: #2563eb; }

/* Edit panel (top-level edit controls — label, save, add) */
#editpanel {
  position: absolute; bottom: 16px; left: 16px;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  border-radius: 12px; padding: 14px; width: 380px;
  display: flex; flex-direction: column; gap: 10px;
}
#editpanel[hidden] { display: none; }
.editpanel-row { display: flex; gap: 8px; align-items: flex-end; }
.editpanel-row label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; opacity: 0.7; flex: 1;
}
.editpanel-row input[type="text"] {
  background: rgba(255,255,255,0.1); border: 0; border-radius: 6px;
  color: #fff; padding: 8px 10px; font-size: 14px;
}
.editpanel-row button, .selection-actions button {
  background: rgba(255,255,255,0.15); color: #fff; border: 0;
  border-radius: 6px; padding: 8px 12px; cursor: pointer; font-size: 13px;
  white-space: nowrap;
}
.editpanel-row button:hover, .selection-actions button:hover { background: rgba(255,255,255,0.25); }
.editpanel-row button.primary { background: #2563eb; }
.editpanel-row button.primary:hover { background: #1d4ed8; }
.editpanel-hint { font-size: 11px; opacity: 0.55; line-height: 1.4; }
#save-status { font-size: 12px; opacity: 0.7; align-self: center; }
#save-status.success { color: #4ade80; opacity: 1; }
#save-status.error { color: #f87171; opacity: 1; }

.calibration { padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.calibration-label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; opacity: 0.75; }
.calibration input[type="range"] { width: 100%; accent-color: #4dd0e1; }
#calibration-value { font-size: 12px; color: #4dd0e1; font-weight: 500; }

/* Selection panel — appears when an arrow is selected in edit mode */
#selection-panel {
  position: absolute; bottom: 16px; right: 16px;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  border-radius: 12px; padding: 14px; width: 300px;
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid rgba(77, 208, 225, 0.6);
}
#selection-panel[hidden] { display: none; }
.selection-fromto { font-size: 14px; font-weight: 500; }
.selection-fromto .from { opacity: 0.7; }
.selection-fromto .to { color: #4dd0e1; }
.selection-hint { font-size: 11px; opacity: 0.55; margin-top: 4px; }
.selection-target-label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; opacity: 0.8;
}
.selection-target-label select {
  background: rgba(255,255,255,0.1); color: #fff; border: 0;
  border-radius: 6px; padding: 8px; font-size: 13px;
}
.selection-actions { display: flex; gap: 8px; }
.selection-actions button.danger {
  background: rgba(239, 68, 68, 0.25); color: #fecaca;
}
.selection-actions button.danger:hover { background: rgba(239, 68, 68, 0.4); color: #fff; }

/* Floor pill */
#floor-pill {
  position: absolute; top: 70px; left: 16px;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(12px);
  padding: 6px 12px; border-radius: 999px; font-size: 11px;
  opacity: 0.7;
}
