/* --- Design Tokens & Global CSS --- */
:root {
    --bg-main: #070d19;
    --bg-header: rgba(11, 22, 44, 0.7);
    --bg-sidebar: rgba(13, 27, 56, 0.65);
    --bg-item: rgba(30, 41, 59, 0.5);
    --bg-item-hover: rgba(51, 65, 85, 0.7);
    --bg-item-active: rgba(71, 85, 105, 0.9);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-accent: #f1d3b3; /* Sand gold accent */
    --accent-glow: rgba(241, 211, 179, 0.3);
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px rgba(56, 189, 248, 0.4); /* Neon blue glow */
    --shadow-glow-success: 0 0 20px rgba(74, 222, 128, 0.5); /* Neon green glow */

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    /* Dot grid background */
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
    background-size: 24px 24px;
}

/* --- Layout Structure --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

/* Header Styling */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    animation: float 4s ease-in-out infinite;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--text-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.tagline {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.game-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-grow: 1;
    max-width: 400px;
    margin: 0 40px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
}

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

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-accent);
}

.progress-bar-container {
    width: 150px;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--text-accent) 0%, #38bdf8 100%);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px var(--accent-glow);
}

.control-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Button UI */
.btn {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 16px;
    height: 36px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--text-accent) 0%, #d4af37 100%);
    color: #070d19;
    box-shadow: 0 4px 12px rgba(241, 211, 179, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(241, 211, 179, 0.4);
}

.btn-share {
    background: linear-gradient(135deg, #1d9bf0 0%, #0a7cc4 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(29, 155, 240, 0.2);
}

.btn-share:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(29, 155, 240, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fff;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    height: 36px;
    width: 36px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

/* Music Button */
.music-btn {
    position: relative;
    transition: all var(--transition-fast);
}

.music-btn.music-on {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.5);
    color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
    animation: musicPulse 2.5s ease-in-out infinite;
}

.music-btn.music-on:hover {
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
}

@keyframes musicPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(56, 189, 248, 0.2); }
    50%       { box-shadow: 0 0 18px rgba(56, 189, 248, 0.5); }
}


/* --- Game Layout --- */
.game-layout {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* --- Playboard Canvas --- */
.playboard-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.playboard {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 120px; /* leaves space for ad banner */
    background: transparent;
    cursor: default;
    overflow: hidden;
}

.board-instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.15);
    font-size: 1.1rem;
    text-align: center;
    max-width: 400px;
    pointer-events: none;
    line-height: 1.6;
    font-weight: 300;
}

/* Trash Zone */
.trash-zone {
    position: absolute;
    bottom: 24px;
    left: 24px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.6);
    border: 2px dashed rgba(239, 68, 68, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 5;
    transition: all var(--transition-normal);
}

.trash-zone:hover, .trash-zone.drag-over {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

.trash-icon {
    font-size: 1.5rem;
    transition: transform var(--transition-fast);
}

.trash-zone:hover .trash-icon {
    transform: rotate(10deg) scale(1.1);
}

.trash-text {
    font-size: 0.55rem;
    text-transform: uppercase;
    margin-top: 4px;
    color: rgba(239, 68, 68, 0.7);
    letter-spacing: 0.5px;
    text-align: center;
    pointer-events: none;
}

/* --- Sidebar --- */
.sidebar {
    width: 320px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 8;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-accent);
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    position: relative;
    transition: border-color var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--text-accent);
}

.search-icon {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-right: 8px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.85rem;
}

.clear-search-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    position: absolute;
    right: 8px;
    padding: 0 4px;
}

.clear-search-btn:hover {
    color: #fff;
}

/* Sidebar Elements List */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
}

