/* ============================================
   DARK FANTASY QUEST — Dungeon Crawler Theme
   ============================================ */

:root {
    /* Core palette */
    --bg-abyss: #0a0a0f;
    --bg-dungeon: #0e0e18;
    --bg-stone: #141422;
    --bg-card: #16162a;
    --bg-card-hover: #1e1e3a;

    /* Accent colors */
    --gold: #d4a017;
    --gold-light: #f0c850;
    --gold-dim: #8b6914;
    --blood: #8b1a1a;
    --blood-light: #c0392b;
    --arcane: #6c3483;
    --arcane-light: #9b59b6;
    --frost: #2e86c1;
    --ember: #e67e22;
    --ember-glow: #f39c12;

    /* Rarity colors */
    --common: #9e9e9e;
    --rare: #3498db;
    --epic: #9b59b6;
    --legendary: #f39c12;

    /* Text */
    --text-primary: #e8dcc8;
    --text-secondary: #a89880;
    --text-dim: #6b5e50;

    /* Borders */
    --border-stone: #2a2a44;
    --border-gold: rgba(212, 160, 23, 0.3);

    /* Fonts */
    --font-title: 'Cinzel Decorative', 'MedievalSharp', serif;
    --font-heading: 'Cinzel', 'MedievalSharp', serif;
    --font-pixel: 'Press Start 2P', monospace;
    --font-body: 'Cinzel', serif;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-dim) var(--bg-abyss);
}

body {
    font-family: var(--font-body);
    background: var(--bg-abyss);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    cursor: default;

    /* Subtle stone texture via gradient with pixel dithering */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(108, 52, 131, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 26, 26, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(212, 160, 23, 0.04) 0%, transparent 40%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.015'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg width='4' height='4' viewBox='0 0 4 4' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h1v1H0zM2 1h1v1H2zM1 2h1v1H1zM3 3h1v1H3z' fill='%23000000' fill-opacity='0.05'/%3E%3C/svg%3E");
    background-attachment: fixed;
    background-size: auto, auto, auto, auto, 4px 4px;
    image-rendering: pixelated;
}

/* ---- AMBIENT LAYERS ---- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 998;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08) 0px,
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.4;
    animation: crtFlicker 0.15s infinite alternate;
}

@keyframes crtFlicker {
    0% { opacity: 0.38; }
    100% { opacity: 0.42; }
}

.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 997;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
}

/* Torch glow effects */
.torch {
    position: fixed;
    width: 300px;
    height: 600px;
    z-index: 1;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: torchFlicker 4s ease-in-out infinite;
}

.torch-left {
    top: 10%;
    left: -100px;
    background: radial-gradient(circle, rgba(230, 126, 34, 0.4), transparent 70%);
    animation-delay: 0s;
}

.torch-right {
    top: 30%;
    right: -100px;
    background: radial-gradient(circle, rgba(230, 126, 34, 0.3), transparent 70%);
    animation-delay: 2s;
}

@keyframes torchFlicker {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    25% { opacity: 0.35; transform: scale(1.05); }
    50% { opacity: 0.2; transform: scale(0.95); }
    75% { opacity: 0.4; transform: scale(1.02); }
}

/* ---- MAIN CONTAINER ---- */
.dungeon {
    position: relative;
    z-index: 10;
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

/* ---- HEADER / GUILD HALL ---- */
.guild-hall {
    text-align: center;
    padding: 50px 20px 40px;
    margin-bottom: 30px;
    position: relative;
}

/* Emblem / Avatar */
.emblem {
    margin: 0 auto 24px;
    width: 110px;
    height: 110px;
    position: relative;
}

.emblem-border {
    width: 100%;
    height: 100%;
    border: 4px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-dungeon);
    overflow: hidden;
    box-shadow:
        0 0 20px rgba(212, 160, 23, 0.4),
        0 0 60px rgba(212, 160, 23, 0.15),
        inset 0 0 20px rgba(212, 160, 23, 0.15),
        inset -3px -3px 0 rgba(0, 0, 0, 0.3),
        inset 3px 3px 0 rgba(212, 160, 23, 0.2);
    animation: emblemPulse 3s ease-in-out infinite;
}

.emblem-border::before,
.emblem-border::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--gold);
    z-index: 10;
    box-shadow: 0 0 10px rgba(212, 160, 23, 0.6);
}

