/* css/style.css */
/* Kids Code Adventure - Complete Styles */

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --accent: #FFE66D;
    --dark: #2C3E50;
    --light: #F7F9FC;
    --success: #2ECC71;
    --warning: #F39C12;
    --danger: #E74C3C;
    --purple: #6C5CE7;
    --shadow: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 20px;
    --font-family: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', cursive, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==================== NAVIGATION ==================== */
.main-nav {
    background: rgba(255,255,255,0.95);
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 4px solid var(--secondary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary);
}

.logo img {
    width: 45px;
    height: 45px;
    animation: bounce 2s infinite;
}

.logo span {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    background: var(--light);
    border: 2px solid transparent;
    padding: 10px 18px;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-color: var(--secondary);
}

.nav-btn .icon {
    font-size: 1.2rem;
}

/* ==================== DASHBOARD ==================== */
.dashboard {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    animation: fadeIn 0.5s ease;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: rgba(255,255,255,0.95);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-container {
    position: relative;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--accent);
    background: #f0f0f0;
    object-fit: cover;
}

.level-badge {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: var(--primary);
    color: white;
    border-radius: 50px;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
}

.user-info h2 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    color: var(--dark);
}

.stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.stat {
    background: var(--light);
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.progress-card h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.progress-bar {
    background: #e0e0e0;
    height: 14px;
    border-radius: 50px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    background: linear-gradient(90deg, var(--secondary), var(--accent));
    height: 100%;
    border-radius: 50px;
    transition: width 0.8s ease;
    width: 0%;
}

.world-progress {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: #666;
    margin-top: 5px;
}

.daily-reward h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.daily-reward .claim-btn {
    background: linear-gradient(135deg, var(--accent), #f9ca24);
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 8px;
}

.daily-reward .claim-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.4);
}

.daily-reward .claim-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.daily-reward .timer {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: #888;
}

.continue-btn {
    background: linear-gradient(135deg, var(--purple), #a29bfe);
    color: white;
    border: none;
    padding: 20px 30px;
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    width: 100%;
}

.continue-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(108, 92, 231, 0.6);
}

.continue-btn .icon {
    font-size: 1.8rem;
}

/* ==================== ACHIEVEMENTS ==================== */
.achievements-section {
    background: rgba(255,255,255,0.95);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.achievements-section h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.achievement {
    background: var(--light);
    padding: 15px 10px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.achievement span:first-child {
    font-size: 2rem;
}

.achievement span:last-child {
    font-size: 0.85rem;
    font-weight: bold;
}

.achievement.unlocked {
    background: linear-gradient(135deg, #fff, #f0fdf4);
    border: 2px solid var(--success);
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.2);
}

.achievement.locked {
    opacity: 0.5;
    filter: grayscale(0.7);
}

/* ==================== WORLD SELECTION ==================== */
.world-selection {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    animation: fadeIn 0.5s ease;
}

.world-selection h2 {
    color: white;
    font-size: 2.2rem;
    margin-bottom: 25px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    text-align: center;
}

.world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 25px;
}

.world-card {
    background: rgba(255,255,255,0.95);
    padding: 30px 20px;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.world-card.unlocked {
    border: 3px solid var(--secondary);
    cursor: pointer;
}

.world-card.unlocked:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}

.world-card.unlocked::after {
    content: '▶';
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 1.5rem;
    opacity: 0.3;
}

.world-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.world-card.locked::before {
    content: '🔒';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
}

.world-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 10px;
}

.world-card h3 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    color: var(--dark);
}

.world-card p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 8px;
}

.world-card .stars {
    color: var(--accent);
    font-size: 1.2rem;
    letter-spacing: 2px;
}

/* ==================== GAME AREA ==================== */
.game-area {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    animation: fadeIn 0.5s ease;
}

.game-container {
    display: grid;
    grid-template-columns: 240px 1fr 220px;
    gap: 20px;
    background: rgba(255,255,255,0.95);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    min-height: 600px;
}

/* ==================== BLOCK PALETTE ==================== */
.block-palette {
    background: var(--light);
    border-radius: 15px;
    padding: 15px;
    max-height: 700px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.block-palette h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.block-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.cat-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 50px;
    background: #e0e0e0;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.75rem;
    transition: all 0.3s ease;
    font-weight: bold;
    flex: 1;
    min-width: 50px;
}

.cat-btn:hover {
    background: #d0d0d0;
}

.cat-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 10px rgba(255,107,107,0.3);
}

.block-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    padding-right: 5px;
}

