/* ==========================================================================
   OPTIMIZED COZY VARIABLES
   ========================================================================== */
:root {
    /* Safe CSS Colors */
    --bg-parchment: #FDF6E3;
    --bg-parchment-dark: #EADCB9;
    --wood-dark: #4A3320;
    --wood-base: #704A32;
    --wood-light: #9C6A48;
    
    /* Text */
    --text-main: #3E2723;
    --text-muted: #8C7A6B;
    --text-light: #FFFBF2;
    
    /* Accents */
    --color-accent: #E07A5F; 
    --color-gold: #FBC02D;
    --color-green: #81B29A;
    
    /* Fonts */
    --font-ui: 'Fredoka', sans-serif;
    --font-body: 'Nunito', sans-serif;
    --font-pixel: 'VT323', monospace;
    
    /* Geometry */
    --radius-md: 8px;
    --radius-lg: 16px;
    --shadow-soft: 0 8px 24px rgba(0,0,0,0.15);
    --shadow-text: 1px 1px 2px rgba(0,0,0,0.8);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* Custom Cursor */
body, a, button, input, textarea, .interactive-element {
    cursor: url('Icon_Cursor_03a.png'), auto !important;
}

body {
    font-family: var(--font-body);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Flexbox layout to push footer to bottom */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1; /* Pushes footer down */
}

.pixel-art { image-rendering: pixelated; }

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--wood-dark); }
::-webkit-scrollbar-thumb { background: var(--wood-light); border: 2px solid var(--wood-dark); border-radius: 6px; }

/* ==========================================================================
   BACKGROUND ENVIRONMENT
   ========================================================================== */
.world-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: url('background.png') center bottom / cover no-repeat;
    z-index: -2; filter: brightness(0.85); 
}

#ambient-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    z-index: -1; pointer-events: none;
}

/* ==========================================================================
   REUSABLE UI PANELS
   ========================================================================== */
.content-panel {
    background: var(--bg-parchment);
    border: 6px solid var(--wood-base);
    border-radius: var(--radius-lg);
    padding: 35px; position: relative;
    box-shadow: var(--shadow-soft);
}
.content-panel::after {
    content: ''; position: absolute; top: 6px; left: 6px; right: 6px; bottom: 6px;
    border: 2px dashed rgba(112, 74, 50, 0.2); border-radius: var(--radius-md); pointer-events: none;
}

/* ==========================================================================
   USER ASSET INTEGRATION (Banners & Slots)
   ========================================================================== */
.section-banner {
    position: relative; width: 100%; max-width: 400px;
    margin: 0 auto 30px auto; display: flex; justify-content: center; align-items: center;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.3));
}
.banner-img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.banner-text {
    position: absolute; top: 55%; left: 50%; transform: translate(-50%, -50%);
    font-family: var(--font-ui); font-size: clamp(1.4rem, 4vw, 2rem);
    color: var(--bg-parchment); text-shadow: 1px 1px 0 rgba(0,0,0,0.4); white-space: nowrap;
}

.skill-slot {
    position: relative; width: 72px; height: 72px;
    display: flex; justify-content: center; align-items: center;
    margin-bottom: 15px; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.slot-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 1; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2)); }
.skill-icon { font-size: 2.2rem; color: var(--wood-dark); position: relative; z-index: 2; }
.skill-card:hover .skill-slot { transform: scale(1.1) translateY(-5px); }

/* ==========================================================================
   TYPOGRAPHY & UTILITIES
   ========================================================================== */
h1, h2, h3, h4 { font-family: var(--font-ui); color: var(--text-main); }
.body-text { font-size: 1.1rem; line-height: 1.6; color: var(--text-main); }
.body-text.small { font-size: 0.95rem; }

.pixel-text { font-family: var(--font-pixel); font-size: 1.2rem; letter-spacing: 1px; }
.pixel-tag {
    display: inline-block; font-family: var(--font-pixel); font-size: 1rem;
    background: var(--bg-parchment-dark); color: var(--text-muted);
    padding: 4px 10px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.1);
}

