/* Robot Coding Game CSS - Adapted from Sudoku Game */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: fixed;
    width: 100%;
}

.robot-game-wrapper {
    height: 100vh; /* Exact viewport height */
    height: 100dvh; /* Dynamic viewport height for mobile */
    max-height: 100vh;
    max-height: 100dvh;
    padding: 0.5vh;
    display: flex;
    flex-direction: column;
    gap: 1vh;
    overflow: hidden; /* No scrolling */
    box-sizing: border-box;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

/* Info Button */
.game-info-button {
    position: absolute;
    top: clamp(10px, 2vh, 20px);
    right: clamp(10px, 2vw, 20px);
    z-index: 100;
}

.info-btn {
    width: clamp(40px, 8vw, 50px);
    height: clamp(40px, 8vw, 50px);
    border-radius: 50%;
    background: linear-gradient(135deg, #2196f3, #1976d2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 3vw, 20px);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.info-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.info-btn:active {
    transform: scale(0.95);
}

/* Game Modal */
.game-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: clamp(12px, 2vw, 20px);
    width: min(90vw, 500px);
    max-height: 80vh;
    max-height: 80dvh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: clamp(15px, 3vw, 25px) clamp(15px, 3vw, 25px) clamp(10px, 2vw, 15px) clamp(15px, 3vw, 25px);
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2196f3;
    font-family: 'Fredoka', cursive;
    font-size: clamp(16px, 3vw, 20px);
}

.modal-close {
    background: none;
    border: none;
    font-size: clamp(18px, 3vw, 22px);
    color: #666;
    cursor: pointer;
    width: clamp(30px, 6vw, 35px);
    height: clamp(30px, 6vw, 35px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.modal-body {
    padding: clamp(15px, 3vw, 25px);
}

.modal-section {
    margin-bottom: clamp(20px, 4vw, 30px);
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h4 {
    margin: 0 0 clamp(10px, 2vw, 15px) 0;
    color: #333;
    font-family: 'Fredoka', cursive;
    font-size: clamp(14px, 2.5vw, 16px);
    display: flex;
    align-items: center;
    gap: clamp(6px, 1vw, 8px);
}

.modal-section h4 i {
    color: #2196f3;
}

/* Modal actions and stats removed - now in main interface */

.game-instructions {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    font-size: clamp(12px, 2.5vw, 14px);
    color: #333;
}

/* Hamburger Menu Button (hidden by default) */
.hamburger-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    z-index: 20;
}

.hamburger-menu:hover {
    background: rgba(102, 126, 234, 0.1);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: #333;
    margin: 2px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Hamburger animation */
.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Header Content */
.header-content.mobile-collapsed {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 12px;
    flex-direction: column;
    gap: 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    z-index: 15;
}

.header-content.mobile-collapsed.expanded {
    max-height: 300px;
    padding: 16px;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 3vw;
    transition: all 0.3s ease;
}

.header-content.mobile-collapsed {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
}


.header-actions {
    display: flex;
    gap: 1vw;
    align-items: center;
}

.game-title {
    font-family: 'Bubblegum Sans', cursive;
    font-size: min(4vw, 6vh);
    color: #764ba2;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5vw;
}

    .game-title .robot-icon {
        color: #ff6b35;
        animation: robotBounce 2s ease-in-out infinite;
    }

.score-timer {
    display: flex;
    gap: 3vw;
    font-size: min(2vw, 3vh);
    color: #555;
}

.timer, .moves {
    display: flex;
    align-items: center;
    gap: 0.5vw;
}

/* Game Controls */
.game-controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5vh 2vw;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4vw;
    min-height: 14vh;
    align-items: flex-start;
    overflow: visible;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vh;
}

    .control-group label {
        font-weight: 600;
        color: #333;
        font-size: min(2vw, 2.5vh);
    }

.size-selector, .difficulty-selector {
    display: flex;
    gap: clamp(4px, 0.5vw, 8px);
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.size-selection {
    flex-shrink: 0;
    margin-top: clamp(4px, 1vh, 8px);
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: visible;
}

.size-btn, .difficulty-btn {
    padding: 1vh 1.5vw;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    color: #555;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Fredoka', cursive;
    font-size: min(2.5vw, 3vh);
    min-width: 4vw;
    min-height: 4vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .size-btn:hover, .difficulty-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .size-btn.active {
        background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
        color: white;
        border-color: transparent;
    }

    .difficulty-btn.active {
        background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
        color: white;
        border-color: transparent;
    }

.header-btn {
    padding: 1vh 1.5vw;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    color: #555;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Fredoka', cursive;
    font-size: min(2.5vw, 3vh);
    min-width: 4vw;
    min-height: 4vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

    .header-btn.new-game {
        background: #4caf50;
        color: white;
        border-color: transparent;
    }

    .header-btn.hint {
        background: #ffc107;
        color: white;
        border-color: transparent;
    }

    .header-btn.run {
        background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
        color: white;
        border-color: transparent;
        font-weight: bold;
        animation: runButtonPulse 2s ease-in-out infinite;
    }

    .header-btn.solve {
        background: #9c27b0;
        color: white;
        border-color: transparent;
    }

/* Game Container */
.game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(4px, 1vh, 12px) clamp(6px, 1vw, 16px);
    min-height: 0;
    overflow-y: auto;
    overflow-x: visible;
    width: 100%;
    box-sizing: border-box;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

/* Beautiful Custom Scrollbar */
.game-container::-webkit-scrollbar {
    width: 8px;
}

.game-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 4px;
}

.game-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2);
}

.game-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Firefox scrollbar styling */
.game-container {
    scrollbar-width: thin;
    scrollbar-color: #667eea rgba(255, 255, 255, 0.1);
}

/* Mobile touch scrolling */
.game-container {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Scroll fade indicators */
.game-container::before,
.game-container::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.game-container::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(102, 126, 234, 0.1), transparent);
    opacity: 0;
}

.game-container::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(102, 126, 234, 0.1), transparent);
    opacity: 0;
}

