/* Global styles and reset */
* {
    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%);
    overflow: hidden;
}

/* Main game container - responsive height */
.game-container {
    width: 100%;
    height: 450px;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* When opened in new tab, use 90vh */
body.fullscreen .game-container {
    height: 90vh;
    gap: 15px;
    padding: 20px;
}

/* Info icon for instructions */
.info-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s;
    user-select: none;
}

.info-icon:hover {
    transform: scale(1.2);
}

/* Tooltip for instructions */
.tooltip {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 1000;
    max-width: 90%;
    width: 400px;
}

.tooltip.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.tooltip-content {
    padding: 20px;
}

.tooltip-content h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 20px;
}

.tooltip-content p {
    margin-bottom: 10px;
    line-height: 1.5;
    color: #333;
}

.close-tooltip {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    margin-top: 10px;
}

.close-tooltip:hover {
    background: #5568d3;
}

/* Score panel */
.score-panel {
    display: flex;
    justify-content: space-around;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

.score-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

/* Word display area */
.word-display {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.word-slots {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.letter-slot {
    width: 90px;
    height: 50px;
    border: 2px solid #667eea;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    background: #f8f9fa;
    transition: all 0.2s;
}

.letter-slot.empty {
    border-style: dashed;
    color: #ccc;
    font-size: 20px;
}

.letter-slot.filled {
    background: #667eea;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    white-space: nowrap;
    min-height: 44px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

.btn-clear {
    background: #ff6b6b;
    color: white;
    flex: 1;
}

.btn-clear:hover {
    background: #ee5a52;
}

/* ADDED: Hint button styles */
.btn-hint {
    background: #ffd43b;
    color: #333;
    flex: 1;
}

.btn-hint:hover {
    background: #fcc419;
}

.btn-hint:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-submit {
    background: #51cf66;
    color: white;
    flex: 2;
}

.btn-submit:hover {
    background: #40c057;
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ADDED: Hint display area styles */
.hint-display {
    background: linear-gradient(135deg, #fff3bf 0%, #ffe066 100%);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
    align-items: center;
    gap: 12px;
    border: 2px solid #ffd43b;
    animation: slideDown 0.3s ease;
}

.hint-display.show {
    display: flex;
}

.hint-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.hint-text {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

/* Letter bank */
.letter-bank {
    background: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    min-height: 100px;
}

.letter-tile {
    width: 90px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.letter-tile:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.letter-tile:active {
    transform: translateY(-2px) scale(1.02);
}

.letter-tile.used {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.letter-tile.used:hover {
    transform: none;
}

/* ADDED: Highlight effect for hinted letters */
.letter-tile.hint-highlight {
    animation: pulse 1s ease-in-out 3;
    box-shadow: 0 0 20px rgba(255, 212, 59, 0.8);
}

/* Completed words section */
.completed-words {
    background: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.completed-header {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
    font-size: 14px;
}

.completed-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.completed-word {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(81, 207, 102, 0.3);
    animation: slideIn 0.3s ease;
}

.empty-message {
    color: #999;
    font-style: italic;
    font-size: 13px;
}

/* Feedback message */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 999;
    opacity: 0;
    transition: all 0.3s;
}

.feedback.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.feedback.success {
    background: #51cf66;
    color: white;
}

.feedback.error {
    background: #ff6b6b;
    color: white;
}

/* Celebration overlay */
.celebration-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.celebration-overlay.show {
    display: flex;
    animation: fadeIn 0.5s ease;
}

.celebration-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.celebration-emoji {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

.celebration-content h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 28px;
}

.celebration-content p {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.final-score {
    font-size: 24px;
    font-weight: bold;
    color: #51cf66;
    margin: 20px 0;
}

.btn-restart {
    background: #667eea;
    color: white;
    padding: 12px 32px;
    margin-top: 10px;
}

.btn-restart:hover {
    background: #5568d3;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ADDED: Slide down animation for hint display */
@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* ADDED: Pulse animation for hint highlight */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 480px) {
    .letter-tile, .letter-slot {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* ADDED: Adjust hint display for mobile */
    .hint-text {
        font-size: 14px;
    }
    
    .hint-icon {
        font-size: 24px;
    }
}

/* Scrollbar styling */
.game-container::-webkit-scrollbar {
    width: 6px;
}

.game-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.game-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.game-container::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}