.text-muted { color: var(--text-muted); }
.text-accent { color: var(--color-accent); font-weight: bold; }
.text-gold { color: var(--color-gold); }
.text-light { color: var(--text-light); }
.text-shadow { text-shadow: var(--shadow-text); }

.mt-5 { margin-top: 5px; } .mt-10 { margin-top: 10px; } .mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; } .mt-30 { margin-top: 30px; }
.mb-5 { margin-bottom: 5px; } .mb-10 { margin-bottom: 10px; } .mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; } .mb-30 { margin-bottom: 30px; }
.m-0 { margin: 0; }
.w-100 { width: 100%; } .text-center { text-align: center; }

.container { max-width: 1000px; margin: 0 auto; padding: 0 25px; }
.section { padding: 80px 0; }
.grid-split { display: grid; grid-template-columns: 1.5fr 1fr; gap: 40px; align-items: center; }

@media (max-width: 768px) {
	.grid-split {
		grid-template-columns: 1fr;
	}
}

.center-flex { display: flex; justify-content: center; align-items: center; flex-direction: column; }

/* Gives breathing room above the music player */
.mailbox-section { padding-bottom: 100px; }

/* ==========================================================================
   BUTTONS (WITH ENHANCED HOVER ANIMATIONS)
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-ui); font-size: 1.1rem; font-weight: 500;
    padding: 12px 24px; border-radius: var(--radius-md);
    text-decoration: none; border: none; outline: none;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn-primary { background: var(--color-accent); color: #fff; border: 3px solid #B0503A; box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), 0 4px 0 #8A3E2C; }
.btn-primary:hover { box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 6px 0 #8A3E2C; }
.btn-primary:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), 0 0px 0 #8A3E2C; filter: brightness(0.9); }

.btn-secondary { background: var(--wood-base); color: #fff; border: 3px solid var(--wood-dark); box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 0 var(--wood-dark); }
.btn-secondary:hover { box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), 0 6px 0 var(--wood-dark); }
.btn-secondary:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 0px 0 var(--wood-dark); filter: brightness(0.9); }

/* ==========================================================================
   TOP NAVIGATION
   ========================================================================== */
.site-nav { position: fixed; top: 0; width: 100%; z-index: 1000; padding: 20px 0; transition: background 0.3s, padding 0.3s; }
.site-nav.scrolled { background: rgba(74, 51, 32, 0.95); backdrop-filter: blur(8px); padding: 12px 0; border-bottom: 3px solid var(--wood-dark); }
.nav-container { max-width: 1100px; margin: 0 auto; padding: 0 25px; display: flex; justify-content: space-between; align-items: center; }
.nav-brand { font-family: var(--font-ui); font-size: 1.6rem; color: var(--text-light); text-decoration: none; display: flex; align-items: center; gap: 8px; text-shadow: var(--shadow-text); transition: transform 0.2s; }
.nav-brand:hover { transform: translateY(-2px); }
.nav-brand i { color: var(--color-green); }

.nav-links { list-style: none; display: flex; gap: 10px; }
.nav-item {
    font-family: var(--font-ui); font-size: 1.1rem; color: var(--text-light); text-decoration: none;
    padding: 8px 16px; border-radius: var(--radius-md); transition: transform 0.2s, background 0.2s; text-shadow: var(--shadow-text);
}
.nav-item:hover { transform: translateY(-2px); background: rgba(255,255,255,0.2); }
.nav-item.active { background: rgba(255,255,255,0.25); }
.menu-toggle { display: none; font-size: 2rem; color: var(--text-light); cursor: pointer; }

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero-section { min-height: 100vh; display: flex; align-items: center; padding-top: 80px; }
.hero-panel { display: flex; gap: 40px; align-items: center; position: relative; }
.hero-content { flex: 1.5; z-index: 2; }
.hero-title { font-size: clamp(3rem, 5vw, 4.5rem); line-height: 1.1; margin-bottom: 10px; }

.dialogue-box { display: flex; gap: 15px; background: var(--bg-parchment-dark); padding: 20px; border-radius: var(--radius-md); border: 2px solid var(--wood-light); }
.speech-icon { width: 36px; height: 36px; flex-shrink: 0; animation: bob 2s infinite ease-in-out; }

