/* miris.quest - RPG Quest Board */

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #2A1B3D;
    --primary: #FFD700;
    --secondary: #7FDBCA;
    --text: #E8DCC8;
    --surface: #3D2B5A;
    --accent: #FF6B6B;
    --border: #C9A96E;
    --surface-dark: #342248;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 14px,
            rgba(61, 43, 90, 0.08) 14px,
            rgba(61, 43, 90, 0.08) 16px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 14px,
            rgba(61, 43, 90, 0.08) 14px,
            rgba(61, 43, 90, 0.08) 16px
        );
    background-size: 16px 16px;
    color: var(--text);
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.6;
    overflow-x: hidden;
    image-rendering: pixelated;
}

/* === NAVIGATION === */
#pixel-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: var(--bg);
    border-bottom: 4px solid var(--border);
    box-shadow:
        0 4px 0 0 var(--surface-dark),
        0 8px 0 0 rgba(42, 27, 61, 0.5);
    padding: 12px 0;
}

#pixel-nav ul {
    display: flex;
    justify-content: center;
    gap: 40px;
    list-style: none;
}

.nav-item {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--text);
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: color 0.2s;
    position: relative;
    padding: 4px 8px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
}

.nav-arrow {
    display: inline-block;
    color: var(--secondary);
    opacity: 0;
    transition: opacity 0.2s;
    animation: bounceArrow 500ms ease-in-out infinite;
}

.nav-item:hover .nav-arrow,
.nav-item.active .nav-arrow {
    opacity: 1;
}

@keyframes bounceArrow {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

/* === HERO SECTION === */
#hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
}

.hero-text-container {
    text-align: center;
}

#hero-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    color: var(--primary);
    letter-spacing: 0.02em;
    margin-bottom: 24px;
    min-height: 32px;
}

#hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: scale(1);
}

#hero-title .char.visible {
    opacity: 1;
    animation: charPop 100ms ease-out forwards;
}

@keyframes charPop {
    0% { transform: scale(1.0); opacity: 0; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1.0); opacity: 1; }
}

.pixel-rule {
    width: 0;
    height: 4px;
    background: var(--border);
    margin: 0 auto 24px auto;
    box-shadow:
        0 4px 0 0 var(--surface-dark);
    transition: width 500ms ease-out;
}

.pixel-rule.drawn {
    width: 300px;
}

#hero-subtitle {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: var(--secondary);
    opacity: 0;
    transition: opacity 400ms ease-in;
    letter-spacing: 0.02em;
}

#hero-subtitle.visible {
    opacity: 1;
}

.subtitle-arrow {
    display: inline-block;
    color: var(--primary);
    animation: bounceArrow 500ms ease-in-out infinite;
}

/* === TORCH === */
.torch-container {
    position: relative;
    width: 64px;
    height: 128px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.torch-svg {
    image-rendering: pixelated;
    opacity: 0;
    transform: scale(0);
    transition: opacity 300ms, transform 300ms ease-out;
}

.torch-svg.ignited {
    opacity: 1;
    transform: scale(2);
}

.torch-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 300ms;
    pointer-events: none;
}

.torch-svg.ignited + .torch-glow {
    opacity: 1;
    animation: glowPulse 1s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

/* Flame animation - 3 frames */
.flame-frame { opacity: 0; }
.flame-frame.flame-1 { animation: flame3frame 600ms steps(1) infinite; }
.flame-frame.flame-2 { animation: flame3frame 600ms steps(1) 200ms infinite; }
.flame-frame.flame-3 { animation: flame3frame 600ms steps(1) 400ms infinite; }

@keyframes flame3frame {
    0%, 33.32% { opacity: 1; }
    33.33%, 100% { opacity: 0; }
}

/* === QUEST BOARD === */
#quest-board {
    padding: 80px 40px 140px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.quest-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* === QUEST CARD === */
.quest-card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-dark) 100%);
    border: 4px solid var(--border);
    box-shadow:
        4px 0 0 0 var(--border),
        -4px 0 0 0 var(--border),
        0 4px 0 0 var(--border),
        0 -4px 0 0 var(--border),
        8px 8px 0 0 rgba(0,0,0,0.3);
    padding: 0;
    position: relative;
    opacity: 0;
    transform: translateY(-20px);
    transition: border-color 0.3s, box-shadow 0.3s;
    image-rendering: pixelated;
}

.quest-card.entered {
    opacity: 1;
    transform: translateY(0);
    animation: bounceEnter 400ms ease-out forwards;
}

@keyframes bounceEnter {
    0% { opacity: 0; transform: translateY(-20px); }
    60% { opacity: 1; transform: translateY(4px); }
    80% { transform: translateY(-2px); }
    100% { opacity: 1; transform: translateY(0); }
}

.quest-card:hover {
    border-color: var(--primary);
    box-shadow:
        4px 0 0 0 var(--primary),
        -4px 0 0 0 var(--primary),
        0 4px 0 0 var(--primary),
        0 -4px 0 0 var(--primary),
        8px 8px 0 0 rgba(0,0,0,0.3);
}

.card-inner {
    padding: 24px;
}

.quest-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: var(--primary);
    letter-spacing: 0.02em;
    margin-bottom: 12px;
    line-height: 1.4;
}

.difficulty-stars {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.pixel-star {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
}

.quest-desc {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 20px;
}

.accept-quest-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--secondary);
    background: transparent;
    border: 2px solid var(--secondary);
    padding: 10px 16px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.2s, color 0.2s;
    position: relative;
}

.accept-quest-btn:hover {
    background: var(--secondary);
    color: var(--bg);
}

.accept-quest-btn .btn-arrow {
    display: inline-block;
    animation: bounceArrow 500ms ease-in-out infinite;
    margin-right: 4px;
}

/* Pixel Sparkle */
.pixel-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    pointer-events: none;
    image-rendering: pixelated;
    animation: sparkleLife 400ms ease-out forwards;
    z-index: 10;
}

@keyframes sparkleLife {
    0% { opacity: 0; transform: scale(0); }
    30% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.5); }
}

/* === STATUS BAR === */
#status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg);
    border-top: 4px solid var(--border);
    box-shadow:
        0 -4px 0 0 var(--surface-dark);
    padding: 12px 24px;
    display: flex;
    justify-content: center;
    gap: 48px;
    z-index: 100;
    transform: translateY(100%);
    transition: transform 400ms ease-out;
}

#status-bar.visible {
    transform: translateY(0);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    image-rendering: pixelated;
}

.status-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--text);
    letter-spacing: 0.02em;
}

.status-value {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--primary);
}

/* === SCREEN FLASH === */
#screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

#screen-flash.flash {
    animation: screenFlash 100ms ease-out forwards;
}

@keyframes screenFlash {
    0% { opacity: 0.3; }
    100% { opacity: 0; }
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .quest-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-content {
        gap: 24px;
    }
    #hero-title {
        font-size: 20px;
    }
}

@media (max-width: 640px) {
    .quest-grid {
        grid-template-columns: 1fr;
    }
    .hero-content {
        flex-direction: column;
        gap: 16px;
    }
    .torch-container {
        display: none;
    }
    #hero-title {
        font-size: 16px;
    }
    #hero-subtitle {
        font-size: 12px;
    }
    #quest-board {
        padding: 40px 16px 140px 16px;
    }
    #pixel-nav ul {
        gap: 16px;
    }
    .nav-item {
        font-size: 8px;
    }
    #status-bar {
        gap: 16px;
        padding: 8px 12px;
    }
    .status-label {
        font-size: 8px;
    }
    .status-value {
        font-size: 8px;
    }
}
