/* Mobile workspace: bounded brand slot and non-scrolling workspace controls.
   No main-menu dimensions, root scrolling or shared dialog transforms here. */
.iliya-brand-film { display: none; }

body.private-bids-page > .container > .pb-tab-bar {
    flex: 0 0 auto;
    position: relative;
    top: auto;
}

/* Decoration uses spare title-row width; all menu sizes stay unchanged. */
body.unified-page #appMenuRegion .header-title::after,
body.private-bids-page > .container > header .header-title::after {
    content: "";
    flex: 1 1 auto;
    min-width: 20px;
    height: 22px;
    margin-inline: 18px 4px;
    pointer-events: none;
    /* A tapered orbital signature, not a rule across the entire header. */
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 40' fill='none'%3E%3Cdefs%3E%3ClinearGradient id='a'%3E%3Cstop stop-color='%23638ffa' stop-opacity='0'/%3E%3Cstop offset='.4' stop-color='%23638ffa' stop-opacity='.45'/%3E%3Cstop offset='.82' stop-color='%235ebff0'/%3E%3Cstop offset='1' stop-color='%2379d7ef' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M8 30C120 38 231 5 351 13S439 27 475 17' stroke='url(%23a)' stroke-width='1.6'/%3E%3Cpath d='M98 36C225 18 322 35 454 5' stroke='url(%23a)' stroke-width='.7' opacity='.55'/%3E%3Cpath d='m367 13 6-1.5L375 5l2 6.5 6 1.5-6 2-2 6-2-6z' fill='%238adcf5'/%3E%3Ccircle cx='438' cy='25' r='1.5' fill='%237caaf5'/%3E%3C/svg%3E") right center / min(100%, 480px) 100% no-repeat;
    opacity: .95;
}
html[data-theme="light"] body.unified-page #appMenuRegion .header-title::after,
html[data-theme="light"] body.private-bids-page > .container > header .header-title::after {
    filter: brightness(.72) saturate(1.15);
}
body.unified-page #appMenuRegion .header-title .version-pill,
body.private-bids-page > .container > header .header-title .version-pill { order: 1; }

@media (min-width: 768px) {
    body.unified-page #appMenuRegion .header-title,
    body.private-bids-page > .container > header .header-title {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        align-items: center;
    }
}