.emblem-border::before {
    top: -2px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.emblem-border::after {
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.emblem-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    image-rendering: auto;
    filter: drop-shadow(0 0 8px rgba(212, 160, 23, 0.5));
}

@keyframes emblemPulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(212, 160, 23, 0.4),
            0 0 60px rgba(212, 160, 23, 0.15),
            inset 0 0 20px rgba(212, 160, 23, 0.15),
            inset -3px -3px 0 rgba(0, 0, 0, 0.3),
            inset 3px 3px 0 rgba(212, 160, 23, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow:
            0 0 30px rgba(212, 160, 23, 0.6),
            0 0 80px rgba(212, 160, 23, 0.25),
            inset 0 0 30px rgba(212, 160, 23, 0.25),
            inset -3px -3px 0 rgba(0, 0, 0, 0.4),
            inset 3px 3px 0 rgba(212, 160, 23, 0.3);
        transform: scale(1.02);
    }
}

/* Title */
.title {
    font-family: var(--font-title);
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    font-weight: 900;
    color: var(--gold-light);
    text-shadow:
        0 0 10px rgba(212, 160, 23, 0.6),
        0 0 30px rgba(212, 160, 23, 0.3),
        0 3px 0 rgba(0, 0, 0, 0.8),
        -2px -2px 0 rgba(0, 0, 0, 0.5);
    letter-spacing: 3px;
    margin-bottom: 12px;
    position: relative;
    filter: drop-shadow(0 0 20px rgba(212, 160, 23, 0.4));
}

/* Glitch effect on title */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    opacity: 0;
}

.glitch::before {
    color: var(--blood-light);
    animation: glitch1 8s infinite;
}

.glitch::after {
    color: var(--arcane-light);
    animation: glitch2 8s infinite;
}

@keyframes glitch1 {
    0%, 92%, 100% { opacity: 0; transform: none; clip-path: none; }
    93% { opacity: 0.8; transform: translateX(-3px); clip-path: inset(20% 0 40% 0); }
    94% { opacity: 0; }
    96% { opacity: 0.6; transform: translateX(2px); clip-path: inset(60% 0 10% 0); }
    97% { opacity: 0; }
}

@keyframes glitch2 {
    0%, 94%, 100% { opacity: 0; transform: none; clip-path: none; }
    95% { opacity: 0.7; transform: translateX(3px); clip-path: inset(10% 0 50% 0); }
    96% { opacity: 0; }
    98% { opacity: 0.5; transform: translateX(-2px); clip-path: inset(40% 0 20% 0); }
    99% { opacity: 0; }
}

.subtitle {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    color: var(--text-secondary);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.8),
        0 0 8px rgba(212, 160, 23, 0.2);
    animation: pixelGlow 3s ease-in-out infinite;
}

@keyframes pixelGlow {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 12px rgba(212, 160, 23, 0.3); }
}

.tagline {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* Social row */
.social-row {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-stone);
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    background: rgba(20, 20, 34, 0.6);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.3),
        inset 2px 2px 0 rgba(255, 255, 255, 0.03);
}

.social-link:hover {
    color: var(--gold-light);
    border-color: var(--gold);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.4),
        inset 2px 2px 0 rgba(212, 160, 23, 0.15),
        0 0 20px rgba(212, 160, 23, 0.4),
        0 4px 0 rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* ---- SECTION HEADERS ---- */
.quest-board {
    margin-bottom: 36px;
    position: relative;
    padding: 4px;
}

/* Pixel corners on sections */
.quest-board::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 4px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 8px 8px;
    border-color: transparent transparent var(--gold-dim) transparent;
    opacity: 0.2;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 8px;
    background: rgba(20, 20, 34, 0.4);
    border: 2px solid rgba(42, 42, 68, 0.6);
    border-left: 4px solid var(--gold-dim);
    border-radius: 0;
    box-shadow:
        inset -1px -1px 0 rgba(0, 0, 0, 0.3),
        inset 1px 1px 0 rgba(255, 255, 255, 0.02);
    position: relative;
}

