/* ============= CSS VARIABLES ============= */
:root {
    --primary-bg-color: #d2b98b;
    --secondary-bg-color: #a88c5d;
    --card-bg-color: #f5e7ce;
    --card-border-color: #6b4b32;
    --text-color-dark: #3a2e0e;
    --text-color-medium: #5d4c2e;
    --text-color-light: #ffebc6;
    --accent-color: #b39b68;
    --accent-color-dark: #8a784c;
    --cork-color: #a07a5c;
    --pin-red: #c1440e;
    --pin-blue: #3a6ea5;
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --banner-bg: #be9e6c;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --vignette: rgba(0, 0, 0, 0.4);
    --page-gradient-top: #342212;
    --page-gradient-bottom: #be9e6c;
    --button-icon-color: #634b2a;
    --icon-filter: sepia(0.2) saturate(1.5) brightness(1.1);
    --main-font: 'IM Fell English', serif;
    --title-font: 'Cinzel Decorative', cursive;
    --header-font: 'Pirata One', cursive;
    --effects-level: 1;
    --landmark-base-size: clamp(70px, 10vw, 160px);
    --wanted-poster-width: clamp(400px, 90vw, 600px);
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --effects-level: 0.2;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============= GLOBAL & SCROLLBARS ============= */
body,
html {
    margin: 0;
    padding: 0;
    font-family: var(--main-font);
    height: 100%;
    background-color: var(--primary-bg-color);
    color: var(--text-color-dark);
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23654321" stroke-width="2"><circle cx="12" cy="12" r="8" fill="%23f9efd3" stroke="%23654321" stroke-width="2"/></svg>'), auto;
    font-size: 16px;
    transition: all 0.8s ease;
}

/* Custom Cursors */
a,
a *,
button,
button *,
.landmark,
.landmark *,
.dropdown-item,
.gallery-image-container,
.gallery-image-container *,
.filter-button {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="8" fill="%23f9d775" stroke="%23654321" stroke-width="2"/><circle cx="12" cy="12" r="3" fill="%23654321"/></svg>'), pointer;
}

/* Unified Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(107, 75, 50, 0.2);
    border-radius: 6px;
    border: 2px solid rgba(245, 231, 206, 0.5);
}

::-webkit-scrollbar-thumb {
    background-color: #6b4b32;
    border-radius: 6px;
    border: 2px solid #f5e7ce;
    box-shadow: inset 0 0 5px rgba(179, 136, 106, 0.8);
}

::-webkit-scrollbar-thumb:hover {
    background-color: #503c2c;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #6b4b32 rgba(107, 75, 50, 0.2);
}

/* Specific Scrollbar Overrides */
.wanted-poster::-webkit-scrollbar {
    width: 8px;
}

.wanted-poster::-webkit-scrollbar-track {
    background: rgba(245, 231, 206, 0.5);
}

.detail-page::-webkit-scrollbar,
.about-container::-webkit-scrollbar,
#about-page::-webkit-scrollbar {
    width: 12px;
}

/* ============= MAP & LAYOUT ============= */
.container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    perspective: 1000px;
}

.map-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/Bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    will-change: transform;
    transform: translateZ(0);
    background-color: #d2b98b;
    transition: all 0.8s ease;
}

.map-background::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/Bg.png');
    background-size: cover;
    background-position: center;
    filter: blur(3px) saturate(1.5);
    z-index: -1;
}

.webgl-canvas,
#particles-canvas,
.random-materials-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.webgl-canvas {
    z-index: 2;
}

#particles-canvas {
    z-index: 3;
}

.random-materials-background {
    z-index: 0;
    overflow: hidden;
}

#about-page .random-materials-background {
    height: calc(100% + 180px);
}

#research-page .random-materials-background {
    height: calc(100% + 240px);
}

.bg-material {
    position: absolute;
    width: 50%;
    height: 50%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform-origin: center;
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* ============= LANDMARKS & GRID ============= */
.map-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 1fr);
    z-index: 5;
}

.landmark {
    position: relative;
    cursor: pointer;
    text-align: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter:
        drop-shadow(var(--landmark-shadow-x, 0px) var(--landmark-shadow-y, 8px) var(--landmark-shadow-blur, 16px) rgba(0, 0, 0, 0.35))
        brightness(var(--landmark-brightness, 1));
    transform-style: preserve-3d;
    width: var(--landmark-base-size);
    height: var(--landmark-base-size);
    justify-self: center;
    align-self: center;
    transform:
        translate3d(var(--landmark-offset-x, 0px), var(--landmark-offset-y, 0px), 0)
        translateZ(var(--landmark-lift, 0px))
        scale(var(--landmark-scale, 1))
        rotate(var(--landmark-tilt, 0deg));
    touch-action: none;
    user-select: none;
}

.landmark:hover {
    --landmark-scale: 1.15;
    --landmark-lift: 20px;
    filter:
        drop-shadow(var(--landmark-shadow-x, 0px) calc(var(--landmark-shadow-y, 8px) + 3px) calc(var(--landmark-shadow-blur, 16px) + 6px) rgba(0, 0, 0, 0.45))
        brightness(calc(var(--landmark-brightness, 1) + 0.03));
}

.landmark.is-dragging {
    --landmark-scale: 1.11;
    --landmark-lift: 26px;
    z-index: 20;
    transition: none;
    cursor: grabbing;
    filter:
        drop-shadow(var(--landmark-shadow-x, 0px) calc(var(--landmark-shadow-y, 8px) + 10px) calc(var(--landmark-shadow-blur, 16px) + 12px) rgba(0, 0, 0, 0.55))
        brightness(calc(var(--landmark-brightness, 1) + 0.05));
}

.landmark.is-dragging .icon-img,
.landmark.is-dragging .icon-img-games,
.landmark.is-dragging .icon-img-others {
    transition: none;
    animation-play-state: paused;
    filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.85)) brightness(calc(var(--landmark-icon-brightness, 1) + 0.08));
}

.landmark.is-dragging .banner-img {
    animation-play-state: paused;
}

.landmark::before {
    display: none;
}

.landmark:hover::before {
    display: none;
}

.landmark::after,
.compass::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 50%;
    bottom: -15px;
    left: 0;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    transform: translate3d(var(--landmark-shadow-shift-x, 0px), var(--landmark-shadow-shift-y, 0px), 0) scaleX(var(--landmark-shadow-scale, 0.7)) rotateX(60deg);
    filter: blur(6px);
    opacity: var(--landmark-ground-shadow-opacity, 0.55);
    transition: all 0.5s ease;
}

.landmark:hover::after {
    opacity: calc(var(--landmark-ground-shadow-opacity, 0.55) + 0.08);
    transform: translate3d(var(--landmark-shadow-shift-x, 0px), var(--landmark-shadow-shift-y, 0px), 0) scaleX(calc(var(--landmark-shadow-scale, 0.7) + 0.04)) rotateX(60deg);
}

/* Landmark Icons */
.icon-img,
.icon-img-games,
.icon-img-others {
    object-fit: contain;
    transition: transform 0.5s ease, filter 0.5s ease;
    transform: translate3d(var(--landmark-icon-shift-x, 0px), var(--landmark-icon-shift-y, 0px), 0);
    transform-style: preserve-3d;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.8)) brightness(var(--landmark-icon-brightness, 1));
}

.icon-img {
    width: 150%;
    height: 150%;
    margin: -30px;
}

.icon-img-games {
    width: 185%;
    height: 185%;
    margin: -30px;
}

.icon-img-others {
    width: 185%;
    height: 195%;
    margin: -50px;
}

.landmark:hover .icon-img,
.landmark:hover .icon-img-games,
.landmark:hover .icon-img-others {
    transform: translate3d(var(--landmark-icon-shift-x, 0px), calc(var(--landmark-icon-shift-y, 0px) - 10px), 10px);
    filter: drop-shadow(0 15px 15px rgba(215, 186, 126, 0.6)) brightness(calc(var(--landmark-icon-brightness, 1) + 0.06));
}

.about .icon-img {
    animation: float-icon 6s ease-in-out infinite;
}

.research .icon-img {
    animation: float-icon 9s ease-in-out infinite;
}

.games .icon-img-games {
    animation: float-icon 8s ease-in-out infinite;
}

.projects .icon-img-others {
    animation: float-icon 7s ease-in-out infinite;
}