.hero-visual { flex: 1; display: flex; justify-content: center; z-index: 2; }
.hero-avatar-frame {
    width: 220px; height: 220px; background: var(--wood-dark);
    border: 6px solid var(--wood-base); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: 0 10px 20px rgba(0,0,0,0.3); transform: rotate(3deg); transition: transform 0.3s, box-shadow 0.3s;
}
.hero-avatar-frame:hover { transform: rotate(0deg) scale(1.05); box-shadow: 0 15px 30px rgba(0,0,0,0.4); }
.pfp-image { width: 100%; height: 100%; object-fit: cover; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ==========================================================================
   CHARACTER SECTION
   ========================================================================== */
.stats-grid { display: flex; gap: 20px; flex-wrap: wrap; background: rgba(0,0,0,0.05); padding: 15px; border-radius: var(--radius-md); }
.stat-box { display: flex; flex-direction: column; }
.stat-value { font-family: var(--font-ui); font-size: 1.3rem; font-weight: 600; }
.profile-card { padding: 15px; background: #fff; border: 3px solid var(--bg-parchment-dark); border-radius: var(--radius-md); box-shadow: 0 4px 10px rgba(0,0,0,0.1); transform: rotate(-2deg); transition: transform 0.3s, box-shadow 0.3s; }
.profile-card:hover { transform: rotate(0deg) scale(1.05); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.profile-pic { width: 160px; height: 160px; border-radius: var(--radius-md); border: 2px solid var(--wood-base); object-fit: cover; }

/* ==========================================================================
   SKILLS SECTION (FORCED 4 COLUMNS)
   ========================================================================== */
.skills-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; 
}
.skill-card { 
    padding: 20px; 
    text-align: center; 
    transition: transform 0.2s, box-shadow 0.2s; 
}
.skill-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 12px 28px rgba(0,0,0,0.2); 
}
.skill-icon { font-size: 2rem; color: var(--wood-dark); }

/* ==========================================================================
   INVENTORY (PORTFOLIO)
   ========================================================================== */
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; }
.inventory-item { padding: 30px; transition: transform 0.2s, box-shadow 0.2s; }
.inventory-item:hover { transform: translateY(-5px); box-shadow: 0 12px 28px rgba(0,0,0,0.2); }
.item-header { display: flex; align-items: center; gap: 20px; border-bottom: 2px dashed rgba(0,0,0,0.1); padding-bottom: 15px; }

/* ==========================================================================
   QUEST LOG (TIMELINE)
   ========================================================================== */
.quest-container { padding: 30px 40px; transition: transform 0.2s, box-shadow 0.2s; }
.quest-container:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.quest-row { display: flex; gap: 20px; padding: 25px 0; border-bottom: 2px dashed rgba(0,0,0,0.1); }
.quest-row:last-child { border-bottom: none; padding-bottom: 0; }
.quest-row.active-quest { background: rgba(251, 192, 45, 0.1); margin: -10px -20px 10px -20px; padding: 25px 20px; border-radius: var(--radius-md); border-bottom: none; border: 2px solid var(--color-gold); }

.quest-icon { width: 48px; flex-shrink: 0; display: flex; justify-content: center; padding-top: 5px; }
.status-icon { width: 40px; height: 40px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
.spin-slow { font-size: 2.5rem; animation: pulseStar 2s infinite ease-in-out; }

@keyframes pulseStar { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); filter: drop-shadow(0 0 8px var(--color-gold)); } }

/* ==========================================================================
   MAILBOX (CONTACT)
   ========================================================================== */
.custom-input {
    width: 100%; background: #fff; border: 3px solid var(--bg-parchment-dark);
    border-radius: var(--radius-md); padding: 12px 15px;
    font-family: var(--font-body); font-size: 1rem; color: var(--text-main);
    outline: none; transition: transform 0.2s, border 0.2s, box-shadow 0.2s;
}
.custom-input:hover { transform: translateY(-1px); }
.custom-input:focus { border-color: var(--color-accent); box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); transform: translateY(-1px); }

/* ==========================================================================
   FOOTER (PINNED TO BOTTOM)
   ========================================================================== */
