/* ================================================
   challenges.css — UI Optimized for Respect Studios
   ================================================ */

:root {
    --c-bg:          var(--bg-dark);
    --c-surface:     var(--bg-card-solid);
    --c-card:        var(--bg-card);
    --c-border:      var(--glass-border);
    --c-border-h:    rgba(168, 85, 255, 0.4);

    --c-purple:      var(--primary-color);
    --c-purple-l:    var(--primary-light);
    --c-purple-d:    var(--primary-dark);
    --c-cyan:        #22d3ee;
    --c-gold:        #fbbf24;
    --c-green:       var(--success);
    --c-red:         var(--danger);

    --font-ar:       'El Messiri', sans-serif;
    --font-mono:     'IBM Plex Mono', monospace;

    --ease-out:      cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);

    --radius-sm:     var(--border-radius-sm);
    --radius-md:     var(--border-radius-md);
    --radius-lg:     var(--border-radius-lg);
    --radius-xl:     32px;
}

/* ── Base ── */
.challenges-page {
    min-height: 100vh;
    background-color: var(--c-bg);
    color: #fff;
    font-family: var(--font-ar);
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* ── Background Elements ── */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    animation: orbFloat 12s ease-in-out infinite alternate;
}
.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(124, 44, 255, 0.2) 0%, transparent 70%);
    top: -150px; right: -100px;
}
.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(168, 85, 255, 0.1) 0%, transparent 70%);
    bottom: -100px; left: -80px;
}

@keyframes orbFloat {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 40px) scale(1.08); }
}

/* ── Hub Content ── */
.hub-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.welcome-section {
    text-align: center;
    margin-bottom: 4rem;
    animation: pageIn 0.8s var(--ease-out) both;
}

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

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    color: var(--c-purple-l);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.title-accent {
    background: linear-gradient(135deg, var(--c-purple-l), var(--c-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Modes Grid ── */
.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.mode-card {
    background: var(--c-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--ease-spring);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: cardIn 0.6s var(--ease-out) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.mode-card:hover {
    transform: translateY(-10px);
    border-color: var(--c-purple-l);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(168, 85, 255, 0.1);
}

.card-icon {
    width: 64px;
    height: 64px;
    background: rgba(168, 85, 255, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-purple-l);
    transition: transform 0.3s ease;
}

.mode-card:hover .card-icon {
    transform: scale(1.1) rotate(-5deg);
    background: rgba(168, 85, 255, 0.2);
}

.card-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.card-action {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--c-purple-l);
}

.card-action svg {
    transition: transform 0.3s ease;
}

.mode-card:hover .card-action svg {
    transform: translateX(-5px);
}

/* ── Stats Strip ── */
.stats-strip {
    display: flex;
    background: var(--c-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    justify-content: space-around;
    animation: pageIn 1s var(--ease-out) 0.4s both;
}

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

.stat-val {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .page-title { font-size: 2.5rem; }
    .modes-grid { grid-template-columns: 1fr; }
    .mode-card { padding: 2rem 1.5rem; }
}

/* =========================================================
   Challenges Leaderboard (challenges_leaderboard.php)
   ========================================================= */
.leaderboard-container {
    max-width: 980px;
    margin: 0 auto;
}

.leaderboard-card {
    background: var(--c-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    position: relative;
    overflow: hidden;
}

.leaderboard-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% -20%, rgba(168, 85, 255, 0.18), transparent 55%);
    pointer-events: none;
}

.leaderboard-header {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: flex-start;
    margin-bottom: 1.1rem;
}

.lb-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    text-decoration: none;
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.25s var(--ease-out);
    white-space: nowrap;
}

.lb-back-btn:hover {
    transform: translateY(-2px);
    background: rgba(168, 85, 255, 0.12);
    border-color: rgba(168, 85, 255, 0.35);
}

.leaderboard-list {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.28s var(--ease-out);
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    background: rgba(168, 85, 255, 0.08);
    border-color: rgba(168, 85, 255, 0.28);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(251, 191, 36, 0.28);
    color: var(--c-gold);
}
.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: rgba(226, 232, 240, 0.10);
    border-color: rgba(226, 232, 240, 0.18);
    color: #e2e8f0;
}
.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: rgba(251, 146, 60, 0.12);
    border-color: rgba(251, 146, 60, 0.22);
    color: #fb923c;
}

.leaderboard-rank {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 900;
    font-size: 1.05rem;
    color: var(--c-purple-l);
    background: rgba(168, 85, 255, 0.12);
    border: 1px solid rgba(168, 85, 255, 0.22);
    flex-shrink: 0;
}

.leaderboard-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.leaderboard-avatar {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    flex-shrink: 0;
}

.leaderboard-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.leaderboard-avatar span {
    font-weight: 900;
    color: #fff;
}

.leaderboard-name {
    font-weight: 900;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-score {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.14);
    flex-shrink: 0;
}

.score-value {
    font-family: var(--font-mono);
    font-weight: 900;
    font-size: 1.05rem;
    color: #e9d5ff;
}

