/* Responsive Table Wrapper */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1.5rem;
    margin: 0 auto;
}

/* Scrollbar styling */
.table-wrapper::-webkit-scrollbar {
    height: 10px;
}
.table-wrapper::-webkit-scrollbar-track {
    background: #0b1329;
    border-radius: 8px;
}
.table-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #0ea5e9, #a855f7);
    border: 2.5px solid #0b1329;
    border-radius: 8px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #38bdf8, #c084fc);
}

/* Global Scrollbar Customization */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #0b1329;
    border-radius: 8px;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #0ea5e9, #a855f7);
    border: 2.5px solid #0b1329;
    border-radius: 8px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #38bdf8, #c084fc);
}

/* Modals scrolling on small screens */
#element-modal {
    z-index: 70;
}
#element-modal-content {
    max-height: 90vh;
    overflow-y: auto;
}
#element-modal-content::-webkit-scrollbar { width: 6px; }
#element-modal-content::-webkit-scrollbar-track { background: transparent; }
#element-modal-content::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

#bohr-model {
    width: 100%;
    max-width: 200px;
    height: auto;
    aspect-ratio: 1/1;
}
@media (min-width: 640px) {
    #bohr-model { max-width: 256px; }
}

/* Responsive Periodic Grid Base */
.periodic-grid {
    display: grid;
    /* Base size that looks good and readable, never shrink below this */
    grid-template-columns: repeat(18, minmax(40px, 1fr));
    gap: 0.2rem;
    position: relative;
    padding: 0.5rem;
    width: max-content; /* Force width based on content */
    margin: 0 auto;
}

@media (min-width: 768px) {
    .periodic-grid {
        grid-template-columns: repeat(18, minmax(50px, 1fr));
        gap: 0.3rem;
        padding: 1rem;
    }
}

@media (min-width: 1200px) {
    .periodic-grid {
        grid-template-columns: repeat(18, minmax(60px, 1fr));
        gap: 0.4rem;
    }
}

/* CSS based on the requested target site's design */

:root {
    --c-alkali: #ff2a6d;
    --c-alkaline-earth: #ffc857;
    --c-transition: #05d9e8;
    --c-post-transition: #005678;
    --c-metalloid: #d1f7ff;
    --c-nonmetal: #a855f7;
    --c-halogen: #d90368;
    --c-noble: #00ff9f;
    --c-unknown: #475569;
}

body {
    font-family: 'Vazirmatn', sans-serif;
}
.font-english {
    font-family: 'Vazirmatn', sans-serif; /* Update Outfit to Vazirmatn globally as requested */
}

