html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

:root {
    --accent: #ff6600;
    --accent-alt: #ffcc00;
    --green: var(--accent);
    --marathon-green: var(--accent);
    --marathon-orange: #ff6600;
    --bg: #000;
    --bg-surface: #0a0a0a;
    --text: #fff;
    --muted: #888;
    --border: #222;
    --pill-bg: rgba(255,255,255,0.05);
    --glass-bg: rgba(255,255,255,0.08);
    --side-width: 200px;
    --transition: var(--transition);
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    background: #000 !important;
}

#hero-canvas { display: none; }

.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg);
}

.layout-header {
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 0;
    gap: 15px;
    z-index: 10;
}

.layout-body {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: row;
    width: 100%;
}

.hud {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

.hud-controls { 
    display: flex; 
    gap: 12px; 
    flex: 1; 
    justify-content: flex-start;
}

.game-logo {
    font-family: 'Boxing', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent);
    text-shadow: 0 0 15px rgba(255, 102, 0, 0.4);
    text-transform: uppercase;
}

.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    padding: 0 20px;
}

.hud-stats {
    display: flex;
    gap: 20px;
    flex: 1;
    justify-content: flex-end;
}

.hud-btn {
    background: var(--pill-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    font-size: 1.2rem;
    color: var(--text);
    transition: var(--transition);
}

.hud-btn:hover {
    background: var(--glass-bg);
    transform: translateY(-2px);
    color: var(--text);
}

#hint-count {
    position: absolute; bottom: -5px; right: -5px; background: var(--marathon-orange); color: white; font-size: 0.6rem; font-weight: bold; width: 16px; height: 16px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
}

.layout-left, .layout-right {
    width: var(--side-width);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 20px 0;
    background: rgba(0,0,0,0.2);
}

@media (max-width: 1000px) {
    .layout-left, .layout-right { display: none; }
    .hud { padding: 0 15px; }
}

@media (max-width: 600px) {
    .card {
        width: 24vw; 
        height: 24vw;
        max-width: 110px;
        max-height: 110px;
    }
    .card-back {
        font-size: 12vw;
    }
    .game-grid {
        gap: 8px;
    }
    .game-logo {
        font-size: 1.1rem;
    }
    .stat-group .value {
        font-size: 1.1rem;
    }
    .hud-timer {
        font-size: 1.2rem;
        padding: 2px 10px;
    }
    .stat-group {
        gap: 0;
    }
}

.layout-main {
    flex: 1;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
}

.hud-timer {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--pill-bg);
    padding: 4px 16px;
    border-radius: 12px;
    margin-top: 4px;
    color: var(--text);
    border: 1px solid var(--border);
}

.stat-group .label {
    font-family: 'Boxing', sans-serif;
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.2;
}

.stat-group .value {
    font-family: 'Boxing', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}
#grid-area { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
.game-grid { display: grid; gap: 12px; width: fit-content; height: fit-content; }

/* Cards */
.card {
    width: 9vmin; height: 9vmin; max-width: 90px; max-height: 90px; 
    perspective: 1000px;
    cursor: pointer;
    background: transparent;
    border: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-front {
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border: 2px solid var(--border);
    color: var(--accent);
    font-size: 2rem;
    font-weight: bold;
    font-family: 'Outfit', sans-serif;
}

.card-back {
    background: #ffffff;
    color: #000;
    transform: rotateY(180deg);
    font-size: 5vmin;
}

.card.matched .card-back {
    box-shadow: 0 0 20px var(--green);
    background: #f0fff4;
}

@keyframes hintPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 106, 0.8); transform: scale(1); }
    50% { box-shadow: 0 0 30px 10px rgba(0, 255, 106, 0.4); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 106, 0); transform: scale(1); }
}

.hint-pulse {
    animation: hintPulse 1s ease-in-out 2;
    z-index: 100;
}

/* Skins & Tile Art */
.card.skin-default .card-front {
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border: 2px solid var(--border);
    color: var(--accent);
}

