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

body {
    font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #000;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

::-webkit-scrollbar {
    display: none;
}

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

/* Android Status Bar */
.status-bar {
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    color: white;
    font-size: 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.time {
    font-weight: 500;
}

.icon {
    font-size: 10px;
}

/* Main Container */
.android-container {
    flex: 1;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    margin-top: 24px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: none;
    position: relative;
}

/* Search Bar */
.search-bar {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-icon {
    font-size: 18px;
    margin-right: 10px;
    opacity: 0.7;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 11px 0;
    font-size: 15px;
    background: transparent;
    color: white;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Pages Wrapper */
.pages-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 0 6px 60px;
    overscroll-behavior: none;
    background: transparent;
    cursor: grab;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: pan-y;
    width: 100%;
}

.pages-wrapper:active {
    cursor: grabbing;
}

.pages-container {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    touch-action: pan-x;
    will-change: transform;
}

/* 5x5 Grid - Fixed Size for Smartphone */
.page {
    min-width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 8px;
    padding: 10px 6px;
    overflow: hidden;
    background: transparent;
    position: relative;
    height: 100%;
}

/* App Icon Card */
.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 3px 2px;
    position: relative;
}

.app-card:active {
    transform: scale(0.9);
}

.app-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 22%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.app-icon-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.app-icon {
    width: 80%;
    height: 80%;
    object-fit: contain;
    transition: opacity 0.2s ease;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.app-name {
    font-size: 9px;
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    font-weight: 400;
    line-height: 1.1;
}

/* Page Indicators */
.page-indicators {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    flex-shrink: 0;
    background: transparent;
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    z-index: 10;
}

.page-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.page-dot.active {
    background: white;
    width: 18px;
    border-radius: 3px;
}

/* Android Navigation Bar */
.nav-bar {
    height: 48px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.nav-button {
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 8px 20px;
    transition: all 0.2s;
    user-select: none;
}

.nav-button:active {
    transform: scale(0.9);
    opacity: 0.6;
}

/* Loading State */
.app-icon-wrapper.loading {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Embedded App View */
.embedded-app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    flex-direction: column;
    overscroll-behavior: none;
    touch-action: pan-y;
}

.embedded-app.active {
    display: flex;
}

.embedded-header {
    background: #242526;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #3a3b3c;
    flex-shrink: 0;
}

.embedded-back-btn {
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    color: white;
}

.embedded-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: contain;
    cursor: pointer;
}

.embedded-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
    flex: 1;
}

.qr-icon {
    font-size: 18px;
    color: #4caf50;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: rgba(76, 175, 80, 0.1);
}

.qr-icon:hover {
    background: rgba(76, 175, 80, 0.2);
    transform: scale(1.1);
}

.qr-icon:active {
    transform: scale(0.95);
}

/* Menu Container */
.embedded-menu-container {
    flex-shrink: 0;
    background: #18191a;
    border-bottom: 0px solid #3a3b3c;
    z-index: 100;
}

.embedded-menu {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 14px;
    gap: 7px;
    white-space: nowrap;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.embedded-menu::-webkit-scrollbar {
    display: block;
    height: 3px;
}

.embedded-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.embedded-menu::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.5);
    border-radius: 2px;
}

.menu-item {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    position: relative;
    user-select: none;
}

.menu-icon {
    font-size: 15px;
    display: inline-block;
}

.menu-text {
    display: inline-block;
}

.menu-arrow {
    font-size: 9px;
    margin-left: 2px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.menu-item:active {
    transform: scale(0.95);
}

.menu-item.active {
    background: #4caf50;
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.menu-item.active .menu-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.submenu-container {
    background: #242526;
    border-top: 1px solid #3a3b3c;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
}

.submenu-container.active {
    max-height: 180px;
    opacity: 1;
}

.submenu {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 7px 14px;
    gap: 5px;
    white-space: nowrap;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.submenu::-webkit-scrollbar {
    display: block;
    height: 3px;
}

.submenu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.submenu::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.5);
    border-radius: 2px;
}

.submenu-item {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 400;
    transition: all 0.2s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    user-select: none;
    border: 1px solid transparent;
}

.submenu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.submenu-item.active {
    background: rgba(76, 175, 80, 0.7);
    color: white;
    border-color: #4caf50;
    font-weight: 500;
}

.submenu-icon {
    font-size: 13px;
    display: inline-block;
}

/* Embedded Content */
.embedded-content {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #18191a;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.embedded-html-wrapper {
    min-height: 100%;
    padding: 14px;
    color: white;
    background: #18191a;
}

/* QR Modal */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
}

.qr-modal.active {
    display: flex;
}

.qr-modal-content {
    background: #242526;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 320px;
    width: 90%;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.qr-code-container {
    width: 220px;
    height: 220px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.qr-code-container canvas {
    display: block;
}

.qr-instruction {
    color: #ccc;
    font-size: 13px;
    margin-bottom: 18px;
    text-align: center;
}

.qr-close-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease;
}

.qr-close-btn:hover {
    background: #43a047;
}

.qr-close-btn:active {
    transform: scale(0.98);
}

.device-pill {
    top: 15px;
    right: 15px;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    align-items: center;
    white-space: nowrap;
    color: white;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

#dev-icon {
    margin-right: 7px;
    font-size: 15px;
}

#dev-name {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#dev-divider {
    margin: 0 7px;
    opacity: 0.3;
    font-weight: 200;
}

#dev-res {
    font-family: monospace;
    opacity: 0.9;
}

#pagesContainer {
    display: flex;
    width: 100%;
    will-change: transform;
    transition: transform 0.3s ease-out;
}