@media (max-width: 767px) {
    :root.mobile-brand-reserved {
        /* Stable screen proportion, with a usable pause target. Safe area is
           outside the film; it must never look like an empty second ad. */
        --app-brand-film-height: clamp(58px, 7.2vh, 68px);
        --app-brand-film-height: clamp(58px, 7.2svh, 68px);
        --app-ad-slot-height: calc(var(--app-brand-film-height) + env(safe-area-inset-bottom, 0px));
        --app-bottom-reserved: var(--app-ad-slot-height);
        --app-dialog-safe-bottom: var(--app-bottom-reserved);
    }
    :root.mobile-brand-reserved body {
        --app-dialog-safe-bottom: var(--app-bottom-reserved);
    }
    :root.mobile-brand-reserved body.unified-page.app-shell > #appMainFrame > #appAdRegion {
        position: fixed !important;
        /* Explicit visual-viewport coordinates survive iOS root-scroll vs.
           locked menu transitions. Do not anchor a child to a grid track. */
        top: calc(var(--app-ad-viewport-bottom, 100dvh) - var(--app-ad-slot-height)) !important;
        right: 0 !important;
        bottom: auto !important;
        left: 0 !important;
        width: 100%;
        height: var(--app-ad-slot-height);
        min-height: var(--app-ad-slot-height);
        max-height: var(--app-ad-slot-height);
        margin: 0;
        padding: 0;
        background: var(--color-bg, #f8fafc);
        overflow: hidden;
        z-index: var(--z-ad-active, 29000) !important;
        isolation: isolate;
    }
    :root.mobile-brand-reserved body.unified-page.app-shell > #appMainFrame > #appAdRegion::after {
        content: "";
        position: absolute;
        z-index: 0;
        top: var(--app-brand-film-height);
        right: 0;
        bottom: 0;
        left: 0;
        background: var(--color-bg, #f8fafc);
        border-top: 1px solid color-mix(in srgb, var(--color-border, #dbe4ef) 72%, transparent);
        pointer-events: none;
    }
    :root.mobile-brand-reserved #appAdRegion > #adBannerArea[data-brand-visible="1"] {
        position: relative !important;
        inset: auto !important;
        width: 100%;
        height: var(--app-brand-film-height) !important;
        min-height: var(--app-brand-film-height) !important;
        max-height: var(--app-brand-film-height) !important;
        box-sizing: border-box;
        padding: 0 !important;
        border: 0;
        display: flex !important;
        align-items: flex-start;
        justify-content: center;
        background: linear-gradient(110deg, #09182f 0%, #182b5e 48%, #123e60 100%);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 24px #07122538;
        overflow: hidden;
        z-index: 1 !important;
    }
    #adBannerArea[data-brand-visible="1"] > .ad-banner-content { display: none; }
    #adBannerArea[data-brand-visible="1"] > .iliya-brand-film {
        display: block;
        position: relative;
        width: 100%;
        height: var(--app-brand-film-height);
        isolation: isolate;
        overflow: hidden;
        border-top: 1px solid #82d9ff80;
        border-bottom: 1px solid #2e6c9f80;
        border-radius: inherit;
        box-shadow: inset 0 1px 0 #ffffff17;
    }
    .iliya-brand-film img, .iliya-brand-film video {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        filter: saturate(1.08) contrast(1.04);
        pointer-events: none;
    }
    .iliya-brand-film video { opacity: 0; transition: opacity .45s ease; }
    .iliya-brand-film video.is-playing { opacity: .9; }
    .iliya-brand-film::before {
        content: "";
        position: absolute;
        z-index: 1;
        inset: 0;
        background:
            radial-gradient(circle at 74% 35%, #7c9cff24 0 11%, transparent 33%),
            linear-gradient(90deg, #061328e8 0 22%, #07162db8 42%, #08162c72 72%, #071328c9 100%);
        pointer-events: none;
    }
    .iliya-brand-film::after {
        content: "✦";
        position: absolute;
        z-index: 1;
        top: 12px;
        right: 47px;
        display: flex;
        width: 62px;
        height: 26px;
        padding-right: 12px;
        align-items: center;
        justify-content: flex-end;
        background: linear-gradient(100deg, transparent 0 9%, #71d8ff12 28%, #71d8ff70 72%, transparent 100%);
        color: #e7fbff;
        font: 800 12px/1 system-ui, sans-serif;
        opacity: .78;
        text-shadow: 0 0 8px #91e6ff, 0 0 16px #7f9fff;
        transform: rotate(-7deg);
        pointer-events: none;
    }
    .iliya-brand-content {
        position: absolute;
        z-index: 2;
        inset: 0 52px 0 0;
        display: grid;
        grid-template-columns: minmax(62px, auto) 1px minmax(0, 1fr);
        align-items: center;
        column-gap: 10px;
        padding: 7px 7px 7px 14px;
        color: #f5f9ff;
        white-space: nowrap;
        pointer-events: none;
    }
    .iliya-brand-lockup {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
    }
    .iliya-brand-wordmark {
        color: #fff;
        font: 850 21px/22px -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
        letter-spacing: -1px;
        text-shadow: 0 1px 9px #3bbef073;
    }
    .iliya-brand-tagline {
        color: #a9d9f3;
        font: 650 9px/12px -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
        letter-spacing: -.2px;
    }
    .iliya-brand-divider {
        width: 1px;
        height: 34px;
        background: linear-gradient(180deg, transparent, #b6dcff73 24% 76%, transparent);
    }
    .iliya-brand-copy {
        position: relative;
        flex: 1;
        min-width: 0;
        height: 44px;
        font: 650 14px/20px -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
        letter-spacing: -.35px;
        color: #f5f9ff;
    }
    .iliya-brand-scene {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        opacity: 0;
        animation: iliya-brand-copy-cycle 18s steps(1, end) infinite paused;
    }
    .iliya-brand-scene:first-child { opacity: 1; }
    .iliya-brand-scene:nth-child(2) { animation-delay: -12s; }
    .iliya-brand-scene:nth-child(3) { animation-delay: -6s; }
    .iliya-brand-scene strong { color: #95e7ff; font-weight: 800; }
    .iliya-brand-scene small {
        overflow: hidden;
        color: #c6d8ec;
        font: 550 10.5px/15px -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
        text-overflow: ellipsis;
    }
    .iliya-brand-film:has(video.is-playing) .iliya-brand-scene { animation-play-state: running; }
    /* Pause/error/data-saver must never freeze half-transparent copy. */
    .iliya-brand-film:not(:has(video.is-playing)) .iliya-brand-scene { animation: none; opacity: 0; }
    .iliya-brand-film:not(:has(video.is-playing)) .iliya-brand-scene:first-child { opacity: 1; }
    /* Exactly one message owns each six-second interval. A discrete handoff
       avoids both overlapping words and an empty transition frame. */
    @keyframes iliya-brand-copy-cycle {
        0%, 33.332% { opacity: 1; }
        33.333%, 100% { opacity: 0; }
    }
    #adBannerArea .iliya-brand-motion {
        position: absolute;
        z-index: 3;
        top: 50%;
        right: 5px;
        transform: translateY(-50%);
        width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        border: 0;
        border-radius: 14px;
        background: #07152e73;
        box-shadow: inset 0 0 0 1px #b9e8ff2e;
        color: #e8f6ff;
        font: 600 13px/1 system-ui, sans-serif;
        cursor: pointer;
    }
    #adBannerArea .iliya-brand-motion:focus-visible { outline: 2px solid #8dd4ff; outline-offset: -3px; }
    #adBannerArea .iliya-brand-motion:hover { background: #294a72; }
    /* The common frame owns the only reservation, including gesture safety. */
    :root.mobile-brand-reserved body.unified-page.app-shell > #appMainFrame > #appViewportRegion {
        box-sizing: border-box;
        padding-bottom: var(--app-bottom-reserved) !important;
    }

    @media (max-width: 339px) {
        .iliya-brand-content {
            grid-template-columns: 58px 1px minmax(0, 1fr);
            column-gap: 8px;
            padding-left: 10px;
        }
        .iliya-brand-wordmark { font-size: 19px; }
        .iliya-brand-copy { font-size: 13px; letter-spacing: -.45px; }
        .iliya-brand-scene small { font-size: 10px; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .iliya-brand-film video { display: none; }
    .iliya-brand-scene { animation: none; opacity: 0; }
    .iliya-brand-scene:first-child { opacity: 1; }
}