.card.skin-bronze .card-front {
    background: radial-gradient(circle at 30% 30%, #cd7f32, #6b4423);
    border: 2px solid #8b4513;
    color: #ffd1a4;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.card.skin-silver .card-front {
    background: linear-gradient(135deg, #e0e0e0, #a0a0a0, #707070);
    border: 2px solid #c0c0c0;
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.card.skin-gold .card-front {
    background: radial-gradient(circle at 50% 50%, #ffd700, #b8860b);
    border: 2px solid #ffaa00;
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,0,0.8);
    animation: goldShimmer 3s infinite alternate;
}

@keyframes goldShimmer {
    from { filter: brightness(1); }
    to { filter: brightness(1.3) contrast(1.1); }
}

.card.skin-marathon .card-front {
    background: #000;
    background-image: 
        linear-gradient(rgba(0,255,106,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,106,0.1) 1px, transparent 1px);
    background-size: 15px 15px;
    border: 2px solid var(--accent);
    color: var(--accent);
    box-shadow: inset 0 0 20px rgba(0,255,106,0.2);
}

.card.skin-diamond .card-front {
    background: linear-gradient(135deg, #b9f2ff, #ffffff, #00d2ff);
    border: 2px solid #fff;
    color: #fff;
    text-shadow: 0 0 20px rgba(255,255,255,0.9);
    animation: diamondShine 4s infinite linear;
}

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

.card.skin-laser .card-front {
    background: #000;
    border: 2px solid #ff00ff;
    color: #ff00ff;
    text-shadow: 0 0 15px #ff00ff;
    box-shadow: inset 0 0 20px rgba(255,0,255,0.4);
}

.layout-footer { grid-area: footer; background: var(--bg-surface); border-top: 1px solid #d2d2d7; display: flex; justify-content: center; align-items: center; }

.overlay-screen { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 0, 0, 0.9); 
    z-index: 100; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    backdrop-filter: blur(10px);
}
.primary-btn { 
    background: var(--accent); 
    color: #000; 
    border: none; 
    padding: 16px 40px; 
    border-radius: 12px; 
    font-weight: 800; 
    cursor: pointer; 
    font-family: 'Kola', sans-serif; 
    letter-spacing: 2px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 20px rgba(0, 255, 106, 0.4);
}
.primary-btn:hover { transform: scale(1.05); box-shadow: 0 0 30px rgba(0, 255, 106, 0.6); }

.secondary-btn { 
    background: transparent; 
    color: #fff; 
    border: 2px solid #fff; 
    padding: 12px 30px; 
    border-radius: 12px; 
    font-weight: 600; 
    cursor: pointer; 
    margin-top: 15px; 
    font-family: 'Kola', sans-serif; 
    transition: all 0.2s;
}
.secondary-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--accent); color: var(--accent); }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 2000; display: flex; justify-content: center; align-items: center; }
.modal.hidden { display: none; }
.modal-glass { 
    background: rgba(15, 15, 20, 0.95); 
    padding: 30px; 
    border-radius: 20px; 
    width: 90%; 
    max-width: 500px; 
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8); 
    border: 1px solid var(--border);
    color: #fff;
    backdrop-filter: blur(15px);
}

.modal-header h2 {
    font-family: 'Kola', sans-serif;
    color: var(--accent);
    letter-spacing: 2px;
}

.close-btn { 
    background: none; 
    border: none; 
    font-size: 2rem; 
    cursor: pointer; 
    color: #fff;
    transition: color 0.2s;
}
.close-btn:hover { color: var(--accent); }

.shop-content { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px; 
    margin: 20px 0; 
    max-height: 50vh; 
    overflow-y: auto; 
    padding-right: 5px;
}

.skin-item { 
    padding: 15px; 
    border-radius: 12px; 
    background: rgba(255,255,255,0.05); 
    text-align: center; 
    cursor: pointer; 
    border: 1px solid var(--border); 
    transition: all 0.2s; 
}
.skin-item:hover { background: rgba(255,255,255,0.1); transform: translateY(-3px); }
.skin-item.equipped { border-color: var(--accent); background: rgba(0,255,106,0.1); }

.skin-preview-container { height: 70px; display: flex; justify-content: center; align-items: center; margin-bottom: 5px; }
.skin-name { font-weight: bold; margin-bottom: 5px; font-size: 0.9rem; }
.skin-cost { color: var(--accent); font-weight: 800; font-size: 0.8rem; }

.toast { position: fixed; bottom: 140px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.8); color: white; padding: 15px 30px; border-radius: 99px; z-index: 5000; transition: opacity 0.3s; pointer-events: none; }

/* Global Utilities */
.hidden { display: none !important; }
