/**
 * Social Studies: Maps & Directions - Enhanced Styles
 * File: /qmbportal/quizzes/assets/css/social_studies_maps.css
 */
 @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;900&display=swap');
 @import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');
 
 /* Import design system and components */
 @import url('components/utilities.css');
 @import url('components/header.css');
 @import url('components/modal.css');

/* --- GENERAL LAYOUT --- */
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #112167 0%, #2c3e50 100%);
    min-height: 100vh;
    padding: var(--space-xl);
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-pink), var(--accent-green), var(--accent-orange));
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.menu-ssmaps {
    display: flex;
    align-items: center;
    justify-content:space-around;
}
.grade-select {
    position: relative;
    display: inline-block;
    max-width: 200px;
    width: 100%;
    margin-right: 40px;
    transition: all 0.3s ease;
}
.selectClass {
    width: 100%;
    padding: 10px 30px 10px 15px; /* Added padding for text and arrow */
    font-size: 1rem;
    color: #333;
    background-color: #fff;
    border: 2px solid var(--golden-light);
    border-radius: var(--radius-sm); /* Slightly larger radius for a modern look */
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.selectClass option {
    padding: 8px;
    background-color: white;
}
.grade-select::after {
    content: '▼';
    font-size: 0.8rem;
    color: var(--orange-dark);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
/* --- Hover State --- */
.selectClass:hover {
    border-color: var(--golden);
}

/* --- Focus State (for accessibility and user feedback) --- */
.selectClass:focus {
    outline: none;
    border-color: var(--golden-dark);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2); /* Soft glow using your orange color */
}

/* --- Disabled State --- */
.selectClass:disabled {
    background-color: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    border-color: #ddd;
}
/* --- SUB MENU / ACTIVITY TABS --- */
.sub-menu-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.sub-menu-screen > div {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 1em;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    color: #5a6c7d;
    user-select: none;
    width: 200px;
}

.sub-menu-screen > div:hover {
    color: #2c3e50;
    transform: translateY(-2px);
}

.sub-menu-screen > div.active {
    background: linear-gradient(135deg, var(--golden-dark) 0%, var(--orange) 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.sub-menu-screen > div.completed {
    position: relative;
}

.sub-menu-screen > div.completed::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.5);
}

.sub-menu-screen > div.locked {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.sub-menu-screen > div.locked::before {
    content: '🔒 ';
    margin-right: 5px;
}

/* Add icons before text */
.sub-menu-screen > div:nth-child(1):not(.locked)::before {
    content: '📚 ';
    font-size: 1.1em;
}

.sub-menu-screen > div:nth-child(2):not(.locked)::before {
    content: '📝 ';
    font-size: 1.1em;
}

.sub-menu-screen > div:nth-child(3):not(.locked)::before {
    content: '🗺️ ';
    font-size: 1.1em;
}

.activity-container {
    margin-top: 5px;
}
/* --- VISUAL PROGRESS INDICATOR --- */
.grade-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

.grade-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: fadeIn 0.5s ease;
}

.grade-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.grade-value {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1;
}

.progress-stats {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    color: #2c3e50;
}

.stat-item i {
    color: #667eea;
}

/* --- SMOOTH TRANSITIONS --- */
.grade-changing {
    opacity: 0.3;
    transform: scale(0.98);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- CONCEPT SCREEN --- */
.concept-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    border: 1px solid rgba(52, 152, 219, 0.1);
}

.concept-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.nav-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.nav-btn:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.nav-btn:active:not(:disabled) {
    transform: scale(1.02);
}

.nav-btn:disabled {
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.5;
}
/* Previous button - floats on left */
.nav-btn.nav-prev {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Next button - floats on right */
.nav-btn.nav-next {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.nav-btn.nav-prev:hover:not(:disabled),
.nav-btn.nav-next:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.05);
}

/* Badge - floats in center */
.concept-progress {
    position: absolute;
    top: 75px;
    right: 25px;
}

.review-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}


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

