/* Isometric Dubai: UI chrome. Dark-sand glass over a live map.
   Type: Fraunces (display), Inter (UI), IBM Plex Sans Arabic (Arabic). */
:root {
  --bg: #1e1812;
  --fg: #f6eddc;
  --glass: rgba(33, 26, 19, .64);
  --glass-strong: rgba(28, 22, 16, .86);
  --glass-edge: rgba(240, 218, 176, .15);
  --glass-hi: rgba(255, 238, 205, .08);
  --ivory: #f6eddc;
  --sand: #e5cf9f;
  --dune: #bba584;
  --dune-dim: #8f7c62;
  --saffron: #f0b45a;
  --saffron-ink: #2a1c0a;
  --moon: #a9b8e6;
  --gulf: #7fd0c8;
  --gutter: 20px;
  --r-panel: 18px;
  --r-ctl: 11px;
  --r-pill: 999px;
  --blur: blur(18px) saturate(1.45);
  --lift: 0 14px 36px -14px rgba(8, 5, 2, .7), 0 2px 6px -2px rgba(8, 5, 2, .35);
  --f-display: Fraunces, 'Iowan Old Style', Georgia, serif;
  --f-ui: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-ar: 'IBM Plex Sans Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, sans-serif;
  --ease: cubic-bezier(.2, .75, .2, 1);
  --time-h: 150px;
  color-scheme: dark;
}
html[lang='ar'] { --f-ui: var(--f-ar); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font-family: var(--f-ui); font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
#map { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; cursor: grab; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[dir='rtl'] .flip-rtl { transform: scaleX(-1); }
[hidden] { display: none !important; }

/* ---------- surfaces ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .8s var(--ease) .15s; }
body.ready #ui { opacity: 1; }
#ui .brand, #ui .topbar > *, #ui .pop, #ui .card, #ui .time, #ui .tour-caption, #ui .minimap, #ui .zoom, #ui dialog { pointer-events: auto; }
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--lift), inset 0 1px 0 var(--glass-hi);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--ivory); cursor: pointer; transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 236, 200, .1); }
.icon-btn:active { background: rgba(255, 236, 200, .16); }
.icon-btn.glass { width: 44px; height: 44px; border-radius: 14px; background: var(--glass); }
.icon-btn.glass:hover { background: rgba(48, 38, 28, .78); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-ctl);
  border: 1px solid rgba(240, 218, 176, .22); background: rgba(255, 236, 200, .04); color: var(--ivory);
  font-weight: 500; font-size: 13.5px; cursor: pointer; transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:hover { background: rgba(255, 236, 200, .1); border-color: rgba(240, 218, 176, .34); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--saffron); border-color: transparent; color: var(--saffron-ink); }
.btn-primary:hover { background: #f6c271; border-color: transparent; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--dune); }
.btn-quiet:hover { color: var(--ivory); }
.link-btn { padding: 0; border: 0; background: none; color: var(--sand); font-size: 12.5px; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(229, 207, 159, .4); text-underline-offset: 3px; }
.link-btn:hover { text-decoration-color: var(--sand); }

/* ---------- brand lockup ---------- */
.brand {
  position: fixed; top: var(--gutter); inset-inline-start: var(--gutter); max-width: 360px;
  padding: 14px 18px 13px; border-radius: var(--r-panel);
  background: linear-gradient(180deg, rgba(33, 26, 19, .62), rgba(33, 26, 19, .5));
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--lift), inset 0 1px 0 var(--glass-hi);
}
.brand-lockup { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px; row-gap: 2px; font-weight: 400; }
.brand-en { font-family: var(--f-display); font-weight: 500; font-size: 28px; line-height: 1.05; letter-spacing: -.01em;
  font-variation-settings: 'opsz' 96; color: var(--ivory); }