/* Base element styles matching the prozhenegar theme */
.element {
    aspect-ratio: 1;
    position: relative;
    border-radius: 0.375rem;
    padding: 0.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    cursor: default;
    background-color: var(--c-unknown);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.element .number {
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    opacity: 0.8;
}

.element .symbol {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    margin: auto 0;
}

.element .name {
    font-size: 0.5rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* Colors for Lantanides and Actinides */
.cat-lanthanide { background-color: #bd00ff; color: white; }
.cat-actinide { background-color: #ff8e00; color: #1e293b; }
.cat-alkali { background-color: var(--c-alkali); }
.cat-alkaline-earth { background-color: var(--c-alkaline-earth); color: #1e293b; }
.cat-transition { background-color: var(--c-transition); color: #1e293b; }
.cat-post-transition { background-color: var(--c-post-transition); }
.cat-metalloid { background-color: var(--c-metalloid); color: #1e293b; }
.cat-nonmetal { background-color: var(--c-nonmetal); }
.cat-halogen { background-color: var(--c-halogen); }
.cat-noble { background-color: var(--c-noble); color: #1e293b; }
.cat-unknown { background-color: var(--c-unknown); }

/* Puzzle Specific Styles */
.element.puzzle-target {
    background-color: #1e293b;
    border: 2px dashed #475569;
    cursor: pointer;
    box-shadow: none;
    color: transparent;
}
.element.puzzle-target:hover {
    border-color: #0ea5e9;
    background-color: #334155;
    transform: scale(1.05);
    z-index: 10;
}

.element.puzzle-target .number,
.element.puzzle-target .symbol,
.element.puzzle-target .name {
    opacity: 0; /* Hide content until filled */
}

/* When a puzzle piece is correctly placed */
.element.filled {
    border: none;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1), 0 0 15px rgba(255,255,255,0.2);
    cursor: default;
    transform: scale(1);
    z-index: 5;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.element.filled .number,
.element.filled .symbol,
.element.filled .name {
    opacity: 1; /* Show content */
}

/* Pre-filled elements (Transition metals, etc.) */
.element.pre-filled {
    opacity: 0.4; /* Dim prefilled elements */
    filter: saturate(0.5);
}

.element.wrong-guess {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.2) !important;
}

.target-element-card {
    width: 80px;
    height: 80px;
    border-radius: 0.5rem;
    background-color: #0ea5e9;
    color: white;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
    animation: pulse 2s infinite;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0.5; filter: brightness(2); }
    50% { transform: scale(1.1); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(14, 165, 233, 0); }
    100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

/* Grid Layout Placement based on standard Periodic Table */
/* Using generic classes that will be applied by JS based on group/period */
/* Note: when headers are disabled (Active Game / Explore Mode), el.p maps to standard rows.
   But we need to ensure Lanthanides (p:9) and Actinides (p:10) always map to grid-rows 9 and 10 */
.element:not([style*="grid-row"]) {
    /* fallback rules if style is not injected dynamically */
}

.period-1:not([style*="grid-row"]) { grid-row: 1; }
.period-2:not([style*="grid-row"]) { grid-row: 2; }
.period-3:not([style*="grid-row"]) { grid-row: 3; }
.period-4:not([style*="grid-row"]) { grid-row: 4; }
.period-5:not([style*="grid-row"]) { grid-row: 5; }
.period-6:not([style*="grid-row"]) { grid-row: 6; }
.period-7:not([style*="grid-row"]) { grid-row: 7; }
.period-9:not([style*="grid-row"]) { grid-row: 9; }
.period-10:not([style*="grid-row"]) { grid-row: 10; }

/* Grid rules for standard explore/game mode layout */
.periodic-grid:not(.selection-mode) .element.period-1 { grid-row: 1; }
.periodic-grid:not(.selection-mode) .element.period-2 { grid-row: 2; }
.periodic-grid:not(.selection-mode) .element.period-3 { grid-row: 3; }
.periodic-grid:not(.selection-mode) .element.period-4 { grid-row: 4; }
.periodic-grid:not(.selection-mode) .element.period-5 { grid-row: 5; }
.periodic-grid:not(.selection-mode) .element.period-6 { grid-row: 6; }
.periodic-grid:not(.selection-mode) .element.period-7 { grid-row: 7; }
.periodic-grid:not(.selection-mode) .element.period-8 { grid-row: 8; }
.periodic-grid:not(.selection-mode) .element.period-9 { grid-row: 9; }
.periodic-grid:not(.selection-mode) .element.period-10 { grid-row: 10; }

.periodic-grid:not(.selection-mode) .element.group-1 { grid-column: 1; }
.periodic-grid:not(.selection-mode) .element.group-2 { grid-column: 2; }
.periodic-grid:not(.selection-mode) .element.group-3 { grid-column: 3; }
.periodic-grid:not(.selection-mode) .element.group-4 { grid-column: 4; }
.periodic-grid:not(.selection-mode) .element.group-5 { grid-column: 5; }
.periodic-grid:not(.selection-mode) .element.group-6 { grid-column: 6; }
.periodic-grid:not(.selection-mode) .element.group-7 { grid-column: 7; }
.periodic-grid:not(.selection-mode) .element.group-8 { grid-column: 8; }
.periodic-grid:not(.selection-mode) .element.group-9 { grid-column: 9; }
.periodic-grid:not(.selection-mode) .element.group-10 { grid-column: 10; }
.periodic-grid:not(.selection-mode) .element.group-11 { grid-column: 11; }
.periodic-grid:not(.selection-mode) .element.group-12 { grid-column: 12; }
.periodic-grid:not(.selection-mode) .element.group-13 { grid-column: 13; }
.periodic-grid:not(.selection-mode) .element.group-14 { grid-column: 14; }
.periodic-grid:not(.selection-mode) .element.group-15 { grid-column: 15; }
.periodic-grid:not(.selection-mode) .element.group-16 { grid-column: 16; }
.periodic-grid:not(.selection-mode) .element.group-17 { grid-column: 17; }
.periodic-grid:not(.selection-mode) .element.group-18 { grid-column: 18; }

/* Selection Mode Styles */
.selection-mode .element {
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.4;
    filter: saturate(0.5);
}
.selection-mode .element.selected-for-quiz {
    opacity: 1;
    filter: saturate(1);
    box-shadow: 0 0 12px var(--c-transition), inset 0 0 0 2px #fff;
    transform: scale(1.05);
    z-index: 10;
}
.selection-mode .element:hover {
    transform: scale(1.1);
    opacity: 0.8;
    z-index: 20;
}

/* Quick Select Headers and Row handles */
.col-selector-btn {
    font-size: 0.55rem;
    font-weight: 800;
    color: #38bdf8;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 2px 0;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    font-family: 'Vazirmatn', sans-serif;
    margin-bottom: 2px;
}
.col-selector-btn:hover {
    background: #0ea5e9;
    color: white;
    border-color: #38bdf8;
}

.row-selector-btn {
    font-size: 0.55rem;
    font-weight: 800;
    color: #c084fc;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    font-family: 'Vazirmatn', sans-serif;
    margin-right: 2px;
}
.row-selector-btn:hover {
    background: #a855f7;
    color: white;
    border-color: #c084fc;
}

/* Spacer block */
.period-8 {
    grid-column: 1 / span 19;
    height: 40px; /* Space between row 7 and Lanthanides */
    pointer-events: none;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Selection Mode Styles */
.selection-mode .element {
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.4;
    filter: saturate(0.5);
}
.selection-mode .element.selected-for-quiz {
    opacity: 1;
    filter: saturate(1);
    box-shadow: 0 0 12px var(--c-transition), inset 0 0 0 2px #fff;
    transform: scale(1.05);
    z-index: 10;
}
.selection-mode .element:hover {
    transform: scale(1.1);
    opacity: 0.8;
    z-index: 20;
}

/* Explore Mode Styles */
.explore-mode .element {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.explore-mode .element:hover {
    transform: scale(1.6);
    z-index: 50;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.4);
    filter: saturate(1.2) brightness(1.2);
}

/* Bohr Model SVG Animations */
@keyframes orbit-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.electron-orbit {
    transform-origin: 100px 100px;
}

/* ============================================================
   NEW FEATURE STYLES — Combo, Hint, Story Map, Confetti, etc.
   ============================================================ */

/* --- Combo indicator --- */
.combo-indicator {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}
.combo-indicator.visible {
    opacity: 1;
    animation: combo-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.combo-text {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(90deg, #fbbf24, #f97316, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 8px rgba(249, 115, 22, 0.6));
}
.combo-sub {
    font-size: 0.9rem;
    color: #fbbf24;
    font-weight: 700;
}
@keyframes combo-pop {
    0% { transform: translateX(-50%) scale(0.5) rotate(-6deg); }
    60% { transform: translateX(-50%) scale(1.25) rotate(3deg); }
    100% { transform: translateX(-50%) scale(1) rotate(0deg); }
}

/* --- Floating score popups (+10 / -5) --- */
.score-popup {
    position: absolute;
    z-index: 70;
    font-weight: 900;
    font-size: 1.3rem;
    pointer-events: none;
    animation: float-up 0.9s ease-out forwards;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
@keyframes float-up {
    0% { transform: translateY(0) scale(0.7); opacity: 0; }
    25% { transform: translateY(-12px) scale(1.15); opacity: 1; }
    100% { transform: translateY(-48px) scale(1); opacity: 0; }
}

/* --- Correct answer glow burst --- */
.burst {
    position: absolute;
    inset: -4px;
    border-radius: 0.5rem;
    pointer-events: none;
    animation: burst-fade 0.5s ease-out forwards;
}
@keyframes burst-fade {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.9), 0 0 30px 10px var(--burst-color, #00ff9f); opacity: 1; }
    100% { box-shadow: 0 0 0 20px rgba(255,255,255,0), 0 0 40px 20px transparent; opacity: 0; }
}

/* --- Hint pulse (green row/column flash) --- */
.hint-pulse {
    animation: hint-glow 0.6s ease-in-out 4 !important;
    z-index: 15;
}
@keyframes hint-glow {
    0%, 100% { box-shadow: none; filter: none; }
    50% {
        box-shadow: 0 0 18px 6px #00ff9f, inset 0 0 0 2px #00ff9f !important;
        filter: brightness(1.6);
    }
}

/* --- Challenge timer bar --- */
.challenge-bar-wrap {
    width: 100%;
    height: 10px;
    background: #1e293b;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
    border: 1px solid #334155;
}
.challenge-bar {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #00ff9f, #05d9e8);
    transition: width 0.95s linear, background 0.3s;
}
.challenge-bar.warning {
    background: linear-gradient(90deg, #ffc857, #ff8e00);
}
.challenge-bar.danger {
    background: linear-gradient(90deg, #ff2a6d, #ef4444);
    animation: danger-blink 0.5s infinite alternate;
}
@keyframes danger-blink {
    from { opacity: 1; }
    to { opacity: 0.55; }
}
.timeout-flash {
    animation: shake 0.4s ease both;
    outline: 2px solid #ff2a6d;
}

/* --- Story Map --- */
#story-map-modal .map-scroll {
    max-height: 62vh;
    overflow-y: auto;
    padding: 4px 2px;
}
.map-region {
    border: 2px solid;
    border-radius: 1.25rem;
    padding: 1rem;
    margin-bottom: 0.9rem;
    background: linear-gradient(135deg, rgba(15,23,42,0.85), rgba(30,41,59,0.65));
    position: relative;
    overflow: hidden;
}
.map-region.locked {
    opacity: 0.45;
    filter: grayscale(0.8);
}
.map-region::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, currentColor 0%, transparent 70%);
    opacity: 0.08;
    pointer-events: none;
}
.map-level-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: right;
    background: rgba(15,23,42,0.7);
    border: 1.5px solid #334155;
    border-radius: 0.9rem;
    padding: 0.65rem 0.9rem;
    color: #f8fafc;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}
.map-level-btn:hover:not(:disabled) {
    transform: translateX(-4px);
    border-color: currentColor;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.map-level-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.map-level-badge {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    background: rgba(255,255,255,0.06);
}
.map-level-btn.done .map-level-badge {
    background: rgba(34, 197, 94, 0.18);
    border: 1.5px solid #22c55e;
}
.region-progress-track {
    height: 7px;
    border-radius: 999px;
    background: rgba(0,0,0,0.4);
    overflow: hidden;
    margin-top: 0.6rem;
}
.region-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: currentColor;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Teaching overlay inside story quiz */
.teach-card {
    background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(168,85,247,0.12));
    border: 1.5px dashed #38bdf8;
    border-radius: 1rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.75rem;
    animation: teach-in 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes teach-in {
    from { opacity: 0; transform: translateY(14px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.teach-element-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.8rem;
    padding: 0.5rem 0.8rem;
    margin: 0.25rem;
    animation: chip-in 0.4s ease both;
}
@keyframes chip-in {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
.story-banner {
    background: linear-gradient(90deg, rgba(14,165,233,0.15), rgba(168,85,247,0.15));
    border: 1.5px solid #38bdf8;
    border-radius: 1rem;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
    font-weight: 800;
    color: #38bdf8;
    margin-bottom: 0.75rem;
}

/* --- Heatmap (progress map) --- */
.heat-none { outline: 2px solid rgba(148,163,184,0.25); }
.heat-weak { outline: 2.5px solid #ff2a6d; box-shadow: 0 0 8px rgba(255,42,109,0.5); }
.heat-mid { outline: 2.5px solid #ffc857; box-shadow: 0 0 8px rgba(255,200,87,0.4); }
.heat-good { outline: 2.5px solid #05d9e8; box-shadow: 0 0 8px rgba(5,217,232,0.4); }
.heat-master { outline: 2.5px solid #00ff9f; box-shadow: 0 0 10px rgba(0,255,159,0.55); }

#heatmap-legend {
    display: flex;
    gap: 0.9rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}
.legend-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- Enhanced info card property grid --- */
.props-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}
.prop-box {
    background: rgba(15,23,42,0.75);
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 0.5rem 0.6rem;
    text-align: center;
    transition: all 0.2s;
}
.prop-box:hover {
    border-color: #0ea5e9;
    transform: translateY(-2px);
}
.prop-label {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}
.prop-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: #f8fafc;
    direction: ltr;
}

/* --- Confetti --- */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 95;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 16px;
    border-radius: 3px;
    animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(-5vh) rotate(0deg) rotateY(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg) rotateY(540deg); opacity: 0.85; }
}
.trophy-shake {
    animation: trophy-shake 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    display: inline-block;
}
@keyframes trophy-shake {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(-16deg) scale(1.2); }
    30% { transform: rotate(14deg) scale(1.2); }
    45% { transform: rotate(-10deg) scale(1.15); }
    60% { transform: rotate(8deg) scale(1.1); }
    75% { transform: rotate(-5deg); }
}

/* ============================================================
   STORY TEACH EFFECTS — locate, bootcamp, extra juice ✨
   ============================================================ */
.teach-locate-btn {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid #38bdf8;
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    margin-right: 0.35rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.18s ease;
}
.teach-locate-btn:hover {
    background: #38bdf8;
    transform: scale(1.15) rotate(-8deg);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
}
.element.teach-locate {
    animation: teach-spotlight 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275) both !important;
    z-index: 5;
    position: relative;
}
@keyframes teach-spotlight {
    0% { transform: scale(0.3) rotate(-180deg); opacity: 0; box-shadow: none; }
    55% { transform: scale(1.65) rotate(8deg); opacity: 1; box-shadow: 0 0 34px 12px rgba(94, 234, 212, 0.85); filter: brightness(1.6); }
    100% { transform: scale(1.28); opacity: 1; box-shadow: 0 0 20px 6px rgba(94, 234, 212, 0.6); }
}
.locate-marker {
    position: fixed;
    z-index: 90;
    background: #0f172a;
    border: 2px solid #5eead4;
    border-radius: 0.9rem;
    padding: 0.55rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: #f1f5f9;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 18px rgba(94, 234, 212, 0.35);
    animation: marker-in 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.4) both;
    white-space: nowrap;
}
@keyframes marker-in {
    from { opacity: 0; transform: translateY(14px) scale(0.85); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.bootcamp-dim {
    opacity: 0.13 !important;
    filter: grayscale(0.9) blur(1px);
    transition: all 0.5s ease;
}
#bootcamp-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 1rem;
    pointer-events: none;
    animation: teach-in 0.4s ease both;
}
.bootcamp-title {
    pointer-events: none;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.92));
    border: 1.5px solid #5eead4;
    color: #5eead4;
    font-weight: 900;
    font-size: 1.05rem;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 26px rgba(94, 234, 212, 0.3);
    animation: bootcamp-pulse 1.6s ease-in-out infinite;
}
@keyframes bootcamp-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 12px 40px rgba(0,0,0,.6), 0 0 26px rgba(94,234,212,.3); }
    50% { transform: scale(1.06); box-shadow: 0 12px 44px rgba(0,0,0,.6), 0 0 40px rgba(94,234,212,.55); }
}
.bootcamp-skip {
    pointer-events: auto;
    margin-right: 0.8rem;
    align-self: center;
    background: rgba(51, 65, 85, 0.92);
    border: 1px solid #64748b;
    color: #e2e8f0;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
}
.bootcamp-skip:hover {
    background: #334155;
    border-color: #94a3b8;
    transform: translateY(-2px);
}

/* 💥 screen shake on wrong answer */
.screen-shake {
    animation: screen-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes screen-shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 1px, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, -1px, 0); }
    40%, 60% { transform: translate3d(4px, 1px, 0); }
}
/* ❤️ heart pop when losing a life */
#lives.heart-hit {
    animation: heart-pop 0.5s ease;
}
@keyframes heart-pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.5) rotate(-8deg); filter: drop-shadow(0 0 8px rgba(255, 42, 109, 0.9)); }
    100% { transform: scale(1); }
}

/* End-game stat chips */
.stat-chips {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}
.stat-chip {
    background: rgba(15,23,42,0.8);
    border: 1px solid #334155;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #cbd5e1;
    animation: chip-in 0.4s ease both;
}
.stat-chip b { color: #38bdf8; }

/* Sound toggle button */
#sound-toggle-btn {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 60;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: #1e293b;
    border: 1.5px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
#sound-toggle-btn:hover {
    border-color: #0ea5e9;
    transform: scale(1.08);
}

/* Story mode dashboard accent */
.game-dashboard.story-active {
    border-color: #a855f7;
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.25);
}

/* Region connector arrow on the map */
.map-connector {
    text-align: center;
    color: #475569;
    font-size: 1.1rem;
    line-height: 1;
    margin: -0.55rem 0 0.35rem;
    user-select: none;
}