/* Banners */
.banner-container {
    pointer-events: none;
    width: calc(var(--landmark-base-size) * 1.1);
    height: calc(var(--landmark-base-size) * 0.4);
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.25));
    transition: all 0.4s ease;
    transform-style: preserve-3d;
    position: relative;
    justify-self: center;
    align-self: center;
    overflow: visible;
    top: -50px;
    left: 10px;
}

.landmark:hover+.banner-container {
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.3));
    transform: translateZ(5px);
}

.banner-img {
    width: 120%;
    height: auto;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: -10%;
    animation: flag-wave 6s ease-in-out infinite;
    transform-origin: left center;
    transform-style: preserve-3d;
}

/* Grid Placement */
.about {
    grid-column: 3 / span 2;
    grid-row: 6 / span 2;
}

.about-banner {
    grid-column: 3 / span 2;
    grid-row: 6 / span 1;
}

.research {
    grid-column: 5 / span 2;
    grid-row: 3 / span 2;
}

.research-banner {
    grid-column: 5 / span 2;
    grid-row: 5 / span 1;
}

.games {
    grid-column: 8 / span 2;
    grid-row: 4 / span 2;
}

.games-banner {
    grid-column: 8 / span 2;
    grid-row: 5 / span 1;
}

.projects {
    grid-column: 9 / span 2;
    grid-row: 7 / span 2;
}

.projects-banner {
    grid-column: 9 / span 2;
    grid-row: 8 / span 1;
}

.compass {
    grid-column: 10 / span 2;
    grid-row: 10 / span 2;
    cursor: pointer;
    transform-origin: center center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.compass:hover {
    transform: scale(1.15) rotate(10deg);
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

.compass:hover .icon-img {
    transform: translateY(-10px) rotate(-10deg);
    filter: drop-shadow(0 15px 15px rgba(0, 0, 0, 0.3)) brightness(1.1);
}

.compass-banner {
    grid-column: 10 / span 2;
    grid-row: 11 / span 1;
}

/* ============= PAGE & NAVIGATION ============= */
.page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease, visibility 0.8s ease;
    overflow: hidden;
    background-color: var(--primary-bg-color);
    background-image: linear-gradient(to bottom, var(--page-gradient-top, var(--secondary-bg-color)), var(--page-gradient-bottom, var(--primary-bg-color)));
    color: var(--text-color-dark);
    transform: translateY(20px);
    pointer-events: none;
}

.page.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.page.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
    z-index: -1;
    animation: page-reveal 1.5s ease-out forwards;
    pointer-events: auto;
    opacity: calc(var(--effects-level) * 1);
}

.page-title {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%) translateZ(20px);
    font-family: var(--header-font);
    font-size: clamp(1.5rem, 5vw, 3rem);
    color: var(--text-color-light);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7), 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 22;
    background-color: var(--banner-bg);
    padding: 10px clamp(20px, 5vw, 40px);
    border-radius: 8px;
    border: 2px solid var(--card-border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.3);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="150" height="150"><rect width="150" height="150" fill="none" stroke="%23594231" stroke-width="1" stroke-opacity="0.2"/></svg>');
    letter-spacing: 1px;
    transform-style: preserve-3d;
    text-align: center;
    width: fit-content;
    max-width: 80%;
    transition: all 0.8s ease;
}

.page-title::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
    border-radius: 15px;
    z-index: -1;
    animation: pulse-glow 3s ease-in-out infinite;
    opacity: var(--effects-level);
    display: block;
}

.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: clamp(8px, 2vw, 12px) clamp(15px, 3vw, 25px) clamp(8px, 2vw, 12px) clamp(30px, 5vw, 45px);
    background-color: var(--accent-color);
    color: var(--text-color-light);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    z-index: 23;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    font-family: var(--main-font);
    font-size: clamp(0.875rem, 2vw, 1rem);
    transform-style: preserve-3d;
    transform: translateZ(30px);
    background-image: linear-gradient(to bottom, #d7ba7e, #c9a87c);
}

.back-button:before {
    content: '←';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    transition: all 0.3s ease;
}

