:root {
    --bg-color: #f8f5ef;
    --text-color: #111;
    --accent-color: #ff2d55;
    --accent-yellow: #ffe600;
    --accent-lime: #c6ff1a;
    --accent-purple: #7b5cff;
    --panel-saw: #ffe600;
    --panel-came: #ff8a3d;
    --panel-conquered: #c6ff1a;
    --panel-bg: #fff;
    --shadow-color: #111;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 1200px;
    width: 100%;
    padding: 2rem;
    text-align: center;
}

header {
    margin-bottom: 3rem;
}

header .header-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

header .header-top h1 {
    grid-column: 2;
    margin-bottom: 0;
}

.header-spacer {
    grid-column: 1;
}

.header-icons {
    grid-column: 3;
    justify-self: end;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.header-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #111;
    border-radius: 12px;
    background: #fff;
    box-shadow: 6px 6px 0 var(--shadow-color);
    padding: 6px;
    text-decoration: none;
    color: inherit;
    transform: translateZ(0);
}

.header-icon svg,
.header-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.header-icon img {
    object-fit: contain;
}

.header-icon:hover {
    transform: translate(1px, 1px);
    box-shadow: 5px 5px 0 var(--shadow-color);
}

.header-icon:active {
    transform: translate(2px, 2px);
    box-shadow: 4px 4px 0 var(--shadow-color);
}

header h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 var(--accent-purple);
}

header p {
    color: #111;
    font-weight: 600;
}

.meme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.meme-panel {
    background: var(--panel-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 4px solid #111;
    box-shadow: 8px 8px 0 var(--shadow-color);
    position: relative;
}

.panel-saw {
    background: var(--panel-saw);
}

.panel-came {
    background: var(--panel-came);
}

.panel-conquered {
    background: var(--panel-conquered);
}

.image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fff;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 4px;
    border: 4px solid #111;
}

.image-container img {
    cursor: zoom-in;
}

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

.placeholder {
    color: #111;
    font-weight: bold;
    font-size: 1.5rem;
}

.status {
    margin-top: 1rem;
    min-height: 1.5rem;
    color: #111;
    font-weight: 600;
}

h2 {
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.conquer-btn {
    background-color: var(--accent-color);
    color: #111;
    border: 4px solid #111;
    padding: 1.1rem 3.5rem;
    font-size: 1.7rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 6px 6px 0 var(--shadow-color);
    transition: transform 0.1s, filter 0.2s, box-shadow 0.1s;
    animation: cta-bounce 2.6s ease-in-out infinite;
}

.label {
    margin-right: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.select {
    background-color: var(--accent-yellow);
    color: #111;
    border: 4px solid #111;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 4px;
    margin-right: 1rem;
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.link {
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 2px;
}

.link:hover {
    filter: brightness(1.1);
}

.conquer-btn:hover {
    filter: brightness(1.1);
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0 var(--shadow-color);
    animation-play-state: paused;
}

.conquer-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--shadow-color);
}

.conquer-btn:disabled {
    background-color: #ddd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    animation: none;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 3px solid #111;
    background: #fff;
    color: #111;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 800;
    box-shadow: 3px 3px 0 var(--shadow-color);
}

.download-btn {
    background: var(--accent-yellow);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.icon-btn span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.icon-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    box-shadow: none;
}

.download-row {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.download-row .ghost-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.ghost-btn {
    background-color: var(--accent-lime);
    color: #111;
    border: 4px solid #111;
    padding: 0.75rem 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.ghost-btn.disabled,
.ghost-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.ghost-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--shadow-color);
}

.gallery {
    margin-top: 3rem;
    padding: 1.5rem;
    border: 4px solid #111;
    background: var(--panel-bg);
    box-shadow: 8px 8px 0 var(--shadow-color);
    border-radius: 8px;
}

.gallery-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.gallery-card {
    background: #fff;
    border: 4px solid #111;
    border-radius: 8px;
    box-shadow: 6px 6px 0 var(--shadow-color);
    padding: 1rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.thumb-link {
    display: block;
    text-decoration: none;
    background: transparent;
    border: none;
    padding: 0;
    cursor: zoom-in;
    font: inherit;
    line-height: 0;
}

.thumb-link:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.gallery-thumbs img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border: 3px solid #111;
    border-radius: 4px;
    display: block;
}

.gallery-meta {
    font-weight: 700;
}

.gallery-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background: var(--accent-purple);
    color: #fff;
    border: 3px solid #111;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
}

