/* Eduplayify Game Template: number_line (خط الأعداد) */

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

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

.nl-instruction-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.4;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.nl-target-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: #0284c7;
    color: #ffffff;
    padding: 0.25rem 0.95rem;
    border-radius: 9999px;
    font-family: 'Courier New', Courier, monospace, system-ui;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
    direction: ltr !important;
    unicode-bidi: isolate;
}

.nl-equation-display {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.25rem 0.85rem;
    border-radius: 9999px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(15, 23, 42, 0.12);
    direction: ltr !important;
    unicode-bidi: isolate;
}

.nl-unknown-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background: #f59e0b;
    color: #0f172a;
    border-radius: 6px;
    font-weight: 900;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(245, 158, 11, 0.4);
    animation: nlPulse 2s infinite ease-in-out;
    direction: ltr !important;
    unicode-bidi: isolate;
}

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

/* Stage Area with SVG Number Line */
.nl-stage-card {
    width: 100%;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.03), 0 6px 16px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    box-sizing: border-box;
    direction: ltr !important;
}

.nl-svg-container {
    width: 100%;
    height: auto;
    max-height: 240px;
    display: block;
    touch-action: none;
    cursor: pointer;
    direction: ltr !important;
}

/* SVG Line & Ticks */
.nl-axis {
    stroke: #0284c7;
    stroke-width: 4;
    stroke-linecap: round;
}

.nl-tick-major {
    stroke: #334155;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.nl-tick-minor {
    stroke: #94a3b8;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.nl-tick-text {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    font-weight: 700;
    fill: #475569;
    text-anchor: middle;
    user-select: none;
    direction: ltr !important;
    unicode-bidi: isolate;
}

.nl-tick-text.is-zero {
    font-weight: 900;
    fill: #0f172a;
    font-size: 12px;
}

.nl-tick-text.is-target {
    font-weight: 900;
    fill: #0284c7;
    font-size: 13px;
}

/* Jump Arcs */
.nl-jump-path {
    fill: none;
    stroke: #f59e0b;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: nlPathDraw 0.6s ease-out forwards;
}

.nl-jump-label {
    font-family: system-ui, sans-serif;
    font-size: 11px;
    font-weight: 800;
    fill: #d97706;
    text-anchor: middle;
    direction: ltr !important;
    unicode-bidi: isolate;
}

/* Marker / Target Pin */
.nl-marker-handle {
    cursor: grab;
    transition: transform 0.1s ease-out;
}

.nl-marker-handle:active {
    cursor: grabbing;
}

.nl-marker-pin {
    fill: #ef4444;
    filter: drop-shadow(0 4px 6px rgba(239, 68, 68, 0.4));
    transition: fill 0.2s ease;
}

.nl-marker-pulse {
    fill: #ef4444;
    opacity: 0.35;
    animation: nlRipple 1.8s infinite ease-out;
}

@keyframes nlRipple {
    0% { r: 6; opacity: 0.5; }
    100% { r: 18; opacity: 0; }
}

.nl-marker-badge-rect {
    fill: #0f172a;
    rx: 6;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
}

.nl-marker-badge-text {
    font-family: monospace, system-ui;
    font-size: 12px;
    font-weight: 900;
    fill: #ffffff;
    text-anchor: middle;
    dominant-baseline: central;
    direction: ltr !important;
    unicode-bidi: isolate;
}

/* Mascot Bunny Animation */
.nl-mascot {
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.25));
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nl-mascot.is-jumping {
    animation: nlBunnyHop 0.5s ease-in-out infinite alternate;
}

@keyframes nlBunnyHop {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

/* Stepper Controls Bar (§10 للأجهزة الضعيفة وشاشات اللمس) */
.nl-controls-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.35rem 0;
    direction: ltr !important;
}

.nl-step-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 44px;
    height: 42px;
    padding: 0 0.85rem;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05);
    transition: all 0.15s ease;
    touch-action: manipulation;
    direction: ltr !important;
    unicode-bidi: isolate;
}

.nl-step-btn:hover {
    background: #f8fafc;
    border-color: #0284c7;
    color: #0284c7;
    transform: translateY(-1px);
}

.nl-step-btn:active {
    transform: translateY(1px);
    background: #f1f5f9;
}

.nl-current-value-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    height: 42px;
    padding: 0 1rem;
    background: #0f172a;
    color: #38bdf8;
    border-radius: 12px;
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: 900;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    direction: ltr !important;
    unicode-bidi: isolate;
}

/* Submit Action Button */
.nl-action-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.nl-check-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 180px;
    height: 48px;
    padding: 0 1.5rem;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.nl-check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.nl-check-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.nl-check-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Multiple Choice Mode Grid */
.nl-choices-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.65rem;
    margin-top: 0.4rem;
}