.back-button:hover {
    background-color: var(--accent-color-dark);
    transform: translateX(-5px) translateZ(35px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 15px 45px rgba(0, 0, 0, 0.3);
    background-image: linear-gradient(to bottom, #e5ca90, #d7ba7e);
}

.back-button:hover:before {
    left: 15px;
}

/* ============= WANTED POSTERS ============= */
.horizontal-scroll {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    box-sizing: border-box;
    perspective: 1000px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    align-items: center;
    justify-content: center;
    padding: clamp(80px, 15vh, 120px) 10% 20px;
    scroll-padding-left: max(5%, 100px);
    scroll-padding-right: max(5%, 100px);
    transition: all 0.5s ease;
}

.horizontal-scroll.poster-focused {
    position: relative;
    overflow: visible;
}

.horizontal-scroll::after {
    content: "";
    padding-right: 5%;
    flex: 0 0 auto;
}

@media (min-width: 1441px) {
    .horizontal-scroll {
        justify-content: flex-start;
    }
}

.wanted-poster {
    scroll-snap-align: center;
    height: auto;
    max-height: 80vh;
    margin: 0 15px;
    position: relative;
    background-color: var(--card-bg-color);
    box-sizing: border-box;
    overflow-y: auto;
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: clamp(300px, 50vw, 700px);
    flex: 0 0 auto;
    border-radius: 5px;
    padding-bottom: 20px;
    padding-top: 25px;
    transition: all 0.8s ease;
}

.horizontal-scroll .wanted-poster:first-child {
    margin-left: 0;
}

.wanted-poster::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"><filter id="grain"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch" seed="0"/><feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.05 0"/></filter><rect width="500" height="500" filter="url(%23grain)"/></svg>');
    background-size: 500px 500px;
    z-index: -1;
    opacity: calc(0.8 * var(--effects-level));
    pointer-events: none;
    mix-blend-mode: multiply;
}

.wanted-poster::after {
    content: '';
    position: absolute;
    bottom: 20%;
    right: 30%;
    width: 100px;
    height: 70px;
    background: radial-gradient(ellipse at center, rgba(139, 69, 19, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    transform: rotate(15deg);
    z-index: -1;
    opacity: calc(0.7 * var(--effects-level));
    pointer-events: none;
}

.wanted-header {
    font-family: var(--header-font);
    font-size: clamp(1.5rem, 5vw, 2.625rem);
    color: var(--text-color-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid rgba(93, 76, 46, 0.3);
    width: 90%;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
    transform: translateZ(10px);
    text-align: center;
    transition: all 0.8s ease;
}

.wanted-reward {
    font-family: var(--title-font);
    font-size: clamp(1.125rem, 3vw, 1.625rem);
    color: var(--text-color-medium);
    font-weight: bold;
    margin-top: 5px;
    margin-bottom: 20px;
    text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.8);
    letter-spacing: 0.5px;
    transform: translateZ(15px);
    text-align: center;
    transition: all 0.8s ease;
}

.wanted-image {
    width: 85%;
    height: clamp(150px, 20vh, 200px);
    margin: 15px 0;
    object-fit: cover;
    border: 5px solid var(--text-color-medium);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 5px 10px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateZ(5px) rotate(calc(var(--random-rotate) * -0.5deg));
    transition: all 0.5s ease;
    filter: sepia(0.3) contrast(1.05);
    position: relative;
}

.wanted-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
}

.wanted-poster:hover .wanted-image {
    transform: translateZ(25px) rotate(calc(var(--random-rotate) * -0.3deg));
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 7px 15px rgba(0, 0, 0, 0.4);
}

.wanted-description {
    font-family: var(--main-font);
    font-size: clamp(0.875rem, 2vw, 1rem);
    line-height: 1.7;
    color: var(--text-color-dark);
    margin: 15px 0;
    text-align: center;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
    transform: translateZ(8px);
    width: 100%;
    padding: 0 5%;
    box-sizing: border-box;
    transition: all 0.8s ease;
}

.wanted-skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 20px 0 10px 0;
    transform: translateZ(12px);
    width: 90%;
}

.skill-tag {
    background-color: rgba(93, 76, 46, 0.15);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    color: var(--text-color-dark);
    font-family: var(--main-font);
    letter-spacing: 0.5px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translateZ(15px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skill-tag:hover {
    background-color: rgba(93, 76, 46, 0.25);
    transform: translateZ(20px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.skill-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: all 0.5s ease;
    display: block;
}

.skill-tag:hover::before {
    left: 100%;
}

/* Pins */
.pin {
    width: clamp(15px, 2vw, 25px);
    height: clamp(15px, 2vw, 25px);
    position: absolute;
    top: 10px;
    border-radius: 50%;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transform: translateZ(30px);
    transition: all 0.8s ease;
}

.pin::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40%;
    height: 40%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.4);
    filter: blur(1px);
}

.pin-red {
    background: var(--pin-red);
    left: 10px;
    top: 5px;
}

.pin-blue {
    background: var(--pin-blue);
    right: 10px;
    top: 5px;
}

/* Interactive Poster Effects */
.wanted-poster.clickable {
    cursor: pointer;
    position: relative;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
    transform-origin: center center;
    overflow: visible;
    backface-visibility: hidden;
    will-change: transform;
}

.wanted-poster.clickable:hover:not(.focused) {
    transform: rotate(calc(var(--random-rotate) * 0.5deg)) translateZ(calc((var(--random-depth) + 50) * 1px)) scale(1.08);
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.7), 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(218, 165, 32, 0.4);
    z-index: 10;
    background-color: rgba(245, 231, 206, 0.95);
}

.wanted-poster-golden-glow,
.wanted-poster.clickable::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    background: linear-gradient(45deg, #d4af37, #f9e076, #c5a028, #e6c86f);
    border-radius: 8px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    filter: blur(10px);
    background-size: 300% 300%;
    animation: gradientBorder 3s ease infinite;
    pointer-events: none;
}

.wanted-poster.clickable:hover:not(.focused)::before,
.wanted-poster.clickable:hover .wanted-poster-golden-glow {
    opacity: 0.8;
}

.wanted-poster.clickable:hover .wanted-description,
.wanted-poster.clickable:hover .wanted-skills,
.wanted-poster.clickable:hover .wanted-reward {
    filter: blur(1px);
    opacity: 0.85;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.wanted-poster.clickable:hover .wanted-header {
    filter: none;
    opacity: 1;
    transform: translateZ(15px);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wanted-poster.clickable:hover .wanted-image {
    filter: blur(2px) sepia(0.4) contrast(1.1);
    transform: translateZ(25px) rotate(calc(var(--random-rotate) * -0.3deg));
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 7px 15px rgba(0, 0, 0, 0.4);
}

/* Disable the magnifying glass icon and 'Click for details' tooltip */
.wanted-poster.clickable .view-details {
    display: none !important;
}

/* Optional: If you want to tone down the hover scale slightly since the icon is gone */
.wanted-poster.clickable:hover:not(.focused) {
    transform: rotate(calc(var(--random-rotate) * 0.5deg)) translateZ(calc((var(--random-depth) + 20) * 1px)) scale(1.05);
}

.wanted-poster.clickable:hover .view-details {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateZ(50px);
    animation: pulse-gold 2.5s infinite ease-in-out;
}

.wanted-poster.clickable .view-details::after {
    content: 'Click for details';
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background-color: rgba(184, 134, 11, 0.85);
    color: #f5e7ce;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: bold;
    font-family: var(--main-font);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wanted-poster.clickable:hover .view-details::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wanted-poster.clickable .corner-fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 40px 40px 0;
    border-color: transparent #d7ba7e transparent transparent;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    opacity: 0.7;
    transform: scale(0.7);
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 5;
}

.wanted-poster.clickable:hover .corner-fold {
    transform: scale(1);
    opacity: 1;
    border-color: transparent #d4af37 transparent transparent;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.3);
}

.wanted-poster.clickable.focused {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg) scale(1.1) !important;
    z-index: 25;
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.9), 0 20px 40px rgba(0, 0, 0, 0.7);
    max-height: 85vh;
    width: clamp(350px, 90vw, 800px);
    background-color: rgba(245, 231, 206, 1);
}

.close-focused {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 40px;
    height: 40px;
    background-color: #6b4b32;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f5e7ce;
    font-size: 24px;
    cursor: pointer;
    z-index: 30;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.wanted-poster.focused .close-focused {
    opacity: 1;
    transform: scale(1);
}

.close-focused:hover {
    background-color: #8a784c;
    transform: scale(1.1);
}

.wanted-poster.focused .wanted-header {
    font-size: clamp(1.8rem, 5vw, 3rem);
}

.wanted-poster.focused .wanted-description {
    font-size: clamp(1rem, 2vw, 1.2rem);
    max-height: none;
    overflow: visible;
}

.wanted-poster.focused .wanted-image {
    height: auto;
    max-height: 30vh;
    filter: none;
}

.wanted-poster.focused .skill-tag {
    transform: translateZ(0);
    padding: 10px 18px;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
}

.wanted-poster.focused .wanted-header,
.wanted-poster.focused .wanted-description,
.wanted-poster.focused .wanted-image,
.wanted-poster.focused .wanted-skills {
    animation: content-appear 0.5s ease forwards;
}

/* ============= DICE & SOCIALS ============= */
.d20-dice-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.d20-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--accent-color);
    border: 2px solid var(--card-border-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color-light);
}

.d20-button:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background-color: var(--accent-color-dark);
}

.d20-button:active {
    transform: scale(0.95);
}

.d20-icon {
    width: 80%;
    height: 80%;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: var(--icon-filter);
}

.d20-button:hover .d20-icon {
    transform: rotate(20deg);
}

.d20-icon.rolling {
    animation: dice-roll 1s ease-out;
}

.dice-result {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background-color: var(--card-bg-color);
    border: 2px solid var(--card-border-color);
    border-radius: 10px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    pointer-events: none;
    color: var(--text-color-dark);
}

.dice-result.show {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

.dice-result-number {
    font-family: var(--title-font);
    font-size: 1.6rem;
    color: var(--text-color-dark);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    font-weight: bold;
}

.dice-result-number.pulse {
    animation: result-pulse 0.5s ease-out;
}

.reset-theme-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f5e7ce;
    border: 2px solid #634b2a;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.reset-theme-button.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.reset-theme-button:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background-color: #e8d9b4;
}

.reset-theme-button svg path {
    fill: var(--button-icon-color);
}

.reset-theme-button:hover svg {
    transform: rotate(180deg);
}

.social-links {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: row;
    gap: 15px;
    z-index: 25;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page.active~.social-links {
    opacity: 0 !important;
    visibility: hidden !important;
}

.social-link {
    width: 40px;
    height: 40px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    color: var(--text-color-dark);
}

.social-link:hover {
    transform: scale(1.15);
    background-color: var(--accent-color);
    color: var(--text-color-light);
}

.social-icon {
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.bannerright-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: var(--icon-filter);
}

/* ============= ABOUT & DETAIL PAGES ============= */
.about-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(20px, 5vw, 60px);
    padding: clamp(40px, 8vw, 100px) clamp(10px, 4vw, 40px) 50px clamp(10px, 4vw, 40px);
    max-width: 1100px;
    margin: auto;
    perspective: 1000px;
    transform-style: preserve-3d;
    min-height: 60vh;
    background: none !important;
    box-shadow: none !important;
}

@media (min-width: 768px) {
    .about-container {
        grid-template-columns: 1fr 1fr;
    }
}

#about-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 80px 0 0;
    box-sizing: border-box;
    overflow-y: auto !important;
}

.about-text {
    display: none !important;
}

/* FIXED: Increased bottom padding for scrolling */
.board-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 36px 32px;
    align-items: flex-start;
    justify-items: center;
    justify-content: center;
    padding-bottom: 0;
    margin-bottom: 20px;
}

.about-paper {
    background: var(--card-bg-color);
    border: 2.5px solid var(--card-border-color);
    border-radius: 12px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.10);
    padding: 32px 28px 28px 28px;
    position: relative;
    min-width: 260px;
    max-width: 420px;
    margin: 0 auto;
    transition: transform 0.25s cubic-bezier(.25, .8, .25, 1), box-shadow 0.25s cubic-bezier(.25, .8, .25, 1);
    z-index: 2;
    will-change: transform, box-shadow;
}

