:root {
  --teal: rgba(20, 96, 103, 0.9);
  --teal-solid: #146067;
  --teal-dark: rgba(12, 64, 69, 0.92);
  --accent: #a3307f;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.78);
  --gap: 12px;
  --safe-t: env(safe-area-inset-top);
  --safe-b: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0e1a1c; color: var(--text); font: 16px/1.4 Dosis, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#view.dragging { cursor: grabbing; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- start screen ---------- */
#intro { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; overflow: hidden; transition: opacity 0.6s; }
#intro.gone { opacity: 0; pointer-events: none; }
#introBg { position: absolute; inset: -30px; background: #146067 center / cover no-repeat; filter: blur(6px); }
#introBg::after { content: ""; position: absolute; inset: 0; background: rgba(20, 96, 103, 0.62); }
#intro .frame { position: absolute; inset: calc(var(--safe-t) + 18px) 18px calc(var(--safe-b) + 18px); border: 6px solid #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
#introSub { margin: 0; font-size: 22px; color: #fff; }
#introTitle { margin: 0; background: var(--accent); padding: 6px 28px; font-size: 26px; font-weight: 700; }
.start { margin-top: 36px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 17px; }
.start .circle { width: 64px; height: 64px; border: 4px solid #fff; border-radius: 50%; display: grid; place-items: center; transition: transform 0.2s; }
.start .circle svg { width: 30px; height: 30px; stroke-width: 3; }
.start:hover .circle { transform: scale(1.08); }
.start:disabled { opacity: 0.7; cursor: default; }

/* ---------- name of the place ---------- */
#brand { position: fixed; z-index: 5; left: var(--gap); top: calc(var(--safe-t) + var(--gap)); background: var(--teal); padding: 8px 14px; line-height: 1.2; max-width: calc(100% - 90px); }
#brandTitle { display: block; font-size: 17px; font-weight: 600; }
#brandSub { color: var(--muted); font-size: 14px; }

/* ---------- rooms ---------- */
#menu { position: fixed; z-index: 6; left: var(--gap); top: calc(var(--safe-t) + 78px); max-height: calc(100% - 330px); overflow-y: auto; scrollbar-width: none; }
#menu::-webkit-scrollbar { display: none; }
#menuList { display: flex; flex-direction: column; gap: 6px; }
.room { display: flex; align-items: center; gap: 10px; background: var(--teal); padding: 5px 14px 5px 5px; text-align: left; min-width: 200px; transition: background 0.2s; }
.room .thumb { width: 60px; height: 40px; flex: none; background: center / cover no-repeat; border: 2px solid rgba(255, 255, 255, 0.85); }
.room:hover { background: var(--teal-dark); }
.room.on { background: var(--accent); }
.room .nm { font-size: 16px; font-weight: 600; }

/* ---------- tools ---------- */
#tools { position: fixed; z-index: 6; right: var(--gap); top: calc(var(--safe-t) + var(--gap)); display: flex; flex-direction: column; gap: 6px; }
.tool { width: 44px; height: 44px; display: grid; place-items: center; background: var(--teal); border: 2px solid rgba(255, 255, 255, 0.85); transition: background 0.2s; }
.tool:hover { background: var(--teal-dark); }
.tool.on { background: var(--accent); }
.tool .txt { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; }
.tool.sm { width: 36px; height: 36px; }
.tool.sm .txt { font-size: 17px; }
#roomsBtn { display: none; }

/* ---------- about the room ---------- */
#info { position: fixed; z-index: 5; right: var(--gap); bottom: calc(var(--safe-b) + var(--gap)); width: 330px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
#info .nav { display: flex; gap: 6px; }
#info .card { width: 100%; background: var(--teal); padding: 12px 16px 14px; }
#info header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#info h2 { margin: 0; font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
#info p { margin: 8px 0 0; color: var(--muted); max-height: 9.5em; overflow-y: auto; }
#info.folded p { display: none; }
.fold svg { transition: transform 0.2s; }
#info.folded .fold svg { transform: rotate(180deg); }

/* ---------- hotspots and plan labels ---------- */
.door { position: absolute; left: 0; top: 0; pointer-events: auto; width: 84px; height: 84px; border-radius: 50%; border: 3px solid #fff; background: #146067 center / cover no-repeat; box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5); overflow: hidden; animation: pulse 2.4s ease-in-out infinite; }
.door .nm { position: absolute; inset: 0; display: grid; place-items: center; padding: 6px; background: rgba(0, 0, 0, 0.34); font-size: 15px; font-weight: 700; line-height: 1.1; text-align: center; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); transition: background 0.2s; }
.door:hover .nm { background: rgba(0, 0, 0, 0.1); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5), 0 3px 14px rgba(0, 0, 0, 0.5); } 50% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0), 0 3px 14px rgba(0, 0, 0, 0.5); } }
.tag { position: absolute; left: 0; top: 0; background: var(--teal); border: 2px solid #fff; padding: 5px 12px; font-weight: 700; white-space: nowrap; pointer-events: auto; }

/* ---------- help, loading ---------- */
#help { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); padding: 16px; }
#help .box { background: var(--teal-solid); border: 3px solid #fff; padding: 18px 22px; max-width: 440px; }
#help h2 { margin: 0 0 8px; font-size: 21px; }
#help ul { margin: 0 0 16px; padding-left: 18px; }
#help li { margin: 6px 0; }
.start-sm { background: var(--accent); padding: 8px 18px; font-weight: 700; }
#toast { position: fixed; z-index: 7; left: 50%; top: 42%; transform: translate(-50%, -50%); background: var(--teal); border: 2px solid #fff; padding: 8px 22px; font-size: 22px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; pointer-events: none; opacity: 0; }
#toast.show { animation: toast 1.8s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -40%); } 15%, 70% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -55%); } }
.door.wait { opacity: 0.6; cursor: progress; animation: none; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.6), 0 3px 14px rgba(0, 0, 0, 0.5); }
#view { transition: none; }
#loading { position: fixed; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--teal); padding: 12px 18px; pointer-events: none; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  :root { --gap: 10px; }
  #brand { padding: 6px 12px; }
  #brandTitle { font-size: 16px; }
  #brandSub { font-size: 13px; }
  #roomsBtn { display: grid; }
  #menu { display: none; left: var(--gap); right: calc(var(--gap) + 52px); top: calc(var(--safe-t) + 70px); max-height: calc(100% - var(--safe-t) - 200px); }
  #menu.open { display: block; }
  .room { min-width: 0; width: 100%; }
  #info { left: var(--gap); right: var(--gap); width: auto; }
  #info .card { padding: 10px 14px 12px; }
  #info h2 { font-size: 17px; }
  #info p { max-height: 5.8em; font-size: 15px; }
  .door { width: 70px; height: 70px; }
  .door .nm { font-size: 13px; }
  #intro .frame { inset: calc(var(--safe-t) + 12px) 12px calc(var(--safe-b) + 12px); border-width: 4px; }
  #introSub { font-size: 18px; }
  #introTitle { font-size: 22px; padding: 6px 18px; }
}
