body {
    background-color: #f5e6c8;
    overflow-x: hidden;
    /* Optimized cursor setting */
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="%233e2723" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5z"></path><line x1="16" y1="8" x2="2" y2="22"></line><line x1="17.5" y1="15" x2="9" y2="15"></line></svg>') 2 29, auto;
}

a, button, .cursor-pointer, input {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="%233e2723" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5z"></path><line x1="16" y1="8" x2="2" y2="22"></line><line x1="17.5" y1="15" x2="9" y2="15"></line></svg>') 2 29, pointer;
}

/* MAGICAL CURSOR FOCUS RING - OPTIMIZED */
#cursor-focus {
    position: fixed;
    pointer-events: none;
    width: 40px;
    height: 40px;
    border: 2px dashed #b8860b;
    border-radius: 50%;
    /* Removed default transform to handle it in JS for performance */
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 9999;
    will-change: transform; /* Performance Hint */
    mix-blend-mode: multiply;
    transition: opacity 0.2s; /* Only animate opacity via CSS */
}
#cursor-focus.active {
    opacity: 1;
    /* Rotate animation handled separately to avoid conflict with movement */
    animation: rotate-ring 4s linear infinite;
}
@keyframes rotate-ring {
    from { transform: translate3d(var(--x), var(--y), 0) translate(-50%, -50%) rotate(0deg); }
    to { transform: translate3d(var(--x), var(--y), 0) translate(-50%, -50%) rotate(360deg); }
}

/* ROYAL BORDER DESIGN */
.royal-scroll {
    position: relative;
    background-color: #fcf5e5;
    border: 1px solid rgba(184, 134, 11, 0.4);
    box-shadow: 0 20px 40px -5px rgba(62, 39, 35, 0.2);
    transform-origin: center top;
}
.royal-scroll::before {
    content: '';
    position: absolute;
    top: 6px; left: 6px; right: 6px; bottom: 6px;
    border: 2px solid #b8860b;
    pointer-events: none;
    z-index: 10;
}

/* PARALLAX FOOTER CONTAINER */
#scroll-knight-container {
    position: fixed; bottom: 0; left: 0;
    width: 100%; height: 100px;
    pointer-events: none; z-index: 50;
    overflow: hidden;
    background: linear-gradient(to top, #fcf5e5 0%, rgba(252, 245, 229, 0) 100%);
}

.bg-layer {
    position: absolute; bottom: 0; left: 0; height: 100%; width: 200%;
    background-repeat: repeat-x; background-position: bottom left;
    will-change: transform;
}

/* SVG BACKGROUNDS - Simplified to Trees/Terrain */
.bg-trees-back {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='%23d4a373' opacity='0.4'%3E%3Cpath d='M50 20 L70 80 H30 Z M20 40 L40 80 H0 Z M80 30 L100 80 H60 Z'/%3E%3C/svg%3E");
    background-size: 150px 80px;
    opacity: 0.5;
}
.bg-trees-front {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='%233e2723' opacity='0.2'%3E%3Cpath d='M10 50 L30 100 H-10 Z M60 40 L90 100 H30 Z M110 60 L130 100 H90 Z'/%3E%3C/svg%3E");
    background-size: 100px 60px;
}

#scroll-knight {
    position: absolute; bottom: 5px; left: 0;
    transition: left 0.1s linear, transform 0.2s;
    filter: drop-shadow(0 4px 2px rgba(0,0,0,0.3));
}
@keyframes bonk-anim {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(0.8) rotate(10deg); }
    100% { transform: translateX(-50%) scale(1); }
}

/* TERMINAL */
.terminal-overlay {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(5px);
    border: 2px solid #b8860b;
    box-shadow: 0 0 20px rgba(184, 134, 11, 0.3);
}
.terminal-text {
    color: #4ade80; font-family: 'Fira Code', monospace;
    text-shadow: 0 0 5px rgba(74, 222, 128, 0.5);
}

/* 3D TILT CARD */
.tilt-card { transform-style: preserve-3d; transform: perspective(1000px); }
.tilt-content { transform: translateZ(20px); }

/* CORNER ORNAMENTS */
.corner-ornament {
    position: absolute; width: 60px; height: 60px;
    pointer-events: none; background-size: contain; background-repeat: no-repeat; opacity: 0.6; z-index: 20;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10,10 L40,10 C30,10 20,20 20,30 L20,90' fill='none' stroke='%23b8860b' stroke-width='2'/%3E%3Cpath d='M10,10 L10,40 C10,30 20,20 30,20 L90,20' fill='none' stroke='%23b8860b' stroke-width='2'/%3E%3Ccircle cx='15' cy='15' r='3' fill='%23b8860b'/%3E%3C/svg%3E");
}

/* Toast Notification */
#guild-toast {
    position: fixed; bottom: 120px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: #1a120b; border: 2px solid #b8860b; color: #fcf5e5;
    padding: 1rem 2rem; border-radius: 0.5rem; opacity: 0; pointer-events: none;
    display: flex; align-items: center; gap: 1rem; z-index: 100;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