.about-paper:hover {
    transform: translateY(-10px) rotate(-1.5deg) scale(1.025);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.about-paper .pin {
    position: absolute;
    width: 22px;
    height: 22px;
    z-index: 3;
    transition: transform 0.25s;
}

.about-paper:hover .pin {
    transform: scale(1.12);
}

.about-paper .pin-red {
    top: -12px;
    left: -12px;
}

.about-paper .pin-blue {
    top: -12px;
    right: -12px;
}

.about-paper h2,
.about-paper p,
.about-paper ul {
    position: relative;
    z-index: 4;
}

/* Restoring About Page Links */
.about-paper a {
    color: var(--accent-color);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, rgba(215, 186, 126, 0.1), rgba(215, 186, 126, 0.2));
    border: 1px solid rgba(215, 186, 126, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: inline-block;
    font-weight: 600;
}

.about-paper a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(215, 186, 126, 0.2), rgba(215, 186, 126, 0.4));
    transition: width 0.3s ease;
    border-radius: 4px;
    z-index: -1;
}

.about-paper a:hover::before {
    width: 100%;
}

.about-paper a:hover {
    color: var(--text-color-light);
    background: linear-gradient(135deg, rgba(215, 186, 126, 0.3), rgba(215, 186, 126, 0.5));
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(215, 186, 126, 0.3);
}

.about-image {
    max-width: 420px;
    margin: 0 auto 0 auto;
    border-radius: 12px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.10);
    position: relative;
    background: var(--card-bg-color);
    border: 2.5px solid var(--card-border-color);
    padding: 12px;
    z-index: 2;
    transform: rotate(-3deg) translateZ(40px);
    transition: transform 0.25s cubic-bezier(.25, .8, .25, 1);
}

.about-image:hover {
    transform: translateY(-10px) rotate(1.5deg) scale(1.025);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.about-image img {
    width: 100%;
    display: block;
    border-radius: 8px;
}

.about-image .pin {
    position: absolute;
    width: 22px;
    height: 22px;
    z-index: 3;
    transition: transform 0.25s;
}

.about-image:hover .pin {
    transform: scale(1.12);
}

.about-image .pin-red {
    top: -12px;
    left: -12px;
}

.about-image .pin-blue {
    top: -12px;
    right: -12px;
}

.about-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin-top: 18px;
    padding: 0;
    list-style: none;
}

.about-skills li {
    position: relative;
    padding-left: 22px;
    font-family: var(--main-font);
    color: var(--text-color-dark);
    transition: all 0.3s ease;
    min-width: 120px;
}

.about-skills li:hover {
    transform: translateZ(20px);
    color: #2a1e0e;
}

.about-skills li:before {
    content: '➔';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.detail-page {
    overflow-y: auto;
    height: 100%;
    padding-top: 140px;
    padding-bottom: 80px;
}

.detail-content {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    background-color: var(--card-bg-color);
    border-radius: 10px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
    background-color: var(--card-bg-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
    .detail-header {
        flex-direction: row;
        align-items: flex-start;
    }
}

.detail-header-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border: 5px solid var(--text-color-medium);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .detail-header-image {
        margin-right: 30px;
        margin-bottom: 0;
    }
}

.detail-title-container {
    flex-grow: 1;
}

.detail-title {
    font-family: var(--header-font);
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--text-color-dark);
    margin-bottom: 5px;
}

.detail-subtitle {
    font-family: var(--main-font);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--text-color-medium);
    margin-bottom: 20px;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.detail-tag {
    background-color: rgba(93, 76, 46, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-color-dark);
    font-family: var(--main-font);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.detail-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

@media (min-width: 992px) {
    .detail-body {
        grid-template-columns: 3fr 2fr;
    }
}

.detail-description,
.detail-gallery {
    background-color: var(--card-bg-color);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.detail-description h2,
.detail-gallery h2 {
    font-family: var(--header-font);
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--text-color-medium);
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(93, 76, 46, 0.3);
    padding-bottom: 10px;
}

.detail-description p {
    font-family: var(--main-font);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-color-dark);
    margin-bottom: 20px;
}

.detail-description a {
    color: var(--accent-color);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, rgba(215, 186, 126, 0.1), rgba(215, 186, 126, 0.2));
    border: 1px solid rgba(215, 186, 126, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: inline-block;
    font-weight: 600;
}

.detail-description a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(215, 186, 126, 0.2), rgba(215, 186, 126, 0.4));
    transition: width 0.3s ease;
    border-radius: 4px;
    z-index: -1;
}

.detail-description a:hover::before {
    width: 100%;
}

.detail-description a:hover {
    color: var(--text-color-light);
    background: linear-gradient(135deg, rgba(215, 186, 126, 0.3), rgba(215, 186, 126, 0.5));
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(215, 186, 126, 0.3);
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.gallery-image,
.detail-header-image {
    width: 100%;
    height: auto;
    border: 3px solid var(--text-color-medium);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.gallery-image:hover,
.detail-header-image:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color);
}

.gallery-image::after,
.detail-header-image::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-image:hover::after,
.detail-header-image:hover::after {
    opacity: 1;
}

.gallery-image-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.youtube-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 48"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55c-2.93,0.78-4.63,3.26-5.42,6.19C.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="%23f00"/><path d="M 45,24 27,14 27,34" fill="%23fff"/></svg>');
    background-size: cover;
    opacity: 0.9;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.7));
    transition: all 0.3s ease;
}

.gallery-image-container:hover .youtube-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.scroll-indicator {
    position: absolute;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
    background-color: rgba(107, 75, 50, 0.7);
    padding: 8px 16px;
    border-radius: 30px;
    color: #f5e7ce;
    font-family: var(--main-font);
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 22;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    touch-action: none;
}

.scroll-indicator.scrolled {
    opacity: 0;
    visibility: hidden;
}

.scroll-indicator:hover {
    opacity: 1;
    background-color: rgba(107, 75, 50, 0.9);
}

.scroll-indicator .arrow {
    font-size: 20px;
    animation: pulse-arrow 1.5s infinite;
}

