:root {
    /* Mystical Forest Palette */
    --bg-primary: #0a1c15; /* Deep dark forest green */
    --bg-secondary: #1b4332; /* Rich fern green */
    --accent: #2d6a4f; /* Lighter emerald */
    --accent-hover: #40916c; /* Bright forest */
    --glow-gold: #f59e0b; /* Magical gold for the wisdom stones */
    --text-primary: #e2e8f0; /* Soft moonlight text */
    --text-secondary: #94a3b8;
    --glass-bg: rgba(10, 28, 21, 0.65); /* Dark green glass */
    --glass-border: rgba(116, 198, 157, 0.2); /* Glowing teal rim */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    
    /* Apply mystical background image and a mystical radial overlay */
    background-image: 
        radial-gradient(circle at 30% 50%, rgba(82, 183, 136, 0.2), transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(245, 158, 11, 0.15), transparent 50%),
        url('../assets/mystical_forest_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-blend-mode: overlay;
    transition: background-image 0.5s ease;
}

/* Mood Crisis Background Override */
body.mood-crisis {
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(220, 38, 38, 0.3), transparent 70%), 
        url('../assets/mystical_forest_bg.png');
}

.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* Shake Effect for Crises */
.shake-effect { animation: rumble 0.5s infinite; }
@keyframes rumble { 
    0% { transform: translate(1px, 1px) rotate(0deg); } 
    10% { transform: translate(-1px, -2px) rotate(-1deg); } 
    20% { transform: translate(-3px, 0px) rotate(1deg); } 
    30% { transform: translate(3px, 2px) rotate(0deg); } 
    40% { transform: translate(1px, -1px) rotate(1deg); } 
    50% { transform: translate(-1px, 2px) rotate(-1deg); } 
    60% { transform: translate(-3px, 1px) rotate(0deg); } 
    70% { transform: translate(3px, 1px) rotate(-1deg); } 
    80% { transform: translate(-1px, -1px) rotate(1deg); } 
    90% { transform: translate(1px, 2px) rotate(0deg); } 
    100% { transform: translate(1px, -2px) rotate(-1deg); } 
}

/* Views */
.view {
    display: none;
    animation: mysticFade 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.view.active {
    display: block;
}

@keyframes mysticFade {
    0% { opacity: 0; transform: scale(0.95) translateY(15px); filter: blur(4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0px); }
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(116, 198, 157, 0.05);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-out {
    opacity: 0;
    transform: translateY(10px);
}

.hidden-game-mechanic {
    display: none !important;
}

/* Typography */
.text-center { text-align: center; }
.title { 
    font-size: 3.5rem; 
    font-weight: 800; 
    margin-bottom: 0.5rem; 
    background: linear-gradient(135deg, #74c69d, #f59e0b); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    text-shadow: 0 0 30px rgba(116, 198, 157, 0.4);
    letter-spacing: 2px;
}
.subtitle { 
    font-size: 1.2rem; 
    color: #cbd5e1; 
    margin-bottom: 2rem; 
    font-style: italic;
}

/* Avatars Placeholder */
.avatar-selection { margin: 2rem 0; }
.avatar-selection h3 { color: var(--glow-gold); font-size: 1.5rem; margin-bottom: 1rem; }
.avatar-placeholder-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}
.avatar-option {
    width: 110px;
    height: 130px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 3rem; 
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.avatar-option span {
    font-size: 0.95rem;
    margin-top: 0.5rem;
    color: #cbd5e1;
    font-weight: 600;
}
.avatar-option:hover { 
    background: rgba(116, 198, 157, 0.1); 
    transform: translateY(-8px); 
    border-color: rgba(116, 198, 157, 0.3);
    box-shadow: 0 10px 25px rgba(20, 255, 100, 0.1);
}
.avatar-option.selected { 
    border-color: var(--glow-gold); 
    background: rgba(245, 158, 11, 0.15); 
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 1.2rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    width: 100%;
    margin-top: 2rem;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-primary:hover { 
    transform: translateY(-3px) scale(1.02); 
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.6); 
}

/* Game Screen */
.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.progress-bar-bg { width: 70%; height: 6px; background: rgba(0,0,0,0.5); border-radius: 99px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.8); }
.progress-fill { height: 100%; width: 5%; background: linear-gradient(90deg, var(--accent), var(--glow-gold)); transition: width 0.4s ease-out; box-shadow: 0 0 10px var(--glow-gold); }
#progress-text { font-weight: 600; color: var(--glow-gold); letter-spacing: 1px; font-size: 0.9rem; text-transform: uppercase; }

/* Loot Inventory */
.stone-inventory { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1.5rem; }
.stone-slot { 
    width: 35px; height: 45px; 
    border: 2px solid rgba(255,255,255,0.15); 
    border-radius: 10px; 
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); 
    background: rgba(0,0,0,0.6); 
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); 
}
.stone-filled { 
    background: linear-gradient(135deg, var(--accent), var(--glow-gold)); 
    border-color: var(--glow-gold); 
    box-shadow: 0 0 20px var(--glow-gold); 
    transform: scale(1.1);
}