.concept-card h2 {
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 2em;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.concept-emoji {
    display: block;
    font-size: 8rem;
    line-height: 1;
    margin: 10px auto;
    text-align: center;
    max-height: 250px;
    user-select: none;
}

.concept-card img {
    max-width: 450px;
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    border-radius: 15px;
    margin: 5px 0;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.concept-card img:hover {
    transform: scale(1.02);
}

.concept-card p {
    font-size: 1.2em;
    line-height: 1.8;
    color: #34495e;
    margin: 25px 0;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.speak-btn {
    position: absolute;
    top:20px;
    right:20px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    align-items: center;
}

.speak-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.6);
}

.speak-btn:active {
    transform: translateY(0);
}

.speak-btn i {
    font-size: 1.1em;
}

.quiz-btn {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    border: none;
    padding: 16px 36px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.15em;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(250, 112, 154, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(250, 112, 154, 0.6);
}

.quiz-btn:active:not(:disabled) {
    transform: translateY(-1px) scale(1.02);
}

.quiz-btn:disabled {
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.quiz-btn i {
    font-size: 1.2em;
}

.unlock-message {
    display: block;
    text-align: center;
    color: #e74c3c;
    margin-top: 15px;
    font-size: 0.95em;
    font-weight: 500;
    animation: fadeIn 0.5s ease;
}

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

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

/* --- EXPORT/IMPORT BUTTONS --- */
.export-import-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.icon-btn {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.icon-btn i {
    font-size: 1.1em;
    transition: color 0.3s ease;
}

.icon-btn:hover i {
    color: white;
}

/* --- DATA VALIDATION FEEDBACK --- */
.validation-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 0.9em;
    animation: shake 0.5s;
}

.validation-success {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 0.9em;
    animation: fadeIn 0.5s;
}

/* --- PROGRESS SUMMARY TOOLTIP --- */
.progress-stats .stat-item {
    position: relative;
    cursor: help;
}

.progress-stats .stat-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    margin-bottom: 5px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

/* --- QUIZ SCREEN --- */
#quiz-screen {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#quiz-question {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
}

#quiz-options {
    list-style: none;
    padding: 0;
}

#quiz-options li {
    background: #ecf0f1;
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1em;
}

#quiz-options li:hover {
    background: #3498db;
    color: white;
    transform: translateX(5px);
}

#quiz-feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 1.2em;
}

#quiz-feedback.correct {
    background: #d4edda;
    color: #155724;
}

#quiz-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
}

/* --- MAP SCREEN --- */
#map-screen {
    background: white;
    border-radius: 12px;
    padding: 20px 24px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

#map-instruction {
    color: #2c3e50;
    font-size: 1.1em;
    margin: 0;
    font-weight: 700;
}

.mode-badge {
    background: #3498db;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

/* --- MAP BODY: map is the star, controls are the compact sidebar --- */
.map-body {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* --- MAP GRID: grows to fill available space — the protagonist --- */
#map-grid {
    display: grid;
    flex: 1 1 auto;     /* map expands */
    max-width: 580px;
    gap: 3px;
    background: #bdc3c7;
    padding: 8px;
    border-radius: 8px;
    margin: 0;
}

.map-cell {
    font-size: 1.6em;
}

.map-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecf0f1;
    border-radius: 4px;
    font-size: 1.5em;
    position: relative;
    transition: all 0.3s;
}

.map-cell.player {
    background: #3498db;
    animation: pulse 1s infinite;
    position: relative;
}

.map-cell.player::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid rgba(255,255,255,0.8);
}

.map-cell.player[data-direction="south"]::after {
    top: auto;
    bottom: 2px;
    border-bottom: none;
    border-top: 12px solid rgba(255,255,255,0.8);
}

