/* 
   =========================================
   1. VARIABLES (Vintage & Glassmorphism)
   ========================================= 
*/
:root {
    /* LIGHT MODE (Vintage Paper/Sepia Theme) */
    --bg-color: #f4eee0;
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.6);
    --text-primary: #3d3522;
    --text-secondary: #6b5f4a;
    --accent-gold: #c5a059;
    --card-shadow: 0 8px 32px 0 rgba(197, 160, 89, 0.15);
    --bubble-color: 197, 160, 89; /* RGB for p5.js */
    --btn-text: #ffffff;
}

[data-theme="dark"] {
    /* DARK MODE (Midnight Luxury/Vintage Noir) */
    --bg-color: #0d1013;
    --glass-bg: rgba(20, 24, 28, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #e5e0d5;
    --text-secondary: #94a3b8;
    --accent-gold: #d4af37;
    --card-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.6);
    --bubble-color: 212, 175, 55;
    --btn-text: #000000;
}

/* 
   =========================================
   2. RESET & BASE STYLES
   ========================================= 
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background 0.4s ease, color 0.4s ease, transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* 
   =========================================
   3. NAVIGATION (Modern Glass)
   ========================================= 
*/
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    position: sticky;
    top: 15px;
    margin: 0 15px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    z-index: 1000;
    box-shadow: var(--card-shadow);
}

.logo {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 1px;
}

.logo span {
    color: var(--accent-gold);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
}

.icon-btn:hover {
    background: rgba(197, 160, 89, 0.1);
    color: var(--accent-gold);
}

/* 
   =========================================
   4. HERO & SEARCH SECTION
   ========================================= 
*/
.hero {
    text-align: center;
    padding: 40px 10px;
    margin-bottom: 20px;
}

.hero h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.4rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.gold-text {
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(197, 160, 89, 0.2);
}

.search-wrapper {
    display: flex;
    align-items: center;
    padding: 14px 22px;
    max-width: 550px;
    margin: 20px auto;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    box-shadow: var(--card-shadow);
}

.search-wrapper i {
    color: var(--accent-gold);
    margin-right: 15px;
    font-size: 1.1rem;
}

.search-wrapper input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

.search-wrapper input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* 
   =========================================
   5. TOOLS GRID (Mobile-First 2 Columns)
   ========================================= 
*/
.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile as requested */
    gap: 15px;
    padding-bottom: 50px;
}

@media (min-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 25px;
    }
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
}

.glass-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-gold);
}

.card-img-holder {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #000;
}

.card-img-holder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s ease;
}

.glass-card:hover .card-overlay {
    opacity: 1;
}

.play-btn {
    width: 45px;
    height: 45px;
    background: var(--accent-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--btn-text);
    font-size: 1.1rem;
    box-shadow: 0 0 20px var(--accent-gold);
    text-decoration: none;
}

.card-info {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-info h3 {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75%;
}

.share-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.share-btn:hover {
    color: var(--accent-gold);
}

/* 
   =========================================
   6. MODAL & DEVELOPER SETTINGS
   ========================================= 
*/
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: flex-end; /* Bottom sheet behavior for mobile */
}

@media (min-width: 768px) {
    .modal { align-items: center; }
}

.modal-content {
    width: 100%;
    max-width: 450px;
    padding: 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
}

@media (min-width: 768px) {
    .modal-content { border-radius: 25px; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: var(--accent-gold);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
}

.dev-profile {
    text-align: center;
    margin-bottom: 30px;
}

.avatar {
    width: 70px;
    height: 70px;
    background: var(--accent-gold);
    color: var(--btn-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: bold;
    margin: 0 auto 12px;
    font-family: 'Cinzel', serif;
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.4);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(197, 160, 89, 0.15);
    color: var(--accent-gold);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 5px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin-bottom: 12px;
    background: rgba(125, 125, 125, 0.08);
    border-radius: 15px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
}

.setting-item:hover {
    background: rgba(197, 160, 89, 0.12);
    border: 1px solid var(--accent-gold);
}

.setting-item i:first-child {
    width: 25px;
    color: var(--accent-gold);
    font-size: 1.1rem;
}

/* 
   =========================================
   7. PWA TOAST NOTIFICATION
   ========================================= 
*/
.pwa-toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 400px;
    padding: 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
    z-index: 3000;
    border-radius: 20px;
}

.pwa-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-content i {
    font-size: 2.2rem;
    color: var(--accent-gold);
}

.pwa-content strong {
    display: block;
    font-size: 0.95rem;
}

.pwa-content small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.btn-gold {
    background: var(--accent-gold);
    color: var(--btn-text);
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: 10px;
    font-size: 1.1rem;
}

/* 
   =========================================
   8. ANIMATIONS & NO RESULTS
   ========================================= 
*/
.no-results {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.fade-in { animation: fadeIn 0.8s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tilt-in { animation: tiltIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes tiltIn { from { opacity: 0; transform: translateY(100px); } to { opacity: 1; transform: translateY(0); } }

/* 
   =========================================
   9. FOOTER
   ========================================= 
*/
footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}