.score-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-secondary);
}

.leaderboard-empty {
    text-align: center;
    padding: 2.8rem 1.2rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-lg);
}

.leaderboard-empty__icon {
    margin-bottom: 1.2rem;
    color: var(--c-purple-l);
    opacity: 0.9;
}

@media (max-width: 600px) {
    .leaderboard-card { padding: 1.05rem; }
    .leaderboard-item { padding: 12px; }
    .leaderboard-score { padding: 8px 12px; }
    .leaderboard-rank { width: 40px; height: 40px; border-radius: 14px; }
    .leaderboard-avatar { width: 42px; height: 42px; border-radius: 14px; }
}

/* =========================================================
   Game Area (game.php)
   ========================================================= */
.challenge-game-area {
    padding: 2rem 0;
    max-width: 1000px;
    margin: 0 auto;
}

.game-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

#levelTitle {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px rgba(168, 85, 255, 0.3);
}

.game-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 850px) {
    .game-main-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.image-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.guess-instruction {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 1.5rem 0;
    text-align: center;
    width: 100%;
}

.image-frame {
    width: 100%;
    aspect-ratio: 1/1;
    background: var(--bg-card-solid);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
}

#challengeImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.image-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 255, 0.1), transparent);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.input-section {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.guess-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.letter-boxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    direction: rtl; /* Changed from ltr to rtl for Arabic input */
}

.letter-box {
    width: 45px;
    height: 55px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.letter-box.active {
    border-color: var(--primary-color);
    background: rgba(168, 85, 255, 0.1);
    box-shadow: 0 0 15px rgba(168, 85, 255, 0.2);
}

.letter-box.revealed {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.letter-space {
    flex-shrink: 0;
}

/* ── Hint System ── */
.hint-trigger-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

.hint-trigger-btn {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--c-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
}

.hint-trigger-btn:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--c-gold);
    color: #000;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.hint-inline-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 0.8rem 1.2rem;
    min-height: 54px;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.hint-menu-popup {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hint-menu-popup.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.hint-menu-content {
    background: var(--bg-card-solid);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.4s var(--ease-out);
}

.hint-menu-item {
    width: 100%;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    text-align: right;
}

.hint-menu-item:hover {
    background: rgba(168, 85, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateX(-5px);
}

.hint-menu-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hint-menu-label {
    font-size: 1.1rem;
    font-weight: 800;
}

.hint-menu-cost {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.hint-menu-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hint-menu-close:hover {
    background: var(--c-red);
    color: #fff;
}

/* ── Success Modal ── */
.game-success-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.success-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 0, 22, 0.95);
    backdrop-filter: blur(12px);
}

.success-content {
    position: relative;
    background: var(--bg-card-solid);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3.5rem 2.5rem;
    width: 100%;
    max-width: 500px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 0 100px rgba(168, 85, 255, 0.2);
    animation: successIn 0.6s var(--ease-spring);
}

@keyframes successIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
    margin-bottom: 1rem;
}

.success-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(135deg, #fff, var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.answer-display {
    background: rgba(168, 85, 255, 0.1);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 20px;
    width: 100%;
}

.answer-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.answer-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-light);
}

.reward-box {
    background: rgba(251, 191, 36, 0.05);
    border: 1px dashed var(--c-gold);
    border-radius: 16px;
    padding: 1.2rem;
    width: 100%;
}

.reward-title {
    color: var(--c-gold);
    font-weight: 800;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.reward-badges {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.badge-item {
    padding: 0.5rem 1rem;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--c-gold);
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.game-btn {
    width: 100%;
    padding: 1.1rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
}

.game-btn.primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 8px 20px rgba(168, 85, 255, 0.3);
}

.game-btn.primary:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(168, 85, 255, 0.4);
}

.game-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: #fff;
}