.section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 4px;
    background: var(--gold);
    box-shadow: 0 0 6px rgba(212, 160, 23, 0.5);
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 4px;
    height: 4px;
    background: var(--gold-dim);
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow:
        0 1px 3px rgba(0,0,0,0.8),
        0 0 10px rgba(212, 160, 23, 0.2),
        -1px -1px 0 rgba(0, 0, 0, 0.5);
    position: relative;
    padding: 0 6px;
}

.rune {
    font-size: 1.2rem;
    color: var(--gold);
    display: flex;
    align-items: center;
}

.rune svg {
    image-rendering: pixelated;
    filter: drop-shadow(0 0 4px rgba(212, 160, 23, 0.4));
}

/* header-line is defined at bottom with pixel pattern */

/* ---- LINK CARDS ---- */
.link-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 2px solid var(--border-stone);
    border-radius: 0;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.4),
        inset 2px 2px 0 rgba(255, 255, 255, 0.03);
    image-rendering: crisp-edges;
}

/* Card rarity left accent (enhanced) */
.link-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--common);
    transition: all 0.3s ease;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.5);
}

.link-card--rare::before { background: var(--rare); }
.link-card--epic::before { background: var(--epic); }
.link-card--legendary::before { background: var(--legendary); }

/* Hover */
.link-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--gold);
    transform: translateX(4px);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.5),
        inset 2px 2px 0 rgba(212, 160, 23, 0.1),
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(212, 160, 23, 0.15),
        0 0 0 1px var(--gold-dim);
}

.link-card:hover::before {
    width: 6px;
    box-shadow:
        inset -1px 0 0 rgba(0, 0, 0, 0.5),
        0 0 15px currentColor;
}

.link-card--rare:hover {
    border-color: rgba(52, 152, 219, 0.4);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.5),
        inset 2px 2px 0 rgba(52, 152, 219, 0.1),
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(52, 152, 219, 0.15),
        0 0 0 1px rgba(52, 152, 219, 0.3);
}

.link-card--epic:hover {
    border-color: rgba(155, 89, 182, 0.4);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.5),
        inset 2px 2px 0 rgba(155, 89, 182, 0.1),
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(155, 89, 182, 0.15),
        0 0 0 1px rgba(155, 89, 182, 0.3);
}

.link-card--legendary:hover {
    border-color: rgba(243, 156, 18, 0.5);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.5),
        inset 2px 2px 0 rgba(243, 156, 18, 0.2),
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 50px rgba(243, 156, 18, 0.25),
        0 0 0 2px rgba(243, 156, 18, 0.4);
}

/* Shine sweep effect */
.card-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.03),
        transparent
    );
    transition: left 0.5s ease;
    pointer-events: none;
}

.link-card:hover .card-shine {
    left: 100%;
}

/* Card icon */
.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 160, 23, 0.06);
    border: 2px solid rgba(212, 160, 23, 0.15);
    border-radius: 0;
    flex-shrink: 0;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    box-shadow:
        inset -1px -1px 0 rgba(0, 0, 0, 0.3),
        inset 1px 1px 0 rgba(212, 160, 23, 0.1);
    position: relative;
}

/* Pixel corners on card icons */
.card-icon::before,
.card-icon::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--gold-dim);
    opacity: 0.3;
}

.card-icon::before {
    top: 0;
    left: 0;
}

.card-icon::after {
    bottom: 0;
    right: 0;
}

.card-icon svg {
    image-rendering: pixelated;
    filter: drop-shadow(0 0 2px rgba(212, 160, 23, 0.2));
    transition: filter 0.3s ease;
}

.link-card:hover .card-icon {
    transform: scale(1.1);
    background: rgba(212, 160, 23, 0.12);
    border-color: rgba(212, 160, 23, 0.4);
    color: var(--gold-light);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.4),
        inset 2px 2px 0 rgba(212, 160, 23, 0.2),
        0 0 10px rgba(212, 160, 23, 0.3);
}

.link-card:hover .card-icon::before,
.link-card:hover .card-icon::after {
    opacity: 0.8;
    background: var(--gold);
}

.link-card:hover .card-icon svg {
    filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.5));
}

