/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --purple-dark: #1a0033;
    --purple-medium: #4a0080;
    --purple-bright: #8b00ff;
    --purple-light: #b366ff;
    --purple-glow: #d699ff;
    --text-primary: #e0d0ff;
    --text-secondary: #b8a0d8;
    --tile-bg: rgba(74, 0, 128, 0.4);
    --tile-border: #8b00ff;
    --glitch-1: #ff00ff;
    --glitch-2: #00ffff;
}

body {
    font-family: 'Courier New', monospace;
    background-color: var(--purple-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Stardust Background */
.stardust {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(139, 0, 255, 0.8), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 0, 255, 0.6), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(214, 153, 255, 0.9), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 33% 85%, rgba(139, 0, 255, 0.7), transparent),
        radial-gradient(1px 1px at 15% 55%, rgba(0, 255, 255, 0.5), transparent),
        radial-gradient(2px 2px at 70% 25%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1px 1px at 40% 95%, rgba(180, 102, 255, 0.8), transparent),
        radial-gradient(1px 1px at 95% 45%, rgba(255, 0, 255, 0.6), transparent);
    background-size: 300% 300%;
    background-position: 0% 0%;
    animation: stardust-move 60s ease-in-out infinite;
}

.stardust::before {
    content: '✨';
    position: absolute;
    top: 10%;
    left: 15%;
    font-size: 24px;
    animation: float-sparkle 8s ease-in-out infinite, twinkle 2s ease-in-out infinite;
}

.stardust::after {
    content: '⭐';
    position: absolute;
    top: 60%;
    right: 20%;
    font-size: 20px;
    animation: float-sparkle 10s ease-in-out infinite reverse, twinkle 3s ease-in-out infinite;
}

@keyframes stardust-move {
    0%, 100% {
        background-position: 0% 0%;
    }
    25% {
        background-position: 100% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
    75% {
        background-position: 0% 100%;
    }
}

@keyframes float-sparkle {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(20px, -30px) rotate(90deg);
    }
    50% {
        transform: translate(40px, 0) rotate(180deg);
    }
    75% {
        transform: translate(20px, 30px) rotate(270deg);
    }
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Navigation Bar */
.navbar {
    background: linear-gradient(135deg, rgba(26, 0, 51, 0.95), rgba(74, 0, 128, 0.95));
    border-bottom: 3px solid var(--tile-border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(139, 0, 255, 0.6);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--purple-light);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 0.7rem 1.5rem;
    border: 3px solid var(--tile-border);
    background: rgba(139, 0, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    border-radius: 8px;
}

.nav-link:hover {
    background: rgba(139, 0, 255, 0.4);
    box-shadow: 0 0 20px var(--purple-bright);
    transform: translateY(-3px) scale(1.05);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.emoticon-header {
    font-size: 2rem;
    margin: 0.5rem 0;
    animation: bounce-emoticons 2s ease-in-out infinite;
}

@keyframes bounce-emoticons {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.glitch-title {
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--purple-glow);
    position: relative;
    display: inline-block;
    animation: glitch-title 3s infinite;
    margin: 1rem 0;
}

@keyframes glitch-title {
    0%, 90%, 100% {
        transform: translate(0);
    }
    92% {
        transform: translate(-2px, 2px);
    }
    94% {
        transform: translate(2px, -2px);
    }
    96% {
        transform: translate(-2px, -2px);
    }
    98% {
        transform: translate(2px, 2px);
    }
}

.glitch-title::before,
.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-title::before {
    color: var(--glitch-1);
    animation: glitch-before 3s infinite;
    z-index: -1;
}

.glitch-title::after {
    color: var(--glitch-2);
    animation: glitch-after 3s infinite;
    z-index: -2;
}

@keyframes glitch-before {
    0%, 90%, 100% {
        opacity: 0;
        transform: translate(0);
    }
    92% {
        opacity: 0.8;
        transform: translate(-3px, 3px);
    }
    94% {
        opacity: 0;
    }
}

@keyframes glitch-after {
    0%, 90%, 100% {
        opacity: 0;
        transform: translate(0);
    }
    94% {
        opacity: 0.8;
        transform: translate(3px, -3px);
    }
    96% {
        opacity: 0;
    }
}

.glitch-line {
    height: 3px;
    background: linear-gradient(90deg, 
        transparent,
        var(--purple-bright),
        var(--glitch-1),
        var(--purple-bright),
        transparent
    );
    margin: 1.5rem auto;
    max-width: 600px;
    animation: pulse-line 2s ease-in-out infinite;
}

@keyframes pulse-line {
    0%, 100% {
        opacity: 0.5;
        box-shadow: 0 0 5px var(--purple-bright);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 20px var(--purple-bright);
    }
}

/* Glitch Effects */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.glitch:hover::before {
    color: var(--glitch-1);
    animation: glitch-hover-before 0.3s infinite;
}

.glitch:hover::after {
    color: var(--glitch-2);
    animation: glitch-hover-after 0.3s infinite;
}

@keyframes glitch-hover-before {
    0%, 100% {
        opacity: 0;
        transform: translate(0);
    }
    33% {
        opacity: 0.7;
        transform: translate(-2px, 2px);
    }
}

@keyframes glitch-hover-after {
    0%, 100% {
        opacity: 0;
        transform: translate(0);
    }
    66% {
        opacity: 0.7;
        transform: translate(2px, -2px);
    }
}

.glitch-subtle {
    position: relative;
    display: inline-block;
}

.glitch-subtle::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    color: var(--glitch-1);
    opacity: 0;
    animation: glitch-subtle-anim 5s infinite;
}

@keyframes glitch-subtle-anim {
    0%, 95%, 100% {
        opacity: 0;
        transform: translate(0);
    }
    96% {
        opacity: 0.3;
        transform: translate(-1px, 1px);
    }
    98% {
        opacity: 0;
    }
}

/* Tile Grid Layout */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
}

/* Tile Styles */
.tile {
    background: var(--tile-bg);
    border: 3px solid var(--tile-border);
    border-radius: 15px;
    padding: 0;
    box-shadow: 0 0 30px rgba(139, 0, 255, 0.4);
    backdrop-filter: blur(8px);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    animation: tile-float 6s ease-in-out infinite;
}

@keyframes tile-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.tile:nth-child(2n) {
    animation-delay: -3s;
}

.tile:nth-child(3n) {
    animation-delay: -4s;
}

.tile::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 0, 255, 0.1) 0%, transparent 70%);
    animation: tile-glow 4s ease-in-out infinite;
}