/* Tension Timer */
.timer-container { width: 100%; height: 6px; background: rgba(0,0,0,0.5); border-radius: 4px; margin-bottom: 1.5rem; overflow: hidden; }
.timer-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #f59e0b, #ef4444); transition: width 1s linear, background-color 0.5s ease; }
.timer-danger { animation: pulseRed 0.5s infinite; }
@keyframes pulseRed { 0% { background: #ef4444; } 50% { background: #991b1b; } 100% { background: #ef4444; } }

.scenario-header { margin-bottom: 1.5rem; display: flex; align-items: center; gap: 1rem; }
.scenario-text { 
    font-size: 1.4rem; 
    line-height: 1.7; 
    margin-bottom: 2.5rem; 
    font-weight: 400; 
    color: #f8fafc;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.ranking-wrapper {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: stretch;
}
.options-pool {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 120px;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    border: 1px dashed var(--glass-border);
}
.ranking-zones {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.drop-zone {
    border: 2px dashed rgba(116, 198, 157, 0.4);
    border-radius: 12px;
    min-height: 70px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    transition: all 0.3s ease;
    padding: 0.5rem;
}

.drop-zone.drag-over {
    background: rgba(116, 198, 157, 0.2);
    border-color: #74c69d;
    box-shadow: 0 0 15px rgba(116, 198, 157, 0.4);
}

.zone-label {
    position: absolute;
    top: -12px;
    left: 1rem;
    background: var(--bg-primary);
    padding: 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--glow-gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 4px;
    z-index: 5;
}

.option-card {
    background: rgba(10, 28, 21, 0.8);
    border: 2px solid rgba(116, 198, 157, 0.3);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    color: #e2e8f0;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1.05rem;
    font-weight: 500;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    width: 100%;
}

.option-card:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.option-card.dragging {
    opacity: 0.6;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border-color: var(--glow-gold);
}

/* Sound Toggle */
.sound-toggle-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
}
.sound-toggle-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}
.sound-toggle-btn.muted {
    opacity: 0.6;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    filter: grayscale(1);
}

/* Animations */
.card-rejected {
    transform: scale(0.9) translateY(50px);
    opacity: 0;
    filter: grayscale(1);
    transition: all 0.5s ease-in !important;
}

.card-grabbed {
    background: rgba(245, 158, 11, 0.3) !important;
    border-color: var(--glow-gold) !important;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5) !important;
    transform: scale(1.05);
    z-index: 9998;
    transition: transform 0.4s ease-in, top 0.4s ease-in !important;
}

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

.hidden { display: none !important; }

/* Custom Hand Cursor */
body.custom-cursor-active, body.custom-cursor-active * {
    cursor: none !important;
}
.custom-cursor {
    position: fixed;
    width: 45px; /* Scaled down for a cursor */
    height: auto;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-30%, -10%); /* Align the image roughly with the exact mouse point */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
    display: none;
}

.character-display { text-align: center; margin-top: -30px; position: relative; z-index: 20; height: 1px; }
.avatar-large { 
    font-size: 5rem; 
    opacity: 0.9; 
    animation: hoverMystic 4s ease-in-out infinite; 
    display: block; 
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5));
}
@keyframes hoverMystic { 0% { transform: translateY(0px) rotate(-2deg); } 50% { transform: translateY(-15px) rotate(2deg); filter: drop-shadow(0 15px 25px rgba(245, 158, 11, 0.3)); } 100% { transform: translateY(0px) rotate(-2deg); } }

/* Animated Grab Hand (Image) */
.avatar-hand {
    position: fixed;
    top: 0;
    left: 0;
    width: 180px;
    height: auto;
    z-index: 9999;
    pointer-events: none;
    display: none;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.7));
}

/* Resolution Overlay */
.resolution-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 28, 21, 0.95);
    z-index: 10000; 
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
}
.resolution-overlay:not(.hidden) {
    opacity: 1; pointer-events: all;
}
.resolution-overlay h2 { color: var(--glow-gold); font-size: 3.5rem; margin-bottom: 1rem; text-shadow: 0 0 20px rgba(245, 158, 11, 0.5); }
.resolution-overlay p { color: #cbd5e1; font-size: 1.5rem; font-style: italic; }

/* Results */
.skills-results-container { margin: 2.5rem 0; display: flex; flex-direction: column; gap: 1.5rem; }
.skill-row { display: flex; flex-direction: column; gap: 0.6rem; }
.skill-label { display: flex; justify-content: space-between; font-weight: 600; font-size: 1rem; color: #e2e8f0; }
.skill-bar-bg { width: 100%; height: 12px; background: rgba(0,0,0,0.4); border-radius: 6px; overflow: hidden; box-shadow: inset 0 1px 4px rgba(0,0,0,0.8); }
.skill-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--glow-gold)); width: 0%; transition: width 1.5s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }

.btn-secondary { 
    background: rgba(16, 185, 129, 0.15); 
    color: #a7f3d0; 
    border: 1px solid var(--accent); 
    width: 100%; 
}
.btn-secondary:hover { background: rgba(16, 185, 129, 0.3); box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }

