/* =========================================
   شوشرة — App-style navigation
   Active ONLY in installed-app mode (html.ss-app).
   In a normal browser nothing here is visible.
   ========================================= */

.ss-tabbar, .ss-sheet, .ss-sheet-backdrop { display: none; }

html.ss-app {
    --ss-tabbar-h: 64px;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- Header: compact, logo only, below the iPhone status bar ---------- */
html.ss-app .ss-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding-top: env(safe-area-inset-top);
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
html.ss-app .ss-navbar {
    min-height: 56px;
    justify-content: center;
    padding-top: .35rem;
    padding-bottom: .35rem;
    flex-wrap: nowrap;
}
html.ss-app .ss-nav-links,
html.ss-app .ss-account-nav,
html.ss-app .ss-footer { display: none !important; }
html.ss-app .ss-brand-logo img { width: 104px; max-height: 50px; }

/* Room for the tab bar so content is never hidden behind it */
html.ss-app body {
    padding-bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + 12px);
    overscroll-behavior-y: none;
}

/* ---------- Bottom tab bar ---------- */
html.ss-app .ss-tabbar {
    display: flex;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1040;
    height: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 max(6px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-right));
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid #e9e3fa;
    box-shadow: 0 -6px 22px rgba(80, 55, 135, .10);
}
.ss-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    font: inherit;
    color: #7a6e93;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}
