/* MOBILE APP SHELL */
.mobile-app {
    display: none;
}

@media (max-width: 760px), (max-width: 1366px) and (pointer: coarse) {
    html,
    body {
        min-height: 100%;
        overflow-x: hidden;
        overscroll-behavior: none;
        touch-action: manipulation;
        -webkit-text-size-adjust: 100%;
    }

    body {
        padding: 0;
        -webkit-tap-highlight-color: transparent;
    }

    button,
    a,
    input,
    select,
    textarea,
    [role="button"] {
        touch-action: manipulation;
    }

    #app {
        display: none !important;
    }

    .floating-damage {
        display: none !important;
    }

    .mobile-app {
        display: grid;
        grid-template-columns: 74px minmax(0, 1fr);
        height: 100dvh;
        min-height: 100vh;
        width: 100%;
        overflow: hidden;
        --mobile-page-accent: #00e5ff;
        background:
            radial-gradient(circle at 70% 0%, rgba(0, 229, 255, 0.08), transparent 34%),
            linear-gradient(180deg, rgba(2, 6, 23, 0.98), rgba(8, 13, 26, 0.98));
        color: var(--text-main);
    }

    .mobile-app[data-mobile-page="combat"] { --mobile-page-accent: #00e5ff; }
    .mobile-app[data-mobile-page="arsenal"] { --mobile-page-accent: #ff4d6d; }
    .mobile-app[data-mobile-page="lab"] { --mobile-page-accent: #b45cff; }
    .mobile-app[data-mobile-page="ship"] { --mobile-page-accent: #38bdf8; }
    .mobile-app[data-mobile-page="expeditions"] { --mobile-page-accent: #22c55e; }
    .mobile-app[data-mobile-page="fleet"] { --mobile-page-accent: #facc15; }
    .mobile-app[data-mobile-page="bestiary"] { --mobile-page-accent: #f97316; }
    .mobile-app[data-mobile-page="casino"] { --mobile-page-accent: #ec4899; }
    .mobile-app[data-mobile-page="inventory"] { --mobile-page-accent: #14b8a6; }
    .mobile-app[data-mobile-page="achievements"] { --mobile-page-accent: #fde047; }
    .mobile-app[data-mobile-page="stats"] { --mobile-page-accent: #a3e635; }
    .mobile-app[data-mobile-page="codex"] { --mobile-page-accent: #818cf8; }

    .mobile-aside {
        position: sticky;
        top: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 8px 6px;
        border-right: 1px solid rgba(0, 229, 255, 0.16);
        background: rgba(2, 6, 23, 0.86);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        z-index: 20;
    }

    .mobile-brand {
        min-height: 54px;
        display: grid;
        place-items: center;
        gap: 4px;
        color: var(--accent-cyan);
        font-size: 0.48rem;
        font-weight: 700;
        text-align: center;
    }

    .mobile-brand i {
        font-size: 1rem;
    }

    .mobile-nav-btn {
        min-height: 48px;
        display: grid;
        place-items: center;
        gap: 3px;
        border: 1px solid rgba(255, 255, 255, 0.04);
        border-radius: 7px;
        background:
            linear-gradient(135deg, color-mix(in srgb, var(--page-accent, var(--accent-cyan)) 13%, transparent), rgba(255, 255, 255, 0.015));
        color: var(--text-dim);
        font-size: 0.48rem;
        font-weight: 700;
        text-transform: uppercase;
        cursor: pointer;
        box-shadow: inset 0 0 10px color-mix(in srgb, var(--page-accent, var(--accent-cyan)) 9%, transparent);
    }

    .mobile-nav-btn i {
        font-size: 1rem;
        color: var(--page-accent, var(--accent-cyan));
        filter: drop-shadow(0 0 6px color-mix(in srgb, var(--page-accent, var(--accent-cyan)) 68%, transparent));
    }

    .mobile-nav-btn span {
        max-width: 58px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-nav-btn.active {
        color: #fff;
        border-color: color-mix(in srgb, var(--page-accent, var(--accent-cyan)) 52%, rgba(255, 255, 255, 0.08));
        background:
            radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--page-accent, var(--accent-cyan)) 26%, transparent), transparent 58%),
            rgba(255, 255, 255, 0.045);
        box-shadow:
            inset 0 0 16px color-mix(in srgb, var(--page-accent, var(--accent-cyan)) 18%, transparent),
            0 0 14px color-mix(in srgb, var(--page-accent, var(--accent-cyan)) 18%, transparent);
    }

    .mobile-nav-btn[data-mobile-page="combat"] { --page-accent: #00e5ff; }
    .mobile-nav-btn[data-mobile-page="arsenal"] { --page-accent: #ff4d6d; }
    .mobile-nav-btn[data-mobile-page="lab"] { --page-accent: #b45cff; }
    .mobile-nav-btn[data-mobile-page="ship"] { --page-accent: #38bdf8; }
    .mobile-nav-btn[data-mobile-page="expeditions"] { --page-accent: #22c55e; }
    .mobile-nav-btn[data-mobile-page="fleet"] { --page-accent: #facc15; }
    .mobile-nav-btn[data-mobile-page="bestiary"] { --page-accent: #f97316; }
    .mobile-nav-btn[data-mobile-page="casino"] { --page-accent: #ec4899; }
    .mobile-nav-btn[data-mobile-page="inventory"] { --page-accent: #14b8a6; }
    .mobile-nav-btn[data-mobile-page="achievements"] { --page-accent: #fde047; }
    .mobile-nav-btn[data-mobile-page="stats"] { --page-accent: #a3e635; }
    .mobile-nav-btn[data-mobile-page="codex"] { --page-accent: #818cf8; }

    .mobile-main {
        position: relative;
        min-width: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        isolation: isolate;
    }

    .mobile-main::before,
    .mobile-main::after {
        content: '';
        position: absolute;
        left: -60%;
        right: -60%;
        height: 50%;
        background-image:
            linear-gradient(rgba(0, 229, 255, 0.42) 1px, transparent 1px),
            linear-gradient(90deg, rgba(0, 229, 255, 0.42) 1px, transparent 1px);
        background-size: 38px 38px;
        opacity: 0.2;
        z-index: -1;
        pointer-events: none;
    }

    .mobile-main::before {
        top: 0;
        transform: perspective(420px) rotateX(-66deg);
        transform-origin: bottom;
        animation: mobileTronCeiling 0.42s linear infinite, mobileTronHue 5s linear infinite, mobileGridRotate 10s ease-in-out infinite alternate;
    }

    .mobile-main::after {
        bottom: 0;
        transform: perspective(420px) rotateX(66deg);
        transform-origin: top;
        animation: mobileTronFloor 0.42s linear infinite, mobileTronHue 5s linear infinite, mobileGridRotate 10s ease-in-out infinite alternate;
    }

    .mobile-topbar {
        position: relative;
        min-height: 62px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(15, 23, 42, 0.68);
        overflow: hidden;
    }
    
    .mobile-topbar.has-active-toast > div:not(.mobile-toast-container) {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }
    
    .mobile-topbar > div:not(.mobile-toast-container) {
        transition: opacity 0.2s;
    }

    .mobile-kicker {
        display: block;
        color: var(--text-dim);
        font-size: 0.48rem;
        font-weight: 700;
        letter-spacing: 0.08em;
    }

    #mobile-page-title {
        display: block;
        margin-top: 2px;
        color: var(--mobile-page-accent);
        font-size: 0.86rem;
        line-height: 1.1;
        text-transform: uppercase;
        text-shadow: 0 0 10px color-mix(in srgb, var(--mobile-page-accent) 52%, transparent);
    }

    .mobile-status-line {
        position: absolute;
        left: 12px;
        right: 118px;
        bottom: 5px;
        color: var(--accent-cyan);
        font-size: 0.48rem;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        opacity: 0;
        transform: translateY(3px);
        transition: opacity 0.18s ease, transform 0.18s ease;
        pointer-events: none;
    }

    .mobile-status-line.active {
        opacity: 0.85;
        transform: translateY(0);
    }

    .mobile-resources {
        display: grid;
        gap: 5px;
        min-width: 94px;
        font-variant-numeric: tabular-nums;
    }

    .mobile-resources span {
        --resource-color: var(--accent-cyan);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding: 5px 7px;
        border: 1px solid color-mix(in srgb, var(--resource-color) 24%, transparent);
        border-radius: 6px;
        background: linear-gradient(90deg, color-mix(in srgb, var(--resource-color) 13%, transparent), rgba(255, 255, 255, 0.035));
        color: var(--resource-color);
        font-size: 0.62rem;
        font-weight: 700;
        box-shadow: inset 2px 0 0 var(--resource-color);
    }

    .mobile-resources span:nth-child(2) {
        --resource-color: var(--accent-magenta);
    }

    .mobile-page {
        display: none;
        flex: 1;
        min-height: 0;
        padding: 12px;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-page.active {
        display: block;
    }

    #mobile-page-combat {
        padding: 0;
        overflow-y: auto;
    }

    .mobile-combat-card {
        min-height: calc(100dvh - 62px);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 12px 12px 16px;
    }

    .mobile-combat-top,
    .mobile-combat-bottom {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .mobile-combat-top {
        gap: 6px;
    }

    .mobile-combat-bottom {
        flex: 0 0 auto;
        gap: 7px;
    }

    .mobile-combat-center {
        flex: 1 1 auto;
        width: 100%;
        min-height: 220px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-combat-stage {
        position: relative;
        width: min(100%, 360px);
        height: min(100%, 290px);
        min-height: 220px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: visible;
        background: none;
        isolation: isolate;
    }

    .mobile-combat-card.is-warping .mobile-combat-stage,
    .mobile-combat-card.is-warping .mobile-monster-readout {
        display: none;
    }

    .mobile-warp-feedback {
        position: relative;
        width: min(100%, 300px);
        height: min(100%, 235px);
        min-height: 180px;
        display: none;
        place-items: center;
        overflow: hidden;
        border-radius: 12px;
        background: radial-gradient(circle at 50% 50%, rgba(0, 229, 255, 0.12), transparent 62%);
    }

    .mobile-combat-card.is-warping .mobile-warp-feedback {
        display: grid;
    }

    .mobile-warp-feedback img {
        position: relative;
        z-index: 2;
        width: 118px;
        height: auto;
        image-rendering: pixelated;
        filter: drop-shadow(0 0 16px rgba(0, 229, 255, 0.62));
        animation: mobileShipWarp 0.42s ease-in-out infinite alternate;
    }

    .mobile-warp-feedback span {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 18px;
        z-index: 2;
        color: var(--accent-cyan);
        font-size: 0.66rem;
        font-weight: 700;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 0.16em;
        animation: mobileWarpText 0.72s ease-in-out infinite alternate;
    }

    .mobile-monster-readout {
        width: min(320px, 100%);
        display: grid;
        gap: 5px;
    }

    .mobile-monster-name {
        max-width: 100%;
        color: #fff;
        font-size: 0.68rem;
        font-weight: 700;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

    .mobile-hp {
        width: 100%;
        height: 6px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.1);
        overflow: hidden;
    }

    #mobile-hp-fill {
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, #fb7185, #ff4d6d);
        box-shadow: 0 0 10px rgba(255, 77, 109, 0.6);
        transition: width 0.2s ease;
    }

    .mobile-monster-button {
        position: relative;
        flex: 0 0 min(82vw, 276px);
        margin: auto;
        width: min(82vw, 276px);
        height: min(82vw, 276px);
        display: grid;
        place-items: center;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: var(--accent-cyan);
        cursor: pointer;
        --mobile-enemy-halo-color: rgba(0, 229, 255, 0.32);
        --mobile-enemy-halo-speed: 4s;
        z-index: 2;
        overflow: visible;
        outline: none;
        -webkit-tap-highlight-color: transparent;
        appearance: none;
        user-select: none;
        touch-action: manipulation;
    }

    .mobile-monster-button:focus,
    .mobile-monster-button:focus-visible,
    .mobile-monster-button:active {
        outline: none;
        box-shadow: none;
    }

    .mobile-monster-button::before {
        content: '';
        position: absolute;
        width: 72%;
        height: 72%;
        border-radius: 50%;
        background: radial-gradient(circle, var(--mobile-enemy-halo-color) 0%, transparent 68%);
        opacity: 0.34;
        z-index: 0;
        filter: drop-shadow(0 0 10px var(--mobile-enemy-halo-color));
        animation: mobileMonsterHalo var(--mobile-enemy-halo-speed) ease-in-out infinite;
        pointer-events: none;
    }

    .mobile-monster-button.enemy-variant-special::before,
    .mobile-monster-button.enemy-variant-elite::before,
    .mobile-monster-button.enemy-variant-boss::before {
        opacity: 0.66;
        width: 78%;
        height: 78%;
    }

    .mobile-monster-sprite {
        position: relative;
        z-index: 2;
        width: 100%;
        height: 100%;
        display: grid;
        place-items: center;
        font-size: 3.2rem;
    }

    .mobile-monster-button.enemy-variant-boss.boss-phase-3 .mobile-monster-sprite {
        animation: mobileBossShake 0.18s linear infinite;
    }

    .mobile-monster-sprite img {
        max-width: 82%;
        max-height: 82%;
        object-fit: contain;
        image-rendering: pixelated;
        filter: drop-shadow(0 0 10px var(--mobile-enemy-halo-color));
    }

    .mobile-random-event {
        position: absolute;
        width: 48px;
        height: 48px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 50%;
        background:
            radial-gradient(circle at 50% 72%, rgba(217, 70, 239, 0.14), transparent 58%),
            rgba(15, 23, 42, 0.82);
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28), inset 0 0 14px rgba(0, 229, 255, 0.12);
        font-size: 1.18rem;
        z-index: 4;
        transform: translate(-50%, -50%);
        animation: mobileEventFloat 1.8s ease-in-out infinite;
    }

    .mobile-tap-burst {
        position: absolute;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        border: 1px solid rgba(0, 229, 255, 0.8);
        transform: translate(-50%, -50%);
        pointer-events: none;
        z-index: 5;
        animation: mobileTapBurst 0.42s ease-out forwards;
    }

    .mobile-floating-damage {
        position: absolute;
        z-index: 6;
        left: 50%;
        top: 50%;
        pointer-events: none;
        font-size: 0.78rem;
        font-weight: 700;
        line-height: 1;
        text-shadow: 0 0 8px currentColor, 0 2px 8px rgba(0, 0, 0, 0.55);
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .mobile-floating-damage.auto {
        font-size: 0.68rem;
        opacity: 0.9;
    }

    .mobile-combat-skills {
        width: 100%;
        max-width: 360px;
        display: flex;
        justify-content: flex-start;
        gap: 9px;
        margin-top: 10px;
        overflow-x: auto;
        padding: 0 2px 2px;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
    }

    .mobile-combat-skills::-webkit-scrollbar {
        display: none;
    }

    .mobile-skill-empty,
    .mobile-skill-btn {
        flex: 0 0 82px;
        width: 82px;
        height: 52px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 8px;
        background: var(--glass-bg, rgba(2, 6, 23, 0.76));
        color: #fff;
        scroll-snap-align: center;
    }

    .mobile-skill-empty {
        flex: 1 0 100%;
        width: auto;
        height: 52px;
        border-radius: 7px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: var(--text-dim);
        font-size: 0.58rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .mobile-skill-empty i {
        color: #b45cff;
    }

    .mobile-skill-btn {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        overflow: hidden;
        font-weight: 700;
        cursor: pointer;
        box-shadow: inset 0 0 12px rgba(180, 92, 255, 0.08), 0 8px 16px rgba(0, 0, 0, 0.22);
    }

    .mobile-skill-btn::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: var(--cooldown-height, 0%);
        background: rgba(2, 6, 23, 0.76);
        z-index: 1;
        transition: height 0.12s linear;
    }

    .mobile-skill-btn i {
        position: relative;
        z-index: 2;
        color: #b45cff;
        font-size: 1.48rem;
        filter: drop-shadow(0 0 6px rgba(180, 92, 255, 0.45));
    }

    .mobile-skill-btn b {
        position: absolute;
        right: 6px;
        bottom: 5px;
        z-index: 2;
        min-width: 25px;
        padding: 1px 4px;
        border-radius: 999px;
        background: rgba(2, 6, 23, 0.78);
        color: #fff;
        font-size: 0.56rem;
        font-weight: 700;
        line-height: 1.25;
        text-align: center;
        font-variant-numeric: tabular-nums;
    }

    .mobile-skill-btn.is-active {
        border-color: #ec4899;
        background: rgba(236, 72, 153, 0.12);
        box-shadow: inset 0 0 14px rgba(236, 72, 153, 0.18), 0 0 14px rgba(236, 72, 153, 0.12);
    }

    .mobile-skill-btn.is-active i {
        color: #ec4899;
        filter: drop-shadow(0 0 7px rgba(236, 72, 153, 0.72));
    }

    .mobile-skill-btn.is-cooling {
        opacity: 0.78;
        pointer-events: none;
    }

    .mobile-active-effects {
        width: 100%;
        max-width: 360px;
        min-height: 34px;
        display: flex;
        gap: 7px;
        overflow-x: auto;
        padding: 0 2px 2px;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
    }

    .mobile-active-effects::-webkit-scrollbar {
        display: none;
    }

    .mobile-effect-chip {
        position: relative;
        flex: 0 0 62px;
        width: 62px;
        height: 32px;
        display: grid;
        grid-template-columns: 20px minmax(0, 1fr);
        align-items: center;
        gap: 4px;
        padding: 5px 6px 7px;
        border: 1px solid #ec4899;
        border-radius: 7px;
        background: rgba(236, 72, 153, 0.12);
        color: #fff;
        overflow: hidden;
        scroll-snap-align: start;
        pointer-events: none;
    }

    .mobile-effect-chip.object {
        border-color: #f97316;
        background: rgba(249, 115, 22, 0.1);
    }

    .mobile-effect-chip.cooldown {
        border-color: rgba(250, 204, 21, 0.28);
        background: rgba(2, 6, 23, 0.76);
        opacity: 0.78;
    }

    .mobile-effect-chip i {
        color: #ec4899;
        font-size: 0.86rem;
        filter: drop-shadow(0 0 6px rgba(236, 72, 153, 0.55));
    }

    .mobile-effect-chip.object i {
        color: #f97316;
        filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.5));
    }

    .mobile-effect-chip.cooldown i {
        color: #facc15;
        filter: drop-shadow(0 0 5px rgba(250, 204, 21, 0.38));
    }

    .mobile-effect-chip b {
        color: #fff;
        font-size: 0.56rem;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
        text-align: right;
    }

    .mobile-effect-chip em {
        position: absolute;
        left: 0;
        bottom: 0;
        height: 2px;
        background: #ec4899;
        box-shadow: 0 0 8px rgba(236, 72, 153, 0.65);
    }

    .mobile-effect-chip.object em {
        background: #f97316;
        box-shadow: 0 0 8px rgba(249, 115, 22, 0.6);
    }

    .mobile-effect-chip.cooldown em {
        background: #facc15;
        box-shadow: 0 0 8px rgba(250, 204, 21, 0.42);
    }

    .mobile-mission-row {
        width: min(360px, 100%);
        display: grid;
        gap: 5px;
        padding: 7px 10px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 7px;
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-dim);
        font-size: 0.6rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .mobile-mission-row > div:first-child {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-width: 0;
    }

    .mobile-mission-row span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #fff;
    }

    .mobile-mission-row strong {
        flex: 0 0 auto;
        color: #38bdf8;
        font-variant-numeric: tabular-nums;
    }

    .mobile-mission-progress {
        height: 3px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.1);
        overflow: hidden;
    }

    #mobile-mission-fill {
        width: 0%;
        height: 100%;
        background: linear-gradient(90deg, #38bdf8, #818cf8);
        box-shadow: 0 0 10px rgba(129, 140, 248, 0.65);
        transition: width 0.2s ease;
    }

    body.red-alert-active .mobile-combat-stage::after {
        content: '';
        position: absolute;
        inset: 8px;
        height: auto;
        left: 8px;
        right: 8px;
        top: 8px;
        bottom: 8px;
        background-image: none;
        transform: none;
        border: 1px solid rgba(251, 113, 133, 0.55);
        border-radius: 12px;
        box-shadow: inset 0 0 24px rgba(251, 113, 133, 0.18);
        pointer-events: none;
        z-index: 1;
        animation: mobileRedAlert 0.8s ease-in-out infinite alternate;
    }

    @keyframes mobileTronFloor {
        from { background-position: center 0; }
        to { background-position: center 34px; }
    }

    @keyframes mobileTronCeiling {
        from { background-position: center 0; }
        to { background-position: center -34px; }
    }

    @keyframes mobileTronHue {
        from { filter: hue-rotate(0deg) brightness(1.15); }
        to { filter: hue-rotate(360deg) brightness(1.15); }
    }

    @keyframes mobileGridRotate {
        0% { rotate: 0deg; }
        25% { rotate: 15deg; }
        75% { rotate: -15deg; }
        100% { rotate: 0deg; }
    }

    @keyframes mobileShipWarp {
        from { transform: translateX(-5px) scale(0.98); }
        to { transform: translateX(5px) scale(1.04); }
    }

    @keyframes mobileWarpText {
        from { opacity: 0.55; transform: translateY(2px); }
        to { opacity: 1; transform: translateY(0); }
    }

    @keyframes mobileBossShake {
        0%, 100% { transform: translate(0, 0); }
        25% { transform: translate(-1px, 1px); }
        50% { transform: translate(1px, -1px); }
        75% { transform: translate(-1px, -1px); }
    }

    @keyframes mobileMonsterHalo {
        0%, 100% { transform: scale(0.94); opacity: 0.34; }
        50% { transform: scale(1.08); opacity: 0.72; }
    }

    @keyframes mobileEventFloat {
        0%, 100% { transform: translate(-50%, -50%) scale(1); }
        50% { transform: translate(-50%, -58%) scale(1.08); }
    }

    @keyframes mobileTapBurst {
        from { transform: translate(-50%, -50%) scale(0.4); opacity: 0.9; }
        to { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
    }

    @keyframes mobileRedAlert {
        from { opacity: 0.45; }
        to { opacity: 0.95; }
    }

    .mobile-list,
    .mobile-stats-grid {
        display: grid;
        gap: 8px;
    }

    .mobile-card,
    .mobile-stat,
    .mobile-placeholder {
        padding: 10px;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 24%, transparent);
        border-radius: 7px;
        background:
            linear-gradient(90deg, color-mix(in srgb, var(--mobile-page-accent) 9%, transparent), rgba(255, 255, 255, 0.035));
        min-width: 0;
        box-shadow: inset 2px 0 0 color-mix(in srgb, var(--mobile-page-accent) 82%, transparent);
    }

    .mobile-card.is-disabled {
        opacity: 0.52;
    }

    .mobile-card.is-selected {
        border-color: color-mix(in srgb, var(--mobile-page-accent) 62%, transparent);
        background: color-mix(in srgb, var(--mobile-page-accent) 13%, rgba(255, 255, 255, 0.035));
    }

    .mobile-card-head {
        display: grid;
        grid-template-columns: 26px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
    }

    .mobile-card-head i {
        width: 26px;
        height: 26px;
        display: grid;
        place-items: center;
        border-radius: 6px;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 30%, transparent);
        color: var(--mobile-page-accent);
        background: rgba(2, 6, 23, 0.55);
        font-size: 0.82rem;
        filter: drop-shadow(0 0 6px color-mix(in srgb, var(--mobile-page-accent) 46%, transparent));
    }

    .mobile-card strong,
    .mobile-stat strong {
        display: block;
        min-width: 0;
        color: #fff;
        font-size: 0.76rem;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .mobile-card span,
    .mobile-stat span {
        display: block;
        margin-top: 4px;
        color: var(--text-dim);
        font-size: 0.58rem;
        line-height: 1.25;
    }

    .mobile-complete-mark {
        color: var(--success);
        font-size: 0.72rem;
        font-weight: 700;
        filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.5));
    }

    .mobile-placeholder {
        min-height: 160px;
        display: grid;
        place-items: center;
        gap: 8px;
        color: var(--text-dim);
        font-size: 0.68rem;
        font-weight: 700;
        text-align: center;
        text-transform: uppercase;
    }

    .mobile-placeholder i {
        color: var(--mobile-page-accent);
        font-size: 1.8rem;
        filter: drop-shadow(0 0 10px color-mix(in srgb, var(--mobile-page-accent) 50%, transparent));
    }

    .toast-container {
        display: none;
    }

    .mobile-action {
        margin-top: 8px;
        width: 100%;
        min-height: 34px;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 42%, transparent);
        border-radius: 6px;
        background: color-mix(in srgb, var(--mobile-page-accent) 15%, transparent);
        color: #fff;
        font-size: 0.62rem;
        font-weight: 700;
        text-transform: uppercase;
        box-shadow: inset 0 0 12px color-mix(in srgb, var(--mobile-page-accent) 14%, transparent);
    }

    .mobile-action:disabled {
        opacity: 0.45;
    }

    .mobile-action.danger {
        border-color: rgba(251, 113, 133, 0.36);
        background: rgba(251, 113, 133, 0.1);
    }

    .mobile-ship-summary {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 8px;
    }

    .mobile-ship-summary-item {
        min-width: 0;
        min-height: 38px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 5px;
        padding: 7px 8px;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 28%, transparent);
        border-radius: 7px;
        background: color-mix(in srgb, var(--mobile-page-accent) 10%, rgba(255, 255, 255, 0.035));
        color: var(--text-dim);
        font-size: 0.58rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .mobile-ship-summary-item i {
        flex: 0 0 auto;
        color: var(--mobile-page-accent);
        font-size: 0.78rem;
    }

    .mobile-ship-summary-item b {
        min-width: 0;
        overflow: hidden;
        color: #fff;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-ship-buy {
        cursor: pointer;
        font-family: inherit;
    }

    .mobile-ship-buy:not(:disabled) {
        border-color: color-mix(in srgb, var(--mobile-page-accent) 48%, transparent);
        background: color-mix(in srgb, var(--mobile-page-accent) 18%, rgba(255, 255, 255, 0.045));
        box-shadow: 0 0 12px color-mix(in srgb, var(--mobile-page-accent) 14%, transparent);
    }

    .mobile-ship-buy:disabled {
        opacity: 0.52;
    }

    #mobile-ship-actions:empty {
        display: none;
    }

    .mobile-ship-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 0;
    }

    .mobile-ship-cell {
        min-height: 142px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 9px;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 24%, transparent);
        border-radius: 7px;
        background:
            linear-gradient(0deg, color-mix(in srgb, var(--mobile-page-accent) 8%, transparent) 1px, transparent 1px),
            linear-gradient(90deg, color-mix(in srgb, var(--mobile-page-accent) 8%, transparent) 1px, transparent 1px),
            rgba(255, 255, 255, 0.03);
        background-size: 18px 18px;
        text-align: center;
        min-width: 0;
    }

    .mobile-ship-cell.locked,
    .mobile-ship-cell.empty {
        color: var(--text-dim);
        font-size: 0.62rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .mobile-ship-visual {
        width: 54px;
        height: 54px;
        display: grid;
        place-items: end center;
        border-radius: 50%;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 26%, rgba(255, 255, 255, 0.08));
        background: color-mix(in srgb, var(--mobile-page-accent) 8%, rgba(15, 23, 42, 0.68));
        overflow: hidden;
    }

    .mobile-ship-visual img {
        width: 88%;
        height: 88%;
        object-fit: contain;
        object-position: bottom center;
        image-rendering: pixelated;
    }

    .mobile-ship-cell strong {
        width: 100%;
        color: #fff;
        font-size: 0.62rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-ship-cell span {
        color: var(--text-dim);
        font-size: 0.56rem;
        font-weight: 700;
    }

    .mobile-ship-cell .mobile-action {
        min-height: 28px;
        margin-top: 2px;
        font-size: 0.54rem;
    }

    .mobile-casino {
        display: grid;
        gap: 12px;
        place-items: center;
        padding-top: 6px;
    }

    .mobile-casino-bets {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }

    .mobile-casino-bet {
        min-height: 44px;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 32%, transparent);
        border-radius: 7px;
        background: color-mix(in srgb, var(--mobile-page-accent) 9%, rgba(255, 255, 255, 0.035));
        color: var(--text-dim);
        font-size: 0.56rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .mobile-casino-bet strong {
        display: block;
        margin-top: 3px;
        color: var(--mobile-page-accent);
        font-size: 0.72rem;
    }

    .mobile-casino-bet.active {
        color: #fff;
        border-color: color-mix(in srgb, var(--mobile-page-accent) 62%, transparent);
        background: color-mix(in srgb, var(--mobile-page-accent) 16%, transparent);
    }

    .mobile-casino-reels {
        width: min(100%, 300px);
        display: grid;
        grid-template-columns: repeat(var(--mobile-casino-reel-count, 3), minmax(0, 1fr));
        gap: 7px;
    }

    .mobile-casino-reel {
        aspect-ratio: 1;
        display: grid;
        place-items: center;
        border: 1px solid color-mix(in srgb, var(--mobile-page-accent) 38%, transparent);
        border-radius: 8px;
        background: rgba(2, 6, 23, 0.82);
        color: var(--mobile-page-accent);
        font-size: 1.2rem;
        box-shadow: inset 0 0 12px color-mix(in srgb, var(--mobile-page-accent) 16%, transparent);
    }

    .mobile-casino-reel.winning {
        color: #fff;
        border-color: #fff;
        box-shadow: 0 0 18px color-mix(in srgb, var(--mobile-page-accent) 42%, transparent), inset 0 0 16px rgba(255, 255, 255, 0.12);
    }

    .mobile-casino-status {
        min-height: 18px;
        color: var(--mobile-page-accent);
        font-size: 0.62rem;
        font-weight: 700;
        text-transform: uppercase;
        text-align: center;
    }
}

@media (max-width: 760px) and (orientation: portrait),
       (max-width: 1366px) and (pointer: coarse) and (orientation: portrait) {
    html,
    body {
        width: 100%;
        height: 100%;
        overflow: hidden;
        background:
            radial-gradient(circle at 50% 18%, rgba(0, 229, 255, 0.18), transparent 42%),
            linear-gradient(180deg, #020617, #0f172a);
    }

    #app,
    .mobile-app {
        display: none !important;
    }

    body::before {
        content: '\f2f1';
        position: fixed;
        left: 50%;
        top: 34%;
        transform: translate(-50%, -50%);
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        color: var(--accent-cyan);
        font-size: 3rem;
        filter: drop-shadow(0 0 18px rgba(0, 229, 255, 0.68));
        z-index: 99999;
    }

    body::after {
        content: 'MODE PAYSAGE REQUIS';
        position: fixed;
        left: 50%;
        top: 52%;
        width: min(84vw, 360px);
        transform: translate(-50%, -50%);
        padding: 18px 20px;
        border: 1px solid rgba(0, 229, 255, 0.34);
        border-radius: 8px;
        background: rgba(2, 6, 23, 0.82);
        color: #fff;
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: 0.12em;
        line-height: 1.4;
        text-align: center;
        text-transform: uppercase;
        box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.08), 0 18px 40px rgba(0, 0, 0, 0.38);
        z-index: 99998;
    }
}

@media (max-width: 760px) and (orientation: landscape),
       (max-width: 1366px) and (pointer: coarse) and (orientation: landscape) {
    html,
    body {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .mobile-app {
        grid-template-columns: clamp(58px, 7.5vw, 74px) minmax(0, 1fr);
    }

    .mobile-aside {
        height: 100dvh;
        gap: 5px;
        padding: 6px 5px;
    }

    .mobile-brand {
        min-height: 36px;
        font-size: 0;
    }

    .mobile-brand i {
        font-size: 1rem;
    }

    .mobile-nav-btn {
        min-height: 38px;
        gap: 2px;
        font-size: 0.42rem;
    }

    .mobile-nav-btn i {
        font-size: 0.9rem;
    }

    .mobile-nav-btn span {
        max-width: 48px;
    }

    .mobile-topbar {
        min-height: 52px;
        padding: 7px 10px;
    }

    .mobile-resources {
        min-width: 150px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-resources span {
        min-width: 0;
        padding: 5px 6px;
    }

    .mobile-page {
        height: calc(100dvh - 52px);
        padding: 8px;
        overflow-y: auto;
    }

    #mobile-page-combat {
        overflow: hidden;
    }

    .mobile-combat-card {
        height: calc(100dvh - 52px);
        min-height: 0;
        display: grid;
        grid-template-columns: minmax(170px, 28%) minmax(210px, 1fr) minmax(170px, 28%);
        grid-template-areas: "top center bottom";
        align-items: stretch;
        gap: 8px;
        padding: 8px;
        overflow: hidden;
    }

    .mobile-combat-top {
        grid-area: top;
        min-height: 0;
        align-self: stretch;
        justify-content: center;
        overflow: hidden;
    }

    .mobile-combat-center {
        grid-area: center;
        min-height: 0;
        height: 100%;
        align-self: stretch;
    }

    .mobile-combat-bottom {
        grid-area: bottom;
        min-height: 0;
        align-self: stretch;
        justify-content: center;
        overflow: hidden;
    }

    .mobile-combat-stage {
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    .mobile-monster-button {
        flex-basis: min(38vw, 58dvh, 276px);
        width: min(38vw, 58dvh, 276px);
        height: min(38vw, 58dvh, 276px);
    }

    .mobile-mission-row,
    .mobile-active-effects,
    .mobile-monster-readout,
    .mobile-combat-skills {
        max-width: none;
    }

    .mobile-active-effects {
        min-height: 34px;
    }

    .mobile-combat-skills {
        margin-top: 8px;
    }

    .mobile-list,
    .mobile-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        align-items: start;
    }

    .mobile-ship-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }
}

@media (max-width: 760px) and (orientation: landscape) and (max-height: 560px),
       (max-width: 1366px) and (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
    .mobile-topbar {
        min-height: 46px;
        padding: 5px 8px;
    }

    .mobile-kicker,
    .mobile-status-line {
        display: none;
    }

    #mobile-page-title {
        margin-top: 0;
        font-size: 0.78rem;
    }

    .mobile-page,
    .mobile-combat-card {
        height: calc(100dvh - 46px);
    }

    .mobile-combat-card {
        grid-template-columns: minmax(150px, 27%) minmax(190px, 1fr) minmax(150px, 27%);
        gap: 6px;
        padding: 6px;
    }

    .mobile-mission-row {
        padding: 6px 8px;
        font-size: 0.54rem;
    }

    .mobile-effect-chip {
        flex-basis: 54px;
        width: 54px;
        height: 29px;
    }

    .mobile-monster-button {
        flex-basis: min(34vw, 56dvh, 220px);
        width: min(34vw, 56dvh, 220px);
        height: min(34vw, 56dvh, 220px);
    }

    .mobile-skill-empty,
    .mobile-skill-btn {
        flex-basis: 68px;
        width: 68px;
        height: 44px;
    }

    .mobile-skill-btn i {
        font-size: 1.24rem;
    }
}

@media (min-width: 761px) and (max-width: 1366px) and (pointer: coarse) and (orientation: landscape) and (min-height: 561px) {
    .mobile-app {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    .mobile-aside {
        gap: 7px;
        padding: 10px 8px;
    }

    .mobile-brand {
        min-height: 62px;
        font-size: 0.54rem;
    }

    .mobile-brand i {
        font-size: 1.25rem;
    }

    .mobile-nav-btn {
        min-height: 54px;
        gap: 4px;
        font-size: 0.54rem;
    }

    .mobile-nav-btn i {
        font-size: 1.18rem;
    }

    .mobile-nav-btn span {
        max-width: 74px;
    }

    .mobile-topbar {
        min-height: 72px;
        padding: 12px 16px;
    }

    .mobile-kicker {
        font-size: 0.58rem;
    }

    #mobile-page-title {
        font-size: 1.08rem;
    }

    .mobile-status-line {
        left: 16px;
        right: 180px;
        bottom: 7px;
        font-size: 0.58rem;
    }

    .mobile-resources {
        min-width: 220px;
        gap: 7px;
    }

    .mobile-resources span {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .mobile-page {
        height: calc(100dvh - 72px);
        padding: 14px;
    }

    .mobile-combat-card {
        height: calc(100dvh - 72px);
        grid-template-columns: minmax(230px, 29%) minmax(280px, 1fr) minmax(230px, 29%);
        gap: 14px;
        padding: 14px;
    }

    .mobile-mission-row {
        padding: 11px 13px;
        font-size: 0.74rem;
    }

    .mobile-mission-progress {
        height: 5px;
    }

    .mobile-active-effects {
        min-height: 42px;
        gap: 9px;
    }

    .mobile-effect-chip {
        flex-basis: 78px;
        width: 78px;
        height: 40px;
        grid-template-columns: 26px minmax(0, 1fr);
        padding: 7px 8px 9px;
    }

    .mobile-effect-chip i {
        font-size: 1.05rem;
    }

    .mobile-effect-chip b {
        font-size: 0.68rem;
    }

    .mobile-monster-button {
        flex-basis: min(34vw, 64dvh, 360px);
        width: min(34vw, 64dvh, 360px);
        height: min(34vw, 64dvh, 360px);
    }

    .mobile-monster-sprite {
        font-size: 4rem;
    }

    .mobile-monster-readout {
        gap: 8px;
    }

    .mobile-monster-name {
        font-size: 0.86rem;
    }

    .mobile-hp {
        height: 8px;
    }

    .mobile-combat-skills {
        gap: 11px;
        margin-top: 12px;
    }

    .mobile-skill-empty,
    .mobile-skill-btn {
        flex-basis: 102px;
        width: 102px;
        height: 64px;
    }

    .mobile-skill-empty {
        font-size: 0.68rem;
    }

    .mobile-skill-btn i {
        font-size: 1.7rem;
    }

    .mobile-skill-btn b {
        right: 8px;
        bottom: 7px;
        min-width: 31px;
        font-size: 0.66rem;
    }

    .mobile-list,
    .mobile-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 12px;
    }

    .mobile-card,
    .mobile-stat,
    .mobile-placeholder {
        padding: 14px;
    }

    .mobile-card-head {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 11px;
    }

    .mobile-card-head i {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .mobile-card strong,
    .mobile-stat strong {
        font-size: 0.92rem;
    }

    .mobile-card span,
    .mobile-stat span {
        font-size: 0.7rem;
    }

    .mobile-action {
        min-height: 42px;
        font-size: 0.74rem;
    }

    .mobile-ship-summary {
        gap: 10px;
        margin-bottom: 12px;
    }

    .mobile-ship-summary-item {
        min-height: 48px;
        padding: 10px 12px;
        font-size: 0.72rem;
    }

    .mobile-ship-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 12px;
    }

    .mobile-ship-cell {
        min-height: 180px;
    }

    .mobile-ship-visual {
        width: 68px;
        height: 68px;
    }

    .mobile-casino {
        gap: 16px;
    }

    .mobile-casino-bet {
        min-height: 58px;
        font-size: 0.68rem;
    }

    .mobile-casino-bet strong {
        font-size: 0.88rem;
    }

    .mobile-casino-reels {
        width: min(100%, 390px);
        gap: 10px;
    }

    .mobile-casino-reel {
        font-size: 1.55rem;
    }

    .mobile-casino-status {
        font-size: 0.78rem;
    }
}

/* Mobile Toasts */
.mobile-toast-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    pointer-events: none;
}

.mobile-toast {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    border-left: 4px solid var(--accent-cyan);
    padding: 0 14px;
    color: white;
    font-family: 'Outfit', sans-serif;
    animation: mobileToastSlideIn 0.25s ease-out forwards;
    pointer-events: none;
}

.mobile-toast strong {
    display: block;
    font-size: 0.72rem;
    color: var(--accent-cyan);
    margin-bottom: 2px;
    text-transform: uppercase;
}

.mobile-toast span {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.85);
}

.mobile-toast.toast-out {
    animation: mobileToastSlideOut 0.25s ease-in forwards;
}

@keyframes mobileToastSlideIn {
    0% { transform: translateX(-110%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes mobileToastSlideOut {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(110%); opacity: 0; }
}

/* Notification Dots for Mobile Nav */
.mobile-nav-btn {
    position: relative;
}

.mobile-nav-btn.has-notif::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--accent-magenta);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--accent-magenta);
}
