/* Kid-Friendly Modern Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --success-color: #95E77E;
    --warning-color: #FFA07A;
    --purple-color: #B19CD9;
    --text-dark: #2D3436;
    --text-light: #FFFFFF;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: slideDown 0.5s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.logo h1 {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 3rem;
    color: var(--text-light);
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    animation: bounce 2s infinite;
}

.logo i {
    font-size: 2.5rem;
    color: var(--accent-color);
    animation: spin 3s linear infinite;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    height: 30px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.progress-fill {
    background: linear-gradient(90deg, var(--success-color), var(--accent-color));
    height: 100%;
    border-radius: 25px;
    width: 0%;
    transition: width 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.word-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 40px;
    box-shadow: var(--card-shadow);
    text-align: center;
    max-width: 600px;
    width: 100%;
    transform: translateY(0);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.word-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.word-card:hover::before {
    opacity: 0.1;
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.word-display {
    margin-bottom: 30px;
}

.word-text {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.word-image {
    font-size: 5rem;
    color: var(--secondary-color);
    animation: float 3s ease-in-out infinite;
}

.word-definition {
    margin-bottom: 30px;
}

.definition-text {
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(45deg, var(--purple-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.word-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Comic Neue', cursive;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

.btn-sound {
    background: linear-gradient(45deg, var(--accent-color), var(--warning-color));
    color: var(--text-dark);
    box-shadow: 0 5px 15px rgba(255, 230, 109, 0.4);
}

.btn-sound:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 230, 109, 0.6);
}

/* Controls Section */
.controls {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 600px;
}

.mode-selector {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 12px 25px;
    border: 3px solid var(--primary-color);
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Comic Neue', cursive;
}

.mode-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Speech Controls */
.speech-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.speech-controls label {
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rate-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--secondary-color);
    transition: all 0.3s ease;
}

.rate-control:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

#speechRate {
    width: 150px;
    height: 6px;
    background: linear-gradient(90deg, var(--warning-color), var(--success-color), var(--primary-color));
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

#speechRate::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#speechRate::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--secondary-color);
}

#speechRate::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: none;
    transition: all 0.3s ease;
}

#speechRate::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--secondary-color);
}

#rateValue {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
    min-width: 30px;
    text-align: center;
    background: var(--accent-color);
    padding: 5px 10px;
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Voice Selector */
.voice-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.voice-selector label {
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.voice-selector select {
    padding: 12px 25px;
    border: 3px solid var(--secondary-color);
    border-radius: 25px;
    font-size: 1rem;
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 250px;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234ECDC4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    padding-right: 50px;
}

.voice-selector select:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
}

.voice-selector select:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
    border-color: var(--primary-color);
}

.voice-selector select option {
    background: white;
    color: var(--text-dark);
    padding: 10px;
}

/* Success and Danger Buttons */
.btn-success {
    background: linear-gradient(45deg, var(--success-color), #4CAF50);
    color: white;
    box-shadow: 0 5px 15px rgba(149, 231, 126, 0.4);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(149, 231, 126, 0.6);
}

.btn-danger {
    background: linear-gradient(45deg, var(--warning-color), #FF6B6B);
    color: white;
    box-shadow: 0 5px 15px rgba(255, 160, 122, 0.4);
}

.btn-danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 160, 122, 0.6);
}

