:root {
  --glass: rgba(18, 22, 28, .58);
  --stroke: rgba(255, 255, 255, .14);
  --text: #f3f4f6;
  --muted: rgba(243, 244, 246, .62);
  --accent: #e8b574;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1014; color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#view.dragging { cursor: grabbing; }

.glass { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }

.top-left { position: fixed; top: 16px; left: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; max-width: calc(100vw - 32px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand small { color: var(--muted); font-size: 12px; }
.logo { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; font-weight: 800; letter-spacing: 1px;
  color: #1a1410; background: linear-gradient(135deg, #f6d7a8, #d79a52); }
.logo.sm { width: 40px; height: 40px; border-radius: 12px; font-size: 12px; flex: none; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.seg button { flex: 1 1 auto; min-width: 0; border: 0; padding: 9px 8px; border-radius: 9px; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer; transition: .18s; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: #1c150d; box-shadow: 0 2px 10px rgba(232, 181, 116, .35); }
#state { flex-direction: column; }

.panel { position: fixed; top: 16px; right: 16px; bottom: 16px; width: 372px; max-width: calc(100vw - 32px); padding: 6px 16px 16px; overflow-x: hidden; overflow-y: auto; transition: transform .3s ease; }
.panel::-webkit-scrollbar { width: 6px; } .panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 3px; }
.panel.closed { transform: translateX(calc(100% + 24px)); }
.panel section { padding: 14px 0; border-bottom: 1px solid var(--stroke); }
.panel section:last-child { border-bottom: 0; }
h3 { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.hint { margin: -4px 0 12px; color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.cfg { padding: 10px 8px; margin: 0 0 4px; border-radius: 12px; border: 1px solid transparent; transition: .25s; }
.cfg.sel { background: rgba(232, 181, 116, .1); border-color: rgba(232, 181, 116, .5); }
.cfg-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 8px; margin-bottom: 8px; }
.cfg-head span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.swatches { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.popover .swatches { grid-template-columns: repeat(5, 30px); }
.sw { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .25); cursor: pointer; padding: 0;
  transition: .15s; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.sw:hover { transform: translateY(-2px); }
.sw.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 181, 116, .35); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--stroke); background: rgba(255, 255, 255, .06); color: var(--text); padding: 7px 11px;
  border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; transition: .15s; }
.chips button:hover { background: var(--accent); color: #1c150d; border-color: transparent; }

.info { position: fixed; left: 16px; bottom: 16px; padding: 12px 16px; min-width: 230px; }
.info small { display: block; color: var(--muted); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; }
.info b { font-size: 19px; }
.info-row { display: flex; gap: 12px; align-items: baseline; color: var(--muted); font-size: 13px; }
.info-row span:first-child { color: var(--accent); font-weight: 700; font-size: 15px; }

.help { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: calc(100vw - 790px); overflow: hidden; text-overflow: ellipsis; padding: 8px 14px; color: var(--muted); font-size: 12px;
  border-radius: 999px; white-space: nowrap; pointer-events: none; }
.help kbd { background: rgba(255, 255, 255, .12); border-radius: 5px; padding: 1px 6px; color: var(--text); font: inherit; font-weight: 600; }

.popover { position: fixed; z-index: 5; padding: 12px; min-width: 180px; }
.popover[hidden] { display: none; }
.popover b { display: block; margin-bottom: 8px; }

#panel-toggle { position: fixed; top: 16px; right: 16px; z-index: 3; width: 42px; height: 42px; color: var(--text); font-size: 18px;
  cursor: pointer; display: none; border-radius: 12px; }

#loader { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #232a33, #0d1014); transition: opacity .6s; }
#loader.done { opacity: 0; pointer-events: none; }
#loader.busy { background: rgba(13, 16, 20, .55); backdrop-filter: blur(6px); }
.loader-card { text-align: center; width: 300px; }
.loader-card .logo { margin: 0 auto 18px; }
.loader-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.loader-card p { margin: 0 0 16px; color: var(--muted); }
.bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

@media (max-width: 900px) {
  #panel-toggle { display: block; }
  .panel { top: 68px; width: min(320px, calc(100vw - 32px)); }
  .brand small, .help { display: none; }
  .top-left { right: 68px; padding: 10px; }
  .seg button { padding: 8px 6px; font-size: 13px; }
  .info { min-width: 0; right: 16px; }
}

html, body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* buttons */
.btn { border: 1px solid var(--stroke); padding: 10px 14px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; transition: .18s; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, .16); }
.btn.primary { background: var(--accent); color: #1c150d; border-color: transparent; box-shadow: 0 4px 18px rgba(232, 181, 116, .45); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.tour-row { display: flex; gap: 6px; }
.tour-row #tour-btn { flex: 1 1 auto; font-size: 15px; letter-spacing: .3px; }
body.touring #tour-btn { background: #f3f4f6; box-shadow: none; }

/* guided tour card */
.tour-card { position: fixed; left: 50%; bottom: 64px; z-index: 4; width: min(440px, calc(100vw - 32px)); padding: 16px 20px;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .5s, transform .5s; }
.tour-card.show { opacity: 1; transform: translate(-50%, 0); }
.tour-card small { display: block; color: var(--muted); font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; }
.tour-card b { display: block; font-size: 22px; margin: 2px 0; }
.tc-area { color: var(--accent); font-weight: 700; font-size: 15px; }
.tour-card p { margin: 8px 0 0; color: var(--text); opacity: .9; }
body.touring .help { display: none; }

/* contact + welcome modals */
#contact-btn { position: fixed; right: 16px; bottom: 16px; z-index: 3; width: 372px; max-width: calc(100vw - 32px); padding: 11px 14px;
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; border-radius: 12px; }
#contact-btn:hover { border-color: rgba(232, 181, 116, .6); }
.panel { bottom: 72px; }
.modal { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 14, .55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .35s ease; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.eyebrow { display: block; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; }
.welcome-card { width: min(520px, 100%); padding: 32px 28px; text-align: center; }
.welcome-card .logo { margin: 0 auto 16px; }
.welcome-card h1 { margin: 6px 0 8px; font-size: clamp(24px, 6vw, 32px); line-height: 1.15; }
.welcome-card .facts { margin: 0 0 24px; color: var(--muted); font-size: 15px; }
.welcome-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.welcome-actions .btn { padding: 13px 20px; font-size: 15px; flex: 1 1 180px; }
.modal-card { position: relative; width: min(400px, 100%); padding: 24px; }
.modal-card h2 { margin: 4px 0 16px; font-size: 22px; }
.modal-card .x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08);
  color: var(--text); font-size: 20px; cursor: pointer; }
.person { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.person small { display: block; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; flex: none; font-weight: 800; color: #1c150d;
  background: linear-gradient(135deg, #f6d7a8, #d79a52); }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border-radius: 12px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--stroke); color: var(--text); text-decoration: none; transition: .15s; }
.row:hover { border-color: var(--accent); }
.row span { color: var(--muted); }
.row b { overflow-wrap: anywhere; text-align: right; }
.modal-card .hint { margin: 10px 0 0; }

/* touch joystick (walkthrough on phones / tablets) */
#joy { position: fixed; left: 24px; bottom: calc(108px + env(safe-area-inset-bottom)); z-index: 3; width: 124px; height: 124px; border-radius: 50%;
  display: none; touch-action: none; background: rgba(18, 22, 28, .35); border: 1px solid var(--stroke);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#joy i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: rgba(243, 244, 246, .85); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); pointer-events: none; }
body.touch.walk #joy { display: block; }
body.touring #joy { display: none; }

@media (max-width: 900px) {
  #contact-btn { width: auto; padding: 0; width: 46px; height: 46px; font-size: 18px; }
  #contact-btn span { display: none; }
  .info { right: 74px; }
  .panel { bottom: 74px; }
  .top-left { gap: 8px; }
  .tour-row .btn { padding: 8px 10px; font-size: 13px; }
  .tour-card { bottom: 96px; padding: 12px 16px; }
  .tour-card b { font-size: 19px; }
  #panel-toggle { width: 46px; height: 46px; }
}
@media (max-width: 900px) and (max-height: 520px) {   /* phone in landscape */
  .brand { display: none; }
  #joy { bottom: 16px; }
  .tour-card { bottom: 16px; }
}

/* cinematic guided tour: letterbox, cross-dissolve overlay, lower-third room cards */
#fade { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; }
#cine-top, #cine-bot { position: fixed; left: 0; right: 0; height: 0; z-index: 2; background: #000; pointer-events: none; transition: height 1s cubic-bezier(.4, 0, .2, 1); }
#cine-top { top: 0; } #cine-bot { bottom: 0; }
body.cine #cine-top, body.cine #cine-bot { height: 8.5vh; }
.top-left, .panel, #panel-toggle, .info, #contact-btn, .help { transition: opacity .6s, transform .3s ease; }
body.cine .top-left, body.cine .panel, body.cine #panel-toggle, body.cine .info, body.cine #contact-btn, body.cine .help { opacity: 0; pointer-events: none; }
#cine-ctl { position: fixed; top: calc(4.25vh - 18px); right: 20px; z-index: 6; display: flex; gap: 8px; opacity: 0; pointer-events: none; transition: opacity .6s; }
body.cine #cine-ctl { opacity: 1; pointer-events: auto; }
#cine-ctl .btn { padding: 7px 12px; font-size: 13px; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); }
body.cine .tour-card { left: max(32px, 5vw); bottom: calc(8.5vh + 28px); transform: translateY(18px); width: min(470px, calc(100vw - 64px));
  background: linear-gradient(90deg, rgba(10, 12, 16, .72), rgba(10, 12, 16, .35)); border-color: rgba(255, 255, 255, .1); transition: opacity .8s, transform .8s; }
body.cine .tour-card.show { transform: none; }
body.cine .tour-card b { font-size: 28px; font-weight: 600; letter-spacing: .2px; }
@media (max-width: 900px) {
  body.cine .tour-card { left: 16px; width: calc(100vw - 32px); bottom: calc(8.5vh + 12px); }
  body.cine .tour-card b { font-size: 21px; }
  #cine-ctl { right: 12px; }
}

.sw.custom { display: grid; place-items: center; position: relative; color: var(--text); font-weight: 700; font-size: 16px; line-height: 1;
  background: rgba(255, 255, 255, .08); border-style: dashed; overflow: hidden; }
.sw.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sw.custom.on { color: transparent; border-style: solid; }
.chips button { white-space: nowrap; }