.brand-ar { font-family: var(--f-ar); font-weight: 500; font-size: 16px; color: var(--sand); line-height: 1.2; }
html[dir='ltr'] .brand-ar { padding-left: 12px; border-left: 1px solid rgba(229, 207, 159, .35); }
html[dir='rtl'] .brand-ar { padding-right: 12px; border-right: 1px solid rgba(229, 207, 159, .35); }
.brand-sub { margin: 6px 0 8px; font-size: 13px; line-height: 1.45; color: var(--dune); max-width: 44ch; }

/* ---------- top bar: search + tools ---------- */
.topbar { position: fixed; top: var(--gutter); inset-inline-end: var(--gutter); display: flex; align-items: flex-start; gap: 10px; pointer-events: none; }
.search { position: relative; width: 320px; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px;
  border-radius: var(--r-pill); background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--lift), inset 0 1px 0 var(--glass-hi); transition: width .25s var(--ease), border-radius .2s; }
.search.open { width: 380px; border-radius: 20px 20px 20px 20px; border-color: rgba(240, 180, 90, .45); }
.search-ico { color: var(--dune); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ivory);
  font: inherit; font-size: 14.5px; }
.search input::placeholder { color: var(--dune); opacity: .9; }
.search-kbd { font-family: var(--f-ui); font-size: 11.5px; color: var(--dune); padding: 3px 7px; border-radius: 7px;
  border: 1px solid rgba(240, 218, 176, .2); background: rgba(255, 236, 200, .05); }
.search.open .search-kbd { display: none; }
#search-results {
  position: absolute; top: calc(100% + 8px); inset-inline: 0; margin: 0; padding: 6px; list-style: none;
  max-height: min(60dvh, 460px); overflow: auto; border-radius: 16px; background: rgba(30, 24, 18, .96);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-edge); box-shadow: var(--lift);
  overscroll-behavior: contain;
}
.res-head, .res-empty { padding: 8px 10px 6px; color: var(--dune); font-size: 12px; }
.res-empty { padding: 14px 10px; font-size: 13px; line-height: 1.45; }
.res { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  cursor: pointer; position: relative; }
.res[aria-selected='true'] { background: rgba(255, 236, 200, .1); }
.res[aria-selected='true']::before { content: ''; position: absolute; inset-inline-start: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--saffron); }
.res-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.res-name { font-weight: 500; color: var(--ivory); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-alt { font-size: 12px; color: var(--dune); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-alt[lang='ar'] { font-family: var(--f-ar); }
html[dir='ltr'] .res-alt { text-align: left; }
html[dir='rtl'] .res-alt { text-align: right; }
.res-kind { font-size: 11.5px; color: var(--dune-dim); white-space: nowrap; }
.res-glyph { display: inline-flex; justify-content: center; align-items: center; gap: 2px; width: 22px; height: 22px; }
.res-glyph::before { content: ''; width: 9px; height: 9px; transform: rotate(45deg) scaleY(.75); border-radius: 1.5px; background: var(--saffron); }
.res-district::before { background: transparent; border: 1.5px solid var(--sand); }
.res-island::before { background: var(--gulf); border-radius: 50%; transform: none; width: 8px; height: 8px; }
.res-place::before { background: var(--sand); border-radius: 50%; transform: none; width: 6px; height: 6px; }
.res-metro::before { display: none; }
.line-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px rgba(255, 250, 240, .8); }

.tools { display: flex; align-items: center; gap: 2px; padding: 3px; height: 46px; border-radius: 15px; }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 40px; height: 38px; padding: 0 10px;
  border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--ivory); cursor: pointer; font-size: 13.5px; font-weight: 500;
  transition: background-color .15s; white-space: nowrap; }
.tool:hover, .tool[aria-expanded='true'] { background: rgba(255, 236, 200, .1); }
.tool[aria-pressed='true'] { background: var(--saffron); color: var(--saffron-ink); }
.tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool-tour { padding-inline: 12px 14px; }
.lang-glyph { font-family: var(--f-ar); font-size: 14.5px; font-weight: 500; }
html[lang='ar'] .lang-glyph { font-family: var(--f-ui); font-size: 13.5px; }
.only-phone { display: none !important; }