.scroll-arrow {
    position: fixed;
    top: 80px;
    bottom: 0;
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 24;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.page.active .scroll-arrow {
    opacity: 0.7;
    pointer-events: auto;
    visibility: visible;
}

.page.active .scroll-arrow:hover {
    opacity: 1;
}

.page:not(.active) .scroll-arrow,
body:not(.detail-page-open) .scroll-arrow {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    display: none;
}

.left-scroll-arrow {
    left: 0;
    background: linear-gradient(to right, rgba(53, 36, 24, 0.5), transparent);
    justify-content: flex-start;
    padding-left: 20px;
}

.right-scroll-arrow {
    right: 0;
    background: linear-gradient(to left, rgba(53, 36, 24, 0.5), transparent);
    justify-content: flex-end;
    padding-right: 20px;
}

.scroll-arrow .arrow-icon {
    width: 50px;
    height: 50px;
    background-color: rgba(179, 136, 106, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    transform: scale(1);
}

.scroll-arrow:hover .arrow-icon {
    transform: scale(1.1);
    background-color: rgba(179, 136, 106, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.scroll-arrow.visible {
    opacity: 0.9;
}

.scroll-arrow svg {
    width: 35px;
    height: 35px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.scroll-arrow .arrow-icon.clicked {
    animation: arrow-click 0.3s forwards;
}

.filter-container {
    position: absolute;
    top: 27px;
    left: 20%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 23;
}

.filter-button {
    background-color: var(--accent-color);
    color: var(--text-color-light);
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: var(--main-font);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.filter-button:hover,
.filter-button.active {
    background-color: var(--accent-color-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding: 40px 32px 24px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    transition: all 0.3s ease;
    box-sizing: border-box;
    text-align: center;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: min(78vw, 1000px);
    max-height: 78vh;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.2);
    animation: zoom 0.6s;
    border-radius: 10px;
}

.video-container {
    position: relative;
    width: 80%;
    max-width: 960px;
    height: 0;
    padding-bottom: 56.25%;
    margin: 0 auto;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.2);
    animation: zoom 0.6s;
}

#modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #f5e7ce;
    padding: 10px 0;
    font-family: var(--main-font);
}

.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: 1px solid rgba(245, 231, 206, 0.65);
    border-radius: 50%;
    background: rgba(58, 46, 14, 0.68);
    color: #f5e7ce;
    font-size: 2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.modal-nav.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-prev {
    left: 28px;
}

.modal-next {
    right: 28px;
}

.modal-nav:hover {
    transform: translateY(-50%) scale(1.08);
    background: rgba(179, 155, 104, 0.88);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f5e7ce;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 1001;
}

.modal-close:hover,
.modal-close:focus {
    color: #d7ba7e;
    text-decoration: none;
    cursor: pointer;
    transform: scale(1.2);
}

body.modal-open {
    overflow: hidden;
}

/* ============= ANIMATIONS ============= */
@keyframes dice-roll {
    0% {
        transform: rotate(0) scale(1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes result-pulse {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes content-appear {
    from {
        opacity: 0.5;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes focus-poster {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.15);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes gradientBorder {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes pulse-smooth {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
    }

    50% {
        transform: translate(-50%, -50%) scale(1.05);
        filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.45));
    }
}

@keyframes pulse-gold {

    0%,
    100% {
        filter: drop-shadow(0 5px 15px rgba(218, 165, 32, 0.3));
    }

    50% {
        filter: drop-shadow(0 5px 25px rgba(218, 165, 32, 0.6));
    }
}

@keyframes flag-wave {

    0%,
    100% {
        transform: perspective(400px) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }

    25% {
        transform: perspective(400px) rotateX(2deg) rotateY(-2deg) rotateZ(1deg);
    }

    50% {
        transform: perspective(400px) rotateX(0deg) rotateY(3deg) rotateZ(0deg);
    }

    75% {
        transform: perspective(400px) rotateX(-2deg) rotateY(1deg) rotateZ(-1deg);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: calc(0.4 * var(--effects-level));
        transform: scale(0.95);
    }

    50% {
        opacity: calc(0.8 * var(--effects-level));
        transform: scale(1.05);
    }
}

@keyframes page-reveal {
    0% {
        opacity: calc(1 * var(--effects-level));
    }

    100% {
        opacity: 0;
    }
}

@keyframes float-icon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-arrow {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.95);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

@keyframes zoom {
    from {
        transform: scale(0.1)
    }

    to {
        transform: scale(1)
    }
}

@keyframes arrow-click {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.85);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes golden-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    }
}

@keyframes shadow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
        filter: brightness(0.7);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
        filter: brightness(0.5);
    }
}

@keyframes dice-particle {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }

    100% {
        transform: translate(var(--x, 50px), var(--y, -50px)) scale(1);
        opacity: 0;
    }
}

/* ============= THEMES ============= */
.light-theme {
    --primary-bg-color: #fff5f9;
    --secondary-bg-color: #f5e7ce;
    --card-bg-color: #fff;
    --card-border-color: #e0b7a4;
    --text-color-dark: #8e4e6f;
    --text-color-medium: #b39b68;
    --text-color-light: #3a2e0e;
    --accent-color: #800080;
    --accent-color-dark: #6a0dad;
    --cork-color: #e0b7a4;
    --pin-red: #e06c75;
    --pin-blue: #5fa8d3;
    --overlay-bg: rgba(255, 255, 255, 0.7);
    --banner-bg: #fff5f9;
    --shadow-color: rgba(200, 100, 100, 0.2);
    --vignette: rgba(200, 100, 100, 0.1);
    --page-gradient-top: #dd7230;
    --page-gradient-bottom: #d21d99;
    --button-icon-color: #800080;
    --icon-filter: hue-rotate(270deg) saturate(2) brightness(1.2);

}

.light-theme body:not(.detail-page-open) .container {
    filter: hue-rotate(320deg) saturate(0.8) brightness(1.05);
}

.light-theme .wanted-poster {
    background-color: #ffeef5 !important;
    border-color: #e78bbf !important;
    filter: none !important;
}

.light-theme .wanted-header {
    color: #8e4e6f !important;
    border-bottom-color: rgba(232, 153, 193, 0.5);
}

.light-theme .wanted-description {
    color: #b66b8d !important;
}

.light-theme .wanted-reward {
    color: #8e4e6f !important;
}

.light-theme .map-background {
    filter: contrast(0.9) saturate(0.8) brightness(1.1) sepia(0.3) hue-rotate(320deg);
}

.light-theme .wanted-image {
    border-color: #ffb1e0;
    filter: contrast(1.05) brightness(1.05) saturate(1.1) sepia(0.2) hue-rotate(320deg);
}

.light-theme .page-title {
    background-color: rgba(232, 153, 193, 0.9);
    border-color: #ffb1e0;
    color: #fff5f9;
}

.light-theme .wanted-skills .skill-tag {
    background-color: rgba(232, 153, 193, 0.2);
    color: #8e4e6f;
    border: 1px solid rgba(232, 153, 193, 0.3);
}

.light-theme .social-link {
    background-color: #ffb1e0;
}

.light-theme .social-link:hover {
    background-color: #e78bbf;
}

.light-theme .horizontal-scroll {
    background-color: rgba(255, 238, 245, 0.3);
}

.light-theme .d20-button,
.light-theme .reset-theme-button {
    background-color: #ffcce8;
    border-color: #e78bbf;
}

.light-theme .dice-particle {
    box-shadow: 0 0 8px rgba(255, 177, 224, 0.7);
}

.light-theme .page.active::after {
    content: '';
    position: fixed;
    top: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ffb1e0" opacity="0.3"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg>');
    background-repeat: no-repeat;
    opacity: 0.5;
    pointer-events: none;
    z-index: 10;
}

.light-theme .page.active::before {
    content: '';
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 100px;
    height: 100px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ffb1e0" opacity="0.3"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg>');
    background-repeat: no-repeat;
    opacity: 0.5;
    pointer-events: none;
    z-index: 10;
    transform: rotate(30deg);
}

.light-theme.critical-hit .wanted-poster {
    box-shadow: 0 0 30px rgba(255, 177, 224, 0.9);
    animation: pink-pulse 2s infinite alternate;
}

@keyframes pink-pulse {
    0% {
        box-shadow: 0 0 20px rgba(255, 177, 224, 0.7);
    }

    100% {
        box-shadow: 0 0 40px rgba(255, 177, 224, 0.9);
    }
}

.dark-theme {
    --primary-bg-color: #1e1c22;
    --secondary-bg-color: #2d2833;
    --card-bg-color: #2d2833;
    --card-border-color: #6b4b32;
    --text-color-dark: #f5e7ce;
    --text-color-medium: #b39b68;
    --text-color-light: #fff;
    --accent-color: #8B0000;
    --accent-color-dark: #6A0000;
    --cork-color: #a07a5c;
    --pin-red: #c1440e;
    --pin-blue: #3a6ea5;
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --banner-bg: #2d2833;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --vignette: rgba(0, 0, 0, 0.4);
    --page-gradient-top: #060417;
    --page-gradient-bottom: #4f0404;
    --button-icon-color: #8B0000;
    --icon-filter: hue-rotate(330deg) saturate(2) brightness(0.8);
}

.dark-theme body:not(.detail-page-open) .container {
    filter: brightness(0.9) contrast(1.1) saturate(0.9);
}

.dark-theme .map-background {
    filter: contrast(1.4) saturate(0.4) brightness(0.5) sepia(0.2) hue-rotate(220deg);
}

.dark-theme .wanted-poster {
    background-color: var(--poster-bg);
    border: 2px solid var(--poster-border);
    box-shadow: 0 15px 35px var(--poster-shadow);
}

.dark-theme .back-button {
    background-color: var(--button-color);
    border: 2px solid var(--button-border);
    color: #1c1510;
}

.dark-theme .pin-red {
    background: radial-gradient(circle at 30% 30%, #a61c1c 30%, #701212 80%);
}

.dark-theme .pin-blue {
    background: radial-gradient(circle at 30% 30%, #1c5fa6 30%, #123e70 80%);
}

.dark-theme .wanted-image {
    border-color: #765c3a;
    filter: contrast(1.2) brightness(0.8) saturate(0.8) sepia(0.2);
}

.dark-theme .page-title {
    background-color: rgba(26, 19, 16, 0.9);
    border-color: #372920;
}

.dark-theme .wanted-header {
    color: #d3c4a8;
    border-bottom-color: rgba(167, 143, 106, 0.3);
}

.dark-theme .wanted-description,
.dark-theme .wanted-skills .skill-tag {
    color: #beb098;
}

.dark-theme .social-link:hover {
    background-color: #5a462d;
}

body,
.map-background,
.wanted-poster,
.back-button,
.pin-red,
.pin-blue,
.wanted-image,
.page-title,
.wanted-header,
.wanted-description,
.wanted-skills .skill-tag,
.social-link {
    transition: all 0.8s ease;
}

.reset-theme-button svg path {
    fill: var(--button-icon-color);
}

.d20-icon,
.bannerright-img {
    filter: var(--icon-filter);
}

.scroll-hint-arrow,
.scroll-fade-hint {
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.critical-success .wanted-poster,
.critical-success-glow {
    animation: golden-pulse 2s infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.critical-failure .wanted-poster,
.critical-failure-shadow {
    animation: shadow-pulse 2s infinite;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
    filter: brightness(0.7);
}

/* About Page Theme Overrides */
.light-theme #about-page,
.light-theme .page#about-page {
    --page-gradient-top: #dd7230;
    --page-gradient-bottom: #d21d99;
    background-color: #fff5f9;
}

.dark-theme #about-page,
.dark-theme .page#about-page {
    --page-gradient-top: #060417;
    --page-gradient-bottom: #4f0404;
    background-color: #2d2833;
}

.about-container,
.light-theme .about-container,
.dark-theme .about-container {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.light-theme .detail-content,
.dark-theme .detail-content {
    background-color: unset !important;
}

.light-theme .about-paper,
.light-theme .about-image {
    background-color: var(--card-bg-color) !important;
    color: var(--text-color-dark) !important;
}

.dark-theme .about-paper,
.dark-theme .about-image {
    background-color: var(--card-bg-color) !important;
    color: var(--text-color-light) !important;
}

.light-theme .wanted-poster,
.dark-theme .wanted-poster {
    background-color: var(--card-bg-color) !important;
}

/* ============= MEDIA QUERIES ============= */
@media print {
    .page {
        display: block !important;
        position: relative;
        overflow: visible;
        background: white;
        transform: none !important;
    }

    .landmark,
    .compass,
    .back-button,
    .dropdown-menu,
    .scroll-indicator,
    .cork-decoration,
    .particles-container,
    .pin,
    .effect-layers {
        display: none !important;
    }

    .wanted-image {
        border: 1px solid #000;
        box-shadow: none;
        filter: none !important;
    }

    .contact-form,
    .about-text,
    .about-image {
        box-shadow: none;
        border: 1px solid #000;
        transform: none !important;
        filter: none !important;
    }

    .horizontal-scroll {
        display: block;
        overflow: visible;
    }
}

@media (min-width: 1441px) {
    :root {
        --effects-level: 1;
    }

    .horizontal-scroll {
        justify-content: flex-start;
    }
}

@media (min-width: 1025px) and (max-width: 1440px) {
    :root {
        --effects-level: 0.9;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --effects-level: 0.8;
    }

    .map-background {
        background-size: cover;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    :root {
        --effects-level: 0.7;
    }

    .page-title {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    :root {
        --effects-level: 0.5;
    }

    .scroll-indicator {
        bottom: 10px;
        padding: 5px 10px;
    }

    .page-title {
        padding: 8px 15px;
        top: 15px;
    }

    .map-content {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(10, 1fr);
    }

    .about {
        grid-column: 1 / span 3;
        grid-row: 3 / span 2;
    }

    .about-banner {
        grid-column: 1 / span 3;
        grid-row: 5 / span 1;
    }

    .research {
        grid-column: 4 / span 3;
        grid-row: 3 / span 2;
    }

    .research-banner {
        grid-column: 4 / span 3;
        grid-row: 5 / span 1;
    }

    .games {
        grid-column: 1 / span 3;
        grid-row: 6 / span 2;
    }

    .games-banner {
        grid-column: 1 / span 3;
        grid-row: 8 / span 1;
    }

    .projects {
        grid-column: 4 / span 3;
        grid-row: 6 / span 2;
    }

    .projects-banner {
        grid-column: 4 / span 3;
        grid-row: 8 / span 1;
    }

    .compass {
        grid-column: 2 / span 4;
        grid-row: 9 / span 2;
    }

    .compass-banner {
        grid-column: 2 / span 4;
        grid-row: 11 / span 1;
    }
}

@media (min-resolution: 192dpi) {

    .map-background,
    .ocean-overlay,
    .parchment-grain,
    .wanted-poster::before {
        background-size: 50%;
    }
}

@media (max-width: 768px) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        transform-style: flat !important;
        will-change: auto !important;
    }

    .landmark,
    .wanted-poster,
    .page-title,
    .about-image,
    .about-paper,
    .social-link {
        filter: none !important;
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15) !important;
        transform: none !important;
    }

    .cursor-highlight,
    .poster-focus-overlay,
    .wanted-poster.clickable .view-details,
    .wanted-poster-golden-glow,
    .wanted-poster .corner-fold,
    .wanted-poster::before,
    .wanted-poster::after,
    .landmark::before,
    .landmark::after,
    #particles-canvas {
        display: none !important;
    }

    .container {
        perspective: none !important;
        overflow: auto;
    }

    /* FIXED: Added row-gap to prevent overlap */
    .map-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: repeat(4, auto) !important;
        align-content: center !important;
        justify-items: center !important;
        padding: 20px 10px !important;
        height: 100vh !important;
        box-sizing: border-box !important;
        gap: 0 !important;
        row-gap: 70px !important;
    }

    .landmark,
    .banner-container {
        grid-column: auto !important;
        grid-row: auto !important;
        position: relative !important;
        justify-self: center !important;
        align-self: center !important;
    }

    .about {
        grid-area: 1 / 1;
    }

    .about-banner {
        grid-area: 2 / 1;
    }

    .research {
        grid-area: 1 / 2;
    }

    .research-banner {
        grid-area: 2 / 2;
    }

    .games {
        grid-area: 3 / 1;
    }

    .games-banner {
        grid-area: 4 / 1;
    }

    .projects {
        grid-area: 3 / 2;
    }

    .projects-banner {
        grid-area: 4 / 2;
    }

    .landmark {
        width: 85px !important;
        height: 85px !important;
    }

    .banner-container {
        width: 95px !important;
        height: 34px !important;
        top: -18px !important;
        left: 0 !important;
        margin-bottom: 3rem;
    }

    .page {
        transform: none !important;
        padding-top: 80px;
        padding-bottom: 20px;
        box-sizing: border-box;
    }

    .page.active {
        display: block !important;
        position: fixed;
        z-index: 100;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .page-title {
        position: fixed;
        top: 15px;
        left: 50%;
        transform: translateX(-50%) !important;
        width: calc(100% - 120px);
        max-width: 300px;
        font-size: 1.5rem !important;
        padding: 8px 15px;
        z-index: 102;
    }

    .back-button {
        position: fixed !important;
        top: 15px !important;
        left: 15px !important;
        z-index: 103 !important;
        padding: 12px !important;
        border-radius: 50% !important;
        width: 44px !important;
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0 !important;
        overflow: hidden !important;
        text-indent: -9999px !important;
        min-width: 44px !important;
        max-width: 44px !important;
    }

    .back-button:before {
        content: '←' !important;
        position: static !important;
        transform: none !important;
        font-size: 20px !important;
        line-height: 1 !important;
        text-indent: 0 !important;
        left: auto !important;
    }

    .horizontal-scroll {
        padding: 0 15px !important;
        gap: 15px;
        justify-content: flex-start !important;
        scroll-snap-type: x mandatory;
    }

    .wanted-poster {
        width: 85vw !important;
        max-width: 320px;
        flex: 0 0 85vw;
        scroll-snap-align: start;
        padding: 20px 10px;
        overflow: hidden;
    }

    .wanted-description {
        height: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .wanted-skills {
        width: 100%;
        padding: 0 5px;
        box-sizing: border-box;
        gap: 6px;
    }

    .skill-tag {
        padding: 5px 8px;
        font-size: 0.7rem;
    }

    .scroll-indicator {
        display: block !important;
        font-size: 0.8rem;
    }

    #about-page {
        padding: 80px 0 40px;
    }

    #about-page .scroll-hint-arrow,
    #about-page .scroll-fade-hint {
        display: none !important;
    }

    .about-container {
        padding: 20px 20px 50px !important;
    }

    .about-paper,
    .about-image {
        max-width: 90vw !important;
    }

    .detail-page {
        padding: 80px 0 20px 0 !important;
    }

    .detail-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 15px !important;
        box-sizing: border-box;
    }

    .detail-header {
        flex-direction: column !important;
    }

    .detail-body {
        grid-template-columns: 1fr !important;
    }

    .d20-dice-container {
        bottom: 15px;
        left: 15px;
        z-index: 50;
    }

    .social-links {
        bottom: 15px;
        right: 15px;
        gap: 10px;
        z-index: 50;
    }

    .social-link {
        width: 36px;
        height: 36px;
    }
}

/* ============= RESEARCH ARCHIVE STYLES ============= */

/* Main Container */
.research-content-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    /* Adjusted top padding: space for Back Button (top:20px) + visual breathing room */
    padding: 100px 5% 40px 5%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    /* Removed custom background/backdrop-filter to match other pages */
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    row-gap: 0;
    column-gap: 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    perspective: 1000px;
    align-content: start;
    padding-bottom: 80px;
}

/* Base style for all academic documents */
.archive-document {
    background-color: var(--card-bg-color);
    border: 1px solid rgba(107, 75, 50, 0.3);
    border-radius: 4px;
    padding: 30px;
    position: relative;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.1),
        0 10px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* 
   Tag Styling - Exact copy of .skill-tag logic 
   Clean hover animation, no cursor change, shine effect
*/
.archive-document .detail-tag {
    display: inline-block;
    background-color: rgba(93, 76, 46, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-color-dark);
    font-family: var(--main-font);
    letter-spacing: 0.5px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translateZ(15px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-right: 8px;
    margin-bottom: 5px;
    vertical-align: middle;
    cursor: default;
    /* Standard cursor, not clickable */
}

.archive-document .detail-tag:hover {
    background-color: rgba(93, 76, 46, 0.25);
    transform: translateZ(20px) scale(1.05);
    /* Slight scale up */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    color: var(--text-color-dark);
}

/* Shine effect */
.archive-document .detail-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: all 0.5s ease;
    display: block;
}

.archive-document .detail-tag:hover::before {
    left: 100%;
}

/* Paper texture overlay */
.archive-document::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.05"/></svg>');
    pointer-events: none;
    z-index: 0;
}

