/* ==========================================================================
   TELLING THE TIME - GAME STYLESHEET
   ========================================================================== */

:root {
    --primary: #3b82f6;
    --primary-dark: #1d4ed8;
    --accent: #facc15;
    --text-main: #1e293b;
    --bg-gradient: linear-gradient(135deg, #e0f2fe, #f0f9ff, #ffffff);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --card-hover-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.15), 0 10px 10px -5px rgba(59, 130, 246, 0.1);
}

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

body {
    font-family: 'Outfit', 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    padding: 15px;
    overflow-x: hidden;
}

.game-container {
    width: min(1000px, 100%);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    border: 6px solid #f1f5f9;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   HEADER / DASHBOARD
   ========================================================================== */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    color: #1e3a8a;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: #475569;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.control-btn:hover {
    transform: scale(1.1);
    background: #e2e8f0;
    color: #0f172a;
}

.control-btn:active {
    transform: scale(0.95);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.score-badge {
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    border: 2px solid #bfdbfe;
    border-radius: 16px;
    padding: 6px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.9);
}

.score-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: #2563eb;
    letter-spacing: 0.5px;
}

#scoreValue {
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: #1e40af;
}

/* ==========================================================================
   CLOCK OPTIONS CARD GRID
   ========================================================================== */

.clock-options-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 10px;
}

.clock-card {
    background: #ffffff;
    border-radius: 20px;
    border: 3px solid #e2e8f0;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.clock-inner {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.clock-inner img {
    width: 100%;
    height: 100%;
    max-width: 130px;
    max-height: 130px;
    object-fit: contain;
    transition: transform 0.25s ease;
}

.clock-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow: var(--card-hover-shadow);
}

.clock-card:hover img {
    transform: scale(1.05);
}

.clock-card:active {
    transform: translateY(-2px) scale(0.98);
}

/* Correct/Incorrect card highlights */
.clock-card.correct {
    border-color: #10b981 !important;
    background-color: #ecfdf5 !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.clock-card.incorrect {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   QUESTION PANEL (TIME IN WORDS)
   ========================================================================== */

.word-time-panel {
    background: #ffffff;
    border: 3px solid #e2e8f0;
    border-radius: 20px;
    padding: 18px 30px;
    text-align: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
    margin: 5px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 104px; /* Ensure panel height is consistent */
}

.word-time-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.speaker-large-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.speaker-large-btn:hover {
    transform: scale(1.15) rotate(-5deg);
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
}

.speaker-large-btn:active {
    transform: scale(0.95);
}

.word-time-text {
    font-family: 'Fredoka One', cursive;
    font-size: 32px;
    color: #1e3a8a;
    letter-spacing: 0.5px;
    animation: fadeInUp 0.4s ease-out;
}

.next-question-btn {
    display: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    padding: 10px 24px;
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
    margin-top: 10px;
    animation: fadeInUp 0.4s ease-out;
}

.next-question-btn:hover {
    transform: scale(1.08);
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.next-question-btn:active {
    transform: scale(0.95);
}

.digital-display {
    display: none;
    width: 140px;
    height: 85px;
    justify-content: center;
    align-items: center;
    background: #0f172a;
    color: #38bdf8;
    font-family: 'Courier New', Courier, monospace;
    font-size: 28px;
    font-weight: 800;
    border-radius: 16px;
    border: 4px solid #334155;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 4px 6px rgba(0, 0, 0, 0.15);
    letter-spacing: 1px;
    text-shadow: 0 0 8px currentColor;
    transition: transform 0.25s ease;
}

.clock-card:hover .digital-display {
    transform: scale(1.05);
}

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

/* ==========================================================================
   BRIDGE CANVAS AND ANIMATIONS
   ========================================================================== */

.bridge-canvas-container {
    width: 100%;
    background: #bae6fd;
    border-radius: 20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border: 2px solid #bae6fd;
    overflow: hidden;
}

#bridgeCanvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Bunny state animations */
#bunny {
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#bunny.is-walking {
    animation: walkingBounce 0.4s ease-in-out infinite alternate;
}

#bunny.is-falling {
    transition: none !important;
    animation: fallingAnim 1.0s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
    transform-origin: center;
}

/* Ears wiggle */
#bunny:hover .ears {
    animation: earsWiggle 0.5s ease infinite alternate;
}

@keyframes earsWiggle {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(5deg);
    }
}

/* Walking bounce */
@keyframes walkingBounce {
    0% {
        transform: translate(var(--bunny-x), var(--bunny-y)) scale(1);
    }

    100% {
        transform: translate(var(--bunny-x), calc(var(--bunny-y) - 10px)) scale(1.02);
    }
}

/* Falling animation */
@keyframes fallingAnim {
    0% {
        transform: translate(var(--bunny-x), var(--bunny-y)) scale(1) rotate(0deg);
        opacity: 1;
    }

    75% {
        transform: translate(var(--bunny-x), 270px) scale(0.8) rotate(270deg);
        opacity: 1;
    }

    100% {
        transform: translate(var(--bunny-x), 320px) scale(0.3) rotate(360deg);
        opacity: 0;
    }
}

/* Splash effect animation */
#splash {
    animation: splashPulse 0.6s ease-out forwards;
    transform-origin: 400px 285px;
}

@keyframes splashPulse {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* ==========================================================================
   MODALS (POP-UPS)
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out forwards;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #ffffff;
    width: min(450px, 90%);
    border-radius: 28px;
    padding: 36px;
    border: 6px solid #f1f5f9;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.8);
    opacity: 0;
    animation: scaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.text-center {
    text-align: center;
}

.modal-emoji {
    font-size: 80px;
    display: block;
    margin-bottom: 16px;
    animation: float 2s ease-in-out infinite;
}

.modal-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 32px;
    color: #1e3a8a;
    margin-bottom: 12px;
}

.modal-content p {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-stats {
    background: #f8fafc;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 24px;
    font-weight: 700;
    font-size: 18px;
    color: #3b82f6;
    border: 2px dashed #cbd5e1;
}

.action-btn {
    width: 100%;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    padding: 14px 28px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(37, 99, 235, 0.35);
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.action-btn:active {
    transform: translateY(-1px);
}

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

    to {
        opacity: 1;
    }
}

@keyframes scaleUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS / PHONES)
   ========================================================================== */

@media (max-width: 768px) {
    .game-container {
        padding: 16px;
        gap: 16px;
    }

    .game-title {
        font-size: 22px;
    }

    .word-time-text {
        font-size: 24px;
    }

    .clock-options-container {
        gap: 12px;
    }

    .clock-card {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .clock-options-container {
        grid-template-columns: 1fr;
        max-width: 250px;
        margin: 0 auto;
    }
}

/* TIMER STYLING */
.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-display {
    font-size: 14px;
    font-weight: 800;
    color: #ea580c;
    background: #ffedd5;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 6px;
    border: 1.5px solid #fed7aa;
    font-family: 'Fredoka One', monospace;
    letter-spacing: 0.5px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* SETTINGS STYLING */
.setting-item label {
    font-size: 16px;
    color: #334155;
}

.setting-item input[type="range"] {
    height: 8px;
    border-radius: 4px;
    background: #cbd5e1;
    outline: none;
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: background 0.15s ease;
}

.setting-item input[type="range"]::-webkit-slider-thumb:hover {
    background: #1d4ed8;
}

.cancel-btn:hover {
    background: linear-gradient(135deg, #64748b, #475569) !important;
}