/* ---------- popovers ---------- */
.pop { position: fixed; top: calc(var(--gutter) + 56px); inset-inline-end: var(--gutter); width: 268px; padding: 10px; border-radius: var(--r-panel); z-index: 3;
  animation: pop-in .18s var(--ease); }
.pop-title { margin: 4px 8px 8px; font-size: 12px; color: var(--dune); }
.pop-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ivory); text-align: start; cursor: pointer; }
.pop-row:hover { background: rgba(255, 236, 200, .08); }
.pop-row .ico { width: 24px; height: 24px; color: var(--sand); }
.pop-row span { display: flex; flex-direction: column; gap: 2px; }
.pop-row b { font-weight: 500; }
.pop-row small { font-size: 12px; color: var(--dune); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 12px; cursor: pointer; position: relative; }
.switch-row:hover { background: rgba(255, 236, 200, .06); }
.switch-row.is-off { cursor: default; }
.switch-row.is-off .switch-text { color: var(--dune-dim); }
.switch-text { display: flex; flex-direction: column; gap: 1px; }
.switch-text small { font-size: 11.5px; color: var(--dune-dim); }
.switch-row input { position: absolute; opacity: 0; inset-inline-end: 10px; width: 36px; height: 22px; margin: 0; cursor: inherit; }
.switch { width: 36px; height: 22px; border-radius: 11px; background: rgba(255, 236, 200, .14); position: relative; flex: none; transition: background-color .2s; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ivory);
  transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch-row input:checked + .switch { background: var(--saffron); }