@keyframes tile-glow {
    0%, 100% {
        transform: rotate(0deg);
        opacity: 0.5;
    }
    50% {
        transform: rotate(180deg);
        opacity: 1;
    }
}

.tile:hover {
    box-shadow: 0 0 50px rgba(139, 0, 255, 0.8), 0 0 80px rgba(255, 0, 255, 0.4);
    transform: translateY(-10px) scale(1.02);
    border-color: var(--purple-light);
}

.tile-large {
    grid-column: span 2;
}

/* Tile Header */
.tile-header {
    background: linear-gradient(135deg, rgba(74, 0, 128, 0.8), rgba(139, 0, 255, 0.6));
    padding: 1.5rem;
    border-bottom: 2px solid var(--tile-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tile-icon {
    font-size: 2rem;
    animation: icon-spin 10s linear infinite;
}

@keyframes icon-spin {
    0%, 90%, 100% {
        transform: rotate(0deg);
    }
    95% {
        transform: rotate(360deg);
    }
}

.tile-title {
    font-size: 1.5rem;
    color: var(--purple-glow);
    margin: 0;
    flex: 1;
}

/* Tile Content */
.tile-content {
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Info Section */
.info-section p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.info-section strong {
    color: var(--purple-light);
}

.emoji-bullet {
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Guidelines List */
.guidelines-list {
    list-style: none;
    padding-left: 0;
}

.guidelines-list li {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
    padding-left: 0;
}

/* Links */
a {
    color: var(--purple-bright);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

a:hover {
    color: var(--glitch-1);
    text-shadow: 0 0 10px var(--glitch-1);
}

.glitch-link {
    position: relative;
    display: inline-block;
    color: var(--purple-bright);
    text-decoration: underline;
}

.glitch-link:hover {
    animation: link-glitch 0.3s;
}

@keyframes link-glitch {
    0%, 100% {
        transform: translate(0);
    }
    25% {
        transform: translate(-2px, 1px);
    }
    50% {
        transform: translate(2px, -1px);
    }
    75% {
        transform: translate(-1px, -2px);
    }
}

/* Form Box */
.form-box {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(26, 0, 51, 0.6);
    border: 2px solid var(--purple-medium);
    border-radius: 12px;
    box-shadow: inset 0 0 20px rgba(139, 0, 255, 0.2);
}

.form-box h3 {
    margin-bottom: 1rem;
    color: var(--purple-light);
    font-size: 1.3rem;
}

.form-box iframe {
    width: 100%;
    border: 2px solid var(--purple-medium);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

/* Code Box */
.code-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(26, 0, 51, 0.6);
    border: 2px solid var(--purple-medium);
    border-radius: 12px;
}

.code-box h3 {
    margin-bottom: 0.5rem;
    color: var(--purple-light);
    font-size: 1.3rem;
}

.code-note {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.code-block {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--purple-medium);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    position: relative;
}

.code-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        var(--glitch-1),
        var(--glitch-2),
        var(--glitch-1)
    );
    animation: code-scan 3s linear infinite;
}

@keyframes code-scan {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

.code-block code {
    color: var(--purple-glow);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    display: block;
}

/* Credits Tile */
.tile-credits {
    grid-column: span 1;
}

.tile-credits .tile-content p {
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
}

/* Discussion Tile */
.tile-discussion {
    grid-column: 1 / -1;
}

.giscus-container {
    padding: 1rem;
    background: rgba(26, 0, 51, 0.4);
    border-radius: 8px;
    border: 1px solid var(--purple-medium);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    border-top: 3px solid var(--tile-border);
    background: linear-gradient(135deg, rgba(26, 0, 51, 0.9), rgba(74, 0, 128, 0.9));
    position: relative;
    z-index: 2;
}

.footer p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tile-large {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .tile-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .glitch-title {
        font-size: 2.2rem;
    }

    .emoticon-header {
        font-size: 1.5rem;
    }

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

    .tile-icon {
        font-size: 1.5rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-link {
        text-align: center;
        width: 100%;
    }

    .tile-content {
        padding: 1.5rem;
    }

    .form-box iframe {
        height: 400px;
    }

    .tile-large {
        grid-column: span 1;
    }
}

@media (max-width: 480px) {
    .glitch-title {
        font-size: 1.8rem;
    }

    .tile-header {
        padding: 1rem;
    }

    .tile-content {
        padding: 1rem;
    }
}

/* Screen Flicker Effect */
@keyframes flicker {
    0%, 100% {
        opacity: 1;
    }
    41.99% {
        opacity: 1;
    }
    42% {
        opacity: 0.8;
    }
    43% {
        opacity: 1;
    }
    45.99% {
        opacity: 1;
    }
    46% {
        opacity: 0.9;
    }
    46.5% {
        opacity: 1;
    }
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(139, 0, 255, 0.02);
    pointer-events: none;
    animation: flicker 5s infinite;
    z-index: 9999;
}