/* ===== ROOT VARIABLES AND RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cute color palette - soft pastels */
    --primary-color: #FF9ECD;
    --secondary-color: #A8E6CF;
    --accent-color: #FFD93D;
    --warning-color: #FF6B6B;
    --safe-color: #95E1D3;
    --bg-color: #FFF5F7;
    --text-color: #2C3E50;
    --panel-bg: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 15px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Comic Sans MS', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FFE5EC 0%, #FFC9DE 100%);
    color: var(--text-color);
    overflow: hidden;
}

/* ===== MAIN CONTAINER - Responsive to iframe/standalone ===== */
#game-container {
    width: 100%;
    height: 450px; /* Default for iframe */
    position: relative;
    overflow: hidden;
    background: var(--bg-color);
}

/* Standalone mode - uses 90vh */
body.standalone #game-container {
    height: 90vh;
}

/* ===== TOOLTIPS ===== */
.tooltip {
    position: absolute;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#header-tooltip {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    white-space: normal;
    text-align: center;
}

#info-tooltip {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: 80%;
    white-space: normal;
}

#info-tooltip.visible {
    opacity: 1;
}

/* ===== PROGRESS TRACKING ===== */
#progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    box-shadow: var(--shadow);
}

#progress-bar {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid white;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--safe-color));
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 217, 61, 0.5);
}

#progress-text {
    font-weight: bold;
    color: white;
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    min-width: 90px;
    text-align: right;
}

/* ===== GAME AREA ===== */
#game-area {
    padding: 15px;
    height: calc(100% - 50px); /* Subtract progress bar height */
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

/* ===== CHARACTER SECTION ===== */
#character-section {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel-bg);
    padding: 10px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

#character-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

/* Cute character animation states */
#character-avatar.character-idle::before {
    content: "🕵️";
}

#character-avatar.character-thinking::before {
    content: "🤔";
}

#character-avatar.character-happy::before {
    content: "😊";
}

#character-avatar.character-worried::before {
    content: "😰";
}

#character-avatar.character-surprised::before {
    content: "😲";
}

#character-avatar:hover {
    transform: scale(1.1) rotate(5deg);
}

#character-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* ===== STORY PANEL ===== */
#story-panel {
    flex: 1;
    background: var(--panel-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-y: auto;
    position: relative;
    border: 3px solid var(--secondary-color);
}

#story-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

#typing-indicator {
    display: inline-block;
    font-size: 1.5rem;
    color: var(--primary-color);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ===== TIMER (Time Pressure Mechanic) ===== */
#timer-container {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--panel-bg);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid var(--accent-color);
    z-index: 10;
}

#timer-icon {
    font-size: 1.2rem;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

#timer-text {
    font-weight: bold;
    font-size: 1rem;
    color: var(--text-color);
}

#timer-container.warning {
    border-color: var(--warning-color);
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== CHOICES CONTAINER ===== */
#choices-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.choice-btn {
    background: linear-gradient(135deg, var(--secondary-color), var(--safe-color));
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    text-align: left;
    width: 100%;
    min-height: 45px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.choice-btn:hover::before {
    left: 100%;
}

.choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
}

.choice-btn:active {
    transform: translateY(0);
}

.choice-btn.safe {
    border-left: 5px solid var(--safe-color);
}

.choice-btn.danger {
    border-left: 5px solid var(--warning-color);
}

/* ===== SOUND CONTROLS ===== */
#sound-controls {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.sound-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--panel-bg);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

.sound-btn.muted {
    opacity: 0.5;
    background: #ccc;
}

/* ===== GAME OVER SCREEN ===== */
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#game-over-content {
    background: var(--panel-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

#game-over-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

#game-over-message {
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

#lessons-learned {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: left;
}

#lessons-learned h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

#lessons-learned ul {
    list-style-position: inside;
    line-height: 1.8;
}

.action-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 600px) {
    #game-area {
        padding: 10px;
        gap: 8px;
    }
    
    #character-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    #story-text {
        font-size: 0.9rem;
    }
    
    .choice-btn {
        font-size: 0.85rem;
        padding: 10px 15px;
    }
}

/* ===== ANIMATIONS FOR ENGAGEMENT ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

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

.bounce {
    animation: bounce 0.6s ease;
}