.switch-row input:checked + .switch::after { transform: translateX(14px); background: #fff8ea; }
[dir='rtl'] .switch-row input:checked + .switch::after { transform: translateX(-14px); }
.switch-row input:disabled + .switch { opacity: .4; }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--saffron); outline-offset: 2px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- info card ---------- */
.card {
  position: fixed; top: calc(var(--gutter) + 58px); inset-inline-end: var(--gutter); width: 344px;
  max-height: calc(100dvh - var(--gutter) * 2 - 58px - 64px); overflow: auto; padding: 16px 18px 18px; border-radius: var(--r-panel);
  opacity: 0; transform: translateY(6px); transition: opacity .22s var(--ease), transform .22s var(--ease); overscroll-behavior: contain;
}
.card.show { opacity: 1; transform: none; }
.sheet-grip { display: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -8px 6px 0; }
[dir='rtl'] .card-head { margin: -4px 0 6px -8px; }
.card-cat { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--sand); }
.card-cat::before { content: ''; width: 8px; height: 8px; transform: rotate(45deg) scaleY(.8); border-radius: 1.5px; background: var(--c, var(--saffron)); }
.cat-culture { --c: #e8a7a0; } .cat-leisure { --c: var(--gulf); } .cat-nature { --c: #a9cf86; } .cat-transport, .cat-metro { --c: var(--moon); }
.cat-district, .cat-place { --c: var(--sand); } .cat-island { --c: var(--gulf); }
.card-name { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 27px; line-height: 1.12; letter-spacing: -.005em;
  font-variation-settings: 'opsz' 72; color: var(--ivory); text-wrap: balance; }
html[lang='ar'] .card-name { font-family: var(--f-ar); font-weight: 600; font-size: 25px; line-height: 1.3; }
.card-alt { margin: 4px 0 0; font-size: 16px; color: var(--sand); }
html[dir='ltr'] .card-alt { text-align: left; }
html[dir='rtl'] .card-alt { text-align: right; }
.card-alt[lang='ar'] { font-family: var(--f-ar); font-weight: 500; }
.card-alt[lang='en'] { font-family: var(--f-display); font-size: 17px; }
.card-blurb { margin: 12px 0 0; font-size: 14px; line-height: 1.6; color: rgba(246, 237, 220, .9); }
.card-facts { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.card-facts li { position: relative; padding-inline-start: 18px; font-size: 13px; line-height: 1.5; color: rgba(246, 237, 220, .82); }
.card-facts li::before { content: ''; position: absolute; inset-inline-start: 2px; top: .55em; width: 7px; height: 7px; transform: rotate(45deg) scaleY(.75);
  border: 1.3px solid var(--saffron); border-radius: 1px; }
.card-lines { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.card-lines-label { font-size: 12px; color: var(--dune); margin-inline-end: 4px; }
.line-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border-radius: var(--r-pill);
  background: rgba(255, 236, 200, .07); font-size: 12px; }
.line-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.card-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- time of day ---------- */
.time {
  position: fixed; bottom: var(--gutter); left: 50%; transform: translateX(-50%); width: 468px; padding: 12px 16px 10px; border-radius: 22px;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.time-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.dial { width: 120px; height: 60px; display: block; overflow: visible; }
.dial-path { stroke: rgba(255, 255, 255, .5); stroke-width: .9; stroke-dasharray: 1.5 3; }
.dial-rim { stroke: rgba(240, 218, 176, .4); stroke-width: 1; }
.sun-glow { opacity: var(--sun-glow, 1); }
.clock { min-width: 0; }
.clock-time { font-family: var(--f-display); font-weight: 500; font-size: 36px; line-height: 1; letter-spacing: -.01em;
  font-variant-numeric: lining-nums tabular-nums; font-variation-settings: 'opsz' 96; color: var(--ivory); direction: ltr; text-align: start; }
html[lang='ar'] .clock-time { text-align: right; }
.clock-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 5px; font-size: 12px; color: var(--sand); }
.clock-zone { color: var(--dune-dim); }
.live-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--gulf); box-shadow: 0 0 0 0 rgba(127, 208, 200, .6); animation: live 2.2s ease-out infinite; }
.time[data-mode='live'] .live-dot { display: inline-block; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(127, 208, 200, .55); } 80%, 100% { box-shadow: 0 0 0 7px rgba(127, 208, 200, 0); } }
.time-modes { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; align-self: start; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: rgba(10, 7, 4, .28); border: 1px solid rgba(240, 218, 176, .1); }
.seg button { height: 28px; padding: 0 11px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--dune); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background-color .15s, color .15s; }
.seg button:hover { color: var(--ivory); }
.seg button[aria-checked='true'] { background: rgba(255, 236, 200, .16); color: var(--ivory); }
.time[data-mode='live'] .seg [data-mode='live'][aria-checked='true'] { color: #dff6f2; background: rgba(127, 208, 200, .2); }
.speed { height: 24px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid rgba(240, 218, 176, .22); background: transparent; color: var(--sand);
  font-size: 11.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.speed:hover { background: rgba(255, 236, 200, .08); }

.track-wrap { position: relative; margin-top: 8px; padding-top: 22px; }
.track-pins { position: absolute; top: 0; left: 8px; right: 8px; height: 22px; }
.pin { position: absolute; left: var(--at); top: 0; transform: translateX(-50%); height: 20px; padding: 0 6px; border: 0; border-radius: 7px; background: transparent;
  color: var(--dune); font-size: 11.5px; white-space: nowrap; cursor: pointer; transition: color .15s, background-color .15s; }
.pin span { font-family: var(--f-ui); }
.pin::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 1px; height: 6px; background: rgba(240, 218, 176, .45); }
.pin:hover, .pin.near { color: var(--ivory); background: rgba(255, 236, 200, .08); }
.pin.near::after { background: var(--saffron); }
.track { position: relative; height: 22px; margin: 0 8px; cursor: pointer; touch-action: none; outline: none; }
.track-bar { position: absolute; left: 0; right: 0; top: 7px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #1b2244 0%, #262c55 20%, #6e5a86 24.5%, #eaa36b 27%, #f5d9a2 32%, #fff0cd 50%, #f6d79f 66%, #ef9a5c 72%, #8c5a7c 75.5%, #2e2d5e 79%, #1b2244 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.track-thumb { position: absolute; top: 1px; left: var(--at, 50%); width: 20px; height: 20px; margin-left: -10px; border-radius: 50%;
  background: var(--ivory); border: 3px solid var(--saffron); box-shadow: 0 2px 6px rgba(0, 0, 0, .45); transition: border-color .3s; }
.time.is-night .track-thumb { border-color: var(--moon); }
.track:focus-visible .track-thumb { outline: 2px solid var(--saffron); outline-offset: 3px; }
.track-ticks { position: relative; height: 14px; margin: 1px 8px 0; font-size: 10.5px; color: var(--dune-dim); font-variant-numeric: tabular-nums; }
.track-ticks span { position: absolute; top: 0; transform: translateX(-50%); }
.track-ticks span:nth-child(1) { left: 0; transform: none; } .track-ticks span:nth-child(2) { left: 25%; }
.track-ticks span:nth-child(3) { left: 50%; } .track-ticks span:nth-child(4) { left: 75%; } .track-ticks span:nth-child(5) { left: auto; right: 0; transform: none; }

/* ---------- tour ---------- */
.tour-caption { position: fixed; bottom: var(--gutter); left: 50%; transform: translateX(-50%); width: min(540px, calc(100vw - var(--gutter) * 2));
  padding: 18px 20px 12px; border-radius: 22px; overflow: hidden; animation: pop-in .3s var(--ease); }
.tour-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: rgba(255, 236, 200, .08); }
.tour-progress i { display: block; height: 100%; background: var(--saffron); transform-origin: left; transform: scaleX(var(--p, 0)); }
[dir='rtl'] .tour-progress i { transform-origin: right; }
.tour-step { margin: 0 0 4px; font-size: 12px; color: var(--dune); }
.tour-name { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 26px; line-height: 1.15; font-variation-settings: 'opsz' 72; }
html[lang='ar'] .tour-name { font-family: var(--f-ar); font-weight: 600; font-size: 24px; }
.tour-blurb { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: rgba(246, 237, 220, .88); max-width: 62ch; }
.tour-ctl { display: flex; align-items: center; gap: 4px; margin-top: 10px; margin-inline-start: -8px; }
.tour-ctl .btn-quiet { margin-inline-start: auto; }
body.touring .time { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(12px); }