.block-item {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: grab;
    border-left: 5px solid var(--secondary);
    font-weight: bold;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 0.9rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.block-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.block-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* ==================== WORKSPACE ==================== */
.workspace {
    background: white;
    border-radius: 15px;
    padding: 15px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

.toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.toolbar button {
    padding: 6px 12px;
    border: none;
    border-radius: 50px;
    background: var(--light);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.toolbar button:hover {
    background: var(--secondary);
    color: white;
    transform: scale(1.05);
}

.toolbar .run-btn {
    background: linear-gradient(135deg, var(--success), #27ae60);
    color: white;
    padding: 6px 20px;
    font-weight: bold;
    font-size: 1.1rem;
    margin-left: auto;
}

.toolbar .run-btn:hover {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
}

.code-area {
    flex: 1;
    min-height: 200px;
    background: #fafafa;
    border-radius: 15px;
    border: 3px dashed #ddd;
    padding: 15px;
    position: relative;
    transition: border-color 0.3s ease;
}

.code-area.drag-over {
    border-color: var(--secondary);
    background: #f0fdf4;
}

.drop-zone {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.3s ease;
}

.hint-text {
    color: #bbb;
    text-align: center;
    font-size: 1.1rem;
    padding: 20px 0;
}

/* Placed blocks in workspace */
.placed-block {
    background: white;
    padding: 8px 14px;
    border-radius: 10px;
    margin: 2px 0;
    border-left: 5px solid var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.placed-block:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.placed-block .block-index {
    background: #f0f0f0;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: #888;
    flex-shrink: 0;
}

/* ==================== ROBOT DISPLAY ==================== */
.robot-display {
    background: var(--light);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    margin-top: 12px;
}

.robot-container {
    position: relative;
    display: inline-block;
}

#roboImage {
    width: 80px;
    height: 80px;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.speech-bubble {
    background: white;
    padding: 8px 15px;
    border-radius: 15px;
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    white-space: nowrap;
    font-size: 0.85rem;
    animation: float 2s infinite;
    max-width: 200px;
    white-space: normal;
    word-wrap: break-word;
    min-width: 60px;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

.game-grid {
    margin-top: 12px;
    display: grid;
    gap: 4px;
    max-width: 220px;
    margin-left: auto;
    margin-right: auto;
}

.grid-cell {
    aspect-ratio: 1;
    background: #e8ecf1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    min-width: 30px;
    min-height: 30px;
    font-weight: bold;
}

.grid-cell.robot {
    background: linear-gradient(135deg, var(--primary), #ff4757);
    animation: pulse 1s infinite;
    border-radius: 50%;
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.grid-cell.goal {
    background: linear-gradient(135deg, var(--accent), #f9ca24);
    animation: pulse 1.5s infinite;
}

.grid-cell.wall {
    background: #95a5a6;
    color: white;
}

/* ==================== INFO PANEL ==================== */
.info-panel {
    background: var(--light);
    border-radius: 15px;
    padding: 15px;
    max-height: 700px;
    overflow-y: auto;
}

.info-panel h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-panel #missionText {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 10px;
    min-height: 40px;
}

.mission-progress {
    margin: 10px 0;
    padding: 8px 12px;
    background: white;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
}

.hint-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
}

.hint-section button {
    background: linear-gradient(135deg, var(--warning), #e67e22);
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-family: var(--font-family);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    width: 100%;
    font-size: 1rem;
}

.hint-section button:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.hint-text {
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
    padding: 10px;
    background: white;
    border-radius: 10px;
    min-height: 30px;
    border-left: 4px solid var(--warning);
}

.hint-count {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #999;
    text-align: center;
}

/* ==================== MODALS ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    padding: 35px 40px;
    border-radius: var(--radius);
    max-width: 420px;
    width: 90%;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content .close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 1.8rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.modal-content .close:hover {
    color: var(--danger);
}

.modal-content h2 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8rem;
}

.modal-content input {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--secondary);
}

.modal-content button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), #e74c3c);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s ease;
}

.modal-content button[type="submit"]:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(255,107,107,0.4);
}

.modal-content p {
    text-align: center;
    margin-top: 15px;
}

.modal-content a {
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
}

.modal-content a:hover {
    text-decoration: underline;
}

/* ==================== LEVEL COMPLETE OVERLAY ==================== */
.level-complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    animation: fadeIn 0.5s ease;
    backdrop-filter: blur(5px);
}

.level-complete-box {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    padding: 40px 50px;
    border-radius: 30px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: bounceIn 0.6s ease;
}

.level-complete-box .emoji {
    font-size: 5rem;
    display: block;
    margin-bottom: 10px;
    animation: bounce 1s infinite;
}

.level-complete-box h2 {
    font-size: 2.2rem;
    color: var(--success);
    margin: 10px 0;
}

.level-complete-box p {
    font-size: 1.1rem;
    color: #555;
    margin: 10px 0 20px 0;
    line-height: 1.5;
}

.rewards-summary {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    font-size: 1.3rem;
    flex-wrap: wrap;
}

.rewards-summary span {
    background: #f5f5f5;
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.rewards-summary span:first-child {
    background: #fef9e7;
    color: #f39c12;
}

.rewards-summary span:nth-child(2) {
    background: #fef9e7;
    color: #f1c40f;
}

.rewards-summary span:last-child {
    background: #eaf2f8;
    color: #3498db;
}

.next-btn {
    background: linear-gradient(135deg, var(--primary), #e74c3c);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255,107,107,0.4);
}

.next-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255,107,107,0.6);
}

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

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

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

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

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

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

@keyframes floatUp {
    0% { transform: translateY(0) scale(0); opacity: 1; }
    100% { transform: translateY(-200px) scale(1.5); opacity: 0; }
}

@keyframes explode {
    0% { transform: scale(0) rotate(0deg); opacity: 1; }
    50% { transform: scale(2) rotate(180deg); opacity: 1; }
    100% { transform: scale(3) rotate(360deg); opacity: 0; }
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.floating-star,
.firework,
.confetti {
    pointer-events: none;
    position: fixed;
    z-index: 9999;
}

/* ==================== RESPONSIVE ==================== */
/* Tablet */
@media (max-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .block-palette {
        order: 2;
        max-height: 300px;
    }
    
    .block-list {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 150px;
        overflow-y: auto;
    }
    
    .block-item {
        flex: 0 0 auto;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .info-panel {
        order: 3;
        max-height: 300px;
    }
    
    .workspace {
        order: 1;
        min-height: 350px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .main-nav {
        padding: 10px 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .logo {
        font-size: 1.1rem;
        justify-content: center;
    }
    
    .logo img {
        width: 35px;
        height: 35px;
    }
    
    .nav-controls {
        justify-content: center;
        gap: 6px;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .nav-btn .icon {
        font-size: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .user-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stats {
        justify-content: center;
    }
    
    .world-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .world-card {
        padding: 20px 15px;
    }
    
    .world-icon {
        font-size: 3rem;
    }
    
    .game-container {
        padding: 10px;
        gap: 10px;
    }
    
    .toolbar {
        gap: 4px;
    }
    
    .toolbar button {
        padding: 4px 8px;
        font-size: 0.85rem;
    }
    
    .grid-cell {
        font-size: 1rem;
        min-width: 25px;
        min-height: 25px;
    }
    
    .speech-bubble {
        font-size: 0.7rem;
        max-width: 120px;
        top: -35px;
    }
    
    .modal-content {
        padding: 25px 20px;
    }
    
    .level-complete-box {
        padding: 30px 25px;
    }
    
    .level-complete-box .emoji {
        font-size: 3.5rem;
    }
    
    .level-complete-box h2 {
        font-size: 1.6rem;
    }
    
    .rewards-summary {
        font-size: 1rem;
        gap: 10px;
    }
    
    .continue-btn {
        font-size: 1.1rem;
        padding: 15px 20px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .nav-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
    
    .nav-btn .icon {
        font-size: 0.8rem;
    }
    
    .logo {
        font-size: 0.95rem;
    }
    
    .logo img {
        width: 28px;
        height: 28px;
    }
    
    .stats {
        gap: 5px;
    }
    
    .stat {
        font-size: 0.85rem;
        padding: 3px 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    .avatar {
        width: 60px;
        height: 60px;
    }
    
    .world-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 10px;
    }
    
    .world-card {
        padding: 15px 10px;
    }
    
    .world-icon {
        font-size: 2.5rem;
    }
    
    .world-card h3 {
        font-size: 1.1rem;
    }
    
    .grid-cell {
        font-size: 0.8rem;
        min-width: 20px;
        min-height: 20px;
    }
    
    .block-item {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
    
    .placed-block {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .toolbar button {
        padding: 3px 6px;
        font-size: 0.75rem;
    }
    
    .toolbar .run-btn {
        font-size: 0.85rem;
        padding: 4px 12px;
    }
}

/* ==================== LANDSCAPE MODE ==================== */
@media (max-height: 600px) and (orientation: landscape) {
    .main-nav {
        padding: 5px 15px;
    }
    
    .dashboard {
        margin: 10px auto;
    }
    
    .card {
        padding: 12px;
    }
    
    .game-container {
        min-height: 400px;
        padding: 10px;
    }
    
    .block-palette {
        max-height: 250px;
    }
    
    .block-list {
        max-height: 120px;
    }
    
    .workspace {
        min-height: 250px;
    }
    
    .code-area {
        min-height: 120px;
    }
    
    .robot-display {
        padding: 8px;
    }
    
    #roboImage {
        width: 50px;
        height: 50px;
    }
    
    .speech-bubble {
        font-size: 0.7rem;
        top: -30px;
        max-width: 100px;
        padding: 4px 10px;
    }
    
    .grid-cell {
        font-size: 0.8rem;
        min-width: 20px;
        min-height: 20px;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .main-nav,
    .nav-controls,
    .toolbar,
    .hint-section,
    .daily-reward {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .card,
    .game-container,
    .block-palette,
    .workspace,
    .info-panel {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ==================== UTILITY ==================== */
.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== DRAG & DROP VISUAL FEEDBACK ==================== */
.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.drop-hover {
    border-color: var(--secondary) !important;
    background: #f0fdf4 !important;
}