:root {
  --ink: #17120f;
  --cream: #f3eee7;
  --gold: #c39762;
  --line: rgba(255, 255, 255, 0.22);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { font-family: "Tajawal", sans-serif; background: var(--ink); color: #fff; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
.tour-shell, #panorama { position: fixed; inset: 0; width: 100%; height: 100%; }
#panorama { background: #211a16; direction: ltr; }
.pnlm-container { font-family: "Tajawal", sans-serif; }
.pnlm-load-box, .pnlm-about-msg, .pnlm-title-box { display: none !important; }
.pnlm-render-container { filter: saturate(.96) contrast(1.02); }

.tour-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(180deg, rgba(13,10,8,.58) 0, transparent 24%, transparent 66%, rgba(13,10,8,.72) 100%);
}
.nav-targets { position: fixed; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.walk-target {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  min-width: 88px; border: 0; background: transparent; color: #fff; cursor: pointer;
  display: grid; justify-items: center; gap: 7px; text-shadow: 0 2px 12px rgba(0,0,0,.7);
  transition: opacity .18s ease; outline: none; pointer-events: auto;
}
.walk-target:focus-visible i { box-shadow: 0 0 0 7px rgba(255,255,255,.22),0 5px 22px rgba(0,0,0,.35); }
.walk-target[hidden] { display: none; }
.walk-target i { width: 76px; height: 30px; position: relative; border: 3px solid rgba(255,255,255,.94); border-radius: 50%; background: rgba(255,255,255,.08); box-shadow: 0 5px 22px rgba(0,0,0,.35); animation: ringPulse 1.8s ease-in-out infinite; }
.walk-target span { padding: 4px 9px; white-space: nowrap; background: rgba(22,17,14,.72); border: 1px solid rgba(255,255,255,.24); font-size: 10px; opacity: .92; }
.walk-target.door i { width: 52px; height: 52px; border: 3px solid #fff; border-radius: 50%; background: rgba(22,17,14,.36); animation: ringPulse 1.8s ease-in-out infinite; }
.walk-target.door i::before { content: ""; position: absolute; width: 16px; height: 25px; border: 2px solid #fff; border-bottom-width: 3px; left: 16px; top: 10px; }
.walk-target.door i::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; top: 22px; left: 28px; }
.walk-target.back i { width: 54px; height: 54px; border-radius: 50%; background: rgba(22,17,14,.48); }
.walk-target.back i::before { content: "\F12F"; position: absolute; inset: 0; display: grid; place-items: center; font-family: bootstrap-icons; font-size: 25px; font-style: normal; }
.walk-target.back span { background: rgba(22,17,14,.76); }
.walk-target:hover i { background: rgba(195,151,98,.35); transform: scale(1.08); }
@keyframes ringPulse { 50% { box-shadow: 0 0 0 8px rgba(255,255,255,.14),0 5px 22px rgba(0,0,0,.35); } }
.walk-target.door span { opacity: 0; transform: translateY(-4px); transition: opacity .16s ease,transform .16s ease; }
.walk-target.door:hover span, .walk-target.door:focus-visible span { opacity: .96; transform: translateY(0); }
.tour-header {
  position: fixed; z-index: 10; top: 0; inset-inline: 0; min-height: 92px;
  padding: 18px clamp(18px,3vw,48px); display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: linear-gradient(180deg,rgba(18,14,11,.82),rgba(18,14,11,.18));
}
.tour-brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 13px; }
.tour-brand img { width: 62px; height: 54px; object-fit: contain; filter: brightness(0) invert(1); }
.tour-brand span { display: grid; gap: 2px; }
.tour-brand b { font-size: 17px; font-weight: 700; }
.tour-brand small { font-size: 11px; color: rgba(255,255,255,.68); letter-spacing: .04em; }
.tour-brand small em { color: #e0bd93; font-style: normal; font-weight: 700; }
.tour-header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .exit-button { height: 44px; border: 1px solid var(--line); background: rgba(22,17,14,.45); backdrop-filter: blur(14px); color: #fff; cursor: pointer; }
.icon-button { width: 44px; display: grid; place-items: center; }
.exit-button { padding: 0 16px; display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 13px; }
.icon-button:hover, .exit-button:hover { background: rgba(195,151,98,.85); border-color: var(--gold); }

.journey-panel {
  position: fixed; z-index: 11; top: 112px; right: clamp(18px,3vw,48px); width: min(330px,calc(100vw - 36px));
  max-height: calc(100vh - 220px); overflow: auto; color: var(--ink); background: rgba(246,241,234,.94);
  backdrop-filter: blur(18px); box-shadow: 0 22px 70px rgba(0,0,0,.22); transition: transform .35s ease,opacity .35s ease;
}
.journey-heading { padding: 20px 20px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(23,18,15,.11); }
.journey-heading > div { display: flex; align-items: baseline; gap: 12px; }
.journey-heading span { font-size: 14px; font-weight: 700; }
.journey-heading b { color: #987044; font-size: 12px; direction: ltr; }
.journey-heading button { border: 0; background: none; cursor: pointer; color: var(--ink); font-size: 16px; display: block; }
.journey-panel.closed { transform: translateX(calc(100% + 70px)); opacity: 0; pointer-events: none; }
.unit-picker { padding: 15px 20px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; background: #e8dfd4; }
.unit-picker label { font-size: 12px; font-weight: 700; }
.unit-picker select { min-width: 0; border: 1px solid rgba(23,18,15,.16); background: #fff; padding: 8px 11px; color: var(--ink); outline: none; }
.scene-list { padding: 8px 0; }
.scene-button { width: 100%; min-height: 50px; padding: 7px 20px; border: 0; background: transparent; color: #5f574f; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 9px; text-align: right; cursor: pointer; position: relative; }
.scene-button::before { content: ""; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 3px; background: transparent; }
.scene-button .scene-number { direction: ltr; font-size: 11px; color: #998b7e; }
.scene-button .scene-name { font-size: 13px; font-weight: 600; }
.scene-button i { font-size: 13px; opacity: .3; }
.scene-button:hover { background: rgba(195,151,98,.08); color: var(--ink); }
.scene-button.active { color: var(--ink); background: rgba(195,151,98,.14); }
.scene-button.active::before { background: var(--gold); }
.scene-button.active i { opacity: 1; color: #987044; }
.plan-button { width: calc(100% - 32px); margin: 4px 16px 16px; min-height: 44px; border: 1px solid rgba(23,18,15,.18); background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer; }
.plan-button:hover { background: var(--ink); color: #fff; }

.scene-card { position: fixed; z-index: 9; bottom: 115px; left: clamp(18px,3vw,48px); width: min(470px,calc(100vw - 36px)); text-align: left; direction: rtl; text-shadow: 0 2px 20px rgba(0,0,0,.5); }
.scene-status { display: flex; justify-content: flex-end; align-items: center; gap: 9px; margin-bottom: 8px; color: #e0bd93; font-size: 11px; font-weight: 700; }
.scene-status i { width: 18px; height: 1px; background: rgba(255,255,255,.45); }
.concept-label { padding: 4px 7px; border: 1px solid rgba(255,255,255,.25); color: rgba(255,255,255,.75); font-weight: 500; }
.scene-card h1 { margin: 0; font-size: clamp(30px,3.4vw,54px); line-height: 1.05; font-weight: 500; }
.scene-card p { margin: 10px 0 0; font-size: 14px; line-height: 1.8; color: rgba(255,255,255,.8); }

.tour-controls { position: fixed; z-index: 12; bottom: 30px; left: 50%; transform: translateX(-50%); height: 58px; display: flex; direction: rtl; align-items: stretch; background: rgba(22,17,14,.78); backdrop-filter: blur(18px); border: 1px solid var(--line); box-shadow: 0 14px 45px rgba(0,0,0,.28); }
.tour-controls button { min-width: 56px; padding: 0 15px; border: 0; border-inline-end: 1px solid rgba(255,255,255,.12); background: transparent; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.tour-controls button:hover { background: rgba(255,255,255,.1); }
.tour-controls button:disabled { opacity: .35; cursor: default; }
.tour-controls .primary-control { background: var(--gold); color: #1e1712; min-width: 150px; font-weight: 700; }
.tour-controls .primary-control:hover { background: #d5ae7f; }
.control-separator { width: 6px; background: rgba(255,255,255,.04); }
.tour-disclaimer { position: fixed; z-index: 7; bottom: 9px; right: clamp(18px,3vw,48px); margin: 0; color: rgba(255,255,255,.57); font-size: 10px; }

.vt-scene-hotspot { width: 58px !important; height: 58px !important; margin: -29px 0 0 -29px !important; border: 1px solid rgba(255,255,255,.7); border-radius: 50%; background: rgba(195,151,98,.9) !important; box-shadow: 0 0 0 8px rgba(195,151,98,.18),0 9px 30px rgba(0,0,0,.25); }
.vt-scene-hotspot::before { content: "\F138"; font-family: bootstrap-icons; position: absolute; inset: 0; display: grid; place-items: center; color: #211813; font-size: 24px; animation: hotspotPulse 1.9s ease-in-out infinite; }
.vt-scene-hotspot.vt-back::before { transform: rotate(180deg); }
.vt-walk-hotspot {
  width: 72px !important; height: 46px !important; margin: -23px 0 0 -36px !important;
  border: 1px solid rgba(255,255,255,.82); border-radius: 50%;
  background: rgba(22,17,14,.72) !important; box-shadow: 0 0 0 8px rgba(195,151,98,.13),0 10px 28px rgba(0,0,0,.3);
}
.vt-walk-hotspot::before {
  content: "↑"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #f3d2a9; font: 700 29px/1 sans-serif; animation: walkPulse 1.5s ease-in-out infinite;
}
.vt-walk-hotspot.vt-back::before { content: "↓"; }
.vt-door-hotspot {
  width: 48px !important; height: 70px !important; margin: -35px 0 0 -24px !important;
  border: 2px solid #f1d3ae; border-bottom-width: 5px; border-radius: 3px 3px 0 0;
  background: rgba(22,17,14,.45) !important; box-shadow: 0 0 0 8px rgba(195,151,98,.12),0 10px 30px rgba(0,0,0,.32);
}
.vt-door-hotspot::before { content: ""; position: absolute; inset: 6px 7px 0; border: 1px solid rgba(255,255,255,.65); border-bottom: 0; }
.vt-door-hotspot::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #f1d3ae; top: 34px; right: 10px; }
.walking-mode .vt-walk-hotspot, .walking-mode .vt-door-hotspot { display: none !important; }
@keyframes walkPulse { 50% { transform: translateY(-5px); } }
.pnlm-tooltip span { background: rgba(22,17,14,.9) !important; border-radius: 0 !important; font-family: "Tajawal",sans-serif !important; font-size: 12px !important; padding: 7px 10px !important; }
@keyframes hotspotPulse { 50% { transform: translateX(-3px); } }

.loading-screen { position: fixed; z-index: 50; inset: 0; display: grid; place-content: center; justify-items: center; background: #17120f; transition: opacity .7s ease,visibility .7s ease; }
.loading-screen.hidden { opacity: 0; visibility: hidden; }
.loading-screen img { width: 112px; filter: brightness(0) invert(1); margin-bottom: 26px; }
.loading-screen p { margin: 12px 0 0; color: rgba(255,255,255,.62); font-size: 12px; }
.loading-line { width: 150px; height: 1px; background: rgba(255,255,255,.13); overflow: hidden; }
.loading-line i { display: block; height: 100%; width: 50%; background: var(--gold); animation: loading 1.2s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(110%); } to { transform: translateX(-210%); } }

.dialog-backdrop { position: fixed; z-index: 40; inset: 0; padding: 20px; display: grid; place-items: center; background: rgba(9,7,5,.72); backdrop-filter: blur(8px); }
.dialog-backdrop[hidden] { display: none; }
.tour-dialog { width: min(670px,100%); max-height: calc(100vh - 40px); overflow: auto; position: relative; padding: clamp(28px,5vw,54px); background: var(--cream); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.35); }
.dialog-close { position: absolute; top: 14px; left: 14px; width: 40px; height: 40px; border: 1px solid rgba(23,18,15,.15); background: transparent; cursor: pointer; }
.dialog-kicker { color: #9e7446; font-size: 12px; font-weight: 700; }
.tour-dialog h2 { margin: 10px 0 28px; font-size: clamp(26px,4vw,42px); font-weight: 500; }
.help-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.help-grid div { border-top: 1px solid rgba(23,18,15,.18); padding-top: 18px; display: grid; gap: 8px; }
.help-grid i { font-size: 24px; color: #a87d4b; }
.help-grid b { font-size: 14px; }
.help-grid span { color: #766d64; font-size: 12px; line-height: 1.7; }
.dialog-action { margin-top: 30px; min-width: 150px; height: 48px; border: 0; background: var(--ink); color: #fff; cursor: pointer; }
.plan-dialog { width: min(900px,100%); }
.plan-frame { height: min(58vh,560px); display: grid; place-items: center; background: #fff; border: 1px solid rgba(23,18,15,.1); padding: 12px; }
.plan-frame img { width: 100%; height: 100%; object-fit: contain; }
.plan-dialog p { color: #766d64; font-size: 12px; }

@media (max-width:850px) {
  .tour-header { min-height: 74px; padding: 12px 14px; }
  .tour-brand img { width: 48px; height: 42px; }
  .tour-brand b { font-size: 14px; }
  .tour-brand small { font-size: 9px; }
  .exit-button span { display: none; }
  .exit-button { width: 44px; padding: 0; justify-content: center; }
  .journey-panel { top: auto; right: 0; bottom: 0; width: 100%; max-height: 74vh; transform: translateY(105%); border-radius: 20px 20px 0 0; }
  .journey-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .journey-panel.closed { transform: translateY(105%); }
  .journey-heading button { display: block; }
  .scene-card { bottom: 105px; left: 16px; width: calc(100vw - 32px); }
  .scene-card h1 { font-size: 31px; }
  .scene-card p { max-width: 90%; font-size: 12px; }
  .tour-controls { bottom: 24px; width: calc(100vw - 32px); height: 56px; }
  .tour-controls button { min-width: 48px; padding: 0 10px; }
  .tour-controls button span { display: none; }
  .tour-controls .primary-control { min-width: 62px; }
  .tour-disclaimer { display: none; }
  .help-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration:.01ms !important; transition-duration:.01ms !important; } }
