:root {
    --bg-body: #07090e;
    --bg-card: rgba(18, 22, 34, 0.75);
    --bg-card-hover: rgba(28, 34, 52, 0.9);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(245, 158, 11, 0.45);
    
    --gold-primary: #f59e0b;
    --gold-light: #fbbf24;
    --amber-glow: #d97706;
    
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    
    --radius-app: 20px;
    --radius-btn: 12px;
    --font-display: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background-image: 
        radial-gradient(circle at 50% -20%, rgba(245, 158, 11, 0.15), transparent 70%),
        radial-gradient(circle at 10% 40%, rgba(139, 92, 246, 0.08), transparent 50%),
        radial-gradient(circle at 90% 70%, rgba(6, 182, 212, 0.08), transparent 50%);
    background-attachment: fixed;
}

/* Canvas Background Visualizer */
#visualizerCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}

/* Main Viewport Container */
.app-viewport {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 980px;
    padding: 1.5rem 1rem 3.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header Navigation Bar */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(14, 18, 28, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: 99px;
    padding: 0.7rem 1.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: var(--text-main);
}

.brand-icon-wrap {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--gold-primary), var(--amber-glow));
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
    color: #0b0d14;
}

.brand-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.18rem;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #ffffff 40%, var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    color: var(--text-sub);
    padding: 0.5rem 0.95rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

.icon-btn.sound-active {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gold-light);
    border-color: rgba(245, 158, 11, 0.4);
}

/* Studio Keypad Dock */
.synth-dock {
    background: rgba(14, 18, 28, 0.8);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-app);
    padding: 1.2rem 1.4rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dock-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dock-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-sub);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dock-title svg {
    color: var(--gold-primary);
}

.dock-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold-light);
    background: rgba(245, 158, 11, 0.12);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.dock-keys {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.45rem;
}

.synth-key {
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    color: #0f172a;
    border: none;
    border-radius: 7px 7px 11px 11px;
    padding: 0.85rem 0.2rem 0.4rem 0.2rem;
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    box-shadow: 0 3px 0 #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    transition: all 0.1s ease;
    user-select: none;
}

.synth-key span {
    font-size: 0.62rem;
    color: #64748b;
    font-weight: 600;
}

.synth-key:hover {
    background: #ffffff;
}

.synth-key:active, .synth-key.active {
    transform: translateY(3px);
    box-shadow: 0 0 0 #94a3b8;
    background: var(--gold-light);
    color: #000;
}

/* Search Bar */
.search-bar-wrap {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.7rem;
    background: rgba(14, 18, 28, 0.75);
    border: 1px solid var(--border-card);
    border-radius: 99px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.25s ease;
}

.search-box input:focus {
    border-color: var(--gold-primary);
    background: rgba(22, 28, 46, 0.95);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    pointer-events: none;
}

/* App Grid Layout */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.25rem;
}

/* Professional App Tile Card */
.app-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-app);
    padding: 1.35rem 1.15rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    backdrop-filter: blur(14px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-tile:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 0 22px rgba(245, 158, 11, 0.15);
}

.tile-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    margin-bottom: 0.9rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.app-tile:hover .tile-icon-wrap img {
    transform: scale(1.08);
}

.tile-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.2rem;
    letter-spacing: -0.2px;
}

.tile-sub {
    font-size: 0.78rem;
    color: var(--text-sub);
    margin-bottom: 1.25rem;
    line-height: 1.35;
}

.tile-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-sound {
    background: rgba(245, 158, 11, 0.14);
    color: var(--gold-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.55rem;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    flex-shrink: 0;
}

.btn-sound:hover {
    background: var(--gold-primary);
    color: #0b0d14;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.btn-open {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, var(--gold-primary), var(--amber-glow));
    color: #0b0d14;
    text-decoration: none;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-btn);
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-open:hover {
    filter: brightness(1.12);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

/* Modal Popup Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 12, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Card */
.modal-card {
    background: rgba(18, 24, 38, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    padding: 2rem 1.8rem 1.8rem 1.8rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px rgba(245, 158, 11, 0.15);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-backdrop.active .modal-card {
    transform: scale(1) translateY(0);
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-sub);
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-main);
    transform: rotate(90deg);
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.modal-icon-wrap {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    background: #1e293b;
    flex-shrink: 0;
}

.modal-icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-meta {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold-light);
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.28);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    text-transform: capitalize;
}

/* Modal Body */
.modal-body {
    background: rgba(10, 14, 23, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modal-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-desc {
    font-size: 0.92rem;
    color: var(--text-sub);
    line-height: 1.55;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.modal-btn-sound {
    width: auto;
    flex: 1;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.modal-btn-open {
    flex: 1.5;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

/* Empty State */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--text-sub);
    font-size: 0.9rem;
    display: none;
}

/* Footer */
.app-footer {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.app-footer a {
    color: var(--text-sub);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--gold-light);
}

@media (max-width: 480px) {
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }

    .app-tile {
        padding: 1.1rem 0.75rem;
    }

    .tile-icon-wrap {
        width: 60px;
        height: 60px;
    }

    .tile-title {
        font-size: 1.1rem;
    }

    .modal-card {
        padding: 1.5rem 1.25rem 1.25rem 1.25rem;
    }

    .modal-icon-wrap {
        width: 64px;
        height: 64px;
    }

    .modal-title {
        font-size: 1.35rem;
    }
}
