/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
}

/* Main container with responsive height */
.game-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-height: 450px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Responsive height for full browser */
@media (min-height: 600px) and (min-width: 800px) {
    .game-container {
        height: 90vh;
        max-height: 90vh;
    }
}

/* Compact header design */
.game-header {
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: help;
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-icon {
    font-size: 16px;
}

.progress-bar {
    width: 60px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffeaa7, #fdcb6e);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Main game content */
.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    overflow-y: auto;
}

/* Scenario panel */
.scenario-panel {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 16px;
    color: white;
    box-shadow: 0 4px 16px rgba(240, 147, 251, 0.3);
}

.scenario-text {
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

/* Word selection panel */
.word-selection-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selection-prompt {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: #2d3436;
}

.sentence-builder {
    background: white;
    border: 2px dashed #74b9ff;
    border-radius: 8px;
    padding: 16px;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.word-slot {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    color: #2d3436;
    animation: pulse 2s infinite;
}

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

/* Word options */
.word-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.word-option {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
    min-height: 44px; /* Touch-friendly height */
}

.word-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
}

.word-option:active {
    transform: translateY(0);
}

.word-option.selected {
    background: linear-gradient(135deg, #00b894, #00cec9);
    transform: scale(1.05);
}

/* Feedback panel */
.feedback-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #00b894;
}

.feedback-content {
    text-align: center;
    margin-bottom: 16px;
}

.feedback-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.feedback-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3436;
}

.feedback-explanation {
    font-size: 14px;
    line-height: 1.5;
    color: #636e72;
    margin-bottom: 16px;
}

.continue-btn {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    min-height: 44px;
}

.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

/* Celebration overlay */
.celebration-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.celebration-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    animation: celebrationPop 0.5s ease-out;
}

.celebration-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 1s infinite;
}

.celebration-message {
    font-size: 20px;
    font-weight: 600;
    color: #2d3436;
}

@keyframes celebrationPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    max-width: 200px;
    text-align: center;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .game-content {
        padding: 12px;
        gap: 10px;
    }
    
    .scenario-text {
        font-size: 13px;
    }
    
    .selection-prompt {
        font-size: 14px;
    }
    
    .sentence-builder {
        font-size: 14px;
        padding: 12px;
    }
    
    .word-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 6px;
    }
    
    .word-option {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .word-option {
        border: 2px solid #000;
    }
    
    .feedback-panel {
        border: 2px solid #000;
    }
}