/* Eduplayify Game Template: interactive_clock (الساعة التفاعلية) */

.clock-game-wrap {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 0.75rem;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

/* Prompt Card Header */
.clock-prompt-card {
    width: 100%;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    box-sizing: border-box;
}

.clock-instruction-text {
    font-size: clamp(1.05rem, 2.5vw, 1.28rem);
    font-weight: 800;
    color: #1e293b;
    line-height: 1.45;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.clock-target-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.4rem 1.1rem;
    border-radius: 9999px;
    font-family: 'Courier New', Courier, monospace;
    font-size: clamp(1.2rem, 3vw, 1.55rem);
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(15, 23, 42, 0.15);
}

.clock-period-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    font-family: inherit;
}
.clock-period-am {
    background: #fef08a;
    color: #854d0e;
    border: 1px solid #fde047;
}
.clock-period-pm {
    background: #312e81;
    color: #e0e7ff;
    border: 1px solid #4338ca;
}

/* Elapsed Time Box */
.clock-elapsed-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.45rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Analog Clock Stage */
.clock-stage {
    position: relative;
    width: 100%;
    max-width: 340px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.25rem auto;
}

.clock-svg {
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: default;
    overflow: visible;
}

/* Interactive Clock Hands */
.clock-hand-group {
    /* No CSS transform-origin! Hand base is at (0,0) and group is translated to center (150,150) in SVG */
}

.clock-hand-hour-stem {
    stroke: #ef4444;
    stroke-width: 8px;
    stroke-linecap: round;
}
.clock-hand-hour-pin {
    fill: #dc2626;
    stroke: #ffffff;
    stroke-width: 3px;
    cursor: grab;
    filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.4));
}
.clock-hand-hour-pin:hover,
.clock-hand-hour-pin.is-active {
    fill: #b91c1c;
    stroke-width: 4px;
}

.clock-hand-minute-stem {
    stroke: #0284c7;
    stroke-width: 5.5px;
    stroke-linecap: round;
}
.clock-hand-minute-pin {
    fill: #0284c7;
    stroke: #ffffff;
    stroke-width: 3px;
    cursor: grab;
    filter: drop-shadow(0 2px 4px rgba(2, 132, 199, 0.4));
}
.clock-hand-minute-pin:hover,
.clock-hand-minute-pin.is-active {
    fill: #0369a1;
    stroke-width: 4px;
}

.clock-center-hub {
    fill: #0f172a;
    stroke: #ffffff;
    stroke-width: 4px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}

/* Nudge Controls (Touch-friendly quick buttons) */
.clock-nudge-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    margin-top: -0.25rem;
}
.clock-nudge-group {
    display: inline-flex;
    align-items: center;
    direction: ltr !important;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    padding: 3px;
    gap: 3px;
}
.clock-nudge-title {
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0 8px;
    color: #475569;
    user-select: none;
}
.clock-nudge-btn {
    border: none;
    border-radius: 9999px;
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: 800;
    direction: ltr !important;
    unicode-bidi: isolate;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}
.clock-nudge-btn:active {
    transform: scale(0.92);
}
.clock-nudge-hour {
    background: #fee2e2;
    color: #991b1b;
}
.clock-nudge-hour:hover {
    background: #fca5a5;
}
.clock-nudge-min {
    background: #e0f2fe;
    color: #075985;
}
.clock-nudge-min:hover {
    background: #bae6fd;
}

/* MCQ Choices Grid (Read the clock mode) */
.clock-mcq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}
.clock-choice-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.85rem 1rem;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
    color: #1e293b;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.clock-choice-card:hover {
    border-color: #0284c7;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.15);
}
.clock-choice-card:active {
    transform: translateY(0);
}
.clock-choice-card.is-correct {
    background: #dcfce7 !important;
    border-color: #22c55e !important;
    color: #15803d !important;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.35) !important;
}
.clock-choice-card.is-wrong {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #b91c1c !important;
    animation: clockShake 0.4s ease;
}

/* Digital Keypad Input Mode */
.clock-keypad-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}
.clock-keypad-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 14px;
    padding: 0.5rem 1.25rem;
    color: #38bdf8;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    font-weight: 800;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}
.clock-digit-input {
    width: 58px;
    background: transparent;
    border: none;
    border-bottom: 2px solid #38bdf8;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-align: center;
    outline: none;
    padding: 0;
}
.clock-digit-input:focus {
    border-bottom-color: #facc15;
    color: #facc15;
}

/* Primary Check / Submit Button */
.clock-submit-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 0.8rem 2.2rem;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.clock-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}
.clock-submit-btn:active {
    transform: translateY(0);
}

/* Feedback Alert */
.clock-feedback-box {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    display: none;
    animation: clockFadeIn 0.25s ease;
}
.clock-feedback-box.is-correct {
    display: block;
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #15803d;
}
.clock-feedback-box.is-wrong {
    display: block;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

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

@keyframes clockFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .clock-stage {
        max-width: 270px;
    }
    .clock-mcq-grid {
        grid-template-columns: 1fr;
    }
    .clock-target-display {
        font-size: 1.15rem;
    }
}