.link-card--rare .card-icon { color: var(--rare); background: rgba(52, 152, 219, 0.06); border-color: rgba(52, 152, 219, 0.1); }
.link-card--rare:hover .card-icon { color: var(--rare); background: rgba(52, 152, 219, 0.12); border-color: rgba(52, 152, 219, 0.25); }
.link-card--rare:hover .card-icon svg { filter: drop-shadow(0 0 6px rgba(52, 152, 219, 0.5)); }

.link-card--epic .card-icon { color: var(--epic); background: rgba(155, 89, 182, 0.06); border-color: rgba(155, 89, 182, 0.1); }
.link-card--epic:hover .card-icon { color: var(--epic); background: rgba(155, 89, 182, 0.12); border-color: rgba(155, 89, 182, 0.25); }
.link-card--epic:hover .card-icon svg { filter: drop-shadow(0 0 6px rgba(155, 89, 182, 0.5)); }

.link-card--legendary .card-icon { color: var(--legendary); background: rgba(243, 156, 18, 0.08); border-color: rgba(243, 156, 18, 0.15); }
.link-card--legendary:hover .card-icon { color: var(--gold-light); background: rgba(243, 156, 18, 0.15); border-color: rgba(243, 156, 18, 0.35); }
.link-card--legendary:hover .card-icon svg { filter: drop-shadow(0 0 8px rgba(243, 156, 18, 0.6)); }

/* Card content */
.card-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    transition: color 0.3s ease;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.6),
        -1px -1px 0 rgba(0, 0, 0, 0.3);
}

.link-card:hover .card-title {
    color: var(--gold-light);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(212, 160, 23, 0.5),
        -1px -1px 0 rgba(0, 0, 0, 0.5);
}

.card-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.3px;
    line-height: 1.4;
}

/* Badge */
.card-badge {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    padding: 5px 10px;
    background: linear-gradient(135deg, var(--blood), var(--blood-light));
    color: #fff;
    border-radius: 0;
    letter-spacing: 1px;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    animation: badgePulse 2s ease-in-out infinite;
    border: 2px solid rgba(0, 0, 0, 0.3);
    box-shadow:
        inset -1px -1px 0 rgba(0, 0, 0, 0.5),
        inset 1px 1px 0 rgba(255, 255, 255, 0.2),
        0 2px 0 rgba(0, 0, 0, 0.3);
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow:
            inset -1px -1px 0 rgba(0, 0, 0, 0.5),
            inset 1px 1px 0 rgba(255, 255, 255, 0.2),
            0 2px 0 rgba(0, 0, 0, 0.3),
            0 0 10px rgba(192, 57, 43, 0.4);
    }
    50% {
        box-shadow:
            inset -1px -1px 0 rgba(0, 0, 0, 0.5),
            inset 1px 1px 0 rgba(255, 255, 255, 0.3),
            0 2px 0 rgba(0, 0, 0, 0.3),
            0 0 20px rgba(192, 57, 43, 0.6);
    }
}

/* ---- LEGENDARY CARD SPECIAL (enhanced) ---- */
.link-card--legendary {
    border-color: rgba(243, 156, 18, 0.25);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(243, 156, 18, 0.05) 100%);
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.4),
        inset 2px 2px 0 rgba(243, 156, 18, 0.1),
        0 0 20px rgba(243, 156, 18, 0.1);
    animation: legendaryPulse 3s ease-in-out infinite;
}

@keyframes legendaryPulse {
    0%, 100% {
        box-shadow:
            inset -2px -2px 0 rgba(0, 0, 0, 0.4),
            inset 2px 2px 0 rgba(243, 156, 18, 0.1),
            0 0 20px rgba(243, 156, 18, 0.1);
    }
    50% {
        box-shadow:
            inset -2px -2px 0 rgba(0, 0, 0, 0.4),
            inset 2px 2px 0 rgba(243, 156, 18, 0.15),
            0 0 30px rgba(243, 156, 18, 0.2);
    }
}

.link-card--legendary .card-title {
    color: var(--gold-light);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(243, 156, 18, 0.4);
}

/* ---- FOOTER ---- */
.crypt-footer {
    text-align: center;
    padding: 50px 20px 30px;
    margin-top: 30px;
    border-top: 3px solid var(--border-stone);
    position: relative;
    box-shadow: inset 0 2px 0 rgba(212, 160, 23, 0.1);
}