.archive-document:hover {
    transform: translateY(-5px) rotate(0.5deg);
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.2),
        0 5px 10px rgba(107, 75, 50, 0.2);
    z-index: 5;
    background-color: #fdf5e0;
}

/* Category Headers */
.archive-category-header {
    grid-column: 1 / -1;
    font-family: var(--header-font);
    font-size: 2rem;
    color: var(--text-color-light);
    text-align: center;
    margin-top: 50px;
    margin-bottom: 25px;
    padding: 10px 40px;
    background-color: var(--secondary-bg-color);
    background-image: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.2), transparent);
    border: 2px solid var(--card-border-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    width: fit-content;
    justify-self: center;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateZ(20px);
}

.archive-category-header:first-child {
    margin-top: 0;
}

.archive-category-header::before,
.archive-category-header::after {
    content: '❖';
    color: var(--accent-color);
    margin: 0 15px;
    font-size: 1.2rem;
    vertical-align: middle;
}

/* Document Specifics */
.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(107, 75, 50, 0.2);
    padding-bottom: 15px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.doc-title {
    /* Changed from --title-font to --main-font for readability */
    font-family: var(--main-font);
    font-weight: bold;
    /* Added bold for hierarchy */
    font-size: 1.4rem;
    /* Slightly larger */
    color: var(--text-color-dark);
    margin: 0;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-meta {
    font-family: var(--main-font);
    font-size: 0.9rem;
    color: var(--text-color-medium);
    margin-top: 5px;
    font-style: italic;
    font-weight: bold;
}

.doc-body {
    font-family: var(--main-font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color-dark);
    position: relative;
    z-index: 1;
}

.doc-body p {
    margin: 8px 0;
}

/* Wax Seal Decoration */
.wax-seal {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle at 30% 30%, #a61c1c, #701212);
    border-radius: 50%;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: -15px;
    right: -15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--header-font);
    font-size: 1.2rem;
    transform: rotate(15deg);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.wax-seal::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Theme overrides */
.dark-theme .archive-document {
    background-color: #25202b;
    border-color: #4a3b52;
}

.dark-theme .archive-category-header {
    background-color: #1a1a2e;
    color: #f5e7ce;
    border-color: #4a3b52;
}

.dark-theme .doc-title {
    color: #e0d0b0;
}

.dark-theme .doc-body {
    color: #dcdcdc;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .research-content-container {
        padding: 100px 15px 40px 15px;
    }

    .archive-grid {
        grid-template-columns: 1fr;
    }

    .archive-category-header {
        font-size: 1.5rem;
        width: 90%;
        padding: 10px;
    }

    .btn-text {
        display: none;
    }

    .wax-seal {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* ============= INTERACTIVE EFFECTS ============= */

/* Torchlight Effect for Research Page */
.research-content-container {
    /* We add a radial gradient that will be updated by JS */
    background: radial-gradient(circle 600px at var(--cursor-x, 50%) var(--cursor-y, 50%),
            rgba(232, 217, 180, 0.1) 0%,
            rgba(0, 0, 0, 0) 100%);
    transition: background 0.1s ease;
    /* Smooth transition */
}

/* 3D Tilt Effect Classes */
.archive-document {
    /* Prepare for 3D tilt */
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0) rotateY(0) scale(1);
    /* Remove the old transition for transform to make the physics instant/snappy */
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
    will-change: transform;
}

/* When strictly hovering, we might want a lift, but JS will handle the tilt */
.archive-document.is-hovering {
    z-index: 10;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 10px 20px rgba(107, 75, 50, 0.2);
}

/* Inner content pops out in 3D */
.doc-header,
.doc-body,
.wax-seal {
    transform: translateZ(20px);
    /* Pushes text forward */
    transform-style: preserve-3d;
}

/* ============= GLOBAL INTERACTIVE POLISH ============= */

/* 1. Global Torchlight / Vignette Layer */
.global-lighting-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    /* CHANGED: Switched to soft-light for subtle immersion without yellow tint */
    mix-blend-mode: soft-light;
    background: radial-gradient(circle 500px at var(--cursor-x, 50%) var(--cursor-y, 50%),
            rgba(255, 255, 255, 0.1) 0%,
            /* Neutral white light */
            rgba(0, 0, 0, 0.4) 100%
            /* Dark vignette edges */
        );
    transition: opacity 0.5s ease;
    will-change: background;
}