.ss-tab-icon {
    font-size: 1.35rem;
    line-height: 1;
    filter: grayscale(.85);
    opacity: .75;
    transition: transform .15s ease, filter .15s ease, opacity .15s ease;
}
.ss-tab-label {
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.ss-tab.is-active { color: #6750e8; }
.ss-tab.is-active .ss-tab-icon { filter: none; opacity: 1; transform: translateY(-1px) scale(1.08); }
.ss-tab.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 34px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, #9B4FD9, #6750e8);
}
.ss-tab:active .ss-tab-icon { transform: scale(.9); }
.ss-tab:focus-visible { outline: 2px solid #6750e8; outline-offset: -4px; border-radius: 12px; }

/* ---------- Bottom sheets (Admin / Account menus) ---------- */
html.ss-app .ss-sheet-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(35, 24, 69, .38);
    animation: ss-fade .18s ease;
}
html.ss-app .ss-sheet:not([hidden]) {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1060;
    max-height: 78vh;
    overflow-y: auto;
    padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
    background: #fff;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(35, 24, 69, .22);
    animation: ss-slide-up .22s ease;
}
.ss-sheet-handle {
    width: 42px;
    height: 5px;
    border-radius: 3px;
    background: #ddd5f3;
    margin: 4px auto 10px;
}
.ss-sheet-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #231845;
    margin: 0 0 6px;
}
.ss-sheet-email {
    font-size: .85rem;
    color: #716783;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ss-sheet a,
.ss-sheet-danger {
    display: block;
    width: 100%;
    text-align: start;
    padding: 13px 6px;
    border: 0;
    border-bottom: 1px solid #f0ecfa;
    background: transparent;
    font: inherit;
    font-weight: 700;
    color: #3d2f63;
    text-decoration: none;
    cursor: pointer;
}
.ss-sheet a:last-child { border-bottom: 0; }
.ss-sheet a:active { background: #f6f2ff; }
.ss-sheet form { margin: 0; }
.ss-sheet-danger { color: #c62f4e; border-bottom: 0; }

html.ss-sheet-open, html.ss-sheet-open body { overflow: hidden; }

/* ---------- Notifications invitation (installed app only, shown by push.js) ---------- */
.ss-push-banner:not([hidden]) {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 0 0 1rem;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f5edff, #fff7e6);
    border: 1px solid #e4d8f9;
    box-shadow: 0 6px 18px rgba(86, 58, 156, .08);
    color: #3d2f63;
    animation: ss-fade .25s ease;
}
.ss-push-banner-icon { font-size: 1.8rem; line-height: 1; }
.ss-push-banner-body { flex: 1; min-width: 0; line-height: 1.6; }
.ss-push-banner-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ss-push-btn {
    border: 0; border-radius: 999px; padding: 8px 18px;
    background: linear-gradient(135deg, #7a5cec, #6750e8); color: #fff;
    font: inherit; font-weight: 800; cursor: pointer;
}
.ss-push-btn-link { border: 0; background: transparent; color: #716783; font: inherit; font-weight: 700; cursor: pointer; padding: 8px 6px; }

/* ---------- Install invitation (phones in a normal browser, shown by install.js) ---------- */
.ss-install-icon { width: 48px; height: 48px; border-radius: 12px; flex: 0 0 auto; box-shadow: 0 3px 10px rgba(86, 58, 156, .2); }
.ss-install-steps { margin: 10px 0 0; padding-inline-start: 1.3rem; line-height: 1.9; }
div.ss-install-steps { padding-inline-start: 0; }
.ss-install-share { width: 20px; height: 20px; vertical-align: -4px; color: #2f7cf6; margin: 0 2px; }
.ss-install-hint { color: #716783; font-size: .85em; }

/* ---------- Quick game guide (all modes; see _GameGuide.cshtml + guide.js) ---------- */
.ss-guide-fab {
    position: fixed; z-index: 1035;
    left: max(14px, env(safe-area-inset-left)); bottom: calc(18px + env(safe-area-inset-bottom));
    width: 48px; height: 48px; border-radius: 50%; border: 0;
    background: linear-gradient(135deg, #7a5cec, #6750e8); color: #fff; font-size: 1.35rem;
    box-shadow: 0 8px 22px rgba(103, 80, 232, .35); cursor: pointer;
}
html.ss-app .ss-guide-fab { bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + 14px); }
.ss-guide:not([hidden]) {
    position: fixed; inset: 0; z-index: 1070;
    display: flex; align-items: center; justify-content: center; padding: 18px;
    background: rgba(35, 24, 69, .55); animation: ss-fade .2s ease;
}
.ss-guide-card {
    width: min(440px, 100%); max-height: 90vh; overflow-y: auto;
    background: #fff; border-radius: 26px; padding: 28px 24px 18px; text-align: center;
    box-shadow: 0 24px 60px rgba(35, 24, 69, .35); color: #231845;
}
.ss-guide-icon { font-size: 3.2rem; line-height: 1; margin-bottom: 10px; }
.ss-guide-title { font-size: 1.35rem; font-weight: 900; margin: 0 0 10px; color: #392060; }
.ss-guide-text { font-size: 1.05rem; line-height: 1.9; margin: 0; color: #4b3b64; min-height: 5.7em; }
.ss-guide-dots { display: flex; justify-content: center; gap: 7px; margin: 18px 0 16px; }
.ss-guide-dots span { width: 9px; height: 9px; border-radius: 50%; background: #e2dbf5; transition: all .2s ease; }
.ss-guide-dots span.is-on { width: 24px; border-radius: 5px; background: #6750e8; }
.ss-guide-actions { display: flex; flex-direction: column; gap: 6px; }
.ss-guide-next {
    border: 0; border-radius: 999px; padding: 13px 20px; font: inherit; font-weight: 900; font-size: 1.05rem;
    background: linear-gradient(135deg, #7a5cec, #6750e8); color: #fff; cursor: pointer;
}
.ss-guide-skip { border: 0; background: transparent; color: #716783; font: inherit; font-weight: 700; padding: 8px; cursor: pointer; }
.ss-guide-more { display: inline-block; margin-top: 6px; font-size: .88rem; font-weight: 700; color: #673ab7; text-decoration: none; }
html.ss-guide-open, html.ss-guide-open body { overflow: hidden; }

/* Small "how to play" button in the installed app's header */
.ss-help-link { display: none; }
html.ss-app .ss-help-link {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border-radius: 50%; background: #f1ecff; color: #6750e8;
    font-weight: 900; text-decoration: none; font-size: 1.05rem;
}
html.ss-app .ss-navbar { position: relative; }

/* ---------- Guest trial ---------- */
.ss-guest-banner {
    display: flex; gap: 10px; align-items: center; margin: 0 0 1rem; padding: 12px 16px;
    border-radius: 16px; background: linear-gradient(135deg, #fff7e6, #f5edff); border: 1px solid #f1d9a6;
    color: #4b3b64; line-height: 1.7;
}
.ss-guest-banner-icon { font-size: 1.6rem; }
.ss-guest-banner a { font-weight: 800; color: #673ab7; }
.ss-guest-cta {
    margin: 1.5rem auto 1rem; max-width: 520px; text-align: center; padding: 1.6rem 1.4rem;
    border-radius: 24px; background: linear-gradient(160deg, #f5edff, #fff7e6); border: 1px solid #e4d8f9;
}
.ss-guest-cta-icon { font-size: 2.8rem; line-height: 1; }
.ss-guest-cta h2 { font-weight: 900; color: #392060; margin: .6rem 0; font-size: 1.5rem; }
.ss-guest-cta p { color: #4b3b64; line-height: 1.9; margin-bottom: 1.1rem; }
.ss-guest-cta-btn {
    display: block; padding: 15px 20px; border-radius: 999px; font-weight: 900; font-size: 1.15rem;
    background: linear-gradient(135deg, #7a5cec, #6750e8); color: #fff !important; text-decoration: none;
    box-shadow: 0 10px 26px rgba(103, 80, 232, .3);
}
.ss-guest-cta-link { display: inline-block; margin-top: .8rem; font-weight: 700; color: #673ab7; }
.ss-guest-start { margin: 0; }
.ss-guest-start button {
    border: 2px dashed #cdbcf5; background: #faf6ff; color: #5b3aa8; border-radius: 16px;
    padding: 12px 18px; font: inherit; font-weight: 800; cursor: pointer; width: 100%;
}
.ss-guest-start small { display: block; font-weight: 600; color: #716783; margin-top: 2px; }

/* ---------- Guest popups (guest-popup.js) ---------- */
html.ss-pop-open, html.ss-pop-open body { overflow: hidden; }
.ss-pop {
    position: fixed; inset: 0; z-index: 1900; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(36, 16, 66, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    animation: ss-fade .25s ease both;
}
.ss-pop[hidden] { display: none; }
.ss-pop.is-closing { animation: ss-fade .22s ease reverse both; }
.ss-pop-card {
    position: relative; width: min(420px, 100%); max-height: calc(100dvh - 40px); overflow: auto;
    text-align: center; padding: 30px 24px 18px; border-radius: 28px; color: #fff;
    background: radial-gradient(circle at 50% 0, rgba(255, 214, 120, .35) 0, rgba(255, 214, 120, 0) 55%), linear-gradient(165deg, #9B4FD9 0%, #6750e8 55%, #5B1488 100%);
    box-shadow: 0 30px 70px rgba(30, 10, 60, .55), inset 0 0 0 1px rgba(255, 255, 255, .18);
    animation: ss-pop-in .5s cubic-bezier(.2, .9, .3, 1.35) both;
}
.ss-pop.is-closing .ss-pop-card { animation: ss-pop-in .22s ease reverse both; }
.ss-pop-x {
    position: absolute; top: 12px; inset-inline-end: 12px; width: 34px; height: 34px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .18); color: #fff; font-size: 1rem; cursor: pointer;
}
.ss-pop-gift { font-size: 4.2rem; line-height: 1; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .25)); animation: ss-pop-wiggle 2.4s ease-in-out .6s infinite; }
.ss-pop-tag {
    display: inline-block; margin-top: 12px; padding: 4px 14px; border-radius: 999px;
    background: #E9A633; color: #3b1d00; font-weight: 900; font-size: .85rem;
}
.ss-pop-card h2 { margin: 10px 0 6px; font-weight: 900; font-size: clamp(1.5rem, 6vw, 1.9rem); color: #fff; }
.ss-pop-card p { margin: 0 0 14px; line-height: 1.8; color: rgba(255, 255, 255, .9); }
.ss-pop-facts { display: flex; gap: 8px; justify-content: center; list-style: none; padding: 0; margin: 0 0 18px; }
.ss-pop-facts li { flex: 1; padding: 10px 4px; border-radius: 16px; background: rgba(255, 255, 255, .14); font-size: .85rem; font-weight: 700; }
.ss-pop-facts b { display: block; font-size: 1.6rem; line-height: 1.2; color: #FFD56B; }
.ss-pop-perks { list-style: none; padding: 0; margin: 0 0 18px; text-align: start; display: grid; gap: 8px; }
.ss-pop-perks li { padding: 9px 14px; border-radius: 14px; background: rgba(255, 255, 255, .14); font-weight: 600; }
.ss-pop-perks b { color: #FFD56B; }
.ss-pop-card form { margin: 0; }
.ss-pop-main {
    display: block; width: 100%; padding: 16px 20px; border: 0; border-radius: 999px; cursor: pointer;
    font: inherit; font-weight: 900; font-size: 1.25rem; text-decoration: none;
    background: linear-gradient(135deg, #FFD56B, #E9A633); color: #3b1d00 !important;
    box-shadow: 0 12px 28px rgba(233, 166, 51, .45); animation: ss-pop-pulse 1.8s ease-in-out 1s infinite;
}
.ss-pop-main:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ss-pop-links { margin-top: 14px; display: flex; gap: 8px; justify-content: center; align-items: center; color: rgba(255, 255, 255, .6); }
.ss-pop-links a { color: #fff; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; }
.ss-pop-later { margin-top: 8px; border: 0; background: none; color: rgba(255, 255, 255, .7); font: inherit; font-size: .9rem; padding: 6px 10px; cursor: pointer; }
.ss-pop-burst span { position: absolute; top: 70px; left: 50%; font-size: 1.3rem; opacity: 0; animation: ss-pop-burst 1.1s ease-out .25s both; }
.ss-pop-burst span:nth-child(1) { --x: -130px; --y: -40px; }
.ss-pop-burst span:nth-child(2) { --x: 120px; --y: -55px; animation-delay: .32s; }
.ss-pop-burst span:nth-child(3) { --x: -95px; --y: 45px; animation-delay: .4s; }
.ss-pop-burst span:nth-child(4) { --x: 105px; --y: 40px; animation-delay: .3s; }
.ss-pop-burst span:nth-child(5) { --x: -40px; --y: -75px; animation-delay: .45s; }
.ss-pop-burst span:nth-child(6) { --x: 45px; --y: -80px; animation-delay: .38s; }
@keyframes ss-pop-in { from { opacity: 0; transform: translateY(30px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes ss-pop-wiggle { 0%, 70%, 100% { transform: rotate(0) scale(1); } 76% { transform: rotate(-12deg) scale(1.08); } 82% { transform: rotate(10deg) scale(1.08); } 88% { transform: rotate(-6deg); } 94% { transform: rotate(4deg); } }
@keyframes ss-pop-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes ss-pop-burst { 0% { opacity: 0; transform: translate(-50%, 0) scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--x)), var(--y)) scale(1.2); } }
@media (prefers-reduced-motion: reduce) {
    .ss-pop, .ss-pop-card, .ss-pop-gift, .ss-pop-main, .ss-pop-burst span { animation: none !important; }
    .ss-pop-burst { display: none; }
}

@keyframes ss-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ss-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
    html.ss-app .ss-sheet:not([hidden]),
    html.ss-app .ss-sheet-backdrop:not([hidden]) { animation: none; }
}

/* =========================================
   Full-screen game (body.ss-in-game, set in _Layout for Game pages during a match):
   the top bar and the app tab bar are hidden; the ☰ button brings them back as overlays.
   The game's own score/team bar is part of the page and is not affected.
   ========================================= */
body.ss-in-game:not(.ss-nav-open) .ss-header,
body.ss-in-game:not(.ss-nav-open) .ss-tabbar { display: none !important; }
html.ss-app body.ss-in-game { padding-bottom: 0; }
/* The header used to absorb the iPhone status-bar inset; keep only that at the top. */
body.ss-in-game main.ss-main { padding-top: env(safe-area-inset-top, 0px); }

/* ☰ open: bars float over the game without moving it. */
body.ss-in-game.ss-nav-open .ss-header {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 1045;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 8px 24px rgba(80, 55, 135, .18);
}

.ss-game-menu-btn { display: none; }
body.ss-in-game .ss-game-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: max(8px, env(safe-area-inset-left, 0px));
    z-index: 1050;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 12px;
    background: rgba(40, 24, 80, .45);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: .75;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: opacity .15s, background .15s;
}
body.ss-in-game .ss-game-menu-btn:hover,
body.ss-in-game.ss-nav-open .ss-game-menu-btn { opacity: 1; background: rgba(103, 58, 183, .9); }
