@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;900&display=swap');

/* Reset, page background, layout container, shared keyframes and utilities */

:root {
    --app-surface: rgba(30, 41, 59, 0.8);
    /* Opaque match for --app-surface composited over the page gradient.
       Used for the folder body and active tab so they render identically. */
    --folder-surface: #1d2638;
    --shell-radius: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus,
a:focus {
    outline: none;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100dvh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    color: #e2e8f0;
    overflow: hidden;
    overscroll-behavior: none;
}

/* Desktop shell: a stable card with an intentional lower edge. */
.container {
    background: var(--app-surface);
    backdrop-filter: blur(10px);
    border-radius: var(--shell-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 500px;
    height: min(calc(100dvh - 24px), 840px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 601px) {
    .container {
        transition: border-radius 0.22s ease;
    }
}

.container.at-bottom {
    border-radius: var(--shell-radius);
}

/* Keep the strategy modal on the same desktop card geometry as the app. */
.container.strategy-open {
    border-radius: var(--shell-radius);
    border-color: transparent;
}

/* Scrollable region below the locked header */
.content-scroll {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Fade the bottom edge while there is more to scroll. */
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 52px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 52px), transparent);
}

/* Manila-folder body: same opaque fill as the active tab, with rounded
   shoulders where it meets the tab strip. */
.content-scale {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--folder-surface);
    border-radius: 12px 12px 0 0;
    /* Paint above the tab-bar's extended dark backing. */
    position: relative;
    z-index: 1;
}

.content-scroll::-webkit-scrollbar {
    display: none;
}

/* No fade once the content is fully scrolled to the bottom. */
.container.at-bottom .content-scroll {
    -webkit-mask-image: none;
    mask-image: none;
}

@media (min-width: 601px) {
    :root {
        --desktop-shell-width: 660px;
        --desktop-shell-height: min(calc(100dvh - 48px), 760px);
        --desktop-strategy-width: 540px;
        --desktop-strategy-height: min(calc(100dvh - 48px), 640px);
        /* Matches first input-group label row + spacing before the field. */
        --desktop-input-label-offset: calc(18px + 3px + 4px);
    }

    .container {
        width: min(100%, var(--desktop-shell-width));
        max-width: var(--desktop-shell-width);
        height: var(--desktop-shell-height);
        min-height: var(--desktop-shell-height);
        max-height: var(--desktop-shell-height);
    }

    .content-scroll {
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .content-scale {
        zoom: var(--desktop-ui-scale, 1);
    }

    /* Off-screen clone used by desktopScale.js; matches active tab layout. */
    .tab-content.desktop-scale-probe {
        position: fixed;
        left: -10000px;
        top: 0;
        visibility: hidden;
        pointer-events: none;
        z-index: -1;
    }

    .container.strategy-open {
        background: transparent;
        backdrop-filter: none;
        box-shadow: none;
        border-color: transparent;
        width: min(100%, var(--desktop-shell-width));
        max-width: var(--desktop-shell-width);
        height: var(--desktop-shell-height);
        min-height: var(--desktop-shell-height);
        max-height: var(--desktop-shell-height);
    }

    .container.strategy-open > .header,
    .container.strategy-open > .content-scroll {
        visibility: hidden;
    }
}

@keyframes animateGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

@keyframes float-higher {
    0% { transform: translateY(-6px); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(-6px); }
}

.hidden {
    display: none !important;
}