/* 2. Unified 3D Tilt Physics Class */
.interactive-card {
    transform-style: preserve-3d;
    /* SMOOTHER TRANSITIONS: Using cubic-bezier for 'alive' feel */
    transition: transform 0.1s linear, box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}

/* Inner elements pop out */
.interactive-card h2,
.interactive-card img,
.interactive-card .pin,
.interactive-card .skill-tag {
    transform: translateZ(20px);
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 3. About Page Fixes */
.board-layout {
    padding-bottom: 32px !important;
}

@media (max-width: 768px) {
    .modal {
        padding: 72px 16px 24px;
    }

    .modal-content {
        max-width: 88vw;
        max-height: 68vh;
    }

    .modal-nav {
        width: 44px;
        height: 44px;
        font-size: 1.65rem;
    }

    .modal-prev {
        left: 10px;
    }

    .modal-next {
        right: 10px;
    }
}

/* Re-enabling tilt for About items (removed the transform:none override) */
.about-paper.interactive-card,
.about-image.interactive-card {
    /* We allow JS to control transform on hover */
    margin-bottom: 20px;
}

/* 4. Social Links & UI Pop Smoothness */
.social-link {
    /* Springy pop animation */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, color 0.2s ease;
}

.social-link:hover {
    transform: scale(1.2) translateY(-5px);
}

/* 5. Optimization & Mobile */
@media (max-width: 768px) {
    /* ... existing styles ... */

    /* RESEARCH PAGE MOBILE FIXES */
    .research-content-container {
        /* Adjust padding to prevent overflow */
        padding: 110px 15px 30px 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        display: block !important;
        /* Removes centering flex issues */
    }

    .archive-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0 !important;
        margin: 0 !important;
        padding-bottom: 80px !important;
    }

    .archive-document {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        /* Keeps padding inside width */
        transform: none !important;
        /* Disables 3D tilt on mobile which causes overflow */
    }

    /* Fix header width on mobile */
    .archive-category-header {
        width: 100% !important;
        box-sizing: border-box !important;
        font-size: 1.2rem !important;
        margin-top: 30px !important;
    }
}

