/* DunceAI - Bracket Basics Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-orange: #FF6B35;
    --primary-yellow: #FFD23F;
    --primary-blue: #3D5A80;
    --primary-teal: #35A7A7;
    --success-green: #4CAF50;
    --error-red: #E74C3C;
    --bg-cream: #FFF8E7;
    --text-dark: #2C3E50;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', 'Comic Sans MS', Tahoma, sans-serif;
    background: linear-gradient(135deg, var(--bg-cream) 0%, #FFE4C4 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow), 0 0 0 4px var(--primary-orange);
    max-width: 700px;
    width: 100%;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.logo-dunce {
    color: var(--primary-orange);
}

.logo-ai {
    color: var(--primary-blue);
}

.game-header h1 {
    color: var(--text-dark);
    font-size: 1.4rem;
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streak-label {
    font-weight: bold;
    color: var(--text-dark);
}

.streak-smileys {
    display: flex;
    gap: 4px;
}

.streak-smiley {
    width: 24px;
    height: 24px;
    background: var(--primary-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Target Section */
.target-section {
    text-align: center;
    margin-bottom: 24px;
}

.target-label {
    font-size: 1.1rem;
    color: var(--text-dark);
}

.target-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-blue);
    background: linear-gradient(135deg, #E8F4FD 0%, #D0E8F8 100%);
    display: inline-block;
    padding: 10px 30px;
    border-radius: 16px;
    margin-top: 8px;
    border: 3px solid var(--primary-blue);
    min-width: 120px;
}

/* Expression Area */
.expression-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 80px;
    padding: 20px;
    background: #F8F9FA;
    border-radius: 16px;
    margin-bottom: 24px;
}

.expression-symbol {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
    padding: 0 4px;
}

.expression-symbol.bracket {
    color: var(--primary-orange);
    font-size: 2.5rem;
}

.expression-symbol.operator {
    color: var(--primary-teal);
}

.drop-zone {
    width: 60px;
    height: 60px;
    border: 3px dashed #CCC;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.2s ease;
    position: relative;
}

.drop-zone:hover {
    border-color: var(--primary-orange);
    background: #FFF5EE;
}

.drop-zone.drag-over {
    border-color: var(--primary-orange);
    border-style: solid;
    background: #FFE8DD;
    transform: scale(1.05);
}

.drop-zone.filled {
    border-style: solid;
    border-color: var(--primary-yellow);
    background: var(--primary-yellow);
}

.drop-zone .number-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-dark);
}

.drop-zone .reset-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--error-red);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.drop-zone.filled .reset-btn {
    display: flex;
}

.drop-zone .reset-btn:hover {
    transform: scale(1.1);
}

/* Numbers Tray */
.numbers-tray {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.number-tile {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-yellow) 0%, #FFC107 100%);
    border: 3px solid #E6A800;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-dark);
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.number-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.number-tile:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.number-tile.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

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

/* Dunce Section */
.dunce-section {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    min-height: 120px;
}

.dunce-character {
    flex-shrink: 0;
    width: 100px;
    transition: transform 0.3s ease;
}

.dunce-svg {
    width: 100%;
    height: auto;
}

/* Dunce Expressions */
.dunce-character.thinking .dunce-eyes {
    animation: lookAround 2s infinite;
}

.dunce-character.excited {
    animation: bounce 0.5s ease;
}

.dunce-character.smirk .dunce-eyebrows {
    transform: translateY(-3px);
}

.dunce-character.disappointed {
    transform: translateY(5px);
}

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

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

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

.dunce-cap {
    transform-origin: center bottom;
}

.dunce-character.wrong .dunce-cap {
    animation: shake 0.3s ease-in-out 3;
}

/* Speech Bubble */
.speech-bubble {
    background: white;
    border: 3px solid var(--primary-orange);
    border-radius: 20px;
    padding: 16px 20px;
    position: relative;
    flex-grow: 1;
    box-shadow: var(--shadow);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 20px;
    border: 10px solid transparent;
    border-right-color: var(--primary-orange);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    left: -6px;
    top: 23px;
    border: 7px solid transparent;
    border-right-color: white;
}

.speech-bubble p {
    color: var(--text-dark);
    font-size: 1.1rem;
    line-height: 1.4;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-check {
    background: linear-gradient(135deg, var(--success-green) 0%, #45A049 100%);
    color: white;
    box-shadow: 0 4px 0 #2E7D32;
}

.btn-check:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2E7D32;
}

.btn-check:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2E7D32;
}

.btn-reset {
    background: linear-gradient(135deg, #95A5A6 0%, #7F8C8D 100%);
    color: white;
    box-shadow: 0 4px 0 #5D6D6E;
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #5D6D6E;
}

.btn-next {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #2C4A6E 100%);
    color: white;
    box-shadow: 0 4px 0 #1E3A5F;
    animation: pulse 1.5s infinite;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1E3A5F;
    animation: none;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 0 #1E3A5F, 0 0 0 0 rgba(61, 90, 128, 0.4); }
    50% { box-shadow: 0 4px 0 #1E3A5F, 0 0 0 10px rgba(61, 90, 128, 0); }
}

/* Explanation Overlay */
.explanation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    padding: 20px;
}

.explanation-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.explanation-box {
    background: #FFFDE7;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    border: 4px solid var(--primary-yellow);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.explanation-box h3 {
    color: var(--primary-blue);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.explanation-steps {
    text-align: left;
}

.explanation-steps .step {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin: 12px 0;
    padding: 10px 15px;
    background: white;
    border-radius: 10px;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.4s ease;
}

.explanation-steps .step.show {
    opacity: 1;
    transform: translateX(0);
}

.explanation-steps .step.highlight {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-left: 4px solid var(--success-green);
}

.explanation-steps .step.wrong {
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    border-left: 4px solid var(--error-red);
}

/* Result Animations */
@keyframes correctBounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(0.95); }
    75% { transform: scale(1.05); }
}

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

.expression-area.correct {
    animation: correctBounce 0.5s ease;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border: 3px solid var(--success-green);
}

.expression-area.wrong {
    animation: wrongShake 0.5s ease;
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    border: 3px solid var(--error-red);
}

/* Responsive */
@media (max-width: 600px) {
    .game-container {
        padding: 16px;
    }

    .game-header {
        justify-content: center;
        text-align: center;
    }

    .game-header h1 {
        width: 100%;
        order: -1;
    }

    .target-number {
        font-size: 2.5rem;
    }

    .expression-symbol {
        font-size: 1.5rem;
    }

    .expression-symbol.bracket {
        font-size: 2rem;
    }

    .drop-zone, .number-tile {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }

    .dunce-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .speech-bubble::before,
    .speech-bubble::after {
        display: none;
    }

    .dunce-character {
        width: 80px;
    }
}