.map-cell.player[data-direction="east"]::after {
    top: 50%;
    left: auto;
    right: 2px;
    transform: translateY(-50%);
    border-bottom: none;
    border-left: 12px solid rgba(255,255,255,0.8);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.map-cell.player[data-direction="west"]::after {
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    border-bottom: none;
    border-right: 12px solid rgba(255,255,255,0.8);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.map-cell.destination {
    background: #2ecc71;
    animation: glow 2s infinite;
}

.map-cell.obstacle {
    background: #95a5a6;
}

.map-cell.moving {
    animation: bounce 0.3s;
}

.map-cell.success {
    animation: celebrate 0.5s;
}

.map-cell.error {
    animation: shake 0.5s;
}

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

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(46, 204, 113, 0.5); }
    50% { box-shadow: 0 0 20px rgba(46, 204, 113, 0.8); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-10deg); }
    75% { transform: scale(1.2) rotate(10deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* --- MAP INTERFACE: compact sidebar — never wider than needed --- */
.map-interface {
    flex: 0 0 230px;
    width: 230px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 0;
}

.instruction-list {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.instruction-list h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
}

#instructions-container {
    max-height: 300px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    opacity: 0.7;
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 20px;
}
.empty-state::before {
    content: '📝';
    font-size: 2em;
    margin-bottom: 10px;
    opacity: 0.5;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.instruction-item.active {
    border-color: #3498db;
    background: #ebf5fb;
}

.instr-number {
    background: #3498db;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 600;
    flex-shrink: 0;
}

.instr-text {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
}

.remove-instr {
    background: #e74c3c;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    transition: background 0.3s;
    flex-shrink: 0;
}

.remove-instr:hover {
    background: #c0392b;
}

/* --- CONTROLS --- */
.controls-section {
    background: #f8f9fa;
    padding: 14px 12px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.direction-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}

.middle-row {
    display: flex;
    gap: 16px;
}

.dir-btn, .turn-btn {
    padding: 9px 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.875em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: #3498db;
    color: white;
    min-width: 78px;
    min-height: 44px;
}

.dir-btn:hover, .turn-btn:hover {
    background: #2980b9;
    transform: scale(1.05);
}

.dir-btn:active, .turn-btn:active {
    transform: scale(0.95);
}

.dir-btn:disabled, .turn-btn:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;
}

.turn-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.turn-btn {
    background: #9b59b6;
}

.turn-btn:hover {
    background: #8e44ad;
}

/* --- TEXT INPUT --- */
.controls-section label {
    display: block;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 10px;
}

#text-instructions {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1em;
    resize: vertical;
    margin-bottom: 10px;
    font-family: inherit;
}

#text-instructions:focus {
    outline: none;
    border-color: #3498db;
}

#parse-text-btn {
    margin-top: 10px;
    width: 100%;
}

/* --- ACTION BUTTONS --- */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 4px;
}

.action-buttons button {
    min-width: 130px;
    min-height: 44px;
    flex: 1;
}

/* --- SCENARIO SUMMARY --- */
.scenario-summary {
    text-align: left;
    padding: 20px;
}

.scenario-summary p {
    margin: 10px 0;
    font-size: 1.1em;
}