/* ============= THE GRAND GRIMOIRE (REVAMPED) ============= */

/* 1. Page & Background Layout */
#grimoire-page {
    /* Reset padding because we use a custom sticky header */
    padding-top: 0 !important;
    overflow: hidden !important;
    /* Internal container handles scroll */
    background: var(--primary-bg-color);
    /* Dark leather color behind the book */
}

.grimoire-book-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Create a book spine effect in the center */
    background-color: var(--card-bg-color);
    opacity: 1;
    z-index: 0;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.5);
}

/* Texture overlay for paper feel */
.grimoire-book-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="paper"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23paper)" opacity="0.1"/></svg>');
    opacity: 0.6;
    pointer-events: none;
}

/* 2. Sticky Header */
.grimoire-sticky-header {
    position: absolute;
    /* Using absolute inside fixed page, acts sticky */
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--banner-bg);
    /* Use your map texture or solid color */
    border-bottom: 3px double var(--card-border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    padding: 0 40px;
    position: relative;
    z-index: 2;
}

.grimoire-title {
    position: static !important;
    /* Override default page-title styles */
    transform: none !important;
    margin: 0;
    font-size: 2.5rem !important;
    text-shadow: 2px 2px 0 #000;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.grim-close {
    position: static !important;
    /* Override default back-button styles */
    transform: none !important;
}

/* 3. Main Content Container */
.grimoire-container {
    position: absolute;
    top: 100px;
    /* Below header */
    bottom: 0;
    left: 0;
    width: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 40px 0 100px;
    /* Bottom padding for scroll space */
    z-index: 10;
}

.grimoire-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

/* 4. Chapters */
.grim-chapter {
    margin-bottom: 80px;
    opacity: 0;
    animation: fade-in-up 0.8s ease-out forwards;
}

.grim-chapter:nth-child(1) {
    animation-delay: 0.1s;
}

.grim-chapter:nth-child(2) {
    animation-delay: 0.3s;
}

.grim-chapter:nth-child(3) {
    animation-delay: 0.5s;
}

.chapter-header {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
}

.chapter-header h2 {
    font-family: var(--header-font);
    font-size: 2rem;
    color: var(--text-color-dark);
    /* Dark Ink Color */
    white-space: nowrap;
    margin-right: 20px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.chapter-line {
    height: 2px;
    background: linear-gradient(90deg, var(--card-border-color), transparent);
    width: 100%;
    opacity: 0.5;
}

/* 5. The Grid (Dense) */
.grim-grid {
    display: grid;
    /* This setup fits 3-4 items depending on screen width */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    perspective: 1000px;
    /* Essential for 3D tilt */
}

/* 6. Card Styles (Base) */
.grim-entry {
    position: relative;
    border-radius: 8px;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
    /* Super fast for mouse tracking */
    will-change: transform;
    background: var(--card-bg-color);
    /* Light parchment */
    border: 1px solid var(--card-border-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(160, 130, 90, 0.1);
}

/* Shine Effect Layer */
.grim-shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    border-radius: 8px;
    mix-blend-mode: overlay;
}

/* --- VISUAL ENTRIES (Games) --- */
.visual-entry {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Interactive vs Static */
.visual-entry.clickable {
    cursor: pointer;
    border-bottom: 4px solid var(--accent-color);
    /* Visual cue */
}

.visual-entry.static-entry {
    cursor: default;
    /* filter: grayscale(0.8) opacity(0.8); REMOVED per user request */
    border: 1px dashed var(--text-color-medium);
    background: var(--secondary-bg-color);
}

.visual-entry.static-entry:hover {
    transform: none !important;
    /* No tilt */
}

.grim-img-container {
    height: 160px;
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid var(--card-border-color);
    position: relative;
    background: #000;
}

.grim-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.grim-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.6));
    z-index: 1;
}

.hover-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 16px;
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    font-family: var(--header-font);
    z-index: 5;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.visual-entry.clickable:hover .hover-hint {
    transform: translate(-50%, -50%) scale(1);
}

.visual-entry.clickable:hover img {
    transform: scale(1.1);
}

.grim-content-box {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    transform: translateZ(20px);
    /* 3D pop text */
}

.grim-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--accent-color-dark);
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.grim-title {
    font-family: var(--header-font);
    font-size: 1.4rem;
    margin: 0 0 8px 0;
    color: var(--text-color-dark);
    line-height: 1.1;
}

.grim-desc {
    font-family: var(--main-font);
    font-size: 0.9rem;
    color: var(--text-color-medium);
    margin-bottom: 15px;
    line-height: 1.4;
}

.grim-tags {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.grim-tag {
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    color: #444;
}


/* --- RESEARCH ENTRIES (The Fix) --- */
.research-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    /* Slightly wider */
}

.text-entry {
    background: var(--accent-color);
    border: none;
    padding: 20px;
    position: relative;
    overflow: hidden;
    /* Create a "pinned paper" look */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-left: 4px solid var(--pin-red);
}

.paper-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.5" numOctaves="2"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.05"/></svg>');
    pointer-events: none;
    z-index: 0;
}

.wax-seal-mark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="%238B0000" opacity="0.8"/><circle cx="50" cy="50" r="30" stroke="rgba(0,0,0,0.2)" fill="none" stroke-width="2"/></svg>') no-repeat center;
    opacity: 0.6;
    transform: rotate(20deg);
}

.text-content {
    position: relative;
    z-index: 2;
    transform: translateZ(10px);
}

/* Ensure text is dark and readable */
.grim-title.dark {
    color: var(--text-color-dark);
    font-size: 1.3rem;
}

.grim-role.dark {
    color: var(--accent-color-dark);
}

.grim-desc.dark {
    color: var(--text-color-medium);
    font-style: italic;
}

.grim-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-color-medium);
    border-bottom: 1px solid var(--card-border-color);
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-family: var(--main-font);
}

.dark-theme .text-entry .grim-title.dark,
.dark-theme .text-entry .grim-role.dark,
.dark-theme .text-entry .grim-desc.dark,
.dark-theme .text-entry .grim-meta {
    color: var(--text-color-light);
}

.dark-theme .text-entry .grim-meta {
    border-bottom-color: rgba(255, 255, 255, 0.18);
}

/* 1. Toggle Button */
.grimoire-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 90;
    /* Above map, below modals */
    background: var(--accent-color);
    border: 2px solid var(--card-border-color);
    border-radius: 4px;
    /* Squared off like a book */
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: var(--header-font);
    font-size: 1.1rem;
    color: var(--text-color-light);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.grimoire-btn:hover {
    transform: translateY(-2px);
    background: var(--accent-color-dark);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.btn-icon {
    font-size: 1.4rem;
}


/* --- ANIMATIONS --- */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    .grimoire-title {
        font-size: 1.5rem !important;
    }

    .grim-close {
        padding: 5px 15px !important;
        width: auto !important;
        height: auto !important;
        border-radius: 4px !important;
        text-indent: 0 !important;
        font-size: 0.9rem !important;
    }

    .grim-close:before {
        display: none !important;
    }

    .grim-grid {
        grid-template-columns: 1fr;
        /* Single column on mobile */
    }

    .grimoire-container {
        padding: 20px 0 120px;
        width: 100%;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }

    .header-content {
        padding: 0 15px;
    }

    /* Disable Tilt on Mobile for performance */
    .grim-entry {
        transform: none !important;
    }

    .grimoire-btn {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
        top: 20px;
        bottom: auto;
        right: 20px;
    }

    .btn-text {
        display: none;
    }
}

/* ============= GRIMOIRE THEME OVERRIDES ============= */
/* Light theme override removed */

/* Dark theme override removed */

/* FIX: Ensure Grimoire content is visible on mobile where animations are disabled */
@media (max-width: 768px) {
    .grim-chapter {
        opacity: 1 !important;
        animation: none !important;
        transform: none !important;
        visibility: visible !important;
        display: block !important;
    }
}

/* Parchment Background Style */
.parchment-bg {
    background-color: var(--card-bg-color);
    position: relative;
    overflow: hidden;
}

.parchment-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"><filter id="grain"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch" seed="0"/><feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.05 0"/></filter><rect width="500" height="500" filter="url(%23grain)"/></svg>');
    background-size: 500px 500px;
    z-index: 0;
    opacity: calc(0.8 * var(--effects-level));
    pointer-events: none;
    mix-blend-mode: multiply;
}