/* Show scroll indicators when scrollable */
.game-container[data-scrollable="true"]::before {
    opacity: 1;
}

.game-container[data-scrollable="true"]::after {
    opacity: 1;
}

.game-board-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 1vh, 16px);
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: visible;
    justify-content: center;
    padding: 0;
}

/* Solution Header with Absolutely Centered Commands */
.solution-header-with-commands {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: clamp(8px, 2vw, 12px);
    min-height: clamp(45px, 8vh, 60px);
}

.solution-board-header {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Absolutely Centered Command Palette */
.command-palette-centered {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.command-palette-centered .palette-grid-inline,
.command-palette-centered .command-item {
    pointer-events: all;
}

.header-spacer {
    display: none; /* Not needed with absolute positioning */
}

.palette-grid-inline {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

/* Bigger inline command items */
.palette-grid-inline .command-item {
    width: clamp(40px, 8vw, 50px);
    height: clamp(40px, 8vw, 50px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: clamp(6px, 1.5vw, 10px);
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.palette-grid-inline .command-item:hover {
    transform: scale(1.1);
    border-color: #2196f3;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.25);
}

.palette-grid-inline .command-item:active,
.palette-grid-inline .command-item.dragging {
    cursor: grabbing;
    transform: scale(1.15);
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3);
}

.palette-grid-inline .command-item .command-icon-palette {
    font-size: clamp(16px, 3.5vw, 22px);
}

/* Solution Board */
.solution-board-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: clamp(8px, 2vw, 15px);
    padding: clamp(8px, 2vw, 15px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: none;
    margin-bottom: clamp(12px, 2.5vw, 20px);
    display: flex;
    flex-direction: column;
    overflow: visible;
    contain: layout;
}

.solution-board-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-family: 'Fredoka', cursive;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.solution-robot {
    font-size: 24px;
    color: #4caf50;
}


.solution-board {
    display: flex;
    gap: clamp(1px, 0.3vw, 2px);
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: clamp(80px, 12vh, 100px);
    padding: clamp(12px, 2.5vw, 20px);
    border: 3px dashed #bbb;
    border-radius: clamp(8px, 2vw, 15px);
    background: rgba(248, 249, 250, 0.8);
    overflow: visible;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    pointer-events: all;
}

.solution-board:hover {
    border-color: #2196f3;
    background: rgba(33, 150, 243, 0.05);
}

.solution-board.drag-over {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

/* Placeholder for empty solution board */
.solution-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #888;
    transition: all 0.3s ease;
    pointer-events: none;
    opacity: 1;
    text-align: center;
    background: rgba(33, 150, 243, 0.05);
    border: 2px dashed rgba(33, 150, 243, 0.3);
    border-radius: 12px;
    padding: clamp(16px, 4vw, 24px);
    min-width: clamp(200px, 40vw, 300px);
    animation: pulseDropZone 2s ease-in-out infinite;
}

@keyframes pulseDropZone {
    0%, 100% {
        border-color: rgba(33, 150, 243, 0.3);
        background: rgba(33, 150, 243, 0.05);
    }
    50% {
        border-color: rgba(33, 150, 243, 0.5);
        background: rgba(33, 150, 243, 0.08);
    }
}

.solution-board:not(:empty) .solution-placeholder,
.solution-board.has-commands .solution-placeholder {
    opacity: 0;
    pointer-events: none;
}

.placeholder-icon {
    font-size: clamp(28px, 5vw, 36px);
    color: #2196f3;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-4px);
    }
    60% {
        transform: translateY(-2px);
    }
}

.placeholder-text {
    font-size: clamp(12px, 2.5vw, 16px);
    font-weight: 500;
    font-family: 'Fredoka', cursive;
    text-align: center;
}

/* Insertion zones for drag-between functionality */
.insertion-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0;
    height: clamp(50px, 10vh, 65px);
    padding: 0;
    margin: 0;
    position: relative;
    opacity: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    z-index: 10;
    overflow: visible;
    pointer-events: all;
}

.insertion-zone.show,
.insertion-zone.drag-over {
    opacity: 1;
    width: clamp(50px, 10vw, 60px);
    margin: 0 clamp(6px, 1.5vw, 10px);
    min-height: clamp(50px, 10vh, 65px);
    padding: clamp(4px, 1vw, 8px);
}

.insertion-indicator {
    width: clamp(24px, 5vw, 32px);
    height: clamp(24px, 5vw, 32px);
    background: #4CAF50;
    border-radius: clamp(4px, 1vw, 6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 3vw, 18px);
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    opacity: 0;
    transition: all 0.2s ease;
    transform: scale(0.8);
}

.insertion-zone.drag-over .insertion-indicator {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.5);
    background: #66bb6a;
}

/* Show insertion zones during drag mode */
.solution-board.drag-mode .insertion-zone {
    opacity: 0;
}

/* Make the final insertion zone more prominent and easier to target */
.final-insertion-zone {
    width: clamp(30px, 6vw, 40px) !important;
    opacity: 0.3 !important;
    margin-left: clamp(8px, 2vw, 12px) !important;
    border-left: 2px dashed #4caf50;
    background: linear-gradient(90deg, transparent 0%, rgba(76, 175, 80, 0.1) 100%);
}

.solution-board.drag-mode .final-insertion-zone {
    opacity: 0.6 !important;
    width: clamp(50px, 10vw, 60px) !important;
}

.final-insertion-zone.drag-over {
    opacity: 1 !important;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.2) 0%, rgba(76, 175, 80, 0.4) 100%);
    border-left: 3px dashed #4caf50;
}