.nl-choice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    min-height: 48px;
    background: #ffffff;
    border: 2.5px solid #cbd5e1;
    border-radius: 14px;
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
    touch-action: manipulation;
    font-family: monospace, system-ui;
    direction: ltr !important;
    unicode-bidi: isolate;
}

.nl-choice-btn:hover {
    border-color: #0284c7;
    background: #f0f9ff;
    color: #0369a1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.nl-choice-btn.is-selected {
    border-color: #0284c7;
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.nl-choice-btn.is-correct {
    border-color: #10b981 !important;
    background: #10b981 !important;
    color: #ffffff !important;
    animation: nlPopSuccess 0.4s ease-out;
}

.nl-choice-btn.is-incorrect {
    border-color: #ef4444 !important;
    background: #ef4444 !important;
    color: #ffffff !important;
    animation: nlShake 0.4s ease-in-out;
}

/* Feedback Notice */
.nl-feedback-notice {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    box-sizing: border-box;
    text-align: center;
    animation: nlSlideDown 0.3s ease-out;
}

.nl-feedback-success {
    background: #dcfce7;
    border: 1.5px solid #86efac;
    color: #14532d;
}

.nl-feedback-error {
    background: #fee2e2;
    border: 1.5px solid #fca5a5;
    color: #7f1d1d;
}

/* Animations */
@keyframes nlPopSuccess {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

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

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

/* Mathematical Stacked Fraction Display */
.nl-math-frac, .nl-mixed {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    font-family: inherit;
    direction: ltr !important;
    unicode-bidi: isolate;
    gap: 4px;
}

.nl-frac-whole, .nl-whole {
    font-size: 1.15em;
    font-weight: 800;
    margin-right: 2px;
}

.nl-frac-stack, .nl-fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
    font-size: 0.82em;
    vertical-align: middle;
    padding: 0 1px;
}

.nl-frac-num, .nl-num {
    font-weight: 800;
    padding: 0 2px 1px 2px;
}

.nl-frac-line {
    width: 100%;
    height: 1.5px;
    background: currentColor;
    margin: 1px 0;
}

.nl-frac-den, .nl-den {
    font-weight: 800;
    padding: 1px 2px 0 2px;
    border-top: 1.5px solid currentColor;
}

/* Pin only mode (no value badge visible during drag) */
.nl-marker-handle.is-pin-only .nl-marker-badge {
    display: none;
}

.nl-marker-needle {
    stroke: #ef4444;
    stroke-width: 2.5;
    stroke-linecap: round;
}

/* Masked hidden tick label */
.nl-tick-text.is-masked {
    display: none;
}

/* Math Expression Badge */
.nl-expr-badge {
    background: #0f172a;
    color: #38bdf8;
    padding: 0.35rem 1rem;
    border-radius: 9999px;
    font-family: monospace;
    font-size: 1.3rem;
    font-weight: 900;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
    direction: ltr !important;
    unicode-bidi: isolate;
}

/* Responsive Optimizations */
@media (max-width: 480px) {
    .nl-game-wrap {
        padding: 0.35rem 0.45rem;
        gap: 0.5rem;
    }
    .nl-instruction-text {
        font-size: 0.95rem;
    }
    .nl-target-badge {
        font-size: 1.1rem;
        padding: 0.2rem 0.75rem;
    }
    .nl-step-btn {
        min-width: 40px;
        height: 38px;
        padding: 0 0.5rem;
        font-size: 0.88rem;
    }
    .nl-current-value-box {
        min-width: 60px;
        height: 38px;
        font-size: 1.1rem;
    }
    .nl-check-btn {
        width: 100%;
        height: 44px;
        font-size: 1rem;
    }
}

/* ==========================================================================
   Math Stacked Fractions & Educational Safeguards
   ========================================================================== */
.nl-fraction {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    text-align: center;
    font-size: 0.88em;
    line-height: 1.05;
    padding: 0 3px;
    direction: ltr !important;
    unicode-bidi: isolate;
}
.nl-fraction .nl-num {
    border-bottom: 1.8px solid currentColor;
    padding-bottom: 1px;
    font-weight: 800;
}
.nl-fraction .nl-den {
    padding-top: 1px;
    font-weight: 800;
}
.nl-mixed {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
    direction: ltr !important;
    unicode-bidi: isolate;
}
.nl-mixed .nl-whole {
    font-size: 1.15em;
    font-weight: 900;
}

/* Pin-Only Drag Mode (Educational Challenge - No Peeking) */
.nl-marker-handle.is-pin-only .nl-marker-badge-rect,
.nl-marker-handle.is-pin-only .nl-marker-badge-text {
    display: none !important;
}

/* Math Expression in Prompts */
.nl-math-expr-tag {
    display: inline-block;
    background: #0f172a;
    color: #38bdf8;
    border-radius: 8px;
    padding: 3px 12px;
    font-weight: 800;
    font-family: inherit;
    direction: ltr !important;
    unicode-bidi: isolate;
    margin: 0 4px;
}

