@font-face { font-family: 'Cairo'; src: url('../assets/Cairo-var.ttf') format('truetype'); font-weight: 200 1000; font-style: normal; font-display: block; }

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0e14; font-family:'Cairo', sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* Loading */
#loading-screen { position: absolute; inset: 0; background: linear-gradient(160deg, #0d1b2a, #1b3a4b); display: flex; align-items: center; justify-content: center; z-index: 100; }
.loading-inner { text-align: center; }
.game-logo { font-size: 52px; font-weight: 700; color: #f0c75e; text-shadow: 0 3px 12px rgba(0,0,0,.5); letter-spacing: 2px; }
.game-sub { font-size: 16px; color: #cfe3ee; margin-top: 6px; }
.loading-bar { width: 240px; height: 8px; background: rgba(255,255,255,.15); border-radius: 4px; margin: 22px auto 10px; overflow: hidden; }
#loading-fill { width: 0%; height: 100%; background: #f0c75e; border-radius: 4px; transition: width .2s; }
#loading-text { color: #9db8c9; font-size: 13px; }

/* Menus */
.menu { position: absolute; inset: 0; background: rgba(6,12,18,.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 90; }
.menu-box { background: rgba(16,28,40,.95); border: 1px solid rgba(240,199,94,.25); border-radius: 16px; padding: 28px 34px; min-width: 280px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.menu-title { font-size: 26px; font-weight: 700; color: #f0c75e; margin-bottom: 16px; }
.menu-btn { display: block; width: 100%; margin: 8px 0; padding: 12px; font-family: inherit; font-size: 17px; font-weight: 600; color: #10202e; background: #f0c75e; border: none; border-radius: 10px; cursor: pointer; }
.menu-btn:active { transform: scale(.97); }
.menu-btn.secondary { background: rgba(255,255,255,.12); color: #dcebf5; }
.menu-btn.small { width: auto; padding: 8px 22px; font-size: 14px; margin: 10px auto 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #dcebf5; font-size: 15px; margin: 12px 0; }
.setting-row select, .setting-row input { font-family: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: #0d1b2a; color: #fff; min-width: 130px; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
#hud-top { position: absolute; top: env(safe-area-inset-top, 8px); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; }
#hud-stats { display: flex; flex-direction: column; gap: 5px; }
.stat { display: flex; align-items: center; gap: 6px; background: rgba(8,16,24,.66); color: #fff; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 8px; width: fit-content; }
.stat-icon { font-size: 11.5px; }
.mini-bar { width: 64px; height: 8px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.mini-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.mini-fill.hunger { background: #f0a45e; width: 100%; }
.mini-fill.energy { background: #5ec9f0; width: 100%; }
#minimap { border-radius: 10px; border: 2px solid rgba(240,199,94,.4); background: rgba(8,16,24,.66); }
#mission-tracker { position: absolute; top: calc(env(safe-area-inset-top, 8px) + 172px); left: 10px; background: rgba(8,16,24,.72); border-right: 3px solid #f0c75e; border-radius: 8px; padding: 8px 12px; max-width: 220px; color: #fff; }
#mission-title { font-weight: 700; color: #f0c75e; font-size: 12.5px; }
#mission-desc { font-size: 11px; color: #cfe3ee; margin-top: 2px; }
#mission-dist { font-size: 10px; color: #8fd18b; margin-top: 3px; font-weight: 600; }
.ctl-btn.ctl-text { font-size: 11.5px; font-weight: 700; }
#speedo { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: rgba(8,16,24,.72); border-radius: 12px; padding: 8px 16px; color: #fff; text-align: center; }
#speed-val { font-size: 27px; font-weight: 700; color: #f0c75e; }
.speed-unit { font-size: 11px; color: #9db8c9; display: block; }
#interact-prompt { position: absolute; top: 30%; bottom: auto; left: 50%; transform: translateX(-50%); background: rgba(8,16,24,.8); color: #f0c75e; font-size: 14.5px; font-weight: 700; padding: 9px 20px; border-radius: 24px; border: 1px solid rgba(240,199,94,.5); }
#dialogue-box { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); width: min(560px, 92vw); background: rgba(10,20,30,.92); border: 1px solid rgba(240,199,94,.35); border-radius: 14px; padding: 14px 18px; color: #fff; pointer-events: auto; }
#dialogue-name { color: #f0c75e; font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
#dialogue-text { font-size: 13.5px; line-height: 1.7; color: #e8f2f9; }
#dialogue-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dlg-choice { font-family: inherit; font-size: 12.5px; font-weight: 600; background: rgba(240,199,94,.16); color: #f0c75e; border: 1px solid rgba(240,199,94,.45); border-radius: 8px; padding: 7px 14px; cursor: pointer; }
#shop-panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(420px, 90vw); max-height: 88vh; display: flex; flex-direction: column; background: rgba(10,20,30,.95); border: 1px solid rgba(240,199,94,.35); border-radius: 14px; padding: 18px; color: #fff; pointer-events: auto; text-align: center; }
#shop-items { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
#shop-title { font-size: 17px; font-weight: 700; color: #f0c75e; margin-bottom: 10px; }
.shop-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 12.5px; }
.shop-item span:first-child { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; text-align: right; }
.shop-item span:nth-child(2) { flex-shrink: 0; font-size: 11px; color: #cfd8e3; }
.shop-item button { font-family: inherit; background: #f0c75e; color: #10202e; border: none; border-radius: 7px; padding: 5px 14px; font-weight: 700; font-size: 11.5px; cursor: pointer; flex-shrink: 0; min-width: 64px; }
.shop-item button:disabled { background: #555; color: #999; }
#toast { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); background: rgba(8,16,24,.88); color: #ffe9b0; font-size: 14.5px; font-weight: 700; padding: 10px 24px; border-radius: 24px; border: 1px solid rgba(240,199,94,.4); text-align: center; max-width: 86vw; }

/* Touch controls */
#touch-controls { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
#joystick-zone { position: absolute; left: 0; bottom: env(safe-area-inset-bottom, 0px); width: 45%; height: 55%; pointer-events: auto; touch-action: none; }
#joystick-base { position: absolute; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.10); border: 2px solid rgba(255,255,255,.25); display: none; }
#joystick-knob { position: absolute; width: 48px; height: 48px; border-radius: 50%; background: rgba(240,199,94,.85); left: 31px; top: 31px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
#camera-zone { position: absolute; right: 0; bottom: env(safe-area-inset-bottom, 0px); width: 55%; height: 70%; pointer-events: auto; touch-action: none; }
#action-buttons { position: absolute; right: 12px; bottom: 90px; display: grid; grid-template-columns: repeat(2, 54px); gap: 10px; pointer-events: auto; }
#btn-vehicle { width: auto; min-width: 54px; border-radius: 27px; padding: 0 14px; font-size: 15px; font-weight: 700; white-space: nowrap; grid-column: span 2; justify-self: end; }
body.modal-open #touch-controls, body.modal-open #interact-prompt { display: none !important; }
.ctl-btn { touch-action: manipulation; width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(255,255,255,.38); background: rgba(8,16,24,.48); color: #fff; font-size: 20px; font-family: inherit; cursor: pointer; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.ctl-btn:active { background: rgba(240,199,94,.4); }
.ctl-btn.accent { border-color: #f0c75e; color: #f0c75e; font-weight: 700; font-size: 24px; }
#drive-buttons { position: absolute; left: 0; right: 0; bottom: 90px; display: flex; direction: ltr; justify-content: space-between; padding: 0 16px; pointer-events: none; }
#drive-buttons .pedal-group, #drive-buttons .steer-group { display: flex; gap: 12px; pointer-events: auto; }
.ctl-btn.pedal { width: 76px; height: 76px; font-size: 15px; font-weight: 700; border-radius: 18px; }

/* Short landscape phones: keep right controls and pedals clear of stats/mission (must stay last: same-specificity base rules above) */
@media (max-height: 240px) {
  #shop-panel { padding: 6px 10px; max-height: 96vh; width: min(380px, 94vw); }
  #shop-title { font-size: 11px; margin-bottom: 3px; }
  .shop-item { padding: 2px 3px; font-size: 9.5px; gap: 4px; }
  .shop-item span:nth-child(2) { font-size: 8px; }
  .shop-item button { padding: 2px 8px; font-size: 9px; min-width: 48px; }
  #shop-close { margin-top: 3px; padding: 2px 10px; font-size: 9px; }
}

@media (max-height: 420px) {
  #shop-panel { padding: 10px 14px; max-height: 94vh; }
  #shop-title { font-size: 13.5px; margin-bottom: 6px; }
  .shop-item { padding: 5px 4px; font-size: 11px; }
  .shop-item span:nth-child(2) { font-size: 10px; }
  .shop-item button { padding: 3px 10px; font-size: 11px; min-width: 56px; }
  #shop-close { margin-top: 6px; padding: 4px 12px; font-size: 11px; }
  .stat { font-size: 11px; padding: 3px 8px; }
  .stat-icon { font-size: 10px; }
  .mini-bar { width: 52px; height: 6px; }
  #hud-stats { gap: 3px; }
  #minimap { width: 110px; height: 110px; }
  #mission-tracker { top: calc(env(safe-area-inset-top, 8px) + 4px); left: 50%; transform: translateX(-50%); max-width: 190px; padding: 3px 8px; }
  #mission-title { font-size: 10px; }
  #mission-desc { font-size: 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #mission-dist { font-size: 8px; }
  /* controls: horizontal wrap at bottom-right instead of a tall grid that hits the stats */
  #action-buttons { right: 10px; bottom: 10px; display: flex; flex-direction: row-reverse; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 62vw; }
  .ctl-btn { width: 44px; height: 44px; font-size: 17px; }
  #btn-vehicle { min-width: 44px; border-radius: 22px; padding: 0 10px; font-size: 13px; }
  #drive-buttons { bottom: 10px; padding: 0 12px; }
  #drive-buttons .pedal-group, #drive-buttons .steer-group { gap: 8px; }
  .ctl-btn.pedal { width: 54px; height: 54px; font-size: 12px; border-radius: 12px; }
  #speedo { bottom: 10px; top: auto; left: 50%; transform: translateX(-50%); padding: 4px 12px; }
  #speed-val { font-size: 18px; }
  .speed-unit { font-size: 9px; }
  #interact-prompt { top: 26%; bottom: auto; font-size: 11.5px; padding: 6px 14px; }
}

@media (max-height: 240px) {
  /* ultra-short landscape: stats become a top strip, prompt parks under it, controls shrink */
  #hud-top { top: 4px; left: 6px; right: 6px; }
  #hud-stats { flex-direction: row; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
  .stat { font-size: 7.5px; padding: 1px 3px; gap: 2px; }
  .stat-icon { font-size: 7.5px; }
  .mini-bar { width: 26px; height: 4px; }
  #minimap { width: 56px; height: 56px; }
  #mission-tracker { top: 68px; left: 6px; max-width: 120px; padding: 3px 6px; }
  #mission-title { font-size: 8px; }
  #mission-desc { font-size: 7.5px; }
  #mission-dist { font-size: 7.5px; }
  #interact-prompt { top: 42px; bottom: auto; font-size: 9px; padding: 3px 8px; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #action-buttons { right: 6px; bottom: 6px; gap: 4px; max-width: 52vw; }
  .ctl-btn { width: 30px; height: 30px; font-size: 12px; }
  #btn-vehicle { min-width: 30px; border-radius: 15px; padding: 0 6px; font-size: 10px; }
  #drive-buttons { bottom: 6px; padding: 0 6px; }
  #drive-buttons .pedal-group, #drive-buttons .steer-group { gap: 5px; }
  .ctl-btn.pedal { width: 42px; height: 42px; font-size: 10px; border-radius: 10px; }
  #speedo { padding: 2px 8px; top: 4px; bottom: auto; left: 66px; transform: none; }
  #speed-val { font-size: 11.5px; }
  .speed-unit { font-size: 7.5px; }
}

/* While driving, lift the right action column clear of the pedal row */
#touch-controls.driving #action-buttons { bottom: 190px; }
@media (max-height: 240px) {
  #touch-controls.driving #action-buttons { bottom: 70px; }
}

/* Approved cover, contained at its native ratio, never stretched or cropped. */
#start-menu { background:#07151d; backdrop-filter:none; }
.cover-stage { position:relative; width:min(100vw,177.7778vh); height:min(100vh,56.25vw); background:url('../assets/tex/ui/main-menu.jpg') center/contain no-repeat; }
.cover-actions { position:absolute; left:60.8%; top:49.8%; width:28.5%; height:43.1%; display:flex; flex-direction:column; justify-content:space-between; }
.cover-btn { height:24%; width:100%; border:2px solid #48230b; border-radius:15% 6% 14% 6%; background:linear-gradient(#935323,#6c3414 55%,#86491d); color:#fff4da; text-shadow:0 2px 2px #251208; box-shadow:inset 0 2px 2px #d99b57,0 2px 3px #271708; font:700 clamp(15px,3.1vw,40px) 'Cairo',sans-serif; cursor:pointer; }
.cover-play { background:linear-gradient(#ffe66a,#ffbb00); color:#201707; text-shadow:0 1px #ffe978; }
.cover-btn:active { filter:brightness(1.18); transform:scale(.98); }
.cover-btn:focus-visible { outline:3px solid white; outline-offset:2px; }
#achievements-list { color:#f5e9d0; line-height:2.1; text-align:right; }
#exit-message { color:#dcebf5; max-width:300px; }
@media (orientation:portrait) {
 #start-menu { align-items:flex-start; overflow-y:auto; }
 .cover-stage { width:100vw; height:calc(56.25vw + 300px); background-size:100% auto; background-position:top center; }
 .cover-actions { top:56.25vw; left:10%; width:80%; height:280px; padding-top:14px; }
 .cover-btn { font-size:22px; height:23%; border-radius:12px; }
}

#minimap { width:120px;height:109px;cursor:pointer;pointer-events:auto; }
.world-map-box { width:min(96vw,1100px);background:#15232b;padding:12px;border-radius:16px;color:#e7e6d7;max-height:96vh;overflow-y:auto; }
.world-map-box .menu-title { font-size:22px;margin-bottom:5px; }
#world-map-canvas { width:100%;height:auto;display:block;border-radius:8px; }
.map-toolbar { display:flex;gap:8px;align-items:center; }
.map-toolbar select { min-width:0;flex:2;padding:10px;font:16px Cairo; }
.map-toolbar button { flex:1;font-size:14px;width:auto; }
#map-destination-note { font-size:13px;line-height:1.6;text-align:center; }
@media(max-height:500px){#world-map-canvas{height:48vh;object-fit:contain}.world-map-box{padding:8px}.map-toolbar button{padding:6px;margin:4px 0}}

.map-layout-note{font-size:13px;color:#d9e2dc;text-align:center;line-height:1.5}

#adhkar-reminder{position:fixed;z-index:30;top:14px;left:50%;transform:translateX(-50%);width:min(330px,48vw);padding:12px 20px;background:rgba(17,42,36,.96);border:1px solid #b9a96a;border-radius:12px;color:#f6eed9;text-align:center;pointer-events:auto;box-shadow:0 4px 16px #0005}
#adhkar-reminder strong{font-size:13.5px;color:#e7cc80}#adhkar-reminder p{font-size:20.5px;margin:5px 0}#adhkar-reminder small{font-size:10px;line-height:1.5;color:#cfdbd0}#btn-adhkar-close{position:absolute;left:5px;top:2px;background:none;border:0;color:#eee;font-size:20.5px;padding:0 5px}
/* Compact text-only adhkar card, user revision Nov26. */
#adhkar-reminder{top:10px;width:min(235px,38vw);padding:7px 18px 8px;border-radius:8px;box-shadow:0 2px 7px #0003}#adhkar-reminder strong{font-size:11px}#adhkar-reminder p{font-size:16px;margin:3px 0}#adhkar-reminder small{font-size:9px}#btn-adhkar-close{font-size:15.5px;left:3px;top:1px;padding:0 3px}

/* Edge-aligned compact HUD, Nov26. Tap the map for the full-size map. */
#mission-tracker{top:calc(env(safe-area-inset-top, 0px) + 116px);left:8px;right:auto;transform:none;width:164px;max-width:25vw;padding:5px 7px;border-radius:6px}
#mission-title{font-size:10px;line-height:1.55}#mission-desc{font-size:9px;line-height:1.65;margin-top:1px}#mission-dist{font-size:9px;margin-top:2px}
#adhkar-reminder{top:calc(env(safe-area-inset-top, 0px) + 8px);left:184px;right:auto;transform:none;width:184px;max-width:30vw;padding:5px 15px 5px 7px;border-radius:6px}
#adhkar-reminder strong{font-size:9px}#adhkar-reminder p{font-size:13.5px;line-height:1.6;margin:1px 0}#adhkar-reminder small{font-size:8px;line-height:1.5}
#toast{top:8px;left:50%;max-width:38vw;font-size:11px;line-height:1.6;padding:6px 10px;border-radius:8px}
body.adhkar-on #toast{top:calc(env(safe-area-inset-top, 0px) + 112px)}
@media(max-height:380px){#minimap{width:92px;height:84px}#mission-tracker{top:94px;max-width:150px;width:23vw;padding:3px 6px}#adhkar-reminder{left:166px;max-width:27vw;width:172px}#mission-title{font-size:9px}#mission-desc,#mission-dist{font-size:8px}}
@media(orientation:portrait){#mission-tracker{max-width:44vw;width:164px}#adhkar-reminder{left:8px;top:calc(env(safe-area-inset-top, 0px) + 336px);max-width:44vw}#toast{top:calc(env(safe-area-inset-top, 0px) + 276px);max-width:70vw}body.adhkar-on #toast{top:calc(env(safe-area-inset-top, 0px) + 276px)}}
/* Shared timber-and-gold menu language from the cover. */
:root{--menu-wood:linear-gradient(#935323,#6c3414 55%,#86491d);--menu-gold:#ffe66a;--menu-cream:#fff4da;}
.cover-actions{top:39%;height:56%;gap:4px;}
.cover-btn{height:auto;flex:1;min-height:0;font-size:clamp(12px,2.2vw,29px);}
.cover-btn:disabled{filter:grayscale(.8);opacity:.62;cursor:default;}
.menu:not(#start-menu){background:linear-gradient(100deg,rgba(24,16,9,.85),rgba(35,24,12,.7)),url('../assets/tex/ui/main-menu.jpg') center/cover;}
.menu-box,.world-map-box,#shop-panel,#dialogue-box{font-family:'Cairo',sans-serif;background:linear-gradient(135deg,rgba(79,43,19,.98),rgba(36,24,14,.98));border:2px solid #be8b4f;border-radius:16px;color:var(--menu-cream);box-shadow:inset 0 0 0 2px #48230b,0 12px 40px #0009;}
.menu-box{width:min(440px,92vw);max-height:94vh;overflow-y:auto;padding:20px 26px;}
.menu-title,#shop-title,#dialogue-name,#mission-title{color:var(--menu-gold);text-shadow:0 2px 2px #251208;}
.menu-btn,.menu-btn.secondary,.shop-item button,.dlg-choice{background:var(--menu-wood);border:2px solid #48230b;box-shadow:inset 0 1px 1px #d99b57,0 2px 3px #271708;color:var(--menu-cream);border-radius:10px;font-family:'Cairo',sans-serif;text-shadow:0 1px 2px #251208;}
.menu-btn:not(.secondary):first-of-type{background:linear-gradient(#ffe66a,#ffbb00);color:#201707;text-shadow:none;}
.setting-row select,.setting-row input,#map-destination{background:#402817;border-color:#b48750;color:var(--menu-cream);}
#mission-tracker{background:linear-gradient(135deg,#4f2b13ed,#24180eed);border:1px solid #be8b4f;border-right:3px solid #ffe66a;}
#btn-pause{position:absolute;top:calc(env(safe-area-inset-top,0px) + 12px);left:180px;pointer-events:auto;width:44px;height:44px;border-radius:12px;background:#24180ebd;border-color:#e4c591;display:grid;place-items:center;}
.pause-bars{width:17px;height:20px;border-left:6px solid #fff4da;border-right:6px solid #fff4da;}
@media(max-height:420px){.menu-box{padding:10px 22px;}.menu-title{font-size:21px;margin-bottom:8px;}.menu-btn{padding:8px;margin:6px 0;font-size:15px;}.setting-row{margin:8px 0;}.cover-actions{top:37%;height:59%;}}
@media(orientation:portrait){.cover-actions{top:56.25vw;height:330px;gap:5px;}.cover-stage{height:calc(56.25vw + 345px);}.cover-btn{font-size:18px;}#btn-pause{left:10px;top:140px;}}

.cover-actions{background:#3d2515;border:2px solid #754722;border-radius:12px;padding:5px;box-shadow:0 3px 9px #0008;}
#btn-pause{left:auto;right:112px;}
@media(orientation:portrait){#btn-pause{left:auto;right:95px;top:12px;}}

/* Edge-to-edge artwork and game viewport, including wide Android displays. */
html,body,#app{width:100%;height:100%;min-width:100%;min-height:100%;}
#app,#game-canvas{position:fixed;inset:0;margin:0;border:0;padding:0;}
#game-canvas{width:100%;height:100%;}
#start-menu{padding:0;overflow:hidden;}
.cover-stage{width:100%;height:100%;min-height:100%;background-size:cover;background-position:center;flex:none;}
@media(orientation:portrait){
 .cover-stage{width:100%;height:100%;background-size:cover;background-position:38% center;}
 .cover-actions{top:auto;bottom:max(3%,env(safe-area-inset-bottom));left:10%;width:80%;height:54%;}
}
@media(orientation:landscape){.cover-actions{top:39%;bottom:0;height:auto;padding-bottom:10px;border-bottom-left-radius:0;border-bottom-right-radius:0;}}
/* Original cover stays complete and undistorted. Extra display area uses extended scenery. */
#start-menu{isolation:isolate;background:#a99b64 url('../assets/tex/ui/main-menu-extended.jpg') center/100% 100% no-repeat;}
@media(orientation:landscape){
 .cover-stage{width:min(100vw,177.77778vh);height:min(100vh,56.25vw);min-height:0;background-size:100% 100%;background-position:center;}
 .cover-actions{top:39%;bottom:0;height:auto;}
}
@media(orientation:portrait){
 #start-menu{background:linear-gradient(#8cb7c7,#76934b 35%,#4a6130);}
 .cover-stage{width:100%;height:100%;min-height:100%;background-size:100% auto;background-position:center top;}
 .cover-actions{top:56.25vw;bottom:3%;height:auto;}
}
.menu:not(#start-menu),#loading-screen{background:linear-gradient(100deg,rgba(24,16,9,.88),rgba(35,24,12,.8)),url('../assets/tex/ui/main-menu.jpg') center/contain no-repeat,url('../assets/tex/ui/main-menu-extended.jpg') center/100% 100% no-repeat;}

/* User-supplied loading art. Baked progress bar removed, real loader retained. */
#loading-screen{background:#38412c url('../assets/tex/ui/loading-extended.jpg') center/100% 100% no-repeat;}
#loading-screen::before{content:'';position:absolute;inset:0;background:url('../assets/tex/ui/loading-art.jpg') center/contain no-repeat;pointer-events:none;}
.loading-inner{position:relative;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;padding-bottom:9vh;}
.loading-bar{width:min(40vw,460px);height:9px;margin:0 auto 8px;background:#c0b59c80;border:1px solid #e2c9a7;box-shadow:0 2px 6px #0009;}
#loading-fill{background:linear-gradient(90deg,#f6d35d,#ffe9a0);}
#loading-text{color:#fff0cf;text-shadow:0 1px 3px #000;font-size:12px;}
.loading-inner{position:absolute;top:76%;height:auto;padding:0;justify-content:flex-start;}
.loading-bar{width:min(33vw,460px);height:10px;}
/* Main-menu-only light brown multiply + blur on scenery, sharp foreground preserved. */
#start-menu{background-image:url('../assets/tex/ui/main-menu-extended-brown.jpg');}
.cover-stage{background-image:url('../assets/tex/ui/main-menu-brown.jpg');}
#settings-menu .setting-row{margin:7px 0;font-size:13px;gap:8px;}
#settings-menu .menu-box{padding:12px 22px;}
#settings-menu .menu-title{margin-bottom:8px;}
#settings-menu .setting-row input[type=range]{width:135px;min-width:110px;flex-shrink:0;}

/* Keep route instructions first, with the readable map directly underneath. */
#mission-map-stack{position:absolute;top:calc(env(safe-area-inset-top,0px) + 8px);left:8px;width:164px;max-width:28vw;display:flex;flex-direction:column;gap:7px;pointer-events:none}
#mission-map-stack #mission-tracker{position:relative;top:auto;left:auto;right:auto;transform:none;width:100%;max-width:none;box-sizing:border-box}
#mission-map-stack #minimap{position:relative;top:auto;left:auto;width:100%;height:auto;aspect-ratio:280/230;box-sizing:border-box;background:#e6eccf;border:2px solid #f7d85c;border-radius:7px;opacity:1;pointer-events:auto}
@media(orientation:portrait){#mission-map-stack{max-width:40vw;width:164px}}
@media(max-height:380px){#mission-map-stack{width:138px;max-width:25vw;gap:4px}#mission-map-stack #minimap{max-height:100px}}

#map-search{width:100%;box-sizing:border-box;padding:10px;border-radius:8px;border:1px solid #b48750;background:#402817;color:#fff3d5;font:16px Cairo;direction:rtl;margin:5px 0;pointer-events:auto}#mission-map-stack{z-index:2}body.modal-open #mission-map-stack{pointer-events:none}body.modal-open #mission-map-stack #minimap{pointer-events:none}

@media(max-height:650px){#world-map-canvas{height:37vh;object-fit:contain}.world-map-box .menu-title{font-size:18px}.map-layout-note{font-size:10px}.world-map-box{max-height:94vh;padding:8px}.map-toolbar select{padding:5px;font-size:13px}.map-toolbar button{padding:5px;font-size:12px}.map-toolbar{gap:4px}#map-search{padding:6px;margin:3px 0}#map-destination-note{font-size:11px;margin:2px}}

/* In-game phone (0.33.0): HUD button + phone-shaped overlay. Own icons and
   restrained brown/gold styling; nothing copied from the reference screenshot. */
#btn-phone{pointer-events:auto;position:absolute;top:calc(env(safe-area-inset-top,0px) + 12px);right:112px;left:auto;width:46px;height:46px;padding:0;border-radius:12px;border:2px solid #f7d85c;background:rgba(45,26,12,.9);color:#ffe66a;display:flex;align-items:center;justify-content:center;box-shadow:0 3px 10px rgba(0,0,0,.45);touch-action:manipulation}
#btn-phone svg{width:23px;height:23px;pointer-events:none}
#btn-phone:active{transform:scale(.95)}
#phone-badge{position:absolute;top:-3px;right:-3px;width:11px;height:11px;border-radius:50%;background:#e0402a;box-shadow:0 0 0 2px rgba(20,12,6,.8);animation:phonePulse 1.1s ease-in-out infinite}
@keyframes phonePulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.4);opacity:.65}}
#phone-overlay{position:absolute;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;background:rgba(8,5,3,.58);pointer-events:auto}
#phone-overlay.hidden{display:none}
#phone-frame{position:relative;width:min(74vw,300px);height:min(78vh,560px);background:linear-gradient(#4a2e16,#221407 60%,#3a2413);border-radius:30px;padding:9px;box-shadow:0 20px 46px rgba(0,0,0,.65),inset 0 0 0 2px #7a5427,inset 0 0 22px rgba(0,0,0,.5)}
#phone-close{position:absolute;top:-12px;left:-12px;width:30px;height:30px;border-radius:50%;border:2px solid #f7d85c;background:#2a1a0c;color:#ffe66a;font:16px Cairo,sans-serif;line-height:1;z-index:2}
#phone-screen{position:relative;width:100%;height:100%;border-radius:23px;overflow:hidden;background:radial-gradient(circle at 50% -10%,#33452f,#16211a 65%,#0d1512);color:#f7f1de;direction:rtl;font-family:Cairo,sans-serif;display:flex;flex-direction:column}
#phone-statusbar{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:7px 14px 4px;font-size:10px;color:#d9d2b8;opacity:.9}
#phone-statusbar .phone-sig{letter-spacing:-2px;font-size:8px;opacity:.75}
#phone-home{flex:1;display:flex;flex-direction:column;padding:6px 14px 12px;overflow:auto}
.phone-bigclock{font-size:39.5px;font-weight:700;letter-spacing:1px;text-align:center;margin-top:6px;color:#fff6df;text-shadow:0 2px 8px rgba(0,0,0,.5)}
.phone-sub{text-align:center;font-size:11px;color:#cbbf9c;margin-bottom:12px}
.phone-apps{display:grid;grid-template-columns:repeat(3,1fr);gap:12px 8px;margin-top:4px}
.phone-app{display:flex;flex-direction:column;align-items:center;gap:5px;background:none;border:0;color:#f2ead4;font-family:Cairo,sans-serif;font-size:10px;padding:2px}
.phone-app:active{transform:scale(.95)}
.phone-app-icon{width:46px;height:46px;border-radius:14px;display:flex;align-items:center;justify-content:center;background:linear-gradient(#8a5a24,#5d3a15);border:1px solid #f0c85e55;color:#ffe9a8;box-shadow:inset 0 1px 0 #ffffff22,0 2px 6px rgba(0,0,0,.4)}
.phone-app-icon svg{width:25px;height:25px}
.phone-note{margin-top:auto;font-size:10px;color:#cfc4a4;background:rgba(255,255,255,.06);border-radius:10px;padding:8px 10px;line-height:1.5;min-height:34px}
#phone-call{flex:1;display:flex;flex-direction:column;align-items:center;padding:18px 16px 14px;gap:8px;text-align:center}
#phone-call.hidden,#phone-panel.hidden,#phone-home.hidden{display:none}
.phone-call-who{font-size:14.5px;font-weight:700;color:#ffe9a8}
.phone-call-state{font-size:11px;color:#c9bda0;min-height:16px}
.phone-call-text{font-size:11.5px;line-height:1.75;color:#f7f1de;background:rgba(255,255,255,.05);border-radius:12px;padding:10px 12px;min-height:20px}
.phone-call-route{font-size:11px;color:#ffd977}
.phone-call-actions{margin-top:auto;display:flex;gap:10px;width:100%}
.phone-btn{flex:1;padding:10px 12px;border-radius:12px;border:1px solid #f0c85e66;background:linear-gradient(#8a5a24,#5d3a15);color:#fff3d5;font:13px Cairo,sans-serif}
.phone-btn.answer{background:linear-gradient(#2f7d4a,#1d5a33);border-color:#7fe0a466}
.phone-btn.decline{background:linear-gradient(#8a3024,#5c1d15);border-color:#e08a7a66}
#phone-panel{flex:1;display:flex;flex-direction:column;padding:14px;gap:8px;overflow:auto}
.phone-panel-title{font-size:13.5px;font-weight:700;color:#ffe9a8;margin-bottom:2px}
.phone-panel-body{display:flex;flex-direction:column;gap:8px;font-size:11px}
.phone-row{display:flex;flex-direction:column;gap:2px;background:rgba(255,255,255,.055);border-radius:10px;padding:8px 10px}
.phone-row b{font-size:11.5px;color:#fff4da;font-weight:600}
.phone-row span{color:#c6bb9d}
.phone-row em{font-style:normal;color:#ffd977;font-size:10px}
.phone-notes{margin-top:6px;border-top:1px solid #ffffff22;padding-top:8px;color:#cfc4a4;font-size:10px;display:flex;flex-direction:column;gap:5px}
@media(max-height:430px){
  #phone-frame{width:min(58vw,260px);height:min(94vh,400px);padding:7px}
  .phone-bigclock{font-size:23.5px;margin-top:0}
  .phone-app-icon{width:38px;height:38px;border-radius:11px}
  .phone-app-icon svg{width:21px;height:21px}
  .phone-apps{gap:8px 6px}
  /* Short landscape screens: the call must fit without clipping its button. */
  #phone-statusbar{padding:5px 12px 2px;font-size:9px}
  #phone-call{padding:10px 12px 8px;gap:5px;overflow:auto}
  .phone-call-who{font-size:12.5px}
  .phone-call-state{font-size:10px;min-height:12px}
  .phone-call-text{font-size:10px;line-height:1.55;padding:7px 9px}
  .phone-call-route{font-size:10px}
  .phone-btn{padding:8px 10px;font-size:11px;border-radius:10px}
  #phone-panel{padding:10px;gap:6px}
  .phone-panel-title{font-size:11.5px}
  .phone-panel-body{font-size:10px;gap:6px}
  .phone-row{padding:6px 8px}
}

/* 0.33.1 HUD layout (Ahmed's report): the mission panel covered the food/energy
   bars, and the phone icon sat under the camera drag zone so taps never reached it.
   Stats now sit on the right, under the two round buttons; the mission panel and
   minimap stay on the left; phone icon at right:112 (pause's old spot) and pause at
   right:10 (the phone icon's old spot). */
#hud-top{position:absolute;inset:0;pointer-events:none}
#hud-stats{position:absolute;top:calc(env(safe-area-inset-top,0px) + 66px);right:8px;left:auto;flex-direction:column;align-items:flex-end;gap:5px;flex-wrap:nowrap}
#mission-map-stack{top:calc(env(safe-area-inset-top,0px) + 8px);left:8px}
#btn-pause{left:auto;right:10px;top:calc(env(safe-area-inset-top,0px) + 12px);width:46px;height:46px}
@media(orientation:portrait){
  #hud-stats{top:calc(env(safe-area-inset-top,0px) + 122px);right:8px;flex-wrap:wrap;max-width:60vw}
  #btn-pause{right:10px;top:calc(env(safe-area-inset-top,0px) + 12px)}
  #btn-phone{right:10px;left:auto;top:calc(env(safe-area-inset-top,0px) + 66px)}
}
@media(max-height:380px){
  #hud-stats{gap:3px;top:calc(env(safe-area-inset-top,0px) + 62px)}
  #mission-map-stack{width:150px}
}

/* Single right-side stack: buttons, stats and mode actions flow in one column so
   they can never overlap (fixes the cart-mode overlap Ahmed reported). */
#hud-right { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); right: 8px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none; z-index: 52; max-height: calc(100% - 186px); }
#hud-btnrow { display: flex; gap: 6px; pointer-events: auto; }
#hud-right #btn-phone, #hud-right #btn-pause { position: relative; top: auto; right: auto; left: auto; margin: 0; }
#hud-right #hud-stats { position: static; top: auto; right: auto; left: auto;
  display: flex; flex-direction: column; align-items: flex-end; flex-wrap: nowrap; gap: 5px; }
#hud-right #action-buttons { position: static; top: auto; right: auto; left: auto; bottom: auto;
  display: flex; flex-direction: row-reverse; flex-wrap: wrap; justify-content: flex-end;
  gap: 8px; max-width: 54vw; pointer-events: auto; }
#hud-right #action-buttons .ctl-btn { width: 46px; height: 46px; font-size: 17px; }
#hud-right #btn-vehicle { min-width: 46px; border-radius: 23px; padding: 0 12px; font-size: 13px; }
#hud-right #vehicle-radio { position: static; pointer-events: auto; }
@media (max-height: 430px) {
  #hud-right { top: calc(env(safe-area-inset-top, 0px) + 6px); gap: 4px; }
  #hud-right #action-buttons { gap: 6px; }
  #hud-right #action-buttons .ctl-btn { width: 40px; height: 40px; font-size: 15px; }
  #hud-right .stat { font-size: 11px; padding: 3px 8px; }
  #hud-right .mini-bar { width: 50px; height: 6px; }
}
#loading-note{margin-top:10px;max-width:88vw;color:#fff0cf;font-size:12px;line-height:1.75;direction:rtl;text-align:center;text-shadow:0 1px 3px #000}

/* 0.33.15 Ahmed: phone icon larger, left of the HUD cluster on PC (circled spot), pulses on incoming call. Mobile keeps the cluster slot. */
@keyframes phonePulse{0%,100%{transform:scale(1);box-shadow:0 0 0 0 rgba(247,216,92,.7)}50%{transform:scale(1.1);box-shadow:0 0 0 14px rgba(247,216,92,0)}}
#btn-phone.ringing{animation:phonePulse .9s ease-in-out infinite;background:rgba(30,110,60,.95);border-color:#7cf0a0;color:#fff}
@media (hover:hover) and (pointer:fine) and (min-width:900px){
  /* 0.33.17 PC HUD: stats in a row at the top-right corner, pause beside them, phone at the circled spot,
     action buttons in one row bottom-right. Everything is fixed so no element depends on another's size. */
  #hud-right{max-height:none}
  #hud-right #btn-pause{position:fixed;top:12px;right:14px;left:auto;z-index:53}
  #hud-right #hud-stats{position:fixed;top:12px;right:110px;left:auto;flex-direction:row;align-items:center;gap:8px;max-width:none;flex-wrap:nowrap;z-index:53}
  #hud-right #btn-phone{position:fixed;left:67%;right:auto;top:11%;width:84px;height:84px;border-radius:20px;z-index:30}
  #hud-right #btn-phone svg{width:44px;height:44px}
  #hud-right #action-buttons{position:fixed;left:auto;top:auto;right:16px;bottom:84px;flex-direction:row-reverse;flex-wrap:nowrap;gap:8px;max-width:none;width:auto}
  #hud-right #vehicle-radio{position:fixed;top:64px;right:14px}
}


/* 0.33.43: clearer mission card (current objective, readable contrast, distance row) */
#mission-map-stack{width:186px;max-width:31vw}
#mission-map-stack #mission-tracker{background:rgba(22,13,6,.95);border:2px solid #ffe66a;border-right-width:4px;padding:6px 9px;border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,.5)}
#mission-title{font-size:12px;font-weight:700;color:#ffe66a;line-height:1.5}
#mission-desc{font-size:11px;font-weight:600;color:#fff;line-height:1.6;margin-top:2px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
#mission-dist{display:flex;align-items:center;font-size:12px;font-weight:700;color:#a8f5a2;background:rgba(0,0,0,.4);border-radius:5px;padding:2px 6px;margin-top:4px}
@media(max-height:380px){#mission-map-stack{width:148px;max-width:27vw}#mission-title{font-size:10.5px}#mission-desc{font-size:9.5px;-webkit-line-clamp:2}#mission-dist{font-size:10px}}
@media(orientation:portrait){#mission-map-stack{width:176px;max-width:44vw}}
/* 0.33.56 mission card: compact, top, centre-left, no tilt, clear of minimap + chips */
@media(orientation:landscape){
#mission-map-stack #mission-tracker{position:fixed;top:calc(env(safe-area-inset-top,0px) + 8px);left:max(204px,calc(50% - 206px));right:auto;width:clamp(150px,calc(50vw - 204px),230px);max-width:none;transform:none;box-sizing:border-box;padding:6px 10px 7px;border-radius:12px;background:linear-gradient(160deg,rgba(24,15,8,.82),rgba(12,8,4,.78));border:1px solid rgba(255,230,106,.5);border-right-width:1px;box-shadow:0 3px 10px rgba(0,0,0,.4);font-family:Cairo,system-ui,sans-serif;pointer-events:none}
#mission-map-stack #mission-title{font-family:Cairo,system-ui,sans-serif;font-size:12px;font-weight:800;line-height:1.45;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#mission-map-stack #mission-desc{font-family:Cairo,system-ui,sans-serif;font-size:10.5px;font-weight:600;line-height:1.5;margin-top:1px;color:#f3ead2;-webkit-line-clamp:2}
#mission-map-stack #mission-dist{font-family:Cairo,system-ui,sans-serif;font-size:11px;font-weight:700;margin-top:4px;padding:2px 7px;background:rgba(0,0,0,.35)}
#toast{top:calc(env(safe-area-inset-top,0px) + 112px);left:max(204px,calc(50% - 206px));transform:none;width:clamp(150px,calc(50vw - 204px),230px);max-width:none;box-sizing:border-box;text-align:center;font-size:11.5px;line-height:1.6;padding:6px 10px;border-radius:10px}
body.adhkar-on #toast{top:calc(env(safe-area-inset-top,0px) + 150px)}
}
/* 0.33.56 loading screen: whole note visible, anchored above the bottom edge, safe-area aware */
#loading-screen .loading-inner{position:absolute;top:auto;bottom:calc(env(safe-area-inset-bottom,0px) + 10px);left:0;right:0;width:100%;height:auto;max-height:46vh;padding:0 4vw;box-sizing:border-box;justify-content:flex-end;overflow:hidden}
#loading-screen .loading-bar{margin:0 auto 5px;flex:none}
#loading-screen #loading-text{font-size:clamp(10px,2.8vh,16px);line-height:1.5;flex:none}
#loading-screen #loading-note{margin-top:4px;max-width:92vw;font-size:clamp(9px,2.6vh,15px);line-height:1.6;flex:none;text-shadow:0 1px 3px #000,0 0 6px #000}

/* 0.33.65 Ahmed: right HUD smaller and aligned (same widths, radii, sizes); phone button at his marked spot. */
#hud-right{gap:5px}
#hud-right #btn-pause{width:38px;height:38px;border-radius:11px}
#hud-right #btn-phone{position:fixed;right:calc(34vw - 20px);left:auto;top:calc(env(safe-area-inset-top,0px) + 26vh);width:40px;height:40px;border-radius:11px;z-index:53}
#hud-right #btn-phone svg{width:21px;height:21px}
#hud-right #hud-stats{gap:4px;align-items:stretch;width:150px}
#hud-right .stat{box-sizing:border-box;width:100%;min-height:30px;font-size:12px;padding:4px 9px;border-radius:10px;display:flex;align-items:center;justify-content:center;gap:6px}
#hud-right .bar-stat{justify-content:space-between}
#hud-right .mini-bar{flex:1;width:auto;height:6px}
#hud-right #action-buttons{gap:6px;max-width:300px}
#hud-right #action-buttons .ctl-btn{width:38px;height:38px;font-size:13px;border-radius:11px;padding:0}
#hud-right #btn-vehicle{min-width:38px;height:38px;border-radius:11px;font-size:12px;padding:0 10px}
#hud-right #vehicle-radio{box-sizing:border-box;width:150px;font-size:12px;padding:6px 8px;border-radius:10px;text-align:center}
@media (max-height:430px){#hud-right #action-buttons .ctl-btn{width:36px;height:36px;font-size:12px}#hud-right #btn-pause{width:36px;height:36px}#hud-right #btn-phone{width:38px;height:38px}}

/* 0.33.65 single-image menu + responsive menu text */
#start-menu{background:#b9c7cf url('../assets/tex/ui/main-menu-one.jpg') center/auto 100% no-repeat !important;}
.cover-stage{background:none !important;}
.cover-btn{font-size:calc(min(100vw,177.7778vh)*.026) !important;line-height:1.1;white-space:nowrap;overflow:hidden;padding:0 2%;}
@media(orientation:portrait){#start-menu{background-size:cover !important;background-position:38% center !important;}.cover-btn{font-size:20px !important;}}
.menu-title{font-size:clamp(16px,4.2vmin,34px);}
.menu-btn,.setting-row,.setting-row label,.setting-row span{font-size:clamp(12px,3vmin,20px);}
.menu-box{max-height:92vh;overflow-y:auto;}

/* 0.33.72 menu: achievements entry removed from the main menu list (code and data kept) */
#btn-achievements,#btn-cover-new{display:none !important}

/* 0.33.72 riding HUD tidy: smaller aligned right column, mission card, speed readout and steering arrows. Gas and brake are NOT touched. */
#touch-controls.driving #hud-right{width:150px;align-items:stretch;gap:4px}
#touch-controls.driving #hud-right #hud-stats{align-items:stretch;gap:4px}
#touch-controls.driving #hud-right .stat{font-size:11px;min-height:24px;padding:2px 7px;border-radius:8px}
#touch-controls.driving #hud-right .mini-bar{height:5px}
#touch-controls.driving #hud-right #action-buttons{max-width:none;width:150px !important;box-sizing:border-box;align-self:stretch;flex-wrap:nowrap;justify-content:space-between;gap:4px}
#touch-controls.driving #hud-right #action-buttons .ctl-btn{height:34px;min-width:0;flex:1;width:auto;font-size:12px;border-radius:9px;padding:0 4px}
#touch-controls.driving #hud-right #vehicle-radio{width:100%;box-sizing:border-box;font-size:11px;padding:5px 6px;border-radius:8px;text-align:center}
#touch-controls.driving #hud-right #btn-pause{height:34px}
#touch-controls.driving #mission-map-stack{width:150px}
#touch-controls.driving #mission-title{font-size:10.5px}
#touch-controls.driving #mission-desc{font-size:9.5px;-webkit-line-clamp:2}
#touch-controls.driving #mission-dist{font-size:10px;padding:1px 5px}
#touch-controls.driving #speedo{padding:3px 10px;border-radius:9px}
#touch-controls.driving #speed-val{font-size:18px}
#touch-controls.driving #btn-steer-left,#touch-controls.driving #btn-steer-right{width:56px;height:44px;border-radius:12px;font-size:12px}

/* 0.33.74 on-foot action buttons: never overlap. Fixed 150px column under the stats, contextual buttons (اركب / !) get their own full-width row, run/jump/camera keep a fixed size. */
@media(orientation:landscape){
#touch-controls:not(.driving) #hud-right #action-buttons{width:150px;max-width:150px;box-sizing:border-box;flex-wrap:wrap;flex-direction:row-reverse;justify-content:flex-start;align-content:flex-end;gap:6px;bottom:14px;right:16px}
#touch-controls:not(.driving) #hud-right #action-buttons .ctl-btn{flex:0 0 auto;box-sizing:border-box;white-space:nowrap;overflow:hidden;width:44px;height:38px;padding:0;font-size:12px;margin:0}
#touch-controls:not(.driving) #hud-right #action-buttons #btn-camera{width:38px}
#touch-controls:not(.driving) #hud-right #action-buttons #btn-vehicle,#touch-controls:not(.driving) #hud-right #action-buttons #btn-interact{order:10;flex:0 0 100%;width:100%;min-width:0;font-size:14px}
}
