* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Use dynamic viewport height where supported; fallback to 100vh */
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

body {
    background-color: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-display, 'Inter'), system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}

.mobile-container {
    width: 100%;
    max-width: 450px;
    height: 100%;
    max-height: 950px;
    background-color: var(--surface);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* Enforce a mobile-like aspect ratio */
    aspect-ratio: 9 / 19.5;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .mobile-container {
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        aspect-ratio: unset;
    }

    /* Ensure header stays visible below browser UI bars */
    .app-header {
        position: fixed;
        top: env(safe-area-inset-top, 0px);
        left: 0;
        right: 0;
        z-index: 2000;
    }
}

.app-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 56px;
    /* Avoid overlap with mobile browser top bars / notches */
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    height: calc(56px + env(safe-area-inset-top, 0px));
}

.hamburger-menu-button {
    font-size: 22px;
    cursor: pointer;
    position: absolute;
    left: 12px;
    top: calc(12px + env(safe-area-inset-top, 0px));
    z-index: 1001;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.hamburger-menu-button:hover { opacity: 0.95; box-shadow: 0 0 0 1px var(--accent, rgba(255,255,255,0.2)) inset; }
.hamburger-menu-button:active { transform: scale(0.98); }

.app-header h1 {
    font-size: 18px;
    margin: 0;
    width: 100%;
    text-align: center;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.refresh-button {
    font-size: 18px;
    cursor: pointer;
    position: absolute;
    right: 12px;
    top: calc(12px + env(safe-area-inset-top, 0px));
    z-index: 1001;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.refresh-button:hover { opacity: 0.95; box-shadow: 0 0 0 1px var(--accent, rgba(255,255,255,0.2)) inset; }
.refresh-button:active { transform: rotate(-20deg) scale(0.98); }
.refresh-button.spinning i { animation: spin 0.8s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.app-content {
    flex-grow: 1;
    overflow: hidden;
    /* Match header visual height including safe-area inset */
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
    height: calc(100% - (60px + env(safe-area-inset-top, 0px)));
    position: relative;
}

/* Ensure no scrollbars anywhere */
::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* For tablets and larger screens */
@media (min-width: 768px) {
    .mobile-container {
        /* Allow wider layout on tablet/desktop while keeping a comfortable cap */
        max-width: min(1100px, 92vw);
        max-height: 92vh;
    }
}