.crypt-footer::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 6px;
    background: var(--gold-dim);
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}

.footer-rune {
    font-size: 1.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
    color: var(--gold);
    display: inline-flex;
    filter: drop-shadow(0 0 4px rgba(212, 160, 23, 0.3));
    animation: skullFloat 4s ease-in-out infinite;
}

.footer-rune svg {
    image-rendering: pixelated;
}

@keyframes skullFloat {
    0%, 100% { transform: translateY(0px); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 0.6; }
}

.crypt-footer p {
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.pixel-text {
    font-family: var(--font-pixel);
    font-size: 0.4rem !important;
    color: var(--text-dim);
    opacity: 0.5;
    letter-spacing: 2px;
}

/* ---- RPG DECORATIVE CORNERS ---- */
.quest-board {
    position: relative;
    padding: 4px;
}

/* Subtle top border ornament on sections — pixel style */
.quest-board::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background:
        repeating-linear-gradient(
            90deg,
            var(--gold-dim) 0px,
            var(--gold-dim) 4px,
            transparent 4px,
            transparent 8px
        );
    opacity: 0.35;
    image-rendering: pixelated;
}

/* ---- CUSTOM SCROLLBAR (Webkit) ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-abyss);
}

::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* ---- SELECTION ---- */
::selection {
    background: rgba(212, 160, 23, 0.3);
    color: var(--gold-light);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
    .dungeon {
        padding: 20px 14px 40px;
    }

    .guild-hall {
        padding: 30px 10px 30px;
    }

    .emblem {
        width: 90px;
        height: 90px;
    }

    .emblem-img {
        width: 100%;
        height: 100%;
    }

    .link-card {
        padding: 14px 14px;
        gap: 12px;
    }

    .card-icon {
        width: 36px;
        height: 36px;
    }

    .card-icon svg {
        width: 20px;
        height: 20px;
    }

    .card-title {
        font-size: 0.82rem;
    }

    .card-desc {
        font-size: 0.65rem;
    }

    .torch {
        display: none;
    }
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .scanlines, #particles {
        display: none;
    }
}

/* ---- HOVER SOUND INDICATOR (visual) ---- */
.link-card:active {
    transform: translateX(2px) scale(0.995);
    transition-duration: 0.1s;
}

/* ---- PIXEL ART BORDER PATTERNS (enhanced with sparkle) ---- */
.guild-hall::after {
    content: '▪ ▫ ▪ ◆ ▪ ▫ ▪';
    display: block;
    margin-top: 22px;
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--gold-dim);
    letter-spacing: 5px;
    opacity: 0.5;
    animation: pixelShimmer 4s ease-in-out infinite;
    filter: drop-shadow(0 0 2px rgba(212, 160, 23, 0.3));
}

@keyframes pixelShimmer {
    0%, 100% { opacity: 0.4; }
    25% { opacity: 0.7; color: var(--gold); filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.5)); }
    50% { opacity: 0.5; }
    75% { opacity: 0.8; color: var(--gold-light); filter: drop-shadow(0 0 8px rgba(212, 160, 23, 0.6)); }
}

/* ---- PIXEL GRID OVERLAY on body for retro feel (enhanced) ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(212, 160, 23, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 160, 23, 0.015) 1px, transparent 1px);
    background-size: 3px 3px;
    mix-blend-mode: overlay;
    animation: pixelDrift 20s linear infinite;
}

@keyframes pixelDrift {
    0% { background-position: 0 0; }
    100% { background-position: 3px 3px; }
}

/* ---- PIXEL CORNERS on cards (enhanced) ---- */
.link-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    border-top: 3px solid transparent;
    border-right: 3px solid transparent;
    opacity: 0;
    transition: all 0.3s ease;
}

.link-card:hover::after {
    opacity: 1;
    border-top-color: var(--gold);
    border-right-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 160, 23, 0.5);
}

/* ---- Section pixel ornament ---- */
.header-line {
    flex: 1;
    height: 1px;
    background:
        repeating-linear-gradient(
            90deg,
            var(--gold-dim) 0px,
            var(--gold-dim) 3px,
            transparent 3px,
            transparent 6px
        );
    opacity: 0.4;
}