.final-insertion-zone .insertion-indicator {
    background: #4caf50;
    opacity: 0.8;
    transform: scale(0.9);
}

.solution-slot {
    width: clamp(40px, 8vw, 55px);
    height: clamp(40px, 8vw, 55px);
    border-radius: clamp(8px, 2vw, 12px);
    border: 2px solid #e0e0e0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    margin: 0;
    pointer-events: all;
}

.solution-slot:active {
    cursor: grabbing;
}

.solution-slot.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
}

.solution-slot.drop-target {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
    transform: scale(1.1);
}

    .solution-slot .command-icon {
        font-size: 24px !important;
    }

.command-number {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #2196f3;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
    pointer-events: none;
}

.solution-slot:hover {
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.2);
}

.solution-slot.filled {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8f1 100%);
}

.solution-slot.drag-over {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
    transform: scale(1.05);
}

.solution-slot.executing {
    border-color: #2196f3;
    background: rgba(33, 150, 243, 0.2);
    animation: pulse 0.8s infinite;
    transform: scale(1.1);
}

.solution-slot.executed {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.2);
}

.solution-slot.error {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.2);
    animation: shake 0.5s ease-in-out;
}

.slot-placeholder {
    font-size: 12px;
    color: #999;
    font-weight: 500;
}

.solution-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(10px, 2vw, 15px);
    margin-top: clamp(8px, 2vw, 12px);
    flex-wrap: wrap;
}