.download-link {
    text-decoration: none;
    padding: 0.35rem 0.45rem;
    border: 3px solid #111;
    background: var(--accent-yellow);
    color: #111;
    font-weight: 800;
    border-radius: 6px;
}

.image-container.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.05),
        rgba(0, 0, 0, 0.05) 10px,
        rgba(255, 230, 0, 0.35) 10px,
        rgba(255, 230, 0, 0.35) 20px
    );
    animation: shimmer 1s linear infinite;
}

.image-container {
    position: relative;
}

.pop {
    animation: pop 0.3s ease;
}

@keyframes shimmer {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 80px 0;
    }
}

@keyframes pop {
    from {
        transform: scale(0.96);
    }
    to {
        transform: scale(1);
    }
}

@keyframes cta-bounce {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-3px, -3px);
    }
}

.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 15, 0.85);
    z-index: 1000;
    padding: 2rem;
}

.lightbox.is-open {
    display: flex;
}

.lightbox-content {
    max-width: min(92vw, 1080px);
    max-height: 90vh;
    background: #fff;
    border: 4px solid #111;
    box-shadow: 10px 10px 0 var(--shadow-color);
    border-radius: 8px;
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
    justify-items: center;
}

.lightbox-img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border: 4px solid #111;
    background: #fff;
}

.lightbox-title {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--accent-yellow);
    color: #111;
    border: 4px solid #111;
    font-weight: 800;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.no-scroll {
    overflow: hidden;
}

.audio-player {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 4px solid #111;
    box-shadow: 6px 6px 0 var(--shadow-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    z-index: 900;
}

.audio-bars {
    display: inline-flex;
    gap: 0.25rem;
    align-items: flex-end;
    height: 20px;
}

.audio-bars span {
    width: 4px;
    height: 6px;
    background: #111;
    border-radius: 2px;
    animation: audio-bar 0.9s ease-in-out infinite;
    animation-play-state: paused;
}

.audio-bars span:nth-child(2) {
    animation-delay: 0.1s;
}

.audio-bars span:nth-child(3) {
    animation-delay: 0.2s;
}

.audio-bars span:nth-child(4) {
    animation-delay: 0.3s;
}

.audio-player.is-playing .audio-bars span {
    animation-play-state: running;
}

@keyframes audio-bar {
    0%, 100% {
        height: 6px;
    }
    50% {
        height: 18px;
    }
}

.audio-toggle {
    border: 3px solid #111;
    background: var(--accent-purple);
    color: #fff;
    font-weight: 800;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--shadow-color);
}

.audio-info {
    text-align: left;
}

.audio-title {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.audio-status {
    font-size: 0.75rem;
    color: #333;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .meme-grid {
        grid-template-columns: 1fr;
    }

    .audio-player {
        left: 1rem;
        right: 1rem;
        justify-content: space-between;
    }
}

@media (max-width: 980px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    header .header-top {
        grid-template-columns: auto 1fr auto;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    header .header-top h1 {
        font-size: 2.1rem;
        letter-spacing: 1px;
    }

    .header-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        box-shadow: 5px 5px 0 var(--shadow-color);
        padding: 5px;
    }
}

@media (max-width: 380px) {
    header .header-top h1 {
        font-size: 1.85rem;
    }

    .header-icon {
        width: 36px;
        height: 36px;
        padding: 4px;
    }
}
