:root {
    --bg-gradient: radial-gradient(circle at 50% 15%, #1e293b 0%, #0b1120 100%);
    --nav-bg: rgba(15, 23, 42, 0.85);
    --card-border: rgba(255, 255, 255, 0.12);
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --device-frame: #334155;
    --device-border-highlight: rgba(255, 255, 255, 0.18);
    --screen-bg: #0f172a;
    --screen-border: transparent;
    --btn-bg: rgba(255, 255, 255, 0.08);
    --btn-hover: rgba(255, 255, 255, 0.16);
    --device-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.7);
}

[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(15, 23, 42, 0.15);
    --text-main: #0f172a;
    --text-sub: #334155;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --device-frame: #334155; 
    --device-border-highlight: rgba(255, 255, 255, 0.4);
    --screen-bg: #f8fafc;
    --screen-border: #94a3b8; 
    --btn-bg: #ffffff;
    --btn-hover: #e2e8f0;
    --device-shadow: 0 30px 60px -12px rgba(15, 23, 42, 0.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent; 
    outline: none;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

nav {
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--card-border);
}

footer {
    flex-shrink: 0;
    border-top: 1px solid var(--card-border);
    padding: 1.2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-sub);
    position: relative;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.5rem;
}

.brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
}
.brand span { color: var(--primary); }

.controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-ctrl {
    background: var(--btn-bg);
    color: var(--text-main);
    border: 1px solid var(--card-border);
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.btn-ctrl:hover { background: var(--btn-hover); }
.btn-ctrl svg {
    width: 18px; height: 18px; fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.click-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 45; 
    display: none;
    cursor: pointer;
}
.stage-active-header .click-overlay { display: block; }

main {
    flex: 1;
    display: flex;
    align-items: center;  
    justify-content: center;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.hero-text {
    position: absolute;
    top: 6vh;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 10;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none; 
}
.hero-text h1 {
    font-size: 2.3rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
    letter-spacing: -0.5px;
}
.hero-text p {
    color: var(--text-sub);
    font-size: 1rem;
}

.stage-active-header .hero-text {
    opacity: 0;
    transform: translateY(-20px);
}

.stage-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5rem;
    perspective: 1200px;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.device {
    flex-shrink: 0; 
    cursor: pointer;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}
.device:hover:not(.active) {
    transform: translateY(-8px) scale(1.02);
}

.phone {
    width: 254px;
    height: 494px;
    background: var(--device-frame);
    border: 3px solid var(--device-border-highlight);
    border-radius: 38px;
    box-shadow: var(--device-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.phone .screen {
    flex: 1;
    background: var(--screen-bg);
    border-radius: 34px;
    padding: 1.2rem 1rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--screen-border);
}
.phone .camera-hole {
    width: 12px; height: 12px; background: var(--device-frame);
    border-radius: 50%; margin: 0 auto 0.8rem auto;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}
[data-theme="light"] .phone .camera-hole { background: #0f172a; box-shadow: none; }

.monitor-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(var(--device-shadow));
}
.monitor {
    width: 470px;
    height: 295px;
    background: var(--device-frame);
    border: 3px solid var(--device-border-highlight);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}
.monitor .screen {
    width: 100%; height: 100%; background: var(--screen-bg);
    border-radius: 12px; padding: 1.4rem;
    display: flex; flex-direction: column; position: relative;
    overflow: hidden; border: 1px solid var(--screen-border);
}
.monitor-stand {
    width: 64px; height: 35px; background: var(--device-frame);
    border-left: 2px solid var(--device-border-highlight);
    border-right: 2px solid var(--device-border-highlight);
}
.monitor-base {
    width: 160px; height: 10px; background: var(--device-frame);
    border: 2px solid var(--device-border-highlight); border-radius: 6px 6px 0 0;
}
.screen-label {
    font-size: 0.8rem; font-weight: 700; color: var(--text-sub); margin-bottom: 0.6rem;
}

.apps-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem 0.8rem; margin-top: 0.8rem;
}
.monitor .apps-grid {
    grid-template-columns: repeat(4, 1fr); gap: 1.2rem;
}
.app-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; transition: transform 0.2s ease;
}
.app-item:hover { transform: scale(1.08); }
.app-icon {
    width: 54px; height: 54px; border-radius: 15px; display: flex; align-items: center;
    justify-content: center; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
    overflow: hidden; background: var(--primary);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.pc-icon { background: linear-gradient(135deg, #10b981, #059669); font-size: 1.5rem; }
.app-item span {
    font-size: 0.75rem; font-weight: 600; color: var(--text-main);
    text-align: center; max-width: 65px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.app-modal {
    position: absolute; inset: 0; background: var(--screen-bg); z-index: 20;
    padding: 1.2rem; display: flex; flex-direction: column;
    transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-modal.open { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.modal-badge { font-size: 0.8rem; font-weight: 700; color: var(--primary); }
.modal-close {
    background: var(--btn-bg); border: 1px solid var(--card-border); color: var(--text-main);
    font-size: 1rem; width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 30;
}
.modal-content {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 0.6rem; overflow-y: auto; flex: 1;
}
.modal-icon {
    width: 64px; height: 64px; border-radius: 16px; overflow: hidden; box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}
.modal-icon img { width: 100%; height: 100%; object-fit: cover; }
.modal-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.2rem; }
.modal-desc {
    font-size: 0.82rem; color: var(--text-sub); line-height: 1.6;
    text-align: center; padding: 0 0.5rem; width: 100%;
}
.modal-links {
    display: flex; flex-direction: column; gap: 0.5rem; width: 100%; margin-top: auto; z-index: 30;
}
.btn-app {
    background: var(--primary); color: #fff; padding: 0.65rem 0.8rem; border-radius: 8px;
    font-size: 0.85rem; font-weight: 600; text-decoration: none; text-align: center;
}
.btn-app:hover { background: var(--primary-hover); }
.btn-sub {
    color: var(--text-sub); font-size: 0.75rem; text-decoration: none; text-align: center;
}
.btn-sub:hover { color: var(--primary); }

.stage.focus-phone .phone {
    transform: translateX(275px) scale(1.25);
    z-index: 50;
}
.stage.focus-phone .monitor-wrapper {
    opacity: 0; pointer-events: none;
    transform: translateX(275px) scale(0.8);
}
.stage.focus-monitor .monitor-wrapper {
    transform: translateX(-167px) scale(1.4);
    z-index: 50;
}
.stage.focus-monitor .phone {
    opacity: 0; pointer-events: none;
    transform: translateX(-167px) scale(0.8);
}

@media (max-width: 820px) {
    .hero-text { top: 4vh; }
    .hero-text h1 { font-size: 1.8rem; }
    
    .stage {
        gap: 2rem;
        transform: scale(0.44);
    }
    
    .stage.focus-phone {
        transform: scale(0.95);
    }
    .stage.focus-phone .phone {
        transform: translateX(251px);
        z-index: 50;
    }
    .stage.focus-phone .monitor-wrapper {
        opacity: 0; pointer-events: none;
        transform: translateX(251px) scale(0.8);
    }
    
    .stage.focus-monitor {
        transform: scale(0.68);
    }
    .stage.focus-monitor .monitor-wrapper {
        transform: translateX(-143px);
        z-index: 50;
    }
    .stage.focus-monitor .phone {
        opacity: 0; pointer-events: none;
        transform: translateX(-143px) scale(0.8);
    }
}