/* ---------- minimap ---------- */
.minimap { position: fixed; bottom: var(--gutter); inset-inline-start: var(--gutter); width: 244px; padding: 10px 10px 8px; border-radius: var(--r-panel); }
#minimap-canvas { display: block; width: 100%; aspect-ratio: 2 / 1; cursor: crosshair; touch-action: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); transition: filter .6s; }
.minimap.is-night #minimap-canvas { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)) brightness(.78) saturate(.85); }
.map-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; height: 22px; direction: ltr; }
.scale { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 11px; color: var(--sand); font-variant-numeric: tabular-nums; }
.scale i { display: block; height: 6px; width: 60px; border: 1.5px solid var(--sand); border-top: 0; transition: width .2s var(--ease); }
.north { position: relative; width: 22px; height: 22px; margin-right: 8px; }
.north svg { width: 22px; height: 22px; transform: rotate(var(--rot, 63deg)); }
.north .n-head { fill: var(--saffron); }
.north .n-tail { fill: rgba(246, 237, 220, .35); }
.north b { position: absolute; top: -4px; right: -1px; font-family: var(--f-display); font-weight: 500; font-size: 11px; color: var(--sand); }

/* ---------- zoom ---------- */
.zoom { position: fixed; bottom: var(--gutter); inset-inline-end: var(--gutter); display: flex; flex-direction: column; gap: 2px; padding: 3px; border-radius: 15px; }