/* Ragged Edges */
.torn-edge-top { clip-path: polygon(0% 10px, 2% 0px, 4% 10px, 6% 0px, 8% 10px, 10% 0px, 12% 10px, 14% 0px, 16% 10px, 18% 0px, 20% 10px, 22% 0px, 24% 10px, 26% 0px, 28% 10px, 30% 0px, 32% 10px, 34% 0px, 36% 10px, 38% 0px, 40% 10px, 42% 0px, 44% 10px, 46% 0px, 48% 10px, 50% 0px, 52% 10px, 54% 0px, 56% 10px, 58% 0px, 60% 10px, 62% 0px, 64% 10px, 66% 0px, 68% 10px, 70% 0px, 72% 10px, 74% 0px, 76% 10px, 78% 0px, 80% 10px, 82% 0px, 84% 10px, 86% 0px, 88% 10px, 90% 0px, 92% 10px, 94% 0px, 96% 10px, 98% 0px, 100% 10px, 100% 100%, 0% 100%); }
.torn-edge-bottom { clip-path: polygon(0% 0%, 100% 0%, 100% calc(100% - 10px), 98% 100%, 96% calc(100% - 10px), 94% 100%, 92% calc(100% - 10px), 90% 100%, 88% calc(100% - 10px), 86% 100%, 84% calc(100% - 10px), 82% 100%, 80% calc(100% - 10px), 78% 100%, 76% calc(100% - 10px), 74% 100%, 72% calc(100% - 10px), 70% 100%, 68% calc(100% - 10px), 66% 100%, 64% calc(100% - 10px), 62% 100%, 60% calc(100% - 10px), 58% 100%, 56% calc(100% - 10px), 54% 100%, 52% calc(100% - 10px), 50% 100%, 48% calc(100% - 10px), 46% 100%, 44% calc(100% - 10px), 42% 100%, 40% calc(100% - 10px), 38% 100%, 36% calc(100% - 10px), 34% 100%, 32% calc(100% - 10px), 30% 100%, 28% calc(100% - 10px), 26% 100%, 24% calc(100% - 10px), 22% 100%, 20% calc(100% - 10px), 18% 100%, 16% calc(100% - 10px), 14% 100%, 12% calc(100% - 10px), 10% 100%, 8% calc(100% - 10px), 6% 100%, 4% calc(100% - 10px), 2% 100%, 0% calc(100% - 10px)); }

/* HANGING PHOTOS GALLERY */
.hanging-gallery {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5;
}
.hanging-item {
    position: absolute; top: -20px; transform-origin: top center; animation: sway 6s ease-in-out infinite alternate;
}
.hanging-item .string {
    width: 2px; background-color: #3e2723; margin: 0 auto; position: relative; border-left: 1px dashed rgba(255,255,255,0.3);
}
.hanging-item .string::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 8px; height: 8px;
    background-color: #b8860b; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.photo-frame {
    background-color: #fcf5e5; padding: 8px; border: 4px double #3e2723; box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    transform-origin: center top; position: relative;
}
.photo-frame img {
    width: 100%; height: auto; display: block; sepia: 0.3; border: 1px solid rgba(62, 39, 35, 0.2);
}
.rotate-left { transform: rotate(-2deg); }
.rotate-right { transform: rotate(2deg); }
@keyframes sway {
    0% { transform: rotate(-1.5deg); }
    100% { transform: rotate(1.5deg); }
}

/* --- NEW CREATIVE ELEMENT: THE ROYAL SEAL SOCIAL HUB --- */
.royal-seal-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    width: 80px;
    height: 80px;
}

.wax-seal-btn {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #a02020, #8a1c1c, #5c0a0a);
    border-radius: 45% 55% 40% 60% / 50% 60% 40% 50%; /* Irregular wax shape */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
            0 4px 6px rgba(0,0,0,0.3),
            inset 2px 2px 5px rgba(255,255,255,0.2),
            inset -2px -2px 5px rgba(0,0,0,0.3);
    cursor: pointer;
    position: relative;
    /* Removed rotate from transition to fix usability */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(138, 28, 28, 0.5);
}

.wax-seal-btn::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px dashed rgba(255,255,255,0.1);
    opacity: 0.6;
}

/* The Stamped Icon */
.seal-icon {
    font-size: 32px;
    color: #5c0a0a;
    filter: drop-shadow(1px 1px 0 rgba(255,255,255,0.2));
    transform: rotate(-10deg);
}

.wax-seal-btn:hover {
    transform: scale(1.05); /* Reduced scale, removed rotation to prevent clicking issues */
}

/* The Gold Coins (Social Links) */
.social-coin {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #b8860b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 2px solid #8a6d3b;
    opacity: 0;
    pointer-events: none; /* Initially disabled */
    z-index: -1;
    /* Added transition for smooth hover state without GSAP conflict */
    transition: box-shadow 0.2s, transform 0.2s;
}

.social-coin::after {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px dotted #3e2723;
    border-radius: 50%;
    opacity: 0.5;
}

.coin-icon {
    color: #3e2723;
    font-size: 24px;
    transition: color 0.2s;
}

.social-coin:hover {
    /* No movement on hover to ensure clickability */
    box-shadow: 0 0 15px #ffd700;
}

.social-coin:hover .coin-icon {
    color: #8a1c1c;
}

/* Tooltip for coins */
.coin-tooltip {
    position: absolute;
    right: 70px;
    background: #1a120b;
    color: #ffd700;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Cinzel Decorative', serif;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    white-space: nowrap;
    border: 1px solid #b8860b;
    /* Vertical centering for default side tooltips */
    top: 50%;
    transform: translateY(-50%);
}
.social-coin:hover .coin-tooltip {
    opacity: 1;
}

/* Fix: Move GitHub tooltip (Coin 1) to the top to avoid covering LinkedIn */
.social-coin-1 .coin-tooltip {
    right: auto;
    left: 50%;
    top: -35px;
    transform: translateX(-50%);
}