/* ==========================================================================
   Spac2 Music Center - Dark Audio Studio Theme (TikTok/Mini-App Style UI)
   Mobile First Optimized Design
   Path: /music/css/music.css
   ========================================================================== */

:root {
    --bg-main: #0d0909;
    --bg-gradient: radial-gradient(ellipse at 50% 12%, #222d1d 0%, #131a11 55%, #090d09 100%);
    --bg-header: rgba(18, 24, 16, 0.88);
    --bg-card: rgba(26, 35, 23, 0.75);
    --bg-card-hover: rgba(40, 52, 35, 0.9);
    --bg-glass: rgba(22, 30, 20, 0.85);
    --bg-modal: #101510;

    --border-color: rgba(255, 255, 255, 0.12);
    --border-glow: rgba(245, 158, 11, 0.4);

    --accent-green: #f59e0b;
    --accent-gold: #ffbe0b;
    --accent-crimson: #ff385c;

    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-dim: rgba(255, 255, 255, 0.45);

    --font-heading: 'Outfit', 'Be Vietnam Pro', -apple-system, sans-serif;
    --font-body: 'Be Vietnam Pro', -apple-system, sans-serif;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-squircle: 28px;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    background: #090d09;
    background-image: radial-gradient(circle at 50% 15%, #1d2a19 0%, #11180f 50%, #080c08 100%);
    background-size: 140% 140%;
    animation: ambientGlowMove 12s ease infinite alternate;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-font-smoothing: antialiased;
}

@keyframes ambientGlowMove {
    0% { background-position: 50% 0%; }
    100% { background-position: 50% 35%; }
}

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

/* Main Viewport Container */
.arcade-viewport {
    position: relative;
    z-index: 3;
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 0.85rem 3rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

/* ==========================================================================
   Header Bar Layout
   ========================================================================== */
.arcade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: var(--bg-header);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
    gap: 0.75rem;
}

/* ================= STANDARDIZED BRAND HEADER ================= */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-back {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    color: #ffffff !important;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 18px;
    padding: 0;
    box-sizing: border-box;
}

.btn-back i,
.btn-back svg {
    color: #ffffff !important;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff !important;
    transform: translateX(-2px);
    border-color: rgba(255, 255, 255, 0.45);
}

.btn-back:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.6);
    opacity: 0.85;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.brand-link:hover {
    opacity: 0.92;
}

.brand-logo-card {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
    padding: 3.5px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo-card {
    transform: scale(1.04);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #ffffff;
    letter-spacing: -0.025em;
    line-height: 1;
}

.brand-divider {
    font-size: 14px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    opacity: 0.7;
    user-select: none;
}

.brand-app {
    font-size: 14px;
    font-weight: 600;
    color: #cbd5e1;
    letter-spacing: -0.01em;
    line-height: 1;
}

@media (max-width: 640px) {
    .btn-back {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 16px;
    }

    .brand-logo-card {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        padding: 3px;
    }

    .brand-name {
        font-size: 17px;
    }

    .brand-divider {
        font-size: 13px;
    }

    .brand-app {
        font-size: 13px;
    }
}

/* Sleek Glassmorphic Search Bar Container */
.search-bar-container {
    width: 100%;
    max-width: 320px;
    margin: 0.2rem auto 0.4rem auto;
}

.search-bar-container .search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar-container .search-icon {
    position: absolute;
    left: 14px;
    color: var(--accent-green);
    pointer-events: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.search-bar-container .search-input {
    width: 100%;
    padding: 0.52rem 2.2rem 0.52rem 2.6rem;
    background: rgba(22, 30, 20, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    border-radius: 50px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-body);
    outline: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.search-bar-container .search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.search-bar-container .search-input:focus {
    background: rgba(26, 38, 24, 0.95);
    border-color: var(--accent-green);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.25), inset 0 0 10px rgba(245, 158, 11, 0.1);
    transform: translateY(-1px);
}

.search-bar-container:focus-within .search-icon {
    color: #ffffff;
    transform: scale(1.1);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-ctrl {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-ctrl:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   3D Hero Stage Carousel Showcase (Mobile-First Size Optimization)
   ========================================================================== */
.hero-3d-stage {
    position: relative;
    width: 100%;
    padding: 0.8rem 0 0.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.carousel-nav-btn {
    position: absolute;
    top: 36%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.carousel-nav-btn:active {
    transform: translateY(-50%) scale(0.92);
    background: rgba(255, 255, 255, 0.3);
}

.nav-prev { left: 4px; }
.nav-next { right: 4px; }

.stage-cards-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: pan-y;
}

.stage-card {
    position: absolute;
    border-radius: var(--radius-squircle);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease, filter 0.4s ease;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
    background: #211815;
}

/* Peeking Side Cards */
.card-peek {
    width: 145px;
    height: 145px;
    opacity: 0.5;
    z-index: 2;
    cursor: pointer;
    filter: brightness(0.7);
}

.card-left {
    transform: translateX(-125px) scale(0.82) rotate(-3deg);
}

.card-right {
    transform: translateX(125px) scale(0.82) rotate(3deg);
}

.card-peek:hover, .card-peek:active {
    opacity: 0.8;
    filter: brightness(0.95);
}

/* Center Active Hero Squircle Card */
.card-center {
    width: 195px;
    height: 195px;
    z-index: 6;
    transform: translateX(0) scale(1) rotate(0deg);
    opacity: 1;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 25px rgba(245, 158, 11, 0.25);
    cursor: pointer;
}

.card-center:active {
    transform: scale(0.97);
}

.stage-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Smooth Carousel Slide Animation Keyframes */
.stage-cards-container.slide-left .card-center {
    animation: slideNextCenter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stage-cards-container.slide-right .card-center {
    animation: slidePrevCenter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideNextCenter {
    0% { transform: translateX(40px) scale(0.9) rotate(3deg); opacity: 0.75; }
    100% { transform: translateX(0) scale(1) rotate(0deg); opacity: 1; }
}

@keyframes slidePrevCenter {
    0% { transform: translateX(-40px) scale(0.9) rotate(-3deg); opacity: 0.75; }
    100% { transform: translateX(0) scale(1) rotate(0deg); opacity: 1; }
}

/* Desktop Larger Sizes */
@media (min-width: 650px) {
    .stage-cards-container {
        height: 260px;
    }
    .card-center {
        width: 240px;
        height: 240px;
    }
    .card-peek {
        width: 180px;
        height: 180px;
    }
    .card-left {
        transform: translateX(-155px) scale(0.82) rotate(-4deg);
    }
    .card-right {
        transform: translateX(155px) scale(0.82) rotate(4deg);
    }
}

/* Meta Box & Solid White 'Play' Button */
.hero-meta-box {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 7;
}

.hero-game-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -0.02em;
    margin-bottom: 0.15rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.hero-game-sub {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.hero-btn-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Prominent Pill White 'Play' Button */
.btn-hero-play {
    background: #ffffff;
    color: #0d0909;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 900;
    padding: 11px 52px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn-hero-play:active {
    transform: scale(0.95);
    background: #e0e0e0;
}

.btn-hero-window {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.btn-hero-window:active {
    transform: scale(0.92);
}

/* ==========================================================================
   Music Synth Dock Styles
   ========================================================================== */
.synth-dock {
    width: 100%;
    background: var(--bg-header);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.4rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin: 0.5rem auto;
}

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

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

.dock-title svg {
    color: var(--accent-green);
}

.dock-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: #ffbe0b;
    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: #ffbe0b;
    color: #000;
}

/* ==========================================================================
   Main Apps Section
   ========================================================================== */
.arcade-main-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ==========================================================================
   Squircle Music Grid Layout
   ========================================================================== */
.arcade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 10px;
    margin-top: 0.2rem;
}

@media (min-width: 550px) {
    .arcade-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
}

@media (min-width: 800px) {
    .arcade-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 16px;
    }
}

/* Squircle Game Card Element */
.game-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.game-card-item:active {
    transform: scale(0.94);
}

.game-card-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    overflow: hidden;
    background: #211815;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    transition: all 0.25s ease;
}

/* Special Glowing Rainbow Border Frame (TikTok Effect Style) */
.game-card-item.rainbow-border .game-card-frame {
    padding: 3px;
    background: linear-gradient(135deg, #ff007f, #00f2fe, #4facfe, #00e676, #ff007f);
    background-size: 200% 200%;
    animation: rainbowGlow 4s linear infinite;
    border: none;
}

@keyframes rainbowGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 19px;
    display: block;
    transition: transform 0.25s ease;
}

.game-card-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffffff;
    margin-top: 0.45rem;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    opacity: 0.95;
}

/* Skeleton Loading Card */
.skeleton-card {
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

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

/* Footer */
.arcade-footer {
    text-align: center;
    padding: 1.5rem 0 1rem 0;
    font-size: 0.78rem;
    color: var(--text-dim);
}

.arcade-footer a {
    color: var(--text-muted);
    text-decoration: underline;
}

/* ==========================================================================
   Modals & Detail Popup
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-top {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
}

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

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
}

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

.tag-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.modal-btns {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* No results state */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* SEO Screen Reader Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
