:root {
  --bg: #16171a;
  --panel: rgba(20, 21, 24, 0.72);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #ffffff;
  --line: rgba(255, 255, 255, 0.16);
  --gold: #c8973a;
  --navy: #0c1e3d;
  --paper: #fbfbf9;
  --ink: #1d2329;
  --ink-muted: #6b747b;
  --plan-room: #ffffff;
  --plan-wall: #2a2f35;
  --plan-spot: var(--navy);
  --badge: 0px;
}
/* Netlify's free plan adds a "Powered by Netlify" badge (64px tall) in the
   bottom-right corner. It can't be hidden, so lift our buttons above it. */
body:has(#nl-badge-frame) { --badge: 64px; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

.view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
.view[hidden] { display: none; }
#doll { background: var(--bg); touch-action: none; cursor: grab; }
#doll.hovering { cursor: pointer; }
#doll.glide { pointer-events: none; cursor: default; background: #000; }
#doll.fade { opacity: 0; transition: opacity 0.2s ease; }

.bar {
  position: fixed;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  pointer-events: none;
  z-index: 10;
}
.bar > * { pointer-events: auto; }
.top { top: 0; justify-content: space-between; padding-top: max(12px, env(safe-area-inset-top)); }
.bottom {
  bottom: 0;
  flex-direction: column;
  padding-bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--badge));
}
.row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; pointer-events: none; }
.row > * { pointer-events: auto; }

.label {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  max-width: calc(100% - 64px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#room-name { font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }

/* Unity Media logo, top left */
.left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.left .label { max-width: none; min-width: 0; }
.brand {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  color: #fff;
  text-decoration: none;
  font: 800 17px/1 Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.02em;
}
.brand img { display: block; width: 30px; height: 30px; }
.brand:hover { background: rgba(12, 30, 61, 0.85); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) {
  .brand { padding: 4px; }
  .brand span { display: none; }
}

.modes, .chips {
  display: flex;
  gap: 4px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 4px;
}
.chips[hidden] { display: none; }

.btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 36px;
  white-space: nowrap;
}
.btn:hover { background: var(--line); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.on { background: var(--accent); color: #111; }
.narrow { display: none; } /* short button labels, shown only on phones */
.btn.icon {
  background: var(--panel);
  backdrop-filter: blur(8px);
  width: 40px;
  padding: 0;
  font-size: 18px;
}

/* Walk-mode floor circles (spots you can move to) */
.pnlm-hotspot-base.spot {
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
/* Pannellum moves circles with "transform", so hover must never animate or change it. */
.pnlm-hotspot-base.spot:hover { background: rgba(255, 255, 255, 0.45); border-color: #fff; }
.pnlm-hotspot-base.spot span { visibility: hidden; }
.pnlm-hotspot-base.spot:hover span { visibility: visible; }
/* Stairs: orange with an up or down arrow */
.pnlm-hotspot-base.spot.stair {
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-top: -20px;
  border-color: var(--gold);
  background: rgba(200, 151, 58, 0.85);
}
.pnlm-hotspot-base.spot.stair:hover { background: var(--gold); border-color: #fff; }
.pnlm-hotspot-base.spot.stair::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font: 700 20px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.pnlm-hotspot-base.spot.stair.up::after { content: "↑"; }
.pnlm-hotspot-base.spot.stair.down::after { content: "↓"; }

/* Hide Pannellum's own buttons; ours are in the bars. */
.pnlm-controls-container, .pnlm-load-button { display: none !important; }

/* Floor plan overlay */
.plan {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.plan[hidden] { display: none; }
.plan-card {
  width: min(980px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.plan-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  border-bottom: 1px solid #e3e6e4;
}
.plan-head strong { font-size: 16px; margin-right: auto; }
.chips.light { background: #eceeed; backdrop-filter: none; }
.chips.light .btn, .btn.icon.light { color: var(--ink); }
.chips.light .btn:hover, .btn.icon.light:hover { background: #dfe2e0; }
.chips.light .btn.on { background: var(--ink); color: #fff; }
.btn.icon.light { background: transparent; backdrop-filter: none; }
.plan-view { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px; }
.plan-view svg { display: block; width: 100%; height: auto; max-height: 70vh; margin: 0 auto; }
.plan-hint { margin: 0; padding: 8px 18px 12px; font-size: 13px; color: var(--ink-muted); }

.p-room { fill: var(--plan-room); }
.p-wall { stroke: var(--plan-wall); stroke-linecap: square; }
.p-glass { stroke: var(--plan-wall); stroke-width: 2; }
.p-stair { fill: none; stroke: #8a9298; stroke-width: 2; }
.p-name { font: 600 26px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; fill: var(--ink); text-anchor: middle; }
.p-area { font: 20px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; fill: var(--ink-muted); text-anchor: middle; }
.p-spot { cursor: pointer; }
.p-spot circle { fill: var(--plan-spot); stroke: #fff; stroke-width: 5; }
.p-spot:hover circle, .p-spot:focus-visible circle { fill: #23457f; stroke-width: 7; }
.p-spot:focus { outline: none; }
.p-spot.here circle { fill: var(--gold); }
.p-cone { fill: rgba(200, 151, 58, 0.3); stroke: none; pointer-events: none; }

/* Mini see-through floor plan in the corner of walk mode */
.mini {
  align-self: flex-start; /* sits at the left, just above the buttons */
  width: 230px;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: rgba(10, 11, 13, 0.28);
  cursor: pointer;
}
.mini[hidden] { display: none; }
.mini:hover { background: rgba(10, 11, 13, 0.48); }
.mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mini svg { display: block; width: 100%; height: auto; max-height: 170px; }
.mini .p-room { fill: rgba(255, 255, 255, 0.1); }
.mini .p-wall { stroke: rgba(255, 255, 255, 0.92); }
.mini .p-cone { fill: rgba(200, 151, 58, 0.5); }
.m-spot { fill: rgba(255, 255, 255, 0.7); }
.m-here { fill: var(--gold); stroke: #fff; stroke-width: 8; }

@media (max-width: 520px) {
  .btn { padding: 8px 11px; }
  /* Floor plan: floor names get their own line, so nothing is cut off */
  .plan-head { flex-wrap: wrap; row-gap: 8px; padding: 10px 8px 10px 16px; }
  .plan-head #plan-floors { order: 1; flex: 1 0 100%; }
  .plan-head #plan-floors .btn { flex: 1; padding: 8px 4px; }
  .plan-view { padding: 4px 6px; }
  .mini { width: 150px; }
  .row { gap: 6px; }
  .row .btn { padding: 8px 8px; }
  .wide { display: none; }
  .narrow { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  #doll.fade { transition: none; }
}