/* Custom Scrollbar for Sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}
.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
    padding: 12px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

/* --- Element Block Style --- */
.craft-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: grab;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.craft-item:hover {
    background: var(--bg-item-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.craft-item:active {
    cursor: grabbing;
    background: var(--bg-item-active);
}

.craft-item .item-emoji {
    font-size: 1.1rem;
    display: inline-block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.craft-item .item-name {
    pointer-events: none;
}

/* Board Items (Absolute Positioned) */
.board-item {
    position: absolute;
    z-index: 2;
    touch-action: none;
    box-shadow: var(--shadow-md);
}

.board-item.dragging {
    z-index: 100 !important;
    cursor: grabbing;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: #38bdf8;
    transform: scale(1.05);
}

/* Specific Special Element Animations */
.board-item.special-new {
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow: var(--shadow-lg), var(--shadow-glow-success);
}

.board-item.combining {
    animation: combineOut 0.15s ease-out forwards;
    pointer-events: none;
}

/* --- Particle Effects --- */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    z-index: 50;
    animation: particleAnimation 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

/* --- Modals (Glassmorphism) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
    color: var(--text-primary);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.close-modal:hover {
    color: #fff;
}

.modal-content h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
    color: var(--text-accent);
    text-align: center;
    font-weight: 800;
}

/* Help Modal Steps */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.help-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.step-num {
    background: var(--text-accent);
    color: #070d19;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.help-step p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.help-step p strong {
    color: var(--text-primary);
}

.help-goal {
    background: rgba(241, 211, 179, 0.05);
    border: 1px solid rgba(241, 211, 179, 0.15);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.9rem;
    margin-bottom: 24px;
    text-align: center;
}

.close-modal-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

/* Victory Screen Specifics */
.victory-content {
    max-width: 600px;
    text-align: center;
    border: 2px solid var(--text-accent);
    box-shadow: 0 0 30px rgba(241, 211, 179, 0.3);
}

.victory-banner {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    letter-spacing: 2px;
    animation: pulse 1.5s infinite alternate;
}

.victory-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.victory-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 28px;
}

.v-stat {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: 12px;
    min-width: 150px;
}

.v-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.v-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-accent);
}

.victory-badge {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 30px;
    display: inline-block;
    margin-bottom: 28px;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.modal-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 360px; /* Offset from sidebar */
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(74, 222, 128, 0.4);
    border-left: 4px solid #4ade80;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(50px);
    animation: toastIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
               toastOut 0.35s cubic-bezier(0.6, -0.28, 0.735, 0.045) 3.5s forwards;
}

/* --- Animations Keyframes --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(241, 211, 179, 0.2)); }
    100% { transform: scale(1.03); filter: drop-shadow(0 0 15px rgba(241, 211, 179, 0.6)); }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

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

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

.shake-animation {
    animation: shake 0.35s ease-in-out;
}

@keyframes particleAnimation {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) scale(0.2);
        opacity: 0;
    }
}

@keyframes toastIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* --- Responsive Styling --- */
@media (max-width: 900px) {
    .game-layout {
        flex-direction: column-reverse;
    }
    .playboard {
        bottom: 70px;
    }
    .sidebar {
        width: 100%;
        height: 250px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    .sidebar-content {
        padding: 12px;
    }
    .toast-container {
        right: 24px;
        bottom: 274px;
    }
    .game-stats {
        margin: 0 10px;
        display: none; /* Hide stats on small screens to save space */
    }
    .game-header {
        padding: 10px 16px;
    }
    .logo-icon {
        font-size: 1.6rem;
    }
    .logo-text h1 {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .logo-text p.tagline {
        display: none;
    }
    .control-buttons {
        gap: 4px;
    }
    #select-language {
        width: 42px;
        min-width: 42px;
        padding: 0 0 0 8px;
        background-image: none; /* Hide dropdown arrow */
    }
    #btn-clear, #btn-reset {
        font-size: 0 !important; /* Hide text nodes */
        width: 36px;
        height: 36px;
        min-width: 36px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }
    #btn-clear::before {
        content: "🧹";
        font-size: 1.1rem;
        line-height: 1;
    }
    #btn-reset::before {
        content: "🔄";
        font-size: 1.1rem;
        line-height: 1;
    }
    .sidebar {
        height: 25dvh;
        min-height: 160px;
        max-height: 220px;
    }
    .sidebar-footer {
        display: none; /* Hide double click instruction to save space */
    }
    .board-instruction {
        font-size: 0.9rem;
        padding: 0 20px;
        width: 100%;
        max-width: 320px;
    }
    .trash-zone {
        width: 60px;
        height: 60px;
        bottom: 16px;
        left: 16px;
    }
    .trash-icon {
        font-size: 1.25rem;
    }
    .trash-text {
        font-size: 0.5rem;
    }
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: calc(25dvh + 16px);
    }
    .toast {
        width: 100%;
        transform: translateY(50px);
        animation: toastInMobile 0.35s ease forwards,
                   toastOutMobile 0.35s ease 3.5s forwards;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none; /* Hide game title on extremely small screens */
    }
    .logo-area {
        gap: 0;
    }
}

