:root{--green:#0f3d2e;--sand:#f4ede1;--gold:#b8912f;--ink:#1d1d1b;--muted:#5d6661;--card:#fffdf8;--line:#e2d8c4;--danger:#9b2226}
*{box-sizing:border-box}
html,body{height:100%;margin:0;overflow:hidden;background:#101512;color:var(--ink);font-family:system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif}
#scene{position:fixed;inset:0;width:100vw;height:100vh;display:block;touch-action:none;outline:none}
#loading{position:fixed;inset:0;display:grid;place-items:center;color:#f7ecd2;font-size:18px;background:#101512;z-index:5}
#loading[hidden]{display:none}
#hud-top{position:fixed;top:0;inset-inline:0;display:flex;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px;background:linear-gradient(rgba(15,61,46,.85),rgba(15,61,46,0));color:#f7ecd2;z-index:2;pointer-events:none}
#hud-top>*{pointer-events:auto}
.title{display:grid;gap:2px;min-width:0}
.title strong{font-size:16px}
#floor-label{font-size:12px;opacity:.9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:60vw}
.top-btns{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
button{font:inherit;border:0;border-radius:12px;cursor:pointer;min-height:44px;padding:8px 12px;background:var(--green);color:#fff}
button:disabled{opacity:.5;cursor:default}
button.gold{background:var(--gold);color:#1d1d1b;font-weight:700}
button.ghost{background:transparent;color:inherit;border:1px solid var(--line)}
/* Press feedback: a small transform-only response on touch (cheap on iPhone Safari). Reduced-motion users get none. */
button{touch-action:manipulation;transition:transform .12s ease-out}
button:active:not(:disabled){transform:scale(.97)}
@media(prefers-reduced-motion:reduce){button{transition:none}button:active:not(:disabled){transform:none}}
.chip{background:rgba(255,255,255,.14);color:#fff;border:1px solid rgba(255,255,255,.25);backdrop-filter:blur(4px);min-height:40px;padding:6px 10px}
.chip.gold{background:var(--gold);color:#1d1d1b;border:0}
#action{position:fixed;bottom:calc(env(safe-area-inset-bottom,0px) + 22px);left:50%;transform:translateX(-50%);z-index:3;background:var(--gold);color:#1d1d1b;font-weight:700;max-width:88vw;white-space:normal;text-align:center;box-shadow:0 8px 24px rgba(0,0,0,.35)}
#action[hidden]{display:none}
#joy{position:fixed;bottom:calc(env(safe-area-inset-bottom,0px) + 18px);left:14px;width:132px;height:132px;border-radius:50%;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.3);z-index:3;display:none;touch-action:none}
#knob{position:absolute;left:50%;top:50%;width:52px;height:52px;margin:-26px 0 0 -26px;border-radius:50%;background:rgba(247,236,210,.85);box-shadow:0 2px 8px rgba(0,0,0,.4)}
body.phone #joy{display:block}
#rot-btns{position:fixed;bottom:calc(env(safe-area-inset-bottom,0px) + 18px);right:14px;display:none;gap:8px;z-index:3}
#rot-btns button{width:52px;height:52px;padding:0;font-size:22px;background:rgba(15,61,46,.8);color:#f7ecd2;border:1px solid rgba(255,255,255,.25);touch-action:none}
body.phone #rot-btns{display:flex}
.hint{position:fixed;bottom:10px;inset-inline:0;text-align:center;margin:0;font-size:12px;color:#f7ecd2;opacity:.8;pointer-events:none;z-index:1;padding:0 12px}
body.phone .hint{display:none}
#toast{position:fixed;top:74px;left:50%;transform:translateX(-50%);background:rgba(20,20,20,.9);color:#fff;padding:10px 14px;border-radius:12px;z-index:6;max-width:90vw;text-align:center}
#toast[hidden]{display:none}
#fade{position:fixed;inset:0;background:#000;opacity:0;pointer-events:none;transition:opacity .28s ease;z-index:7}
#fade.on{opacity:1}
#modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:flex-end;justify-content:center;z-index:8}
#modal[hidden]{display:none}
.sheet{position:relative;background:var(--card);color:var(--ink);width:min(520px,100%);max-height:80vh;overflow:auto;border-radius:18px 18px 0 0;padding:20px 18px calc(18px + env(safe-area-inset-bottom,0px));display:grid;gap:10px}
@media (min-width:700px){#modal{align-items:center}.sheet{border-radius:18px}}
#modal-close{position:absolute;top:8px;inset-inline-end:8px;background:transparent;color:var(--ink);min-height:36px;width:36px;padding:0;font-size:22px}
.sheet h2{margin:0 0 4px;font-size:20px}
.muted{color:var(--muted);font-size:14px;margin:0}
.price{font-size:22px;font-weight:700;color:var(--green);margin:4px 0}
.total{font-size:18px;font-weight:700;margin:6px 0}
.line{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;border-bottom:1px dashed var(--line);padding:6px 0}
.floor-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.floor{display:grid;gap:2px;justify-items:start;background:#f2ead8;color:var(--ink);border:1px solid var(--line);text-align:start}
.floor.ghost{opacity:.55}
.floor small{font-size:12px;color:var(--muted)}
#modal-body button:disabled{background:#8c8c86}

/* Wide screens: the product card is a compact side card, so the store stays visible behind it. */
@media (min-width:700px){
  #modal{background:transparent;align-items:center;justify-content:flex-start;pointer-events:none}
  .sheet{pointer-events:auto;width:340px;max-height:70vh;margin:0 18px;border-radius:16px;box-shadow:0 10px 30px rgba(0,0,0,.35)}
}
/* Phone: the bottom sheet covers less of the scene. */
@media (max-width:699px){
  .sheet{max-height:46vh}
}
#credit{position:fixed;inset-inline-end:8px;bottom:4px;font-size:12px;color:#f7ecd2;opacity:.8;margin:0;z-index:1;pointer-events:none}

/* Product inspection panel: a card over the lower part of the store, so the product stays in view above it. */
#inspect{position:fixed;inset-inline:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));z-index:6;background:var(--card);color:var(--ink);border-radius:16px;padding:12px 14px;display:grid;gap:8px;box-shadow:0 8px 24px rgba(0,0,0,.3);max-width:520px;margin-inline:auto}
#inspect[hidden]{display:none}
#inspect .ins-info{display:grid;gap:2px}
#inspect .ins-info strong{font-size:17px}
#inspect .ins-info .price{font-size:18px;font-weight:700;color:var(--green)}
#inspect .ins-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
#inspect .ins-row [data-f="qty"]{min-width:28px;text-align:center;font-weight:700}
#inspect button{min-height:40px}
body.inspecting #joy, body.inspecting #rot-btns, body.inspecting #action, body.inspecting #arrows{display:none}
/* Desktop arrow pad: bottom-left, out of the way of the header, the cart, the lift prompt and the store cards. */
#arrows{position:fixed;left:16px;bottom:52px;direction:ltr;display:none;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(2,44px);gap:6px;z-index:3;padding:8px;border-radius:16px;background:rgba(15,61,46,.55);border:1px solid rgba(255,255,255,.18);backdrop-filter:blur(4px);user-select:none;-webkit-user-select:none}
#arrows span{display:none}
#arrows button{width:44px;height:44px;padding:0;font-size:20px;line-height:1;background:rgba(247,236,210,.16);color:#f7ecd2;border:1px solid rgba(247,236,210,.35);touch-action:none;transition:background .12s ease,transform .12s ease}
#arrows button[data-dir="up"]{grid-column:2;grid-row:1}
#arrows button[data-dir="left"]{grid-column:1;grid-row:2}
#arrows button[data-dir="down"]{grid-column:2;grid-row:2}
#arrows button[data-dir="right"]{grid-column:3;grid-row:2}
#arrows button:active,#arrows button:focus-visible{background:var(--gold);color:#1d1d1b;transform:scale(.96);outline:none}
body:not(.phone) #arrows{display:grid}
body.riding #arrows{display:none}
/* On phones the action prompt sits under the header, away from the joystick and the rotation buttons. */
body.phone #action{top:calc(env(safe-area-inset-top,0px) + 62px);bottom:auto;font-size:14px;padding:8px 14px;max-width:72vw}
body.riding #joy{display:none}

/* Character chooser shown before the visitor enters. */
#chooser{position:fixed;inset:0;background:#101512;z-index:7;display:grid;place-items:center;color:#f7ecd2;padding:16px}
#chooser[hidden]{display:none}
#chooser .ch-card{display:grid;gap:12px;max-width:360px;text-align:center}
#chooser .muted{color:#cfc6ab}
#chooser .ch-row{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
#chooser .ch-row button{min-height:48px;padding:0 16px}

/* Footstep volume slider in the header, sized to sit beside the chips. */
.chip-range{width:84px;height:40px;accent-color:#d9b26a;background:transparent;margin:0 2px}
@media (max-width:699px){.chip-range{width:64px}}

/* Photographic shopping UI. All tap targets meet the 44px touch minimum. */
#shop-strip{position:fixed;z-index:4;inset-inline:12px;bottom:calc(env(safe-area-inset-bottom,0px) + 172px);display:flex;gap:9px;overflow-x:auto;max-width:min(480px,calc(100vw - 24px));margin:auto;padding:9px;background:rgba(15,40,30,.9);border:1px solid rgba(237,210,157,.5);border-radius:15px;box-shadow:0 10px 28px rgba(0,0,0,.35);scroll-snap-type:x proximity}
#shop-strip[hidden]{display:none!important}
.shop-strip-item{min-width:106px;max-width:116px;min-height:106px;background:#f6eee0;color:#2b271e;border:1px solid #b79656;padding:5px;display:grid;align-content:start;justify-items:center;gap:4px;font-size:11px;font-weight:700;scroll-snap-align:center}
.shop-strip-item img{width:92px;height:68px;border-radius:8px;object-fit:cover;background:#e8d7b9}
.shop-strip-item:focus-visible{outline:3px solid #ffda83}
body.inspecting #shop-strip{display:none}
@media(min-width:700px){#shop-strip{right:16px;left:auto;bottom:52px;margin:0;width:360px}}
@media(max-width:699px){#shop-strip{bottom:calc(env(safe-area-inset-bottom,0px) + 158px);max-width:calc(100vw - 22px)}}

.product-photo{position:relative;min-width:0;width:100%;aspect-ratio:4/3;overflow:hidden;border-radius:12px;background:linear-gradient(130deg,#e8d9c0,#f6f0e6);border:1px solid #e2d4bc;display:grid;place-items:center}
.product-photo img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.product-photo .photo-placeholder{max-width:92%;font-size:14px;font-weight:700;text-align:center;color:#5a4932}
.product-photo.photo-loaded .photo-placeholder{display:none}
.product-photo .photo-note{position:absolute;bottom:6px;right:6px;font-size:10px;background:rgba(14,40,31,.88);color:#fff5dc;padding:4px 8px;border-radius:10px}
.hero-photo{max-height:245px;aspect-ratio:16/10}
.mini-photo{width:64px;height:58px;flex-shrink:0}
.mini-photo .photo-placeholder{font-size:10px}
.mini-photo .photo-note{display:none}
.catalog-section{display:grid;gap:9px;padding:10px 0 14px;border-top:1px solid var(--line)}
.catalog-section h3{font-size:17px;margin:0}
.catalog-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.product-tile{min-width:0;display:grid;align-content:start;gap:5px;padding:9px;border:1px solid #e6d8bf;border-radius:15px;background:#fffbf4}
.product-tile strong{font-size:14px;line-height:1.3}
.product-tile small{font-size:11px;line-height:1.4}
.tile-price{font-weight:800;color:#12513a}
.tile-actions{display:flex;flex-wrap:wrap;gap:5px}
.tile-actions button{font-size:12px;min-height:44px;padding:6px;flex:1 1 auto}
#modal.catalog-mode .sheet{max-height:82vh;width:min(700px,100%);padding-top:24px}
@media(max-width:699px){#modal.catalog-mode .sheet{max-height:78vh}.catalog-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
#inspect .inspect-top{display:flex;align-items:center;gap:10px}
#inspect .inspect-photo{flex-shrink:0;width:94px;height:94px;object-fit:cover;border-radius:10px;background:#eee2d0}
#inspect .inspect-photo[hidden]{display:none}
#inspect .ins-info{min-width:0;flex:1}
#inspect .ins-info strong{line-height:1.35}

/* Weekend finish: understated navigation and an easy-to-scan seven-floor directory. */
.cart-actions{display:flex;flex-wrap:wrap;gap:8px}
.cart-actions button{flex:1 1 130px}
.directory-list{display:grid;gap:8px}
.directory-store{display:flex;align-items:center;gap:10px;border-radius:12px;padding:8px;background:#fdf8ed;border:1px solid #e5d7bf}
.directory-store .mini-photo{width:58px;height:58px}
.directory-store-name{display:grid;gap:2px;flex:1;min-width:90px}
.directory-store-name strong{font-size:13px}
.directory-store-name small{font-size:11px}
.directory-store-actions{display:flex;gap:5px;flex-wrap:wrap}
.directory-store-actions button{font-size:11px;padding:6px 9px;min-height:42px}
@media(max-width:699px){
  /* Phone HUD: the brand and sound stay at the top; the actions form one column on the right, within thumb reach,
     so the walkway, the character and the stores stay visible in the middle of the screen. */
  #hud-top{align-items:flex-start;padding-top:calc(env(safe-area-inset-top,0px) + 8px);gap:4px}
  .title{flex:1 1 auto;max-width:calc(100% - 130px);min-width:0}
  .title span{font-size:12px;line-height:1.35}
  .top-btns{position:fixed;inset-inline-end:10px;top:calc(env(safe-area-inset-top,0px) + 112px);display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:6px;width:116px;max-height:calc(100vh - 300px);overflow-y:auto;scrollbar-width:none}
  #hud-top .chip{min-height:40px;width:100%;padding:6px 8px;font-size:12px;border-radius:10px;text-align:center}
  #hud-top .chip-range{width:100%;height:32px;margin:0}
  #btn-sound{font-size:11px}
  #btn-directory{font-weight:650}
  .directory-store{flex-wrap:wrap}
  .directory-store-actions{flex-basis:100%;justify-content:flex-end}
  .directory-store-actions button{flex:1}
  #shop-strip{bottom:calc(env(safe-area-inset-bottom,0px) + 151px)}
}
/* Reduce decorative movement when requested by the OS. */
@media(prefers-reduced-motion:reduce){#fade{transition:none}#arrows button{transition:none}}

/* Visitor-selected transport: concise premium route sheet and one-tap cancel. */
.travel-choices{display:grid;gap:9px;padding-block:6px}
.travel-choice{display:grid;gap:5px;text-align:start;background:#f9f2e5;border:1px solid #d8c39e;color:#26271f;min-height:78px;padding:12px 15px;border-radius:14px}
.travel-choice strong{font-size:16px}
.travel-choice small{font-size:12px;line-height:1.55;color:#526056}
.travel-choice:not(:disabled):active{border-color:#b8912f;background:#f3e4c4;transform:scale(.992)}
.travel-choice:not(:disabled):focus-visible{outline:3px solid #bf973a;outline-offset:2px}
.travel-choice:disabled{opacity:.5}
#tour-guide{position:fixed;z-index:5;top:calc(env(safe-area-inset-top,0px) + 72px);right:12px;left:12px;margin-inline:auto;max-width:455px;display:flex;gap:10px;align-items:center;padding:10px 12px;background:rgba(16,48,36,.94);color:#fff3d8;border:1px solid #c49b55;border-radius:15px;box-shadow:0 10px 28px rgba(0,0,0,.3);pointer-events:auto;backdrop-filter:blur(9px)}
#tour-guide[hidden]{display:none}
#tour-guide .tour-copy{display:grid;gap:3px;flex:1;min-width:0}
#tour-guide strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#tour-guide span{font-size:12px;color:#eddaa8}
#tour-cancel{font-size:12px;background:#f4e6c7;color:#24251e;border:1px solid #d0b883;min-height:38px;padding:6px 9px;white-space:nowrap}
@media (min-width:700px){#tour-guide{left:auto;right:24px;top:95px;margin:0}}
@media (max-width:699px){#tour-guide{top:calc(env(safe-area-inset-top,0px) + 131px);max-width:calc(100vw - 24px)}}

/* Virtual passport: one stamp cell per floor. */
.passport-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-top:12px}
.passport-stamp{display:flex;flex-direction:column;gap:4px;padding:12px;border:1px dashed rgba(184,145,47,.55);border-radius:12px;background:rgba(255,255,255,.04)}
.passport-stamp.is-stamped{border-style:solid;border-color:#b8912f;background:rgba(184,145,47,.14)}
.passport-mark{font-size:22px;line-height:1}

/* Directory search: a full-width field above the seven floors, with a live result count. */
.dir-search{width:100%;min-height:44px;padding:10px 12px;border-radius:12px;border:1px solid #d8c59f;background:#fffbf4;color:var(--ink);font:inherit}
.dir-search:focus-visible{outline:3px solid #ffda83;outline-offset:1px}
/* Local 3D renders of products: shown whole (contain), not cropped, on a light card. */
.product-photo img.preview-img{object-fit:contain;padding:6%;background:#f6eee0}

/* World tales experiment: sample cards with local mute, block and report actions. */
.tales-list{display:grid;gap:10px}
.tale{display:grid;gap:6px;padding:12px;border:1px solid #e6d8bf;border-radius:14px;background:#fffbf4}
.tale-head{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap}
.tale p{margin:0;line-height:1.5}
.tale-actions{display:flex;flex-wrap:wrap;gap:6px}
.tale-actions button{min-height:40px;font-size:13px;flex:1 1 auto}

/* «تمتّع وريح» cinema panels: catalogue and player. Logical properties keep them right-to-left in Arabic. */
#cinema-panel, #cinema-player { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(8, 6, 12, 0.72); }
#cinema-panel[hidden], #cinema-player[hidden] { display: none; }
.cin-card { background: #fbf6ea; color: #1d1a16; width: min(640px, 100%); max-height: 92vh; overflow: auto; padding: 16px; border-radius: 14px; text-align: start; }
.cin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cin-head h2 { margin: 0; font-size: 18px; }
.cin-genres { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.cin-list { display: grid; gap: 12px; }
.cin-film { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; border: 1px solid #e6dcc6; border-radius: 12px; background: #fff; }
.cin-art { display: grid; place-items: center; min-height: 110px; border-radius: 10px; background: linear-gradient(135deg, #2a1b33, #7a1f2b); font-size: 30px; }
.cin-body h3 { margin: 0 0 4px; font-size: 16px; }
.cin-body p { margin: 4px 0; }
.cin-status { font-size: 13px; color: #7a5a12; }
.cin-status.ok { color: #1d6b43; }
#player-video { width: 100%; max-height: 52vh; background: #000; border-radius: 10px; }
.cin-meta, .cin-credits { margin-top: 8px; }
@media (max-width: 420px) { .cin-film { grid-template-columns: 1fr; } .cin-art { min-height: 70px; } }

/* Phone polish (iPhone Safari): a solid header clear of the browser bar, a compact scrollable action column that
   stops above the walking stick, no credit text in play, and the stick and camera buttons at thumb height. */
@media (max-width: 699px) {
  html, body { height: 100%; height: 100dvh; }
  #hud-top {
    padding: calc(env(safe-area-inset-top,0px) + 6px) 12px 10px;
    background: linear-gradient(rgba(12,48,37,.96), rgba(12,48,37,.82) 70%, rgba(12,48,37,0));
  }
  .title { max-width: calc(100% - 118px); }
  .title strong { font-size: 15px; }
  .title span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-btns {
    top: calc(env(safe-area-inset-top,0px) + 92px);
    inset-inline-end: 8px;
    width: 112px;
    gap: 5px;
    max-height: calc(100dvh - env(safe-area-inset-top,0px) - 92px - 176px);
    overscroll-behavior: contain;
  }
  #hud-top .chip {
    min-height: 36px; padding: 5px 8px; font-size: 12px; line-height: 1.25;
    background: rgba(12,48,37,.78); border-color: rgba(247,236,210,.35);
  }
  #hud-top .chip.gold { background: rgba(176,134,50,.95); color: #1d1a16; }
  #hud-top .chip-range { height: 28px; }
  #credit { display: none; }
  #rot-btns button { width: 48px; height: 48px; }
  #joy { left: 12px; }
}

/* World Lounge («مجلس العالم»). 16px inputs stop iOS zoom; composer keeps clear of the home indicator. */
.lounge { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.lounge-notice { font-size: 13px; margin: 0 0 6px; }
.lounge-status { font-size: 14px; margin: 4px 0; color: #8a2b1f; }
.lounge-form { display: flex; flex-direction: column; gap: 10px; }
.lounge-input {
  font: inherit; font-size: 16px; min-height: 44px; width: 100%; box-sizing: border-box;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
}
.lounge-text { resize: none; min-height: 64px; }
.lounge-head, .lounge-msg-head, .lounge-msg-actions, .lounge-report-menu, .lounge-composer-row, .lounge-manage-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between;
}
.lounge-log { max-height: min(46dvh, 420px); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; }
.lounge-msg { padding: 10px 12px; border-radius: 12px; background: #f2ead8; }
.lounge-msg.is-own { background: #f6e7b8; }
.lounge-msg p { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.lounge-msg-actions, .lounge-report-menu { justify-content: flex-start; }
.lounge-msg-actions button, .lounge-report-menu button, .lounge-manage-row button, .lounge-head button { min-height: 40px; }
.lounge-composer { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--card); }
.lounge-manage summary { min-height: 40px; display: flex; align-items: center; cursor: pointer; }
.lounge-manage-list { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 699px) {
  .lounge-log { max-height: 40dvh; }
}

/* On narrow phones the previous two-column catalogue clipped Arabic products and buttons. */
@media (max-width: 480px) {
  #modal.catalog-mode .sheet { width: 100%; max-width: 100vw; overflow-x: hidden; }
  #modal.catalog-mode .catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .product-tile { min-width: 0; overflow-wrap: anywhere; }
}

/* WORLMA iPhone approved menu layout — menu-only patch.
   Keep media/video/catalogue functionality untouched. Sound stays with the brand;
   the original navigation order stays above the joystick, with independent scrolling. */
@media (max-width: 699px) {
  #hud-top .top-btns {
    top: calc(env(safe-area-inset-top, 0px) + 96px);
    /* flex-end pushes overflow above the column, where scrolling cannot reach it (the floors button hid under the volume slider on 320 px phones). */
    justify-content: flex-start;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 96px - 184px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-bottom: 6px;
  }
  #hud-top #btn-sound {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 6px);
    inset-inline-end: 8px;
    width: 112px;
    z-index: 4;
    order: 0;
  }
  #hud-top #sound-vol {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 47px);
    inset-inline-end: 8px;
    width: 112px;
    height: 28px;
    margin: 0;
    z-index: 4;
  }
  .top-btns #btn-exit { order: 0; }
  .top-btns #btn-floors { order: 1; }
  .top-btns #btn-products { order: 2; }
  .top-btns #btn-directory { order: 3; }
  .top-btns #btn-passport { order: 4; }
  .top-btns #btn-cart { order: 5; }
  .top-btns #btn-cinema { order: 6; }
  .top-btns #btn-stories { order: 7; }
  .top-btns #btn-lang { order: 8; }
  #hud-top .top-btns::-webkit-scrollbar { display: none; }
}


/* Cinema catalogue: accessible genre contrast on ivory panels (iPhone Safari). */
#cinema-genres .chip {
  color: #153c30;
  background: #f1f0e4;
  border: 1px solid #aab9a7;
  min-height: 44px;
  font-weight: 700;
  opacity: 1;
  -webkit-text-fill-color: #153c30;
}
#cinema-genres .chip.gold,
#cinema-genres .chip[aria-pressed="true"] {
  color: #1d1d1b;
  -webkit-text-fill-color: #1d1d1b;
  background: #cfaa48;
  border-color: #987325;
}
#cinema-genres .chip:focus-visible { outline: 3px solid #245e47; outline-offset: 2px; }
#cinema-close { color: #153c30; border-color: #668370; background: #f1f0e4; font-weight: 700; }
#hud-top #btn-exit:not([hidden]) {
  background: #b8912f;
  color: #1d1d1b;
  font-weight: 800;
  border-color: #f7df9b;
}
@media (max-width: 699px) {
  #cinema-panel, #cinema-player { padding: 10px; }
  .cin-card { max-height: calc(100dvh - 20px); }
  .cin-head { flex-wrap: wrap; }
  .top-btns #btn-exit:not([hidden]) { order: -20; }
}


/* WORLMA cinema mobile scroll-safe navigation; media source handling untouched. */
#cinema-panel .cin-card, #cinema-player .cin-card {
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 28px);
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
#cinema-panel .cin-head, #cinema-player .cin-head {
  position: sticky; top: -16px; z-index: 3;
  padding: 12px 0; margin-top: -12px;
  background: #fbf6ea;
  border-bottom: 1px solid #d9cfb9;
}
#cinema-panel #cinema-list { padding-bottom: 75px; }
#cinema-panel .cin-count { font-size: 14px; font-weight: 800; color: #174b37; margin: 4px 0; }
#cinema-panel .cin-pending { padding: 10px; border: 1px solid #cbbf9e; border-radius: 12px; background: #f7f2e8; }
#cinema-panel .cin-pending summary { cursor: pointer; min-height: 44px; font-weight: 700; color: #174b37; }
#cinema-panel .cin-pending-item { padding: 10px 0; border-top: 1px solid #d8ccb5; display: grid; gap: 5px; }
#cinema-panel .cin-floating-exit {
  position: absolute;
  right: max(18px, env(safe-area-inset-right, 0px) + 18px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 9;
  padding: 10px 15px;
  min-height: 46px;
  border: 2px solid #e1c375;
  border-radius: 13px;
  background: #153b2b;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0,0,0,.42);
}
#cinema-panel #cinema-close { min-height: 46px; }


/* WORLMA navigation choice visibility fix: four choices on any floor without hiding routes. */
#modal.travel-choice-mode .sheet { max-height: min(82dvh, 780px); overflow-y: auto; overscroll-behavior-y: contain; }
#modal.travel-choice-mode .travel-choices { grid-template-columns: 1fr; }
#modal.travel-choice-mode .travel-choice:disabled { background: #eee9df; border-color: #d7d0c4; color: #5f605b; opacity: .8; }
#modal.travel-choice-mode .travel-choice:disabled small { color: #65685f; }
@media (max-width: 699px) {
  #modal.travel-choice-mode .sheet { max-height: 78dvh; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  #modal.travel-choice-mode .travel-choice { min-height: 70px; }
}


/* Najd Mall bilingual welcome: first screen for three seconds, then visitor selection. */
#welcome-splash {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  overflow: hidden; padding: 24px; background:
    radial-gradient(ellipse at 50% 30%, rgba(187,145,64,.27), transparent 54%),
    linear-gradient(160deg, #061c18 0%, #0c3a30 50%, #041b19 100%);
  color: #f8ecd4; text-align: center;
}
#welcome-splash[hidden] { display: none !important; }
.welcome-ornament { position: absolute; width: min(82vw,440px); height: min(82vw,440px); border: 1px solid rgba(223,175,90,.4); transform: rotate(45deg); border-radius: 24px; pointer-events: none; }
.welcome-card { position: relative; display: grid; gap: 12px; justify-items: center; width: min(100%,480px); padding: 30px 12px; }
.welcome-brand { letter-spacing: .3em; color: #e6c483; font-size: 14px; font-weight: 800; }
.welcome-card h1 { color: #fff5db; font-weight: 750; font-size: clamp(27px, 6vw, 40px); margin: 0; line-height: 1.5; }
.welcome-card h1 span { color: #f6cf77; }
.welcome-card > p[lang="en"] { direction: ltr; font-size: clamp(19px, 5vw, 27px); font-weight: 650; margin: 0; color: #f8e4b9; }
.welcome-rule { width: 88px; height: 2px; background: #cb9b4c; margin-block: 12px; }
.welcome-subtitle, .welcome-subtitle-en { margin: 0; color: #d8d0b9; font-size: 14px; }
.welcome-subtitle-en { font-size: 12px; }

#chooser .ch-card { background: rgba(255,255,255,.035); border: 1px solid rgba(216,173,90,.55); border-radius: 22px; padding: 26px 20px; }
#chooser h2 { color: #f8e9bd; }
#chooser .ch-row { width: 100%; }
#chooser .ch-row button { flex: 1 1 120px; }

/* Seven floors visible and directly selectable from the directory or shop travel sheet. */
.directory-floor-tabs { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; margin-block: 8px; }
.floor-tab { min-width: 0; min-height: 44px; font-size: 13px; padding: 5px; border: 1px solid #9aaa9b; background: #ecf1e7; color: #173e2e; }
.floor-tab.active, .floor-tab[aria-pressed="true"] { color: #1b1d1a; background: #dfbb64; border-color: #b58e30; font-weight: 800; }
.travel-floor-label { color: #285943; font-weight: 750; font-size: 13px; margin: 4px 0; }
.travel-floor-tabs { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px; margin: 0 0 8px; }
.travel-floor-tab { min-width: 0; min-height: 46px; padding: 4px 1px; background: #e9efe9; color: #194433; border: 1px solid #9aaa9b; }
.travel-floor-tab strong { font-size: 15px; }
.travel-floor-tab small { display: none; }
.travel-floor-tab.active { background: #dbb057; color: #171b18; border-color: #9f7b33; }
#modal.travel-choice-mode .sheet { max-height: min(85dvh,820px); }
@media (max-width:699px) {
  #modal.travel-choice-mode .sheet { max-height: 82dvh; }
  .floor-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .floor { min-height: 76px; }
}

/* Inside a store: keep the room visible. The product strip folds to a tab, and on phones the action column
   folds into one row (exit, cart, menu) until the visitor opens the menu. Mall-mode layout is unchanged. */
#btn-store-menu{display:none}
#shop-strip-toggle{position:fixed;z-index:4;inset-inline-end:12px;bottom:calc(env(safe-area-inset-bottom,0px) + 288px);min-height:40px;padding:6px 12px;border-radius:12px;background:rgba(15,40,30,.92);color:#f7ecd2;border:1px solid rgba(237,210,157,.6);font-size:12px;font-weight:700}
#shop-strip-toggle[hidden]{display:none!important}
#shop-strip-toggle:focus-visible{outline:3px solid #ffda83}
body.strip-collapsed #shop-strip{display:none}
body.strip-collapsed #shop-strip-toggle{bottom:calc(env(safe-area-inset-bottom,0px) + 150px)}
body.inspecting #shop-strip-toggle{display:none}
.shop-strip-item img.render{object-fit:contain;background:#f6eee0}
@media(min-width:700px){#shop-strip-toggle{bottom:190px;inset-inline-end:16px}body.strip-collapsed #shop-strip-toggle{bottom:52px}}
@media(max-width:699px){
  body.shopping-store #btn-store-menu{display:block;order:-10}
  body.shopping-store:not(.store-menu-open) #hud-top .top-btns{flex-direction:row;align-items:center;width:auto;inset-inline:8px;max-height:none;overflow:visible;gap:6px;padding-bottom:0}
  body.shopping-store:not(.store-menu-open) #hud-top .top-btns>.chip{display:none;width:auto;flex:1 1 0;min-height:40px}
  body.shopping-store:not(.store-menu-open) #hud-top .top-btns>#btn-exit:not([hidden]),
  body.shopping-store:not(.store-menu-open) #hud-top .top-btns>#btn-cart,
  body.shopping-store:not(.store-menu-open) #hud-top .top-btns>#btn-store-menu{display:block}
  body.shopping-store:not(.store-menu-open) #hud-top #btn-sound,
  body.shopping-store:not(.store-menu-open) #hud-top #sound-vol{display:none}
  body.shopping-store:not(.store-menu-open) #hud-top .top-btns{top:calc(env(safe-area-inset-top,0px) + 52px)}
  body.shopping-store:not(.store-menu-open) .title{max-width:100%}
}

/* Welcome card: the credits link keeps the card palette instead of the browser default blue. */
#chooser .ch-card a { color: #e9cf8e; text-decoration: underline; text-underline-offset: 3px; }

/* Mobile window and menu polish (Safari): sheet height follows the dynamic viewport, close button meets 44 px. */
.sheet { max-height: min(80vh, calc(100vh - 24px)); max-height: min(80dvh, calc(100dvh - 24px)); }
#modal-close { min-width: 44px; min-height: 44px; width: 44px; height: 44px; }
#btn-mall-menu { display: none; min-height: 44px; }
@media (max-width: 699px) {
  #btn-mall-menu { display: inline-flex; align-items: center; }
  body.mall-menu-collapsed .top-btns > button:not(#btn-mall-menu):not(#btn-products):not(#btn-cart):not(#btn-exit):not(#btn-store-menu):not(#btn-floors):not(#btn-directory):not(#btn-lang) { display: none; }
  body.shopping-store #btn-mall-menu { display: none; }
}

/* Short landscape phones (height under 500 px): a shorter product preview, so the add-to-cart button is on screen at once.
   The sheet still scrolls inside itself if the content is taller; the mall behind does not move. */
@media (max-height: 500px) and (orientation: landscape) {
  .product-photo { aspect-ratio: 16 / 6; }
  #modal .sheet { max-height: calc(100dvh - 12px); padding-top: 14px; }
}

/* Visit restored after a reload: small, bottom-centre, 44px touch targets, clear of the joystick and the safe area. */
#resume-banner{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(12px + env(safe-area-inset-bottom));z-index:6;display:flex;align-items:center;gap:8px;max-width:calc(100vw - 24px);padding:6px 8px 6px 12px;border-radius:999px;background:rgba(16,21,18,.92);color:#f7ecd2;font-size:14px;box-shadow:0 6px 18px rgba(0,0,0,.35)}
#resume-banner[hidden]{display:none}
#resume-banner button{min-height:44px;min-width:44px;padding:0 12px;border:1px solid #c09b56;border-radius:999px;background:transparent;color:#f7ecd2;font:inherit;cursor:pointer}

/* Stage 3 directory filter: native picker works with touch, RTL and Safari. */
.dir-category{display:block;width:100%;min-height:44px;margin-block:8px;padding:8px 12px;border:1px solid #d8c59f;border-radius:12px;background:#fffbf4;color:var(--ink);font:inherit;direction:inherit}
.dir-category:focus-visible,.directory-more:focus-visible{outline:3px solid #ffda83;outline-offset:2px}
.directory-more{display:block;min-height:44px;margin:12px auto 4px;padding-inline:18px}
.directory-more[hidden]{display:none}

/* iPhone store usability: show an actually reachable product picker without
   covering the boutique. Do not hide the only visible SKU behind a collapsed tab.
   Keep 44px+ controls and browser safe area clearance. */
@media(max-width:699px){
  body.phone.shopping-store #shop-strip{
    bottom:calc(env(safe-area-inset-bottom,0px) + 151px);
    top:auto;
    height:94px;
    min-height:0;
    box-sizing:border-box;
    max-width:calc(100vw - 24px);
    width:max-content;
    justify-content:flex-start;
    align-items:center;
    gap:6px;
    padding:5px 7px;
    overflow-x:auto;
  }
  body.phone.shopping-store #shop-strip .shop-strip-item{
    min-width:78px;
    max-width:94px;
    width:82px;
    height:80px;
    min-height:80px;
    box-sizing:border-box;
    font-size:10px;
    line-height:1.15;
    gap:2px;
    padding:3px;
    overflow:hidden;
  }
  body.phone.shopping-store #shop-strip .shop-strip-item img{
    width:70px;
    height:47px;
    object-fit:contain;
  }
  body.phone.shopping-store #shop-strip-toggle{
    bottom:calc(env(safe-area-inset-bottom,0px) + 253px);
    inset-inline-end:12px;
    min-height:44px;
    background:#b88b32;
    border:1px solid #f2d9a3;
    color:#1c1b17;
    font-size:13px;
  }
  body.phone.shopping-store.strip-collapsed #shop-strip-toggle{
    bottom:calc(env(safe-area-inset-bottom,0px) + 151px);
  }
}