.difficulty-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.difficulty-selector label {
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.difficulty-selector select {
    padding: 10px 20px;
    border: 3px solid var(--secondary-color);
    border-radius: 15px;
    font-size: 1rem;
    font-family: 'Comic Neue', cursive;
    background: white;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-selector select:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* Quiz Section */
.quiz-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 600px;
    animation: slideUp 0.5s ease-out;
}

.quiz-question h3 {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.quiz-definition {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 25px;
    text-align: center;
    background: var(--accent-color);
    padding: 15px;
    border-radius: 15px;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.quiz-option {
    padding: 15px;
    border: 3px solid var(--secondary-color);
    background: white;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-align: center;
    font-size: 1.1rem;
}

.quiz-option:hover {
    background: var(--secondary-color);
    color: white;
    transform: scale(1.05);
}

.quiz-option.correct {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
    animation: bounce 0.5s ease-out;
}

.quiz-option.incorrect {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
    animation: shake 0.5s ease-out;
}

.quiz-feedback {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px;
    border-radius: 15px;
    margin-top: 20px;
}

.quiz-feedback.success {
    background: var(--success-color);
    color: white;
}

.quiz-feedback.error {
    background: var(--warning-color);
    color: white;
}

/* Game Section */
.game-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 800px;
    animation: slideUp 0.5s ease-out;
}

.game-score {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
    font-size: 1.2rem;
    font-weight: bold;
}

.game-score span {
    background: var(--accent-color);
    padding: 10px 20px;
    border-radius: 15px;
    color: var(--text-dark);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    min-height: 300px;
}

.game-word {
    padding: 20px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.game-word::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, white 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-word:hover::before {
    opacity: 0.2;
}

.game-word:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.game-word.found {
    background: var(--success-color);
    animation: bounce 0.5s ease-out;
}

/* Footer */
.footer {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

.stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.stat-item i {
    font-size: 1.5rem;
    color: var(--accent-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 25px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: zoomIn 0.5s ease-out;
}

.celebration-animation i {
    font-size: 4rem;
    color: var(--accent-color);
    animation: bounce 1s infinite;
}

.celebration-animation h2 {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin: 20px 0;
}

.celebration-animation p {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 25px;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Tablet Optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 25px;
        max-width: 100%;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .word-text {
        font-size: 3.5rem;
    }
    
    .word-image {
        font-size: 4.5rem;
    }
    
    .word-card {
        padding: 35px;
        max-width: 90%;
        margin: 0 auto;
    }
    
    .word-actions {
        gap: 20px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 18px 35px;
        font-size: 1.2rem;
        min-width: 180px;
        border-radius: 30px;
    }
    
    .controls {
        padding: 25px;
        max-width: 90%;
        margin: 0 auto;
    }
    
    .mode-selector {
        gap: 20px;
        margin-bottom: 25px;
    }
    
    .mode-btn {
        padding: 15px 30px;
        font-size: 1.1rem;
        min-width: 150px;
        border-radius: 25px;
    }
    
    .voice-selector {
        margin-bottom: 25px;
    }
    
    .voice-selector select {
        min-width: 300px;
        padding: 15px 30px;
        font-size: 1.1rem;
        padding-right: 60px;
    }
    
    .difficulty-selector {
        gap: 20px;
    }
    
    .difficulty-selector select {
        padding: 15px 30px;
        font-size: 1.1rem;
        min-width: 250px;
    }
    
    .quiz-section {
        padding: 35px;
        max-width: 90%;
        margin: 0 auto;
    }
    
    .quiz-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .quiz-option {
        padding: 20px;
        font-size: 1.2rem;
        border-radius: 20px;
        min-height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .stats {
        justify-content: space-around;
        max-width: 90%;
        margin: 0 auto;
    }
    
    .stat-item {
        font-size: 1.2rem;
        padding: 15px 25px;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.8);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    
    .modal-content {
        padding: 50px;
        max-width: 80%;
        margin: 0 auto;
    }
}

/* Enhanced Touch Targets for Tablets */
@media (hover: none) and (pointer: coarse) {
    .btn, .mode-btn, .quiz-option {
        min-height: 60px;
        padding: 20px 30px;
    }
    
    .voice-selector select, .difficulty-selector select {
        min-height: 60px;
        padding: 20px;
    }
    
    .word-actions {
        gap: 25px;
    }
}

/* Landscape Tablet Orientation */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .main-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 30px;
    }
    
    .word-card {
        flex: 1;
        max-width: 60%;
    }
    
    .controls {
        flex: 0 0 35%;
        max-width: 35%;
    }
    
    .quiz-section {
        flex: 1;
        max-width: 90%;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .word-text {
        font-size: 3rem;
    }
    
    .word-image {
        font-size: 4rem;
    }
    
    .word-card {
        padding: 25px;
    }
    
    .controls {
        padding: 20px;
    }
    
    .mode-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-btn {
        width: 200px;
        justify-content: center;
    }
    
    .difficulty-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .stats {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .game-board {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .word-text {
        font-size: 2.5rem;
    }
    
    .word-image {
        font-size: 3rem;
    }
    
    .definition-text {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
    }
    
    .game-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
.btn:focus,
.mode-btn:focus,
.quiz-option:focus,
.game-word:focus,
.difficulty-selector select:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .word-card,
    .controls,
    .quiz-section,
    .game-section,
    .footer {
        border: 2px solid var(--text-dark);
    }
    
    .btn,
    .mode-btn,
    .quiz-option,
    .game-word {
        border: 2px solid var(--text-dark);
    }
}
