/* style.css - UI Runner (Design System & Atomic Component Crafting) */
:root {
    --color-bg: #070d19;
    --color-panel: rgba(15, 23, 42, 0.88);
    --color-primary: #38bdf8;
    --color-secondary: #f472b6;
    --color-accent: #facc15;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-text: #f8fafc;
    --color-text-secondary: #94a3b8;
}

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--color-bg);
    font-family: 'Inter', sans-serif;
    color: var(--color-text);
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #070d19;
}

/* In-game HUD with Crafting Bar */
.ui-hud {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 18px;
    padding: 10px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
    box-shadow: 0 8px 30px rgba(0,0,0,0.7), 0 0 20px rgba(56, 189, 248, 0.15);
    max-width: 95vw;
    font-size: 0.92rem;
}
.ui-hud.hidden {
    display: none !important;
}

.hud-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    padding-right: 16px;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Crafting Bar in HUD */
.crafting-bar {
    display: flex;
    align-items: center;
    gap: 14px;
}
.crafting-title {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    color: #94a3b8;
}
.crafting-slots {
    display: flex;
    gap: 8px;
    align-items: center;
}
.crafting-slot {
    background: rgba(0, 0, 0, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.crafting-slot.collected {
    border-style: solid;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
    transform: translateY(-2px);
}

.live-preview-box {
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    padding-left: 14px;
    text-align: center;
}
.assembled-preview-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    transition: all 0.3s ease;
}
.assembled-preview-pill.assembled {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    color: #031e2c;
    border-color: #38bdf8;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
}

/* Overlays & Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none !important;
    justify-content: center;
    align-items: center;
    background: rgba(7, 13, 25, 0.9);
    backdrop-filter: blur(14px);
    z-index: 10;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex !important;
}

.screen.hidden {
    display: none !important;
}

.ui-card {
    border: 1px solid rgba(56, 189, 248, 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.2);
    padding: 2.2rem;
    border-radius: 20px;
    max-width: 680px;
    width: 100%;
}

.ui-badge {
    display: inline-block;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 0.8rem;
}

.ui-title {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 25px rgba(56, 189, 248, 0.6);
    margin: 0.4rem 0;
}

.subtitle {
    color: var(--color-text-secondary);
    font-size: 1rem;
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

.controls-legend-box {
    text-align: left;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 12px;
    padding: 14px 18px;
    max-width: 580px;
    margin: 1rem auto;
    font-size: 0.92rem;
    line-height: 1.9;
}

.ui-btn {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%) !important;
    color: #031e2c !important;
    font-weight: 800 !important;
    border: none;
    padding: 12px 28px !important;
    font-size: 1.08rem !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}
.ui-btn:hover {
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.8);
    transform: scale(1.03);
}

/* Tooltip / In-game Concept Modal */
.tooltip-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}
.tooltip-overlay.hidden {
    display: none !important;
}
.tooltip-content {
    max-width: 480px;
    width: 100%;
    padding: 1.8rem;
    text-align: center;
    border: 1px solid var(--color-primary);
    box-shadow: 0 0 35px rgba(56, 189, 248, 0.35);
}

.learning-summary {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.2rem;
    margin: 1.2rem 0;
    line-height: 1.7;
}

/* Completed Component Showoff */
.completed-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    color: #031e2c;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.6);
}

/* Button to toggle Live Web App Mockup */
.btn-mockup-toggle {
    background: rgba(56, 189, 248, 0.18);
    border: 1px solid #38bdf8;
    color: #38bdf8;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-mockup-toggle:hover {
    background: #38bdf8;
    color: #031e2c;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
}

/* Mockup Drawer / Browser Window */
.mockup-drawer {
    position: absolute;
    top: 75px;
    right: 20px;
    width: 380px;
    max-width: 90vw;
    background: #0b1329;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(56, 189, 248, 0.2);
    z-index: 50;
    overflow: hidden;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mockup-drawer.hidden {
    display: none !important;
}

@keyframes slideInRight {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.mockup-drawer-header {
    background: #070d1a;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.browser-dots {
    display: flex;
    gap: 6px;
}
.browser-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }

.browser-url-bar {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    color: #94a3b8;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mockup-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}
.mockup-close-btn:hover { color: #fff; }

.mockup-app-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 480px;
    overflow-y: auto;
}

/* Mock Layers */
.mock-layer {
    position: relative;
    border-radius: 10px;
    padding: 10px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
}
.mock-layer.locked {
    opacity: 0.35;
    filter: grayscale(80%);
}
.mock-layer.unlocked {
    opacity: 1;
    filter: none;
    border-color: #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}
.mock-layer.highlight {
    animation: pulseHighlight 1.5s infinite alternate;
}
@keyframes pulseHighlight {
    from { border-color: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }
    to { border-color: #facc15; box-shadow: 0 0 20px rgba(250, 204, 21, 0.8); }
}

.mock-layer .lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #facc15;
    text-align: center;
    padding: 4px;
}
.mock-layer.unlocked .lock-overlay {
    display: none;
}

/* Layer 1: Navbar */
.mock-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}
.mock-logo { font-weight: 800; color: #38bdf8; }
.mock-nav-links { display: flex; gap: 8px; font-size: 0.72rem; color: #cbd5e1; }
.mock-btn-search {
    background: #0284c7;
    border: 1px solid #38bdf8;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
}

/* Layer 2: User Card */
.mock-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mock-avatar { font-size: 1.8rem; }
.mock-user-info h4 { margin: 0 0 2px; font-size: 0.85rem; }
.mock-badge-aaa {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #34d399;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
}
.mock-user-info p { margin: 4px 0 0; font-size: 0.7rem; color: #94a3b8; }

/* Layer 3: Typography */
.mock-typography h3 { margin: 0 0 4px; font-size: 0.85rem; color: #f8fafc; }
.mock-p { font-size: 0.72rem; line-height: 1.5; color: #cbd5e1; margin: 0; }

/* Layer 4: Ethical Modal */
.mock-ethical-dialog { font-size: 0.75rem; }
.mock-dialog-header { font-weight: 700; color: #c084fc; margin-bottom: 4px; }
.mock-dialog-body { display: flex; flex-direction: column; gap: 4px; font-size: 0.7rem; color: #e2e8f0; margin-bottom: 6px; }
.mock-dialog-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mock-btn-cancel { background: rgba(239, 68, 68, 0.2); border: 1px solid #ef4444; color: #fca5a5; font-size: 0.68rem; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.mock-btn-accept { background: #0284c7; border: 1px solid #38bdf8; color: #fff; font-size: 0.68rem; padding: 2px 6px; border-radius: 4px; cursor: pointer; }

/* Layer 5: Fluid Grid */
.mock-grid-title { font-size: 0.75rem; font-weight: 700; color: #34d399; margin-bottom: 4px; }
.mock-grid-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mock-grid-card { background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px; padding: 6px 2px; text-align: center; font-size: 0.65rem; color: #38bdf8; }

@media (max-width: 768px) {
    .ui-hud {
        font-size: 0.78rem;
        padding: 6px 14px;
        gap: 8px;
    }
    .crafting-bar {
        gap: 8px;
    }
    .hud-left-group {
        padding-right: 8px;
        gap: 8px;
    }
    .mockup-drawer {
        width: 320px;
        top: 60px;
        right: 10px;
    }
}
