body { padding: 0; margin: 0; background: #160d15; overflow: hidden }
#unity-container { position: fixed; top: 0; left: 0; width: 100%; height: var(--joker-game-height, 100%) }

/* بازی همیشه عمودی (portrait) با نسبت ۹:۱۶ است؛
   در پنجره‌های عریض (تلگرام دسکتاپ) به‌صورت ستون عمودی وسط‌چین با حاشیه نمایش داده می‌شود.
   !important برای غلبه بر style ای که runtime یونیتی روی canvas می‌گذارد. */
#unity-canvas {
    position: absolute;
    top: 0;
    left: 0;
    /* حیاتی: بوم باید دقیقاً هم‌اندازه پنجره باشد؛ letterbox با CSS باعث رندر تکراری
       در سین Game می‌شود. نسبت ۹:۱۶ داخل یونیتی اعمال می‌شود (PortraitViewport.cs) */
    width: 100vw !important;
    /* Android WebViews can resize even with interactive-widget=resizes-visual.
       Keep Unity's drawing area stable while the keyboard covers its bottom. */
    height: var(--joker-game-height, 100vh) !important;
    background: #1f1f20
}

#unity-loading-bar {
    position: absolute; inset: 0; display: none; flex-direction: column;
    align-items: center; justify-content: center; box-sizing: border-box;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: #100315 url('joker-loading-stage-v1.jpg') center center / cover no-repeat;
    color: #f5e2b8; font-family: Tahoma, Arial, sans-serif;
}
#unity-logo { position: absolute; top: max(1vh, env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(70vw, 420px, 42vh) }
#unity-logo .joker-monogram { width: auto; height: min(6vh, 60px); object-fit: contain }
#unity-logo .joker-wordmark { display: block; width: 100%; height: auto; object-fit: contain }
#brand-modes { display: none }
#loading-details {
    position: absolute; bottom: max(4vh, calc(env(safe-area-inset-bottom) + 16px));
    width: min(88%, 420px); display: flex; flex-direction: column;
    align-items: center; gap: 12px; text-align: center;
    text-shadow: 0 2px 8px #100315;
}
#unity-progress-bar-empty {
    width: min(58vw, 260px); height: 5px; flex-shrink: 0;
    border: 1px solid #76502b; padding: 3px; border-radius: 8px;
    background: #160d15; overflow: hidden;
}
#unity-progress-bar-full {
    width: 0%; height: 100%; border-radius: 5px;
    background: linear-gradient(90deg, #a96b29, #f6cf78);
    transition: width .15s linear;
}
#loading-status { min-height: 24px; margin: 0; font-size: 14px; line-height: 1.7 }
#loading-tip, #loading-message { margin: 0; font-size: 12px; line-height: 1.8; color: #e6d0b0; white-space: pre-wrap; overflow-wrap: anywhere }
#loading-version { margin: 0; font-size: 12px; color: #e6d0b0; direction: ltr }
.custom-splash-details { background: #100315cc; border-radius: 12px; padding: 14px; box-sizing: border-box }
@media (prefers-reduced-motion: reduce) { #unity-progress-bar-full { transition: none } }
@media (max-height: 450px) { #loading-details { gap: 6px } }
#unity-footer { display: none }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none; font-family: arial; font-size: 13px }

/* Native UniText fields must not trigger mobile Safari focus zoom. */
input[id^="joker-input-"], textarea[id^="joker-input-"] {
    font: 16px/1.4 Tahoma, Arial, sans-serif;
    padding: 4px 8px; color: #3d1d13; background: #f6e6c5;
    border: 1px solid #b78743; border-radius: 6px;
    text-align: start; direction: rtl; resize: none;
}

#joker-runtime-failure {position:fixed;inset:0;z-index:2147483647;background:rgba(15,7,14,.94);display:flex;align-items:center;justify-content:center;padding:22px;box-sizing:border-box;color:#fff0d1;font-family:Tahoma,Arial,sans-serif;line-height:1.9;}
#joker-runtime-failure section {max-width:440px;width:100%;padding:24px;border:1px solid #b68b49;border-radius:16px;background:#281622;box-shadow:0 15px 60px #0008;}
#joker-runtime-failure h2 {font-size:24px;margin:0 0 12px;}
#joker-runtime-failure p {font-size:16px;}
#joker-runtime-failure button {width:100%;min-height:48px;background:#e1bb77;color:#281622;border:0;border-radius:8px;font:700 17px Tahoma,Arial,sans-serif;cursor:pointer;}
#joker-runtime-failure details {margin-top:20px;font-size:13px;}
#joker-runtime-failure pre {white-space:pre-wrap;overflow-wrap:anywhere;max-height:180px;overflow:auto;font-size:11px;color:#e0cdbd;user-select:text;}