.report-output { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--glass-border); text-align: left; }
.report-output h3 { color: var(--glow-gold); margin: 1.5rem 0 0.5rem 0; font-size: 1.3rem; }
.report-output p { color: #cbd5e1; line-height: 1.7; font-size: 1.05rem; background: rgba(0,0,0,0.2); padding: 1.5rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }

/* Report Table */
.table-responsive { width: 100%; overflow-x: auto; margin-bottom: 2rem; }
.report-table { width: 100%; border-collapse: collapse; background: rgba(0,0,0,0.3); border-radius: 12px; overflow: hidden; }
.report-table th, .report-table td { padding: 1rem; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.05); }
.report-table th { background: rgba(16, 185, 129, 0.2); color: var(--glow-gold); font-weight: 600; }
.report-table tr:last-child td { border-bottom: none; }
.report-table tbody tr:hover { background: rgba(255,255,255,0.05); }
.report-table td { color: #f1f5f9; }

.report-sections { display: flex; flex-direction: column; gap: 1.5rem; }

/* Cutscene Elements */
.cutscene-panel {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.cutscene-slide {
    animation: fadeIn 0.5s ease-in;
}

/* Scenario Layout */
.scenario-layout {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: stretch;
}
.scenario-left {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.scenario-right {
    flex: 2;
    display: flex;
    flex-direction: column;
}
.dialogue-box {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
}
.dialogue-avatar {
    font-size: 3rem;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--accent);
    flex-shrink: 0;
}
.dialogue-box .scenario-text {
    flex: 1;
    font-size: 1.1rem;
    text-align: left;
    margin: 0;
    line-height: 1.5;
    color: #f1f5f9;
}

/* RPG Interactive Area Base */
.rpg-interactive-area {
    margin: 1.5rem 0;
    min-height: 200px;
    background: rgba(0,0,0,0.3);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.rpg-map-title {
    color: var(--glow-gold);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Scenario 1: Map */
.rpg-map-container, .rpg-timer-container, .rpg-morale-container, .rpg-craft-container {
    width: 100%;
}
.rpg-map-paths {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 150px;
    background: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><path d="M0,150 Q100,50 200,100 T400,150" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="2"/></svg>') no-repeat center bottom;
}
.map-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}
.map-path:hover { transform: scale(1.1); }
.map-path .path-icon { font-size: 2.5rem; filter: grayscale(50%); transition: filter 0.3s; }
.map-path.inspected .path-icon { filter: grayscale(0%); text-shadow: 0 0 15px var(--glow-gold); }
.path-name { font-weight: 600; margin-top: 0.5rem; color: #cbd5e1; }
.path-info, .task-info, .mat-info {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 28, 21, 0.9);
    border: 1px solid var(--accent);
    padding: 0.5rem;
    border-radius: 8px;
    width: max-content;
    font-size: 0.85rem;
    color: #a7f3d0;
    margin-bottom: 0.5rem;
    pointer-events: none;
    z-index: 10;
}

/* Scenario 2: Timer Tasks */
.rpg-weather-warning {
    text-align: center; color: #ef4444; font-weight: bold; margin-bottom: 1rem;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0% { opacity: 0.7; } 50% { opacity: 1; text-shadow: 0 0 10px #ef4444; } 100% { opacity: 0.7; } }
.rpg-tasks {
    display: flex;
    justify-content: space-around;
}
.rpg-task {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
    position: relative;
}
.rpg-task:hover { background: rgba(255,255,255,0.1); }
.rpg-task.inspected { border-color: var(--accent); box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); }
.task-icon { font-size: 2rem; margin-bottom: 0.5rem; }

/* Scenario 3: Morale */
.rpg-tribe-members {
    display: flex;
    justify-content: center;
    gap: 2rem;
}
.rpg-member {
    cursor: pointer;
    position: relative;
    text-align: center;
    transition: transform 0.2s ease;
}
.rpg-member:hover { transform: scale(1.1); }
.member-icon { font-size: 3rem; opacity: 0.7; transition: opacity 0.3s; }
.rpg-member.listened .member-icon { opacity: 1; }
.member-dialog {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #000;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    width: max-content;
    max-width: 150px;
    font-size: 0.85rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 10;
}
.member-dialog::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

/* Scenario 4: Crafting */
.rpg-materials {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
}
.rpg-material {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    position: relative;
    transition: all 0.2s ease;
}
.rpg-material:hover { background: rgba(255,255,255,0.1); }
.rpg-material.inspected { border-color: var(--glow-gold); }
.mat-icon { font-size: 2rem; }
.bridge-preview {
    text-align: center;
    padding: 1rem;
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    border: 1px dashed var(--glass-border);
    color: #cbd5e1;
    transition: all 0.3s ease;
}
.bridge-preview.ready {
    border-color: var(--accent);
    border-style: solid;
    color: var(--accent);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.2);
}

.info-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--glow-gold);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}
.info-btn:hover {
    transform: scale(1.2);
}