/* ---------- misc ---------- */
.tip { position: fixed; top: 0; left: 0; z-index: 4; padding: 5px 10px; border-radius: 9px; background: var(--glass-strong); border: 1px solid var(--glass-edge);
  color: var(--ivory); font-size: 12.5px; font-weight: 500; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; }
.tip.show { opacity: 1; }
.toast { position: fixed; top: var(--gutter); left: 50%; z-index: 5; transform: translate(-50%, -12px); padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--lift); color: var(--ivory); font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.debug { position: fixed; top: 150px; inset-inline-start: var(--gutter); margin: 0; padding: 8px 10px; border-radius: 10px; background: rgba(10, 8, 6, .72);
  color: #d9f2d0; font: 11px/1.45 ui-monospace, Menlo, monospace; white-space: pre; pointer-events: none; direction: ltr; }

/* ---------- about ---------- */
.about { width: min(580px, calc(100vw - 32px)); max-height: min(86dvh, 760px); padding: 0; border-radius: 22px; color: var(--ivory); background: var(--glass-strong); overflow: hidden; }
.about[open] { display: flex; flex-direction: column; animation: pop-in .22s var(--ease); }
.about::backdrop { background: rgba(14, 9, 4, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.about-inner { overflow: auto; padding: 20px 26px 26px; overscroll-behavior: contain; }
.about-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.about-lockup .brand-en { font-size: 30px; }
.about h3 { margin: 22px 0 6px; font-family: var(--f-display); font-weight: 500; font-size: 18px; color: var(--sand); font-variation-settings: 'opsz' 36; }
html[lang='ar'] .about h3 { font-family: var(--f-ar); font-weight: 600; }
.about p { margin: 0 0 10px; font-size: 14px; line-height: 1.65; color: rgba(246, 237, 220, .88); max-width: 64ch; }
.about-note { padding-inline-start: 12px; border-inline-start: 2px solid var(--saffron); }
.controls { display: grid; gap: 6px; margin: 4px 0 0; }
.controls div { display: grid; grid-template-columns: minmax(150px, 44%) 1fr; gap: 12px; align-items: baseline; }
.controls dt { font-size: 12.5px; color: var(--sand); }
.controls dd { margin: 0; font-size: 13.5px; color: rgba(246, 237, 220, .85); }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 10; display: grid; place-content: center; justify-items: center; text-align: center; gap: 10px;
  background: radial-gradient(120% 90% at 50% 40%, #2b2219 0%, #17120d 70%); color: var(--ivory); transition: opacity .7s var(--ease); }
#loader::before { content: ''; width: 46px; height: 46px; margin-bottom: 18px; border: 1.5px solid var(--sand); border-radius: 3px;
  transform: rotateX(60deg) rotateZ(45deg); box-shadow: 0 0 0 6px rgba(229, 207, 159, .08), 0 0 26px rgba(240, 180, 90, .25);
  animation: tile 2.4s ease-in-out infinite; }
@keyframes tile { 0%, 100% { border-color: rgba(229, 207, 159, .55); } 50% { border-color: var(--saffron); box-shadow: 0 0 0 10px rgba(229, 207, 159, 0), 0 0 34px rgba(240, 180, 90, .35); } }
#loader-title, .loader-title { font-family: var(--f-display); font-weight: 500; font-size: 36px; letter-spacing: -.01em; }
#loader-status { font-size: 13px; color: var(--dune); min-height: 1.4em; }
body.ready #loader { opacity: 0; pointer-events: none; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .search { width: 240px; }
  .search.open { width: 320px; }
  .brand-sub { display: none; }
  .brand { padding: 12px 16px; }
}
@media (max-width: 900px) and (min-width: 721px) {
  .time { width: 420px; }
  .minimap { width: 196px; }
}

/* ---------- phones ---------- */
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .only-phone { display: inline-grid !important; }
  .brand { top: calc(var(--gutter) + env(safe-area-inset-top)); padding: 9px 12px 9px; border-radius: 14px; max-width: calc(100vw - 32px - 110px); }
  .brand-en { font-size: 19px; }
  html[dir] .brand-ar { font-size: 12.5px; padding-left: 9px; padding-right: 9px; }
  html[dir='ltr'] .brand-ar { padding-right: 0; }
  html[dir='rtl'] .brand-ar { padding-left: 0; }
  .brand-lockup { column-gap: 9px; }
  .brand-sub, #about-open { display: none; }
  .topbar { top: calc(var(--gutter) + env(safe-area-inset-top)); gap: 8px; }
  .search { display: none; }
  body.searching .search { display: flex; position: fixed; top: calc(var(--gutter) + env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter); width: auto; z-index: 6; }
  body.searching .brand, body.searching #search-toggle, body.searching #menu-btn { visibility: hidden; }
  .search input { font-size: 16px; } /* no iOS zoom on focus */
  #search-results { max-height: calc(100dvh - 120px); }
  .res-kind { display: none; }
  .tools { display: none; position: fixed; top: calc(var(--gutter) + env(safe-area-inset-top) + 54px); inset-inline-end: var(--gutter); flex-direction: column; align-items: stretch;
    height: auto; width: 220px; padding: 6px; border-radius: var(--r-panel); background: var(--glass-strong); z-index: 3; }
  .tools.open { display: flex; animation: pop-in .18s var(--ease); }
  .tool { justify-content: flex-start; height: 44px; padding: 0 12px; gap: 12px; }
  .tool-label { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
  .tool-lang { padding-inline-start: 44px; }
  .pop, .card, .about {
    top: auto; bottom: 0; left: 0; right: 0; inset-inline: 0; width: auto; max-width: none; border-radius: 22px 22px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom)); border-bottom: 0;
  }
  .pop { position: fixed; padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); animation: sheet-in .26s var(--ease); z-index: 6; }
  .card { max-height: 62dvh; transform: translateY(24px); padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); z-index: 5; }
  .card.show { transform: none; }
  .sheet-grip { display: block; width: 38px; height: 4px; margin: 2px auto 10px; border-radius: 2px; background: rgba(240, 218, 176, .28); }
  .card-name { font-size: 24px; }
  .about { margin: auto 0 0; max-height: 88dvh; width: 100vw; }
  .about-inner { padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); }
  .controls div { grid-template-columns: 1fr; gap: 0; }
  @keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

  .time { left: var(--gutter); right: var(--gutter); width: auto; transform: none; bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); padding: 10px 12px 8px; border-radius: 20px; }
  body.touring .time { transform: translateY(12px); }
  .time-top { gap: 10px; }
  .dial { width: 84px; height: 42px; }
  .clock-time { font-size: 27px; }
  .clock-zone { display: none; }
  .seg button { height: 26px; padding: 0 9px; font-size: 12px; }
  .time-modes { gap: 4px; }
  .pin { font-size: 10.5px; padding: 0 4px; }
  .minimap { width: 150px; padding: 7px 7px 5px; border-radius: 14px; bottom: calc(var(--gutter) + var(--time-h) + 10px + env(safe-area-inset-bottom)); }
  .map-meta { height: 18px; margin-top: 3px; }
  .zoom { bottom: calc(var(--gutter) + var(--time-h) + 10px + env(safe-area-inset-bottom)); border-radius: 14px; }
  .zoom .icon-btn { width: 38px; height: 38px; }
  body.has-card .minimap, body.has-card .zoom, body.has-card .time { visibility: hidden; }
  .tour-caption { bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); }
  .toast { top: auto; bottom: calc(var(--gutter) + var(--time-h) + 20px); }
  .debug { top: 74px; }
}
@media (max-width: 380px) {
  .seg button { padding: 0 7px; }
  .dial { width: 72px; height: 36px; }
  .clock-time { font-size: 24px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .live-dot { animation: none; }
}
