/* Eduplayify Game Template: balance_scale (الميزان الحسابي) */

.scale-game-wrap {
    width: 100%;
    max-width: 600px;
    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 */
.scale-prompt-card {
    width: 100%;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.6rem 1rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    box-sizing: border-box;
}

.scale-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;
}

.scale-equation-display {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.25rem 0.85rem;
    border-radius: 9999px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.22rem;
    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.12);
    direction: ltr !important;
    unicode-bidi: isolate;
}

.scale-target-highlight {
    color: #34d399;
}

.scale-unknown-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 5px;
    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: scalePulse 2s infinite ease-in-out;
    transition: all 0.25s ease;
}

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

/* Stage Area with SVG Scale */
.scale-stage-card {
    width: 100%;
    background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 0.55rem 0.65rem 0.45rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04), 0 6px 18px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
    overflow: hidden;
}

.scale-svg-container {
    width: 100%;
    max-width: 440px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scale-svg {
    width: 100%;
    height: auto;
    max-height: 205px;
    overflow: visible;
}

/* Smooth physics transitions on the lever beam and suspended pans */
.scale-beam-line,
.scale-hook,
.scale-needle-line {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-pan-left-group,
.scale-pan-right-group {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Pan weight readout tags */
.scale-pan-tag {
    font-size: 13px;
    font-weight: 900;
    font-family: system-ui, -apple-system, sans-serif;
    fill: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Weights Rack / Dock */
.scale-rack-card {
    width: 100%;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.55rem 0.85rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    box-sizing: border-box;
}

.scale-rack-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
}

.scale-rack-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
}

.scale-rack-tip {
    font-size: 0.74rem;
    font-weight: 700;
    color: #94a3b8;
}

.scale-weights-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    min-height: 42px;
}

/* Individual Weight Item Chip */
.scale-weight-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 40px;
    padding: 2px 8px;
    border-radius: 10px;
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    border: 2px solid #b45309;
    box-shadow: 0 3px 8px rgba(217, 119, 6, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-weight: 900;
    font-size: 1.05rem;
    transition: all 0.15s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.scale-weight-chip:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 5px 12px rgba(217, 119, 6, 0.4);
}

.scale-weight-chip:active {
    transform: translateY(1px) scale(0.97);
}

.scale-weight-chip.weight-emerald {
    background: linear-gradient(145deg, #10b981 0%, #059669 100%);
    border-color: #047857;
    box-shadow: 0 3px 8px rgba(5, 150, 105, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.scale-weight-chip.weight-sky {
    background: linear-gradient(145deg, #0284c7 0%, #0369a1 100%);
    border-color: #075985;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.scale-weight-chip.weight-purple {
    background: linear-gradient(145deg, #8b5cf6 0%, #6d28d9 100%);
    border-color: #5b21b6;
    box-shadow: 0 3px 8px rgba(109, 40, 217, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.scale-weight-chip.weight-item {
    font-size: 1.25rem;
    min-width: 46px;
}

/* Placed weight in right pan summary bar */
.scale-pan-summary-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.3rem 0.7rem;
    gap: 6px;
    flex-wrap: wrap;
    box-sizing: border-box;
    margin-top: 2px;
}

.scale-pan-items-list {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.scale-mini-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #0f172a;
    color: #fff;
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.scale-mini-pill:hover {
    background: #ef4444;
    transform: scale(1.08);
}

.scale-mini-pill .pill-count {
    color: #38bdf8;
    font-weight: 900;
    margin: 0 2px;
}

.scale-mini-pill .pill-sub {
    color: #cbd5e1;
    font-size: 0.74rem;
    font-weight: 700;
    margin: 0 2px;
}

.scale-mini-pill .pill-del {
    font-size: 0.7rem;
    color: #fca5a5;
    margin-left: 2px;
}

/* Inequality Selection Buttons (<, =, >) */
.scale-inequality-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.2rem 0;
    direction: ltr !important;
    unicode-bidi: isolate;
}

.scale-ineq-btn {
    min-width: 62px;
    height: 46px;
    border-radius: 12px;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: #0f172a;
    font-size: 1.45rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    direction: ltr !important;
    unicode-bidi: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.scale-ineq-btn:hover {
    border-color: #0f766e;
    background: #f0fdfa;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(15, 118, 110, 0.15);
}

.scale-ineq-btn.active {
    background: #0f766e;
    color: #ffffff;
    border-color: #115e59;
    box-shadow: 0 5px 14px rgba(15, 118, 110, 0.35);
    transform: translateY(-2px) scale(1.03);
}

/* Multiple choice buttons */
.scale-choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.6rem;
    width: 100%;
}

.scale-choice-btn {
    padding: 0.6rem 0.85rem;
    border-radius: 12px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    color: #1e293b;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
    text-align: center;
}

.scale-choice-btn:hover {
    border-color: #0f766e;
    background: #f0fdfa;
    transform: translateY(-2px);
}

.scale-choice-btn.selected {
    background: #0f766e;
    color: #ffffff;
    border-color: #115e59;
}

/* Bottom Action Buttons */
.scale-actions-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    flex-wrap: wrap;
}

.scale-btn-reset {
    padding: 0.5rem 1.1rem;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.scale-btn-reset:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

.scale-btn-check {
    padding: 0.55rem 1.7rem;
    border-radius: 12px;
    background: linear-gradient(145deg, #0f766e 0%, #047857 100%);
    border: 2px solid #065f46;
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(4, 120, 87, 0.3);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.scale-btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(4, 120, 87, 0.4);
}

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

/* Feedback Alert Banner */
.scale-feedback-alert {
    width: 100%;
    padding: 0.55rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    animation: scaleFeedbackIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-feedback-alert.correct {
    background: #ecfdf5;
    border: 2px solid #10b981;
    color: #065f46;
}

.scale-feedback-alert.incorrect {
    background: #fef2f2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

@keyframes scaleFeedbackIn {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Level Indicator Needle */
.scale-needle {
    transform-origin: 250px 100px;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Responsive optimization for mobile and small screens */
@media (max-width: 600px) {
    .scale-game-wrap {
        max-width: 100%;
        padding: 0.35rem 0.5rem;
        gap: 0.45rem;
    }
    .scale-prompt-card {
        padding: 0.5rem 0.75rem;
    }
    .scale-instruction-text {
        font-size: 0.95rem;
    }
    .scale-equation-display {
        font-size: 1.05rem;
        padding: 0.2rem 0.7rem;
    }
    .scale-stage-card {
        padding: 0.45rem 0.4rem 0.35rem;
    }
    .scale-svg-container {
        max-width: 360px;
    }
    .scale-svg {
        max-height: 175px;
    }
    .scale-rack-card {
        padding: 0.45rem 0.65rem;
    }
    .scale-weight-chip {
        min-width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    .scale-ineq-btn {
        min-width: 52px;
        height: 42px;
        font-size: 1.3rem;
    }
}