.all-actions {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    justify-content: center;
    flex: 1;
    flex-wrap: wrap;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(40px, 8vw, 50px);
    height: clamp(40px, 8vw, 50px);
    border: 2px solid;
    border-radius: clamp(8px, 2vw, 12px);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(16px, 3.5vw, 20px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

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

/* Icon Button Colors */
.icon-btn.new-game-btn {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    border-color: #1976d2;
    color: white;
}

.icon-btn.new-game-btn:hover {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.icon-btn.hint-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-color: #f57c00;
    color: white;
}

.icon-btn.hint-btn:hover {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.icon-btn.solve-btn {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    border-color: #7b1fa2;
    color: white;
}

.icon-btn.solve-btn:hover {
    background: linear-gradient(135deg, #7b1fa2, #6a1b9a);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

/* Hint Display */
.hint-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: clamp(12px, 3vw, 20px);
    border-radius: clamp(12px, 3vw, 18px);
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
    z-index: 1500;
    max-width: clamp(280px, 80vw, 400px);
    animation: hintSlideIn 0.3s ease;
    font-family: 'Quicksand', sans-serif;
}

@keyframes hintSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.hint-content {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
}

.hint-icon {
    font-size: clamp(18px, 4vw, 24px);
    animation: hintBounce 1s ease infinite alternate;
}

@keyframes hintBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-3px); }
}

.hint-text {
    font-size: clamp(13px, 3vw, 16px);
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
}

.hint-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: clamp(24px, 5vw, 30px);
    height: clamp(24px, 5vw, 30px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 2.5vw, 14px);
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.hint-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.game-stats-inline {
    display: flex;
    gap: clamp(12px, 2.5vw, 16px);
    align-items: center;
    font-size: clamp(11px, 2.5vw, 14px);
    color: #666;
    font-family: 'Fredoka', cursive;
    flex-shrink: 0;
}

.game-stats-inline .stat-item {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1vw, 6px);
}

.game-stats-inline .stat-item i {
    color: #2196f3;
    font-size: clamp(12px, 2.5vw, 15px);
}

/* Big Play Button */
.big-play-btn {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(14px, 2.5vw, 18px);
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

    .big-play-btn:hover {
        background: linear-gradient(135deg, #45a049, #388e3c);
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
    }

    .big-play-btn:active {
        transform: translateY(-1px);
        box-shadow: 0 3px 10px rgba(76, 175, 80, 0.4);
    }

    .big-play-btn:disabled {
        background: #ccc;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

    .big-play-btn i {
        font-size: 20px;
        animation: playButtonPulse 2s infinite;
    }

.solution-btn {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

    .solution-btn:hover {
        background: #d32f2f;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
    }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Moving Robot Styles */
.moving-robot {
    position: absolute;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
    border-radius: 50%;
    background: transparent;
    /* Subtle glow effect instead of background */
    filter: drop-shadow(0 0 8px rgba(229, 62, 62, 0.4));
}

.robot-avatar {
    font-size: 30px; /* Bigger robot */
    color: #e53e3e; /* Red robot */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.moving-robot.robot-moving .robot-avatar {
    animation: robotBounce 0.6s ease-in-out;
}

.moving-robot.robot-error {
    filter: drop-shadow(0 0 12px rgba(244, 67, 54, 0.6));
}

    .moving-robot.robot-error .robot-avatar {
        color: #f44336;
        animation: none;
    }

.moving-robot.robot-success {
    filter: drop-shadow(0 0 15px rgba(255, 193, 7, 0.8));
}

    .moving-robot.robot-success .robot-avatar {
        color: #ffc107;
    }

.moving-robot.robot-shake {
    animation: robotShake 0.6s ease-in-out;
}

.moving-robot.robot-celebrate .robot-avatar {
    animation: robotCelebrate 2s ease-in-out infinite;
}

/* Robot Animations */
@keyframes robotBounce {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(-5deg);
    }

    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

@keyframes robotShake {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }

    10% {
        transform: translateX(-8px) rotate(-8deg);
    }

    20% {
        transform: translateX(8px) rotate(8deg);
    }

    30% {
        transform: translateX(-6px) rotate(-6deg);
    }

    40% {
        transform: translateX(6px) rotate(6deg);
    }

    50% {
        transform: translateX(-4px) rotate(-4deg);
    }

    60% {
        transform: translateX(4px) rotate(4deg);
    }

    70% {
        transform: translateX(-2px) rotate(-2deg);
    }

    80% {
        transform: translateX(2px) rotate(2deg);
    }
}

@keyframes robotCelebrate {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.2) rotate(-10deg);
    }

    50% {
        transform: scale(1.3) rotate(0deg);
    }

    75% {
        transform: scale(1.2) rotate(10deg);
    }
}

@keyframes crackAnimation {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(2) rotate(360deg);
        opacity: 0;
    }
}

@keyframes errorPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes celebrateAnimation {
    0% {
        transform: scale(0) translateY(0);
        opacity: 1;
    }

    50% {
        transform: scale(1.5) translateY(-20px);
        opacity: 1;
    }

    100% {
        transform: scale(2) translateY(-40px);
        opacity: 0;
    }
}

/* Effects */
.crack-effect, .celebration-effect {
    pointer-events: none;
    user-select: none;
}

/* Drag Preview - ensure it doesn't block mouse events */
.drag-preview {
    pointer-events: none !important;
    opacity: 0.8;
    z-index: 9999;
    transform: rotate(5deg);
}