.primary-btn, .secondary-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.primary-btn:disabled {
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.secondary-btn {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #5a6c7d;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: #2c3e50;
}

.secondary-btn:active {
    transform: translateY(0);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .grade-select {
        position: relative;
        display: inline-block;
        max-width: 100px;
        width: 100%;
        margin-right: 40px;
    }
    .selectClass {
        width: 100%;
        padding: 4px 12px 4px 8px; /* Added padding for text and arrow */
    }
    .sub-menu-screen {
        gap: 8px;
        padding: 8px;
        margin-bottom: 10px;
        border-radius: 40px;
    }
    
    .sub-menu-screen > div {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .sub-menu-screen > div:nth-child(1):not(.locked)::before,
    .sub-menu-screen > div:nth-child(2):not(.locked)::before,
    .sub-menu-screen > div:nth-child(3):not(.locked)::before {
        font-size: 1em;
    }
    
    .sub-menu-screen > div.completed::after {
        width: 20px;
        height: 20px;
        font-size: 0.75em;
        top: -6px;
        right: -6px;
    }
    .concept-card {
        padding: 25px 20px;
    }
    
    .concept-header {
        margin-bottom: 20px;
    }
    
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1em;
    }
    
    .review-badge {
        width: 20px;
        height: 20px;
        font-size: 0.8em;
    }
    
    .concept-card h2 {
        font-size: 1.6em;
    }
    
    .concept-emoji {
        font-size: 6rem;
        max-height: 200px;
    }

    .concept-card img {
        max-height: 200px;
    }
    
    .concept-card p {
        font-size: 1.05em;
    }
    
    .speak-btn, .quiz-btn {
        padding: 12px 24px;
        font-size: 1em;
    }
    
    .map-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #map-grid {
        max-width: 100%;
    }
    
    .map-cell {
        font-size: 1.5em;
    }
    
    .middle-row {
        gap: 40px;
    }
    
    .dir-btn, .turn-btn {
        min-width: 100px;
        padding: 12px 20px;
        font-size: 0.9em;
    }
    .primary-btn, .secondary-btn {
        padding: 12px 24px;
        font-size: 0.95em;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons button {
        width: 100%;
    }
    .grade-indicator {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px 0;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .progress-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .export-import-buttons {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    
    .icon-btn {
        width: 35px;
        height: 35px;
    }
}
@media (max-width: 478px) {
    .grade-select {
        position: block;
        display: inline-block;
        margin-right: 10px;
    }
    .sub-menu-screen {
        gap: 8px;
        padding: 8px;
        margin-bottom: 10px;
        border-radius: 40px;
        max-width: 333px;
    }
    .menu-ssmaps {
        flex-direction: column;
        gap: 15px;
    }
    
    .grade-select {
        margin-right: 0;
        max-width: 100%;
    }
    
    .sub-menu-screen {
        width: 100%;
    }
    .grade-badge {
        flex-direction: row;
        gap: 10px;
        padding: 8px 15px;
    }
    
    .grade-label {
        font-size: 0.9em;
    }
    
    .grade-value {
        font-size: 1.2em;
    }
    
    .progress-stats {
        padding: 8px 15px;
        font-size: 0.85em;
    }
    
    .stat-item i {
        font-size: 0.9em;
    }
}
header {
    position: relative;
    padding-right: 250px; /* Make room for grade indicator */
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 768px) {
    header {
        padding-right: 20px;
    }
}

/* ============================================================
   S015 GAMIFICATION LAYER — social_studies_maps.css
   All tokens from tokens.css only. No raw hex values.
   Mobile parity required on every component.
   ============================================================ */

/* --- STAMPS (CD-05: passport-register, distinct from badges) --- */

.ssm-card-stamp {
    position: absolute;
    top: 12px;
    left: 16px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 8px;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.ssm-stamp--studied {
    background: var(--golden-light, #f5e6c8);
    color: var(--orange-dark, #c0392b);
    border: 2px solid var(--golden, #f0c040);
    animation: ssm-stamp-bounce 250ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ssm-stamp--mastered {
    background: var(--accent-green, #2ecc71);
    color: #fff;
    border: 2px solid var(--accent-green, #27ae60);
    animation: ssm-stamp-bounce 250ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes ssm-stamp-bounce {
    0%   { transform: scale(0.4) rotate(-8deg); opacity: 0; }
    60%  { transform: scale(1.15) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

@media (max-width: 768px) {
    .ssm-card-stamp {
        top: 8px;
        left: 8px;
        font-size: 0.7em;
        min-width: 40px;
        min-height: 40px;
    }
}

/* --- SELF-CHECK PANEL (SO-02: suppressed at grade='0' via JS) --- */

.ssm-selfcheck {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f8f9fa);
    border: 2px dashed var(--golden, #f0c040);
    border-radius: var(--radius-md, 12px);
    text-align: center;
    animation: ssm-stamp-bounce 250ms ease both;
}

.ssm-selfcheck-header {
    font-weight: 700;
    font-size: 1em;
    color: var(--text-primary, #2c3e50);
    margin: 0 0 10px;
}

.ssm-selfcheck-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.ssm-selfcheck-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 50px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ssm-selfcheck-yes {
    background: var(--accent-green, #2ecc71);
    color: #fff;
}

.ssm-selfcheck-review {
    background: var(--golden-light, #f5e6c8);
    color: var(--orange-dark, #c0392b);
}

.ssm-selfcheck-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* --- STREAK COUNTER --- */

.ssm-streak-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 1em;
    font-weight: 700;
    color: var(--primary-blue, #2c3e50);
    padding: 8px 0 4px;
    min-height: 32px;
    transition: color 0.2s ease;
}

.ssm-streak-count {
    font-size: 1.4em;
    line-height: 1;
}

.ssm-streak-label {
    font-weight: 600;
    font-size: 0.9em;
}

.ssm-streak--sparkle {
    color: var(--golden-dark, #e67e22);
    animation: ssm-sparkle 400ms ease both;
}

.ssm-streak--glow {
    color: var(--accent-orange, #e67e22);
    animation: ssm-sparkle 400ms ease both;
    text-shadow: 0 0 8px var(--golden, #f0c040);
}

.ssm-streak--burst {
    color: var(--accent-pink, #e91e63);
    animation: ssm-burst 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes ssm-sparkle {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18) rotate(-3deg); }
    70%  { transform: scale(0.96) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes ssm-burst {
    0%   { transform: scale(0.8); opacity: 0.5; }
    50%  { transform: scale(1.25); opacity: 1; }
    75%  { transform: scale(0.97); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .ssm-streak-counter {
        font-size: 0.9em;
    }
    .ssm-streak-count {
        font-size: 1.2em;
    }
}

/* --- QUIZ ANSWER STATES --- */

#quiz-options li.ssm-quiz-option--correct {
    background: var(--accent-green, #2ecc71);
    color: #fff;
    animation: ssm-pulse-correct 250ms ease both;
}

#quiz-options li.ssm-quiz-option--incorrect {
    background: var(--accent-pink, #e74c3c);
    color: #fff;
    animation: ssm-shake 300ms ease both;
}

#quiz-options li.ssm-quiz-option--correct-reveal {
    background: var(--accent-green, #2ecc71);
    color: #fff;
    transition: background 0.6s ease, color 0.6s ease;
}

@keyframes ssm-pulse-correct {
    0%   { transform: scale(1.0); }
    50%  { transform: scale(1.08); }
    100% { transform: scale(1.0); }
}

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

/* --- MAP UI — LIVE TIMER + ATTEMPTS --- */

.ssm-map-timer,
.ssm-map-attempts {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-primary, #2c3e50);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    padding: 4px 10px;
    margin-left: 8px;
}

.ssm-map-timer span:first-child,
.ssm-map-attempts span:first-child {
    opacity: 0.7;
    font-weight: 500;
}

#ssm-timer-value,
#ssm-attempts-value {
    font-weight: 700;
    color: var(--primary-blue, #2c3e50);
}

@media (max-width: 768px) {
    .ssm-map-timer,
    .ssm-map-attempts {
        font-size: 0.78em;
        padding: 3px 8px;
        margin-left: 4px;
    }
}

/* --- MAP BLOCKED ANIMATION --- */

.ssm-map-blocked {
    animation: ssm-blocked-bounce 400ms ease both;
}

@keyframes ssm-blocked-bounce {
    0%   { transform: scale(1); box-shadow: none; }
    30%  { transform: scale(0.92); box-shadow: 0 0 0 4px var(--accent-pink, #e74c3c); }
    60%  { transform: scale(1.05); }
    100% { transform: scale(1); box-shadow: none; }
}

/* --- STARS (displayed in scenario summary) --- */

.ssm-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 8px 0 12px;
}

.ssm-star {
    font-size: 2.2em;
    color: #d0d0d0;
    display: inline-block;
    animation: ssm-star-appear 300ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ssm-star--earned {
    color: var(--golden, #f0c040);
    text-shadow: 0 2px 8px rgba(240, 192, 64, 0.5);
}

@keyframes ssm-star-appear {
    0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
    70%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.ssm-perfect-run {
    display: inline-block;
    background: linear-gradient(135deg, var(--golden-dark, #e67e22), var(--golden, #f0c040));
    color: #fff;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.05em;
    border-radius: 50px;
    padding: 4px 16px;
    margin-bottom: 10px;
    animation: ssm-burst 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@media (max-width: 768px) {
    .ssm-star {
        font-size: 1.8em;
    }
}

/* --- PATH TRACE (800ms reveal on success) --- */

.ssm-path-trace {
    background: rgba(46, 204, 113, 0.35) !important;
    outline: 2px solid var(--accent-green, #2ecc71);
    animation: ssm-path-trace 400ms ease both;
    z-index: 1;
}

@keyframes ssm-path-trace {
    0%   { background: rgba(46, 204, 113, 0); outline-color: transparent; }
    60%  { background: rgba(46, 204, 113, 0.5); }
    100% { background: rgba(46, 204, 113, 0.35); }
}

/* --- EXPEDITION LOG (CD-05: medal/scouting register, distinct from stamps) --- */

.ssm-expedition-log {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg-secondary, #f8f9fa);
    border-top: 1px solid rgba(0,0,0,0.06);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.ssm-log-heading {
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #5a6c7d);
    margin: 0;
    white-space: nowrap;
}

.ssm-badge-slot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px dashed #ccc;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6em;
    font-weight: 700;
    text-align: center;
    color: #aaa;
    transition: border-color 0.3s ease;
    position: relative;
}

.ssm-badge--earned {
    border: 2px solid var(--golden, #f0c040);
    background: linear-gradient(135deg, var(--golden-light, #f5e6c8), #fff);
    color: var(--orange-dark, #c0392b);
    animation: ssm-badge-stamp-in 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Badge stamp-in is visually distinct from stamp-bounce: bigger, rotates more */
@keyframes ssm-badge-stamp-in {
    0%   { transform: scale(0.2) rotate(-25deg); opacity: 0; }
    55%  { transform: scale(1.2) rotate(6deg);  opacity: 1; }
    80%  { transform: scale(0.95) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@media (max-width: 768px) {
    .ssm-expedition-log {
        gap: 10px;
        padding: 8px 10px;
        flex-wrap: wrap;
    }
    .ssm-log-heading {
        font-size: 0.72em;
        width: 100%;
        text-align: center;
    }
    .ssm-badge-slot {
        width: 38px;
        height: 38px;
        font-size: 0.55em;
    }
}

/* =========================================================
   S016 GAMIFICATION LAYER — Fog · Mapbreaker · Shadow
   All tokens from tokens.css. All selectors ssm-namespaced.
   ========================================================= */

/* --- S016 Step 1C: Start-here hint badge --- */
.ssm-start-hint {
    display: inline-block;
    background: var(--accent-pink, #e05a8a);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full, 9999px);
    margin-left: 4px;
    vertical-align: middle;
    white-space: nowrap;
    animation: ssm-hint-pulse 1.4s ease-in-out infinite;
}
@keyframes ssm-hint-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(1.08); }
}

/* --- S016 Step 4: Fog overlay --- */
/* --- Fog overlay: fixed modal so buttons never scroll off-screen --- */
.ssm-fog-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(8, 16, 42, 0.78);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md, 16px);
    opacity: 0;
    transition: opacity 350ms ease;
    pointer-events: none;
}
.ssm-fog-overlay.ssm-fog-active {
    opacity: 1;
    pointer-events: auto;
}
/* White card contains the challenge — readable, contained, aesthetic */
.ssm-fog-challenge {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-2xl, 20px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm, 10px);
    padding: var(--space-lg, 24px) var(--space-md, 20px);
    text-align: center;
    max-width: 500px;
    width: 100%;
    /* Subtle top accent stripe */
    border-top: 4px solid var(--primary-blue, #1e40af);
    animation: ssm-fog-card-in 280ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes ssm-fog-card-in {
    from { opacity: 0; transform: scale(0.88) translateY(12px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}
/* Mapbreaker icon badge at top of card */
.ssm-fog-challenge::before {
    content: '🗺️';
    font-size: 1.8rem;
    line-height: 1;
    display: block;
    margin-bottom: 2px;
}
.ssm-fog-prompt {
    color: var(--text-primary, #1a1a2e);
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.01em;
}
.ssm-fog-image {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: var(--radius-md, 10px);
    background: var(--bg-secondary, #f3f4f6);
    padding: 6px;
    flex-shrink: 0;
}
.ssm-fog-emoji-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    height: 110px;
    font-size: 3.5rem;
    line-height: 1;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: var(--radius-md, 10px);
    flex-shrink: 0;
}
/* Blanked text on a tinted bg pill — clearly readable */
.ssm-fog-blanked-text {
    background: var(--bg-secondary, #f0f4ff);
    border-radius: var(--radius-md, 10px);
    color: var(--text-primary, #1a1a2e);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.6;
    padding: 10px 14px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}
/* ______ blank highlight */
.ssm-fog-blanked-text {
    font-style: italic;
}
.ssm-fog-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}
/* Filled pill buttons — full width, brand colors */
.ssm-fog-option {
    min-height: 48px;       /* tap target SO invariant */
    width: 100%;
    padding: 10px 18px;
    background: var(--primary-blue, #1e40af);
    color: #fff;
    border: none;
    border-radius: var(--radius-full, 9999px);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s, transform 0.12s, box-shadow 0.12s;
    box-shadow: 0 3px 10px rgba(30,64,175,0.25);
    letter-spacing: 0.01em;
}
.ssm-fog-option:hover:not(:disabled) {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30,64,175,0.35);
}
.ssm-fog-option:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(0.95);
}
/* Alternate button color for 2nd/3rd options — visual rhythm */
.ssm-fog-option:nth-child(2) {
    background: var(--accent-purple, #7c3aed);
    box-shadow: 0 3px 10px rgba(124,58,237,0.25);
}
.ssm-fog-option:nth-child(2):hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(124,58,237,0.35);
}
.ssm-fog-option:nth-child(3) {
    background: var(--accent-teal, #0891b2);
    box-shadow: 0 3px 10px rgba(8,145,178,0.25);
}
.ssm-fog-option:nth-child(3):hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(8,145,178,0.35);
}
.ssm-fog-option--correct {
    background: var(--accent-green, #16a34a) !important;
    box-shadow: 0 3px 10px rgba(22,163,74,0.3) !important;
    color: #fff !important;
}
.ssm-fog-option--incorrect {
    background: var(--accent-red, #dc2626) !important;
    box-shadow: 0 3px 10px rgba(220,38,38,0.3) !important;
    color: #fff !important;
}
@media (max-width: 480px) {
    .ssm-fog-challenge {
        padding: var(--space-md, 16px) var(--space-sm, 12px);
        gap: var(--space-xs, 6px);
        border-radius: var(--radius-xl, 14px);
    }
    .ssm-fog-option {
        font-size: 0.925rem;
        min-height: 44px;
    }
    .ssm-fog-image { width: 80px; height: 80px; }
    .ssm-fog-prompt { font-size: 1rem; }
}

/* --- S016 Step 5: Mapbreaker health bar --- */
.ssm-mapbreaker-bar {
    width: 100%;
    padding: var(--space-xs, 4px) 0 var(--space-sm, 8px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ssm-mb-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary, #555);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ssm-mb-track {
    width: 100%;
    height: 10px;
    background: var(--bg-tertiary, #e5e7eb);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
}
.ssm-mb-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-green, #22c55e), var(--accent-orange, #f97316));
    border-radius: var(--radius-full, 9999px);
    transition: width 400ms ease;
}
.ssm-mapbreaker-quiz-frame {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-blue, #1e40af);
    text-align: center;
    margin: 0 0 var(--space-xs, 4px);
    min-height: 1.4em;
}

/* S016 Step 5C: Mapbreaker trap icon on distractors */
/* Grade 0-1: large icon; Grade 2-3: small; Grade 4-5: absent (JS-controlled) */
[data-mb-trap="true"]::before {
    content: '🗺️';
    margin-right: 4px;
    font-size: 1em;
}
body[data-grade="0"] [data-mb-trap="true"]::before,
body[data-grade="1"] [data-mb-trap="true"]::before {
    font-size: 1.2em;
}
body[data-grade="2"] [data-mb-trap="true"]::before,
body[data-grade="3"] [data-mb-trap="true"]::before {
    font-size: 0.75em;
}

/* --- S016 Step 6: Shadow character + real-time mode --- */
.ssm-shadow-cell {
    background: var(--purple-dark, #4c1d95) !important;
    color: #e9d5ff !important;
    border-radius: var(--radius-sm, 4px);
    animation: ssm-shadow-pulse 2.2s ease-in-out infinite;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ssm-shadow-cell.ssm-shadow-closing {
    background: var(--accent-red, #ef4444) !important;
    color: #fff !important;
    animation: ssm-shadow-closing-pulse 0.8s ease-in-out infinite;
}
@keyframes ssm-shadow-pulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50%       { opacity: 1;    transform: scale(1.08); }
}
@keyframes ssm-shadow-closing-pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(1.15); }
}

/* Real-time mode: hide instruction queue controls */
/* Real-time mode: hide queue panels; show only the D-pad in the right panel */
#map-screen.ssm-realtime-mode #instruction-display,
#map-screen.ssm-realtime-mode .action-buttons,
#map-screen.ssm-realtime-mode #map-controls-type {
    display: none !important;
}
#map-screen.ssm-realtime-mode #map-controls-click {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}
/* D-pad fills and centers in the right panel */
#map-screen.ssm-realtime-mode .map-interface {
    justify-content: center;
}
#map-screen.ssm-realtime-mode .direction-buttons {
    margin-bottom: 6px;
}
#map-screen.ssm-realtime-mode .dir-btn {
    min-width: 76px;
    padding: 9px 8px;
}
#map-screen.ssm-realtime-mode .middle-row {
    gap: 14px;
}
/* Real-time: controls section is visually minimal — map is the focus */
#map-screen.ssm-realtime-mode .controls-section {
    background: transparent;
    border: none;
    padding: 8px 4px;
}

/* Timer urgency state (grades 1-5 only; K excluded via SO-06) */
.ssm-map-timer.ssm-timer--urgent {
    color: var(--accent-red, #ef4444);
    animation: ssm-blocked-bounce 0.5s ease-in-out infinite;
}

@media (max-width: 480px) {
    .ssm-shadow-cell {
        font-size: 0.85em;
    }
    .ssm-mapbreaker-bar {
        padding-bottom: var(--space-xs, 4px);
    }
}


/* Map body: stack on narrow screens */
@media (max-width: 700px) {
    .map-body {
        flex-direction: column;
    }
    #map-grid {
        flex: none;
        width: 100%;
        max-width: 100%;
    }
}