.game-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ── Settings Modal ── */
.simple-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.simple-modal-content {
    background: var(--bg-card-solid);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideUp { 
    from { opacity: 0; transform: translateY(30px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* =========================================================
   Classic Challenge Answer UI (game.php) — matches provided mock
   ========================================================= */
.challenges-body.challenges-game-classic .header,
.challenges-body.challenges-game-classic .sidebar,
.challenges-body.challenges-game-classic .sidebar-overlay,
.challenges-body.challenges-game-classic .bg-orb {
    display: none !important;
}

.challenges-body.challenges-game-classic {
    padding-top: 0 !important; /* لأن الهيدر مخفي في هذا التصميم */
    background: var(--bg-dark);
}

.challenges-body.challenges-game-classic .challenges-page {
    /* نفس التخطيط كما في الصورة لكن بألوان ثيم الموقع */
    background-color: var(--bg-dark);
    background-image:
        linear-gradient(180deg, rgba(7, 0, 22, 0.98) 0%, rgba(7, 0, 22, 0.0) 120px),
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 100% 140px, 14px 14px;
    background-repeat: no-repeat, repeat;
    color: var(--text-primary);
    padding: 18px 14px;
    min-height: 100vh;
}

.challenges-body.challenges-game-classic .challenge-game-area {
    padding: 0;
    max-width: 980px;
    margin: 0 auto;
}

.challenges-body.challenges-game-classic .challenge-topbar {
    display: grid;
    grid-template-columns: 52px 1fr 52px;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    direction: ltr; /* keeps back button visually on the left like the mock */
}

.challenges-body.challenges-game-classic .challenge-back-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.18s ease, background 0.18s ease;
}

.challenges-body.challenges-game-classic .challenge-back-btn:hover {
    transform: translateY(-1px);
    background: rgba(var(--primary-rgb), 0.16);
}

.challenges-body.challenges-game-classic .challenge-topbar-title {
    text-align: center;
    font-weight: 900;
    font-size: 1.25rem;
    direction: rtl;
    letter-spacing: 0.2px;
    color: #fff;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.challenges-body.challenges-game-classic .challenge-topbar-brand {
    display: flex;
    justify-content: flex-end;
}

.challenges-body.challenges-game-classic .challenge-topbar-brand img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(var(--primary-rgb), 0.35);
    background: rgba(var(--primary-rgb), 0.12);
    object-fit: cover;
    display: block;
}

.challenges-body.challenges-game-classic .challenge-classic-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.challenges-body.challenges-game-classic .challenge-classic-card {
    width: 100%;
    margin: 0 auto;
}

.challenges-body.challenges-game-classic .image-frame.image-frame-classic {
    width: 100%;
    background: var(--bg-card-solid);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-md);
    aspect-ratio: 16 / 7;
    min-height: 240px;
    padding: 14px; /* مساحات جانبية داخلية مثل الصورة */
}

.challenges-body.challenges-game-classic #challengeImage {
    object-fit: contain;
    background: transparent;
    border-radius: 14px;
}

.challenges-body.challenges-game-classic .letter-boxes.letter-boxes-classic {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    direction: rtl;
}

.challenges-body.challenges-game-classic .letter-boxes.letter-boxes-classic .letter-box {
    width: 34px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
    box-shadow: none;
}

.challenges-body.challenges-game-classic .letter-boxes.letter-boxes-classic .letter-box.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(168, 85, 255, 0.18);
}

.challenges-body.challenges-game-classic .letter-boxes.letter-boxes-classic .letter-box.revealed {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.9);
    color: #0f3d1f;
}

.challenges-body.challenges-game-classic .challenge-answer-bar {
    width: min(560px, 100%);
    margin: 18px auto 0;
    background: rgba(16, 1, 34, 0.72);
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    direction: ltr; /* لترتيب الأزرار: تلميح يسار، تحقق يمين */
}

.challenges-body.challenges-game-classic .hint-inline-box.hint-inline-box-classic {
    flex: 1 1 auto;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    display: none; /* يظهر فقط عند اختيار تلميح "معلومة إضافية" */
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.challenges-body.challenges-game-classic .hint-inline-box.hint-inline-box-classic .hint-inline-text {
    font-size: 0.98rem;
    font-weight: 900;
}

.challenges-body.challenges-game-classic .answer-bar-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
    flex: 0 0 auto;
}

.challenges-body.challenges-game-classic .answer-bar-btn:hover {
    transform: translateY(-1px);
}

.challenges-body.challenges-game-classic .answer-submit-btn:hover {
    background: rgba(var(--primary-rgb), 0.18);
}

.challenges-body.challenges-game-classic .answer-hint-btn:hover {
    background: rgba(251, 191, 36, 0.12);
}

.challenges-body.challenges-game-classic .challenge-answer-input {
    flex: 1 1 auto;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    padding: 0 10px;
    text-align: right;
    font-family: var(--font-ar);
}

.challenges-body.challenges-game-classic .challenge-answer-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 700;
}

.challenges-body.challenges-game-classic .challenge-answer-capture {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    padding: 0;
    margin: 0;
    border: none;
    outline: none;
    background: transparent;
    opacity: 0.01;
    pointer-events: auto; /* Allow events but it's invisible */
    font-size: 16px; /* Prevents auto-zoom on iOS */
    z-index: 1000; /* Bring to front but it's tiny and transparent */
    direction: ltr !important;
    text-align: left !important;
}

.challenges-body.challenges-game-classic .challenge-alert {
    width: min(560px, 100%);
    margin: 10px auto 0;
    text-align: center;
    font-weight: 900;
}

@media (max-width: 520px) {
    .challenges-body.challenges-game-classic .image-frame.image-frame-classic {
        aspect-ratio: 16 / 9;
        min-height: 200px;
    }
    .challenges-body.challenges-game-classic .letter-boxes.letter-boxes-classic .letter-box {
        width: 30px;
        height: 36px;
        font-size: 1.05rem;
    }
    .challenges-body.challenges-game-classic .challenge-topbar-title {
        font-size: 1.05rem;
    }
}