@keyframes toastInMobile {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOutMobile {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ═══════════════════════════════════════════════
   HINT POPUP — Sağ Tık İpucu Sistemi
═══════════════════════════════════════════════ */
.hint-popup {
    position: fixed;
    z-index: 9999;
    min-width: 200px;
    max-width: 260px;
    max-height: 360px;
    background: rgba(15, 20, 35, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 179, 237, 0.25);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    user-select: none;
}
.hint-popup.hint-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}
.hint-popup.hint-closing {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
}

.hint-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.hint-emoji { font-size: 1.4rem; flex-shrink: 0; }
.hint-title-block { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hint-item-name { font-size: 0.85rem; font-weight: 700; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint-subtitle { font-size: 0.65rem; color: rgba(160,200,255,0.55); margin-top: 1px; }
.hint-close {
    background: none; border: none; color: rgba(255,255,255,0.3);
    font-size: 0.75rem; cursor: pointer; padding: 2px 4px; border-radius: 4px;
    flex-shrink: 0; transition: color 0.15s, background 0.15s;
}
.hint-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.hint-list {
    overflow-y: auto; padding: 6px 0; flex: 1;
    scrollbar-width: thin; scrollbar-color: rgba(99,179,237,0.3) transparent;
}
.hint-list::-webkit-scrollbar { width: 4px; }
.hint-list::-webkit-scrollbar-thumb { background: rgba(99,179,237,0.3); border-radius: 4px; }

.hint-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 14px; transition: background 0.12s; cursor: default;
}
.hint-row:hover { background: rgba(255,255,255,0.05); }
.hint-res-emoji { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }
.hint-res-name { font-size: 0.78rem; color: #cbd5e0; flex: 1; }
.hint-row-done .hint-res-name { color: #90cdf4; }
.hint-check { font-size: 0.65rem; color: #68d391; font-weight: 700; flex-shrink: 0; }

.hint-footer {
    padding: 7px 14px; font-size: 0.65rem;
    color: rgba(160,200,255,0.45); text-align: right;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.15);
}

/* ==========================================================================
   LIGHT THEME OVERRIDES
   ========================================================================== */
body.light-theme {
    --bg-main: #f1f5f9;
    --bg-header: rgba(248, 250, 252, 0.85);
    --bg-sidebar: rgba(241, 245, 249, 0.85);
    --bg-item: rgba(255, 255, 255, 0.95);
    --bg-item-hover: rgba(226, 232, 240, 0.9);
    --bg-item-active: rgba(203, 213, 225, 0.95);
    
    --border-color: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(15, 23, 42, 0.18);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-accent: #0f766e; /* Elegant dark teal */
    --accent-glow: rgba(15, 118, 110, 0.15);
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 15px rgba(13, 148, 136, 0.35);
    --shadow-glow-success: 0 0 20px rgba(22, 163, 74, 0.35);
}

body.light-theme {
    background-image: radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 0);
}

body.light-theme .board-instruction {
    color: rgba(15, 23, 42, 0.22);
}

body.light-theme .trash-zone {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: var(--shadow-sm);
}

body.light-theme .trash-text {
    color: rgba(220, 38, 38, 0.85);
}

body.light-theme .search-box {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .search-box input {
    color: #0f172a;
}

body.light-theme .clear-search-btn:hover {
    color: #0f172a;
}

body.light-theme .sidebar-footer {
    background: rgba(0, 0, 0, 0.02);
    border-top-color: var(--border-color);
}

body.light-theme .sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

body.light-theme .logo-text h1 {
    background: linear-gradient(135deg, #0f172a 0%, var(--text-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .modal-overlay {
    background: rgba(15, 23, 42, 0.35);
}

body.light-theme .modal-content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

body.light-theme .close-modal:hover {
    color: #0f172a;
}

body.light-theme .help-goal {
    background: rgba(15, 118, 110, 0.04);
    border-color: rgba(15, 118, 110, 0.12);
}

body.light-theme .help-step p strong {
    color: #0f172a;
}

body.light-theme .v-stat {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border-color);
}

body.light-theme .victory-badge {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.18);
    color: #15803d;
}

/* Hint Popup Light Mode adjustments */
body.light-theme .hint-popup {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(13, 148, 136, 0.25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

body.light-theme .hint-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .hint-item-name {
    color: #1e293b;
}

body.light-theme .hint-subtitle {
    color: rgba(13, 148, 136, 0.75);
}

body.light-theme .hint-close {
    color: rgba(0, 0, 0, 0.4);
}

body.light-theme .hint-close:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .hint-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .hint-res-name {
    color: #475569;
}

body.light-theme .hint-row-done .hint-res-name {
    color: #0d9488;
}

body.light-theme .hint-list::-webkit-scrollbar-thumb {
    background: rgba(13, 148, 136, 0.25);
}

body.light-theme .hint-footer {
    border-top-color: rgba(0, 0, 0, 0.05);
    background: rgba(0, 0, 0, 0.02);
    color: rgba(13, 148, 136, 0.65);
}

/* ==========================================================================
   STORY MODAL & SLIDES (PREMIUM GLASSMORPHISM)
   ========================================================================== */
.story-modal-content {
    max-width: 650px;
    width: 95%;
    padding: 0;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg), 0 0 35px rgba(0, 0, 0, 0.7);
}

body.light-theme .story-modal-content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.story-slides-container {
    position: relative;
    width: 100%;
}

.story-slide {
    display: none;
    flex-direction: column;
    width: 100%;
}

.story-slide.active {
    display: flex;
    animation: fadeInSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.story-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.story-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 6s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.story-slide.active .story-img {
    transform: scale(1.04);
}

.story-text-area {
    padding: 24px 32px 16px;
    text-align: center;
}

.story-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-primary);
    font-weight: 400;
}

body.light-theme .story-text {
    color: #1e293b;
}

.story-actions {
    padding: 0 32px 28px;
    display: flex;
    justify-content: center;
}

.story-actions .btn {
    min-width: 220px;
    padding: 12px 28px;
    font-size: 0.95rem;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

body.light-theme .story-actions .btn-primary {
    background: linear-gradient(135deg, var(--text-accent) 0%, #0d9488 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.25);
}
body.light-theme .story-actions .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

/* ==========================================================================
   GOOGLE ADS BANNER PLACEHOLDER
   ========================================================================== */
.ad-banner-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(728px, calc(100% - 40px));
    height: 90px;
    z-index: 5;
    overflow: hidden;
    pointer-events: auto;
    display: block;
}

/* Responsiveness for Ad Banner */
@media (max-width: 900px) {
    .ad-banner-container {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 468px;
        height: 50px;
    }
}

/* ==========================================================================
   LANGUAGE DROPDOWN SELECT STYLING
   ========================================================================== */
.select-lang {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    height: 36px;
    padding: 0 28px 0 12px;
    box-sizing: border-box;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
}

.select-lang:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

.select-lang option {
    background-color: #0d1527;
    color: #fff;
}

body.light-theme .select-lang {
    background-color: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.1);
    color: #0f172a;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

body.light-theme .select-lang:hover {
    background-color: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.2);
}

body.light-theme .select-lang option {
    background-color: #ffffff;
    color: #0f172a;
}

body.light-theme .icon-btn {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.1);
    color: #0f172a;
}

body.light-theme .icon-btn:hover {
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.2);
}

body.light-theme .btn-secondary {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.1);
    color: #0f172a;
}

body.light-theme .btn-secondary:hover {
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.2);
}

body.light-theme .btn-danger {
    background: rgba(239, 68, 68, 0.08);
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.25);
}

body.light-theme .btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #7f1d1d;
}

/* RTL Support for Arabic */
body.ar-lang {
    direction: rtl;
}
body.ar-lang .sidebar-header,
body.ar-lang .sidebar-content,
body.ar-lang .modal-content,
body.ar-lang .toast {
    text-align: right;
}
body.ar-lang .select-lang {
    background-position: left 8px center;
    padding-left: 28px;
    padding-right: 12px;
}