.site-footer { 
    background: var(--wood-dark); 
    padding: 20px 0; 
    border-top: 4px solid #3E2723; 
    position: relative;
    z-index: 5;
    margin-top: auto; /* Pushes footer to bottom of flex container */
}
.footer-inner { 
    display: flex; 
    justify-content: center; /* Center everything */
    align-items: center; 
    gap: 30px; 
}
.brand-text { font-family: var(--font-ui); font-size: 1.2rem; color: var(--text-light); display: flex; align-items: center; gap: 8px; }

/* ==========================================================================
   MUSIC PLAYER WIDGET
   ========================================================================== */
.music-player-widget {
    position: fixed; bottom: 20px; left: 20px; z-index: 1000;
    display: flex; align-items: center; gap: 15px;
    background: var(--bg-parchment); border: 4px solid var(--wood-base);
    padding: 10px 15px; border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.3s;
}
.music-player-widget:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }

.player-icon {
    width: 40px; height: 40px; background: var(--wood-light);
    border: 2px solid var(--wood-dark); border-radius: 8px;
    display: flex; justify-content: center; align-items: center;
    color: var(--bg-parchment); font-size: 1.5rem;
}
.player-disc.playing { animation: spin 3s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.player-info { width: 140px; display: flex; flex-direction: column; overflow: hidden; }
.player-title { color: var(--wood-dark); font-size: 0.9rem; line-height: 1; margin-bottom: 2px; }

.marquee-container { width: 100%; overflow: hidden; white-space: nowrap; position: relative; }
.marquee-container span { display: inline-block; animation: marquee 10s linear infinite; }
@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.player-controls { display: flex; gap: 5px; }
.player-btn {
    background: var(--wood-base); border: 2px solid var(--wood-dark);
    color: var(--text-light); width: 32px; height: 32px; border-radius: 4px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1rem; cursor: pointer; transition: transform 0.1s, filter 0.2s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 0 var(--wood-dark);
}
.player-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.player-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--wood-dark); filter: brightness(0.9); }
.play-btn { background: var(--color-green); border-color: #4c7562; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 0 #4c7562; }
.play-btn:active { box-shadow: 0 0 0 #4c7562; }

/* ==========================================================================
   ANIMATIONS & MOBILE
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(30px); transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.reveal.active { opacity: 1; transform: translateY(0); }

@media (max-width: 992px) {
    /* Allow skills grid to wrap on slightly smaller screens */
    .skills-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .grid-split, .hero-panel { flex-direction: column; text-align: center; }
    .hero-panel { padding: 40px 25px; }
    .hero-actions { justify-content: center; flex-wrap: wrap; }
    .dialogue-box { text-align: left; }
    .stats-grid { justify-content: center; }
    .character-visual { order: -1; margin-bottom: 20px; }
}

@media (max-width: 768px) {
    body { padding-bottom: 100px; } /* Ensures room for player on mobile */
    .nav-links {
        position: fixed; top: 65px; left: 0; width: 100%; background: var(--wood-base);
        flex-direction: column; align-items: center; padding: 20px 0; gap: 15px;
        transform: translateY(-150%); transition: transform 0.3s ease;
        border-bottom: 4px solid var(--wood-dark);
    }
    .nav-links.active { transform: translateY(0); }
    .menu-toggle { display: block; }
    
    .section { padding: 60px 0; }
    .hero-section { padding-top: 100px; }
    .hero-title { font-size: 2.8rem; }
    .hero-avatar-frame { width: 180px; height: 180px; }
    
    .section-banner { max-width: 320px; }
    .skills-grid { grid-template-columns: 1fr; } /* Stack skills on mobile */
    .quest-container { padding: 25px 20px; }
    .quest-row { flex-direction: column; text-align: center; align-items: center; gap: 10px; }
    
    .footer-inner { flex-direction: column; gap: 15px; text-align: center; justify-content: center; }
    
    /* Ensure the music player spans bottom on mobile */
    .music-player-widget {
        bottom: 0; left: 0; right: 0; width: 100%;
        border-radius: 0; border-width: 4px 0 0 0; justify-content: space-between;
    }
}