/* Trash Bin for Individual Item Removal */
.trash-bin {
    position: relative;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border-radius: clamp(10px, 2vw, 14px);
    width: clamp(70px, 14vw, 90px);
    height: clamp(70px, 14vw, 90px);
    padding: clamp(8px, 2vw, 12px);
    padding-top: clamp(12px, 2.5vw, 16px);
    box-shadow: 0 8px 25px rgba(244, 67, 54, 0.4);
    z-index: 10;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    border: 2px solid white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: top;
    margin-left: clamp(12px, 3vw, 20px);
}

.trash-bin.show {
    opacity: 1;
    pointer-events: all;
}

.trash-bin.drag-over {
    background: linear-gradient(135deg, #d32f2f, #c62828);
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(244, 67, 54, 0.6);
}

.trash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(4px, 1vw, 8px);
    color: white;
    text-align: center;
}

.trash-icon {
    font-size: clamp(28px, 5vw, 36px);
    animation: trashBounce 2s ease-in-out infinite;
}

.trash-text {
    font-size: clamp(12px, 2.5vw, 16px);
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
}

/* Mobile-specific trash bin sizing */
@media (max-width: 768px) {
    .trash-bin {
        width: clamp(55px, 12vw, 70px);
        height: clamp(55px, 12vw, 70px);
        margin-left: clamp(10px, 2vw, 15px);
        padding-top: clamp(10px, 2vw, 14px);
    }
    
    .trash-bin.drag-over {
        transform: scale(1.1);
    }
    
    /* Fix modal visibility on mobile */
    .modal-content {
        width: 95vw;
        max-height: 90vh;
        max-height: 90dvh;
        margin: 10px;
    }
    
    .modal-body {
        padding: clamp(10px, 2vw, 20px);
        max-height: calc(90vh - 100px);
        max-height: calc(90dvh - 100px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-section {
        margin-bottom: clamp(15px, 3vw, 20px);
    }
    
    .modal-section h4 {
        font-size: clamp(14px, 3vw, 18px);
        position: sticky;
        top: 0;
        background: white;
        padding: 5px 0;
        z-index: 1;
    }
}

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

/* Robot Game Board */
.robot-board-wrapper {
    background: rgba(255, 255, 255, 0.95);
    border-radius: clamp(8px, 2vw, 15px);
    padding: clamp(6px, 1.5vw, 12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    width: min(85vw, 60vh, 500px);
    height: min(85vw, 60vh, 500px);
    aspect-ratio: 1;
    margin: 0 auto;
    flex-shrink: 0;
}

.robot-board {
    display: grid;
    gap: 2px;
    background: #e0e0e0;
    padding: 4px;
    border-radius: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

    .robot-board.size-3 {
        grid-template-columns: repeat(3, 1fr);
    }

        .robot-board.size-3 .robot-cell {
            font-size: clamp(50px, 8vw, 90px);
        }

    .robot-board.size-4 {
        grid-template-columns: repeat(4, 1fr);
    }

        .robot-board.size-4 .robot-cell {
            font-size: clamp(40px, 6vw, 70px);
        }

    .robot-board.size-5 {
        grid-template-columns: repeat(5, 1fr);
    }

        .robot-board.size-5 .robot-cell {
            font-size: clamp(32px, 5vw, 56px);
        }

    .robot-board.size-6 {
        grid-template-columns: repeat(6, 1fr);
    }

        .robot-board.size-6 .robot-cell {
            font-size: clamp(28px, 4vw, 48px);
        }

    .robot-board.size-7 {
        grid-template-columns: repeat(7, 1fr);
    }

        .robot-board.size-7 .robot-cell {
            font-size: clamp(24px, 3.5vw, 42px);
        }

    .robot-board.size-8 {
        grid-template-columns: repeat(8, 1fr);
    }

        .robot-board.size-8 .robot-cell {
            font-size: clamp(20px, 3vw, 38px);
        }

    .robot-board.size-9 {
        grid-template-columns: repeat(9, 1fr);
    }

        .robot-board.size-9 .robot-cell {
            font-size: clamp(18px, 2.5vw, 34px);
        }

.robot-cell {
    background: white;
    border: 1px solid #e0e0e0;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    font-size: 40px;
}

    .robot-cell.drag-over {
        background: #e3f2fd;
        border-color: #2196f3;
        transform: scale(1.05);
        box-shadow: 0 0 0 min(0.5vw, 0.8vh) rgba(33, 150, 243, 0.3);
    }

    .robot-cell.start {
        background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
        color: white;
        font-weight: bold;
    }

    .robot-cell.goal {
        background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
        color: white;
        font-weight: bold;
        animation: goalGlow 2s ease-in-out infinite;
    }

    .robot-cell.obstacle {
        background: linear-gradient(135deg, #f44336 0%, #e57373 100%);
        color: white;
    }

    .robot-cell.command {
        background: #f8f9fa;
        border-color: #007bff;
    }

    .robot-cell.executed {
        background: #d4edda;
        border-color: #28a745;
        animation: executedPulse 0.5s ease-in-out;
    }

    .robot-cell.error {
        background: #f8d7da;
        border-color: #dc3545;
        animation: errorShake 0.5s ease-in-out;
    }

    .robot-cell.robot-current {
        background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
        animation: robotMove 0.5s ease-in-out;
    }

/* Robot and Game Elements */
.robot-element {
    font-size: calc(100% - 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
    animation: robotIdle 3s ease-in-out infinite;
}

.goal-element {
    font-size: calc(100%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
}

.obstacle-element {
    font-size: calc(100% - 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
}

/* Solution Items (different from command palette items) */
.solution-item {
    font-size: calc(100% - 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    touch-action: none;
    -webkit-touch-callout: none;
    width: calc(100% - 4px);
    height: calc(100% - 4px);
}

.command-icon {
    font-size: inherit;
    color: #007bff;
}

/* Command Palette */
.command-palette {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 250px;
    overflow-y: auto;
    max-height: calc(100vh - 400px);
}

.palette-title {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.3rem;
    text-align: center;
}

.instructions {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #666;
}

    .instructions p {
        margin: 5px 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .instructions i {
        color: #ff6b35;
        width: 16px;
    }

.palette-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.command-item {
    background: white;
    border: 2px solid #ddd;
    border-radius: clamp(8px, 2vw, 12px);
    padding: 0;
    cursor: move;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(35px, 8vw, 55px);
    height: clamp(35px, 8vw, 55px);
    aspect-ratio: 1;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

    .command-item:hover {
        transform: translateY(-0.5vh);
        box-shadow: 0 1vh 2vh rgba(0, 0, 0, 0.15);
    }

    .command-item.dragging {
        opacity: 0.5;
        cursor: grabbing;
    }

    .command-item.hint-highlight {
        background: #fff3cd !important;
        border: 3px solid #ffc107 !important;
        animation: hintPulse 2s ease-in-out infinite;
    }

.command-icon-palette {
    font-size: 30px;
    color: #007bff;
}

/* Execution Trail */
.execution-trail {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    z-index: 10;
}

/* Game Actions */
.game-actions {
    display: flex;
    justify-content: center;
    gap: 2vw;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
    padding: 0.5vh 0;
}

.action-btn {
    padding: 2vh 4vw;
    border: none;
    border-radius: 15px;
    background: white;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Fredoka', cursive;
    font-size: min(4vw, 5vh);
    box-shadow: 0 0.5vh 1.5vh rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    min-width: 10vw;
    min-height: 6vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .action-btn:hover {
        transform: translateY(-0.3vh);
        box-shadow: 0 1vh 2.5vh rgba(0, 0, 0, 0.15);
    }

    .action-btn.run {
        background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
        color: white;
    }

    .action-btn.hint {
        background: #ffc107;
        color: white;
    }

    .action-btn.new-game {
        background: #4caf50;
        color: white;
    }

/* Robot Execution Animation */
.robot-path-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, #28a745, transparent);
    height: 3px;
    z-index: 5;
    animation: pathGlow 0.5s ease-in-out;
}

/* Success and Error Overlays */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

    .success-overlay.active {
        display: flex;
    }

.success-content {
    text-align: center;
    color: #FFD700;
}

.success-animation {
    animation: successBounce 1s ease-in-out infinite;
}

    .success-animation i {
        font-size: 8rem;
        color: #FFD700;
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }

.error-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(244, 67, 54, 0.95);
    border-radius: 20px;
    min-width: 280px;
    max-width: 90vw;
    padding: 20px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 3px solid #fff;
}

    .error-overlay.active {
        display: flex;
        animation: errorPop 0.6s ease-out;
    }

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

    .error-content i {
        font-size: 3rem;
        color: white;
        margin-bottom: 10px;
    }

.error-message {
    font-family: 'Fredoka', cursive;
    font-size: 18px;
    font-weight: 600;
    color: white;
    text-align: center;
    line-height: 1.3;
    margin: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

    .loading-overlay.active {
        display: flex;
    }

.loading-spinner {
    text-align: center;
}

    .loading-spinner i {
        font-size: 3rem;
        color: #ff6b35;
        animation: spin 1s linear infinite;
    }

    .loading-spinner p {
        margin-top: 10px;
        color: #555;
        font-size: 1.2rem;
    }

/* Hint Highlights */
.hint-target {
    background: #d1ecf1 !important;
    border: 3px solid #17a2b8 !important;
    animation: targetPulse 2s ease-in-out infinite;
}

/* Theme Colors */
.color-blue {
    color: #2196f3;
}

.color-green {
    color: #4caf50;
}

.color-orange {
    color: #ff9800;
}

.color-red {
    color: #f44336;
}

.color-purple {
    color: #9c27b0;
}

.color-yellow {
    color: #ffc107;
}


/* Mobile and Tablet - Unified responsive approach */
@media (max-width: 768px) {
    .robot-game-wrapper {
        padding: clamp(2px, 0.5vh, 8px) clamp(4px, 1vw, 8px);
        gap: clamp(2px, 0.5vh, 6px);
    }

    /* No header on mobile - more space for game */
    
    .header-content {
        gap: clamp(8px, 2vw, 16px);
        flex-wrap: wrap;
        justify-content: space-around;
    }
    
    .header-btn, .difficulty-btn, .size-btn {
        padding: clamp(4px, 1vh, 8px) clamp(6px, 2vw, 12px);
        font-size: clamp(10px, 2.5vw, 14px);
        min-width: clamp(30px, 8vw, 50px);
        min-height: clamp(25px, 6vh, 35px);
    }
    
    .score-timer {
        font-size: clamp(10px, 2.5vw, 14px);
        gap: clamp(8px, 2vw, 16px);
    }

    .game-title {
        font-size: clamp(14px, 4vw, 20px);
    }
    
    .game-board-section {
        width: 100%;
        max-width: min(95vw, 600px);
        margin: 0 auto;
    }

    .robot-board-wrapper {
        width: min(85vw, 45vh, 400px);
        height: min(85vw, 45vh, 400px);
        aspect-ratio: 1;
        flex-shrink: 0;
    }

    /* Mobile layout adjustments */
    .solution-header-with-commands {
        position: relative;
        flex-direction: column;
        align-items: center;
        gap: clamp(8px, 2vw, 12px);
        min-height: auto;
        padding: clamp(4px, 1vw, 8px) 0;
    }

    .solution-board-header {
        position: static;
        transform: none;
        margin-bottom: clamp(6px, 1.5vw, 10px);
    }

    .command-palette-centered {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
    }

    .palette-grid-inline {
        justify-content: center;
        gap: clamp(6px, 1.5vw, 10px);
    }

    .solution-actions {
        flex-direction: column;
        align-items: center;
        gap: clamp(8px, 2vw, 12px);
    }

    .all-actions {
        width: 100%;
        justify-content: center;
        gap: clamp(6px, 1.5vw, 10px);
    }

    .game-stats-inline {
        width: 100%;
        justify-content: center;
        padding: clamp(4px, 1vw, 8px);
        background: rgba(33, 150, 243, 0.05);
        border-radius: clamp(6px, 1.5vw, 10px);
        margin-top: clamp(4px, 1vw, 8px);
    }

    .solution-board-container {
        width: 100%;
        max-width: none;
    }

    .solution-board-header {
        font-size: clamp(12px, 3vw, 16px);
    }

    .solution-robot {
        font-size: clamp(16px, 4vw, 24px);
    }


    .solution-board {
        min-height: clamp(80px, 12vh, 100px);
    }

    .command-number {
        width: clamp(12px, 3vw, 16px);
        height: clamp(12px, 3vw, 16px);
        font-size: clamp(7px, 1.8vw, 10px);
    }

    .moving-robot {
        width: clamp(30px, 8vw, 45px);
        height: clamp(30px, 8vw, 45px);
    }

    .solution-btn {
        padding: clamp(4px, 1vh, 6px) clamp(6px, 2vw, 10px);
        font-size: clamp(10px, 2.5vw, 12px);
    }

    .game-instructions {
        font-size: clamp(9px, 2vw, 12px);
        padding: clamp(4px, 1vw, 8px);
    }

    .error-overlay {
        min-width: clamp(200px, 50vw, 280px);
        padding: clamp(8px, 2vw, 16px);
    }

    .error-message {
        font-size: clamp(12px, 3vw, 16px);
    }

    .robot-cell {
        border-radius: clamp(4px, 1vw, 8px);
    }

    .robot-board.size-3 .robot-cell {
        font-size: clamp(30px, 8vw, 50px);
    }

    .robot-board.size-4 .robot-cell {
        font-size: clamp(25px, 6vw, 40px);
    }

    .robot-board.size-5 .robot-cell {
        font-size: clamp(20px, 5vw, 32px);
    }

    .robot-board.size-6 .robot-cell {
        font-size: clamp(18px, 4.5vw, 28px);
    }

    .robot-board.size-7 .robot-cell {
        font-size: clamp(16px, 4vw, 24px);
    }

    .robot-board.size-8 .robot-cell {
        font-size: clamp(14px, 3.5vw, 22px);
    }

    .robot-board.size-9 .robot-cell {
        font-size: clamp(12px, 3vw, 20px);
    }

    .command-icon-palette {
        font-size: clamp(16px, 4vw, 24px);
    }

    .big-play-btn {
        padding: clamp(6px, 1.5vh, 10px) clamp(12px, 3vw, 20px);
        font-size: clamp(11px, 2.5vw, 16px);
        gap: clamp(4px, 1vw, 8px);
    }
    
    .big-play-btn i {
        font-size: clamp(12px, 3vw, 18px);
    }
}

/* Extra small screens - Fine-tune for very small devices */
@media (max-width: 480px) {
    
    .robot-board-wrapper {
        width: min(90vw, 40vh, 350px);
        height: min(90vw, 40vh, 350px);
        aspect-ratio: 1;
        flex-shrink: 0;
    }
    
    .header-content {
        justify-content: center;
        gap: clamp(4px, 1.5vw, 8px);
    }
    
    .size-selector {
        gap: clamp(2px, 0.5vw, 4px);
    }
    
    .size-btn {
        font-size: clamp(9px, 2vw, 12px);
        padding: clamp(2px, 0.5vh, 4px) clamp(4px, 1vw, 6px);
        min-width: clamp(24px, 6vw, 32px);
    }
}

/* Desktop and large screens */
@media (min-width: 769px) {
    .game-board-section {
        max-width: min(85vw, 900px);
        gap: clamp(8px, 1.5vh, 20px);
        justify-content: flex-start;
    }
    
    .robot-board-wrapper {
        width: min(60vw, 50vh, 600px);
        height: min(60vw, 50vh, 600px);
        aspect-ratio: 1;
        flex-shrink: 0;
    }

    .solution-board-container {
        max-width: min(85vw, 900px);
        margin: 0 auto clamp(15px, 2.5vh, 25px) auto;
    }
    
    .size-selection {
        margin-top: clamp(12px, 2vh, 20px);
        margin-bottom: clamp(8px, 1vh, 12px);
        flex-shrink: 0;
        z-index: 10;
        position: relative;
    }
    
    .size-selector {
        gap: clamp(6px, 1vw, 12px);
    }
    
    .size-btn {
        font-size: clamp(12px, 1.5vw, 16px);
        padding: clamp(6px, 1vh, 10px) clamp(10px, 1.5vw, 16px);
        min-width: clamp(40px, 5vw, 60px);
    }
}

/* Animations */
@keyframes robotBounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

@keyframes robotIdle {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes goalGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    }
}

@keyframes executedPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes robotMove {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes successBounce {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes pathGlow {
    0% {
        opacity: 0;
        width: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        width: 100%;
    }
}

@keyframes runButtonPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 107, 53, 0);
    }
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
        transform: scale(1.05);
    }
}

@keyframes targetPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(23, 162, 184, 0);
        transform: scale(1.05);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.win-animation {
    animation: successBounce 0.5s ease-in-out infinite;
}

.hint-animation {
    animation: hintPulse 0.5s ease-in-out 3;
}

@keyframes playButtonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(33, 150, 243, 0);
    }
}

/* Different obstacle styles for variety */
.obstacle-element {
    font-size: 32px;
    animation: obstacleIdle 2s ease-in-out infinite;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.obstacle-cat {
    animation: catWiggle 1.5s ease-in-out infinite;
}

.obstacle-dog {
    animation: dogBounce 1.2s ease-in-out infinite;
}

.obstacle-tree {
    animation: treeRustle 3s ease-in-out infinite;
}

.obstacle-water {
    animation: waterRipple 2s ease-in-out infinite;
}

.obstacle-fire {
    animation: fireFlicker 0.8s ease-in-out infinite;
}

@keyframes obstacleIdle {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes catWiggle {
    0%, 100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-3deg);
    }

    75% {
        transform: rotate(3deg);
    }
}

@keyframes dogBounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

@keyframes treeRustle {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(1deg) scale(1.02);
    }
}

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

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes fireFlicker {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    25% {
        transform: scale(1.05) rotate(1deg);
        opacity: 0.9;
    }

    50% {
        transform: scale(0.95) rotate(-1deg);
        opacity: 0.95;
    }

    75% {
        transform: scale(1.03) rotate(0.5deg);
        opacity: 0.85;
    }
}