/* ============================================
   BeTech Games - Estilos Principales
   ✨ Diseño amigable para niños de primaria ✨
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Fredoka+One&display=swap');

:root {
    /* Paleta BeTech - Colores vibrantes y amigables */
    --primary-color: #09D4EF;
    --primary-dark: #08BDD6;
    --primary-light: #E8F8FF;
    --primary-glow: rgba(9, 212, 239, 0.4);
    
    --secondary-color: #FFDD59;
    --secondary-dark: #FFCA28;
    --secondary-light: #FFF9E6;
    
    --accent-purple: #A29BFE;
    --accent-pink: #FF9FF3;
    --accent-orange: #FF9F43;
    --accent-cyan: #09D4EF;
    
    --success-color: #09D4EF;
    --danger-color: #FF6B6B;
    --warning-color: #FFDD59;
    
    --dark-color: #2D3436;
    --text-color: #2D3436;
    --text-muted: #636E72;
    --light-color: #F8F9FA;
    
    --background-color: #FFFFFF;
    --card-background: #FFFFFF;
    --background-gradient: linear-gradient(135deg, #E8F8FF 0%, #FFF9E6 50%, #F0E6FF 100%);
    
    --board-cell: linear-gradient(145deg, #FFFFFF 0%, #F0FAFD 100%);
    --board-border: #B2EAF5;
    --robot-color: #09D4EF;
    
    --ball-red: #FF6B6B;
    --ball-blue: #54A0FF;
    --ball-green: #09D4EF;
    --ball-black: #2D3436;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 30px rgba(9, 212, 239, 0.3);
    
    --border-radius-sm: 12px;
    --border-radius-md: 20px;
    --border-radius-lg: 28px;
    --border-radius-xl: 36px;

    /* Mobile/webview metrics */
    --app-height: 100vh;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --board-cell-size: 65px;
    --board-gap: 4px;
    --board-padding: 6px;
    --robot-size: 52px;
    --ball-size: 14px;
    --mobile-touch-target: 44px;
}

@supports (height: 100dvh) {
    :root {
        --app-height: 100dvh;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background: var(--background-gradient);
    color: var(--text-color);
    min-height: var(--app-height);
    overflow-x: hidden;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: var(--safe-area-bottom);
}

#app {
    min-height: var(--app-height);
}

/* Decoraciones de fondo animadas */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(9, 212, 239, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(255, 221, 89, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(162, 155, 254, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Decoraciones flotantes */
.floating-decoration {
    position: fixed;
    pointer-events: none;
    z-index: -1;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

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

/* ============================================
   Screens
   ============================================ */

.screen {
    display: none;
    min-height: var(--app-height);
    width: 100%;
    background: var(--background-gradient);
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: block;
}

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

/* ============================================
   Login Screen
   ============================================ */

#login-screen {
    display: none;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #E8F8FF 0%, #FFFFFF 30%, #FFF9E6 60%, #F0E6FF 100%);
    position: relative;
    overflow: hidden;
}

#login-screen::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    animation: pulse-slow 4s ease-in-out infinite;
}

#login-screen::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 221, 89, 0.3) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    animation: pulse-slow 4s ease-in-out infinite 2s;
}

@keyframes pulse-slow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

#login-screen.active {
    display: flex;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(9, 212, 239, 0.1);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 1;
    border: 2px solid rgba(9, 212, 239, 0.1);
}

.logo {
    margin-bottom: 2rem;
}

.logo i {
    font-size: 4.5rem;
    background: var(--primary-color);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    display: inline-block;
    animation: bounce-gentle 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(9, 212, 239, 0.3));
}

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

.logo h1 {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 2.5rem;
    background: var(--primary-color);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group input {
    width: 100%;
    padding: 1.1rem 1.2rem;
    border: 2px solid #E8F2F5;
    border-radius: var(--border-radius-md);
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    color: var(--text-color);
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input::placeholder {
    color: #A0AEC0;
    font-weight: 500;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-glow), var(--shadow-md);
    transform: translateY(-2px);
}

.error-message {
    color: var(--danger-color);
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ============================================
   Teacher Dashboard
   ============================================ */

.dashboard-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.welcome-card {
    flex: 1;
    min-width: 250px;
}

.welcome-card h2 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.welcome-card p {
    color: var(--text-muted);
    font-size: 1rem;
}

.quick-stats {
    display: flex;
    gap: 1rem;
}

.stat-card {
    background: white;
    padding: 1.2rem 2rem;
    border-radius: var(--border-radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid #E2E8F0;
}

.stat-card .stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 2px solid #E2E8F0;
}

.dashboard-card h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-card h3 i {
    color: var(--primary-color);
}

.classes-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.class-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #F8F9FA;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.class-item:hover {
    background: var(--primary-light);
}

.class-info h4 {
    margin: 0;
    font-size: 1rem;
}

.class-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.activity-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.8rem;
    background: #F8F9FA;
    border-radius: var(--border-radius-sm);
}

.activity-icon {
    font-size: 1.5rem;
}

.activity-info {
    flex: 1;
}

.activity-info strong {
    color: var(--text-color);
}

.activity-time {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.tool-btn-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: linear-gradient(145deg, #F8F9FA, white);
    border: 2px solid #E2E8F0;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.3s;
}

.tool-btn-large:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.tool-btn-large i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.tool-btn-large span {
    font-weight: 600;
    color: var(--text-color);
}

/* ============================================
   Admin Dashboard
   ============================================ */

.admin-header {
    background: linear-gradient(135deg, #2D3436, #636E72) !important;
}

.admin-content {
    display: flex;
    height: calc(100vh - 70px);
}

.admin-sidebar {
    width: 240px;
    background: #2D3436;
    padding: 1rem 0;
}

.admin-nav {
    display: flex;
    flex-direction: column;
}

.admin-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: #B2BEC3;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.admin-nav-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-nav-btn.active {
    background: var(--primary-color);
    color: white;
}

.admin-nav-btn i {
    width: 20px;
}

.admin-main {
    flex: 1;
    padding: 2rem;
    background: #F8F9FA;
    overflow-y: auto;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.admin-section h2 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-stat-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.schools { background: linear-gradient(135deg, #A29BFE, #6C5CE7); }
.stat-icon.teachers { background: #09D4EF; }
.stat-icon.students { background: linear-gradient(135deg, #54A0FF, #2E86DE); }
.stat-icon.games { background: linear-gradient(135deg, #FFDD59, #FF9F43); }

.stat-info .stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-color);
}

.stat-info .stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.admin-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.admin-panel {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.admin-panel h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-panel h3 i {
    color: var(--primary-color);
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 150px;
    padding: 1rem 0;
}

.bar-chart .bar {
    width: 30px;
    background: var(--primary-color);
    border-radius: 5px 5px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.3rem;
    transition: height 0.3s;
}

.bar-chart .bar span {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Top List */
.top-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: #F8F9FA;
    border-radius: var(--border-radius-sm);
}

.top-item .rank {
    width: 30px;
    height: 30px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.top-item .name {
    flex: 1;
    font-weight: 600;
}

.top-item .score {
    color: var(--primary-color);
    font-weight: 700;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-filters {
    display: flex;
    gap: 1rem;
}

.filter-select {
    padding: 0.6rem 1rem;
    border: 1px solid #E2E8F0;
    border-radius: var(--border-radius-sm);
    background: white;
    font-size: 0.9rem;
}

/* Data Table */
.data-table {
    background: white;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
}

.data-table th {
    background: #F8F9FA;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.data-table td {
    color: var(--text-color);
}

.progress-mini {
    width: 100px;
    height: 8px;
    background: #E2E8F0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-mini .fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 10px;
}

.status {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.active {
    background: #E8F8FF;
    color: var(--primary-dark);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--primary-color);
}

/* Games Admin Grid */
.games-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.game-admin-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid #E2E8F0;
    transition: all 0.2s;
}

.game-admin-card:hover {
    border-color: var(--primary-color);
}

.game-admin-card .game-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.game-admin-card h4 {
    margin: 0.5rem 0;
    color: var(--text-color);
}

.game-admin-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ============================================
   Tracking Tables & Full Width Cards
   ============================================ */

.dashboard-card.full-width,
.admin-panel.full-width {
    grid-column: 1 / -1;
}

.students-tracking-table {
    overflow-x: auto;
}

.tracking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tracking-table th,
.tracking-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
}

.tracking-table th {
    background: #F8F9FA;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tracking-table tbody tr:hover {
    background: #F8FEFF;
}

.tracking-table .student-cell {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.tracking-table .student-avatar {
    font-size: 1.5rem;
}

.tracking-table .student-name {
    font-weight: 600;
    color: var(--text-color);
}

.tracking-table .grade-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tracking-table .stars-display {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.tracking-table .stars-display .star-icon {
    color: #FFD93D;
    font-size: 1rem;
}

.tracking-table .stars-display .star-count {
    font-weight: 700;
    color: var(--text-color);
}

.tracking-table .progress-bar-cell {
    width: 120px;
}

.tracking-table .progress-bar {
    height: 10px;
    background: #E2E8F0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.tracking-table .progress-bar .fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.tracking-table .progress-bar .fill.low {
    background: linear-gradient(90deg, #FF6B6B, #FF8787);
}

.tracking-table .progress-bar .fill.medium {
    background: linear-gradient(90deg, #FFD93D, #FFE066);
}

.tracking-table .progress-bar .fill.high {
    background: #09D4EF;
}

.tracking-table .progress-percent {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.tracking-table .last-active {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tracking-table .last-active.recent {
    color: var(--primary-color);
    font-weight: 600;
}

.tracking-table .status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tracking-table .status-indicator.active {
    background: #E8F8FF;
    color: #08BDD6;
}

.tracking-table .status-indicator.inactive {
    background: #FFF4E6;
    color: #FF9F43;
}

.tracking-table .status-indicator.needs-attention {
    background: #FFE6E6;
    color: #FF6B6B;
}

.tracking-table .status-indicator i {
    font-size: 0.6rem;
}

/* School Tracking Section */
.school-tracking-section {
    margin-top: 2rem;
}

.school-tracking-section h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.school-tracking-section h3 i {
    color: var(--primary-color);
}

.grade-tracking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.grade-tracking-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-color);
}

.grade-tracking-card .grade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.grade-tracking-card .grade-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
}

.grade-tracking-card .grade-students {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.grade-tracking-card .grade-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    text-align: center;
}

.grade-tracking-card .grade-stat {
    padding: 0.5rem;
    background: #F8F9FA;
    border-radius: var(--border-radius-sm);
}

.grade-tracking-card .grade-stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-color);
}

.grade-tracking-card .grade-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.grade-tracking-card .grade-progress {
    margin-top: 1rem;
}

.grade-tracking-card .grade-progress-bar {
    height: 8px;
    background: #E2E8F0;
    border-radius: 10px;
    overflow: hidden;
}

.grade-tracking-card .grade-progress-bar .fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.grade-tracking-card .grade-progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   Buttons - Estilo divertido y moderno
   ============================================ */

.btn {
    padding: 0.9rem 1.6rem;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    position: relative;
    overflow: hidden;
    text-transform: none;
    letter-spacing: 0.3px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn:active::before {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    margin-bottom: 0.8rem;
    box-shadow: 0 4px 15px rgba(9, 212, 239, 0.3);
}

.btn-primary:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(9, 212, 239, 0.45);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #b0bec5, #90a4ae);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
}

.btn-secondary {
    background: transparent;
    border: 3px solid var(--primary-color);
    color: var(--primary-color);
    width: 100%;
}

.btn-secondary:hover {
    background: var(--primary-light);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 15px rgba(9, 212, 239, 0.3);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(9, 212, 239, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #E64545);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.45);
}

.btn-small {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    border: 2px solid #E8F2F5;
    border-radius: var(--border-radius-sm);
    backdrop-filter: blur(10px);
}

.btn-small:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* ============================================
   Header - Colorido y atractivo
   ============================================ */

header {
    background: var(--primary-color);
    padding: calc(1rem + var(--safe-area-top)) clamp(1rem, 2.5vw, 2rem) 1rem;
    box-shadow: 0 4px 20px rgba(9, 212, 239, 0.3);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    min-width: 0;
}

.header-content h1 {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.7rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content h1 i {
    color: var(--secondary-color);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    animation: wiggle 3s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    min-width: 0;
}

#user-name {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    backdrop-filter: blur(10px);
}

header .btn-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

header .btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* ============================================
   Main Menu - Games Grid 🎮
   ============================================ */

.menu-content {
    padding: clamp(1.25rem, 3vw, 2.5rem);
    max-width: 1200px;
    margin: 0 auto;
}

.menu-content h2 {
    text-align: center;
    margin-bottom: 2.5rem;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 2.4rem;
    background: var(--primary-color);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.menu-content h2::after {
    content: '🎮';
    position: absolute;
    font-size: 1.2rem;
    margin-left: 10px;
    animation: bounce-gentle 2s ease-in-out infinite;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(1rem, 2vw, 2rem);
}

.games-section-header {
    grid-column: 1 / -1;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-color, #2d3436);
    margin: 1.5rem 0 0.5rem 0;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, rgba(9, 212, 239, 0.1), rgba(108, 92, 231, 0.08));
    border-radius: 12px;
    border-left: 4px solid var(--primary-color, #09D4EF);
}

.games-section-header:first-child {
    margin-top: 0;
}

.game-card {
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.game-card:hover::before {
    transform: scaleX(1);
}

.game-card:hover {
    transform: translateY(-12px) scale(1.02);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.game-card .icon {
    font-size: 5rem;
    margin-bottom: 1.2rem;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    transition: transform 0.4s ease;
}

.game-card:hover .icon {
    transform: scale(1.15) rotate(-5deg);
}

.game-card h3 {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.6rem;
    margin-bottom: 0.7rem;
    color: var(--dark-color);
}

.game-card p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
}

.game-card .progress-bar {
    margin-top: 1.5rem;
    background: #E8F2F5;
    border-radius: var(--border-radius-sm);
    height: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-card .progress-bar .fill {
    background: var(--primary-color);
    height: 100%;
    border-radius: var(--border-radius-sm);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.game-card .progress-bar .fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   Level Selection ⭐
   ============================================ */

.levels-content {
    --levels-accent: #09D4EF;
    --levels-accent-soft: rgba(9, 212, 239, 0.16);
    --levels-accent-strong: rgba(9, 212, 239, 0.34);
    padding: clamp(1.25rem, 3vw, 2.5rem);
    max-width: 1320px;
    margin: 0 auto;
    display: grid;
    gap: 1.5rem;
}

.levels-hero {
    display: grid;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: stretch;
}

.levels-hero-copy {
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.92) 42%, rgba(247, 251, 253, 0.96) 100%);
    border-radius: 28px;
    padding: clamp(1.4rem, 3vw, 2rem);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
}

.levels-hero-copy::after {
    content: '';
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--levels-accent-soft);
    top: -60px;
    right: -45px;
    filter: blur(8px);
}

.levels-chip {
    align-self: flex-start;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: var(--levels-accent-soft);
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    position: relative;
    z-index: 1;
}

.levels-heading {
    margin: 0;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    color: var(--dark-color);
    line-height: 1.05;
    position: relative;
    z-index: 1;
}

.levels-description {
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.levels-map-panel {
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    min-height: 260px;
    padding: 1.25rem;
    background:
        radial-gradient(circle at 15% 18%, rgba(255, 214, 10, 0.28) 0%, transparent 10%),
        radial-gradient(circle at 82% 20%, rgba(186, 104, 200, 0.42) 0%, transparent 8%),
        radial-gradient(circle at 70% 76%, rgba(129, 212, 250, 0.18) 0%, transparent 16%),
        linear-gradient(180deg, #2a6074 0%, #1f4e64 52%, #153c52 100%);
    box-shadow: var(--shadow-lg);
}

.levels-map-panel::before,
.levels-map-panel::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.levels-map-panel::before {
    width: 170px;
    height: 170px;
    background: radial-gradient(circle at 30% 35%, #ffe066 0%, #ffb347 55%, #f57c00 100%);
    right: -38px;
    top: -40px;
    transform: rotate(-18deg);
    box-shadow: 0 12px 30px rgba(245, 124, 0, 0.28);
}

.levels-map-panel::after {
    width: 210px;
    height: 70px;
    background: linear-gradient(135deg, #a8db76, #7cb342);
    left: 52%;
    bottom: -26px;
    transform: translateX(-50%);
    border-radius: 999px 999px 0 0;
    box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.14);
}

.levels-map {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem 0.75rem 1.4rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.levels-map-track {
    min-width: max-content;
    display: flex;
    align-items: center;
    padding: 0.75rem 0 1.5rem;
}

.levels-map-link {
    width: clamp(42px, 7vw, 84px);
    border-top: 4px dotted rgba(255, 255, 255, 0.4);
    margin: 0 0.15rem;
    align-self: center;
}

.levels-map-link.available {
    border-top-color: rgba(255, 255, 255, 0.72);
}

.levels-map-link.completed {
    border-top-color: #ffe082;
}

.levels-map-stop {
    border: none;
    background: none;
    padding: 0;
    min-width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    color: white;
    cursor: pointer;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.levels-map-stop.is-high {
    transform: translateY(-14px);
}

.levels-map-stop.is-low {
    transform: translateY(22px);
}

.levels-map-stop:hover:not(:disabled) {
    transform: translateY(-20px) scale(1.03);
}

.levels-map-stop.is-low:hover:not(:disabled) {
    transform: translateY(16px) scale(1.03);
}

.levels-map-stop:disabled {
    cursor: not-allowed;
}

.levels-map-stop.locked {
    opacity: 0.45;
}

.levels-map-preview {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 1.15rem;
    box-shadow: 0 10px 22px rgba(7, 20, 27, 0.22);
}

.levels-map-node {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #b8d989 0%, #8bc34a 100%);
    border: 4px solid rgba(255, 255, 255, 0.92);
    color: white;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.25rem;
    box-shadow: 0 12px 26px rgba(15, 35, 47, 0.28);
}

.levels-map-stop.completed .levels-map-node {
    background: linear-gradient(145deg, #ffd86b 0%, #ffb300 100%);
}

.levels-map-stop.is-current .levels-map-node {
    background: linear-gradient(145deg, var(--levels-accent) 0%, #55e6ff 100%);
    animation: levels-pulse 1.8s ease-in-out infinite;
}

.levels-map-stop.locked .levels-map-node {
    background: linear-gradient(145deg, #c5d1da 0%, #94a8b6 100%);
}

.levels-map-title {
    max-width: 92px;
    padding: 0.42rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 10px 20px rgba(9, 24, 30, 0.18);
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.level-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, #f8fcfe 100%);
    border-radius: 24px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(226, 236, 241, 0.95);
    position: relative;
    box-shadow: 0 10px 35px rgba(16, 39, 51, 0.08);
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, var(--levels-accent-soft) 0%, transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(244, 250, 253, 0.65) 100%);
    pointer-events: none;
}

.level-card:hover:not(.locked) {
    transform: translateY(-8px);
    border-color: var(--levels-accent);
    box-shadow: 0 18px 44px rgba(16, 39, 51, 0.14);
}

.level-card.locked {
    opacity: 0.72;
    cursor: not-allowed;
    filter: saturate(0.82);
}

.level-card.locked::after {
    content: '\f023';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    font-size: 1.05rem;
    color: #6f8798;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(235, 242, 247, 0.95);
    display: grid;
    place-items: center;
}

.level-card.completed {
    border-color: rgba(0, 210, 160, 0.28);
    box-shadow: 0 14px 36px rgba(0, 210, 160, 0.12);
}

.level-card.current {
    border-color: var(--levels-accent);
    box-shadow: 0 16px 42px var(--levels-accent-soft);
}

.level-card-top,
.level-card-body,
.level-card-footer {
    position: relative;
    z-index: 1;
}

.level-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.level-card-orb {
    width: 66px;
    height: 66px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    background: linear-gradient(145deg, var(--levels-accent-soft) 0%, rgba(255, 255, 255, 0.96) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 8px 20px rgba(14, 35, 46, 0.08);
}

.level-card-status {
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #edf5fa;
    color: #4f6775;
}

.level-card-status.completado {
    background: rgba(0, 210, 160, 0.12);
    color: #00a57e;
}

.level-card-status.siguiente {
    background: var(--levels-accent-soft);
    color: var(--primary-dark);
}

.level-card-status.disponible {
    background: rgba(255, 221, 89, 0.2);
    color: #8a6b00;
}

.level-card-status.bloqueado {
    background: rgba(148, 168, 182, 0.18);
    color: #6f8798;
}

.level-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1;
}

.level-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.level-card .level-number {
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.42rem 0.68rem;
    border-radius: 999px;
    background: rgba(237, 245, 250, 0.96);
    color: var(--dark-color);
}

.level-card-target {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 700;
}

.level-card h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--dark-color);
    line-height: 1.25;
}

.level-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
    font-size: 0.95rem;
}

.level-card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(223, 234, 239, 0.9);
    display: grid;
    gap: 0.85rem;
}

.level-card-stats {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.level-card-stats span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.7rem;
    border-radius: 999px;
    background: rgba(244, 248, 251, 0.94);
    color: #4f6775;
    font-size: 0.8rem;
    font-weight: 700;
}

.level-card-stats i {
    color: var(--levels-accent);
}

.level-card .stars {
    margin-top: 0;
    color: #f6c745;
    font-size: 1rem;
    display: flex;
    gap: 4px;
}

.level-card .stars i {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
    transition: transform 0.2s ease;
}

.level-card:hover:not(.locked) .stars i {
    animation: star-bounce 0.6s ease infinite;
}

.level-card .stars i:nth-child(2) { animation-delay: 0.1s; }
.level-card .stars i:nth-child(3) { animation-delay: 0.2s; }

@keyframes star-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.level-card .stars i.empty {
    color: #D4D4D4;
}

.levels-footer-band {
    padding: 1rem 1.4rem;
    border-radius: 18px;
    background: linear-gradient(135deg, #a45aa6 0%, #c67abf 100%);
    color: white;
    text-align: center;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: clamp(1rem, 2vw, 1.35rem);
    box-shadow: 0 18px 30px rgba(164, 90, 166, 0.22);
}

@keyframes levels-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--levels-accent-strong);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(255, 255, 255, 0);
    }
}

/* ============================================
   Game Screen 🎯
   ============================================ */

.game-content {
    padding: clamp(0.75rem, 2vw, 1.5rem);
    min-height: calc(var(--app-height) - 70px);
    height: auto;
}

.game-layout {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1.5rem;
    min-height: 0;
    height: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

/* Instructions Panel */
.instructions-panel {
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    border-radius: var(--border-radius-lg);
    padding: 1.8rem;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    border: 2px solid #E8F2F5;
}

.instructions-panel h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    color: var(--primary-color);
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.3rem;
}

.instructions-panel h3 i {
    font-size: 1.4rem;
}

.instructions-panel p {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.2rem;
    font-weight: 500;
    font-size: 1rem;
}

.objective {
    background: var(--primary-light);
    padding: 1.3rem;
    border-radius: var(--border-radius-md);
    border-left: 5px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.objective::before {
    content: '🎯';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    opacity: 0.3;
}

.objective h4 {
    color: var(--primary-dark);
    margin-bottom: 0.6rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.objective p {
    margin-bottom: 0;
    color: var(--dark-color);
}

/* Game Board Container */
.game-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(145deg, #FFFFFF 0%, #F0FAFD 100%);
    border-radius: var(--border-radius-lg);
    padding: clamp(0.85rem, 2vw, 2rem);
    box-shadow: var(--shadow-md);
    border: 2px solid #E8F2F5;
    position: relative;
    overflow: hidden;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.game-board-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 0% 0%, rgba(9, 212, 239, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(255, 221, 89, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* Game Board - El tablero mágico ✨ */
.game-board {
    display: grid;
    gap: var(--board-gap);
    background: var(--primary-color);
    padding: var(--board-padding);
    border-radius: var(--border-radius-md);
    box-shadow: 
        0 8px 32px rgba(9, 212, 239, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    width: fit-content;
    max-width: 100%;
}

/* Celdas del tablero */
.cell {
    width: var(--board-cell-size);
    height: var(--board-cell-size);
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    border-radius: 10px;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.03),
        0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(9, 212, 239, 0.1) 0%, transparent 100%);
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cell:hover::before {
    opacity: 1;
}

.cell.highlight {
    background: linear-gradient(145deg, rgba(9, 212, 239, 0.2), rgba(9, 212, 239, 0.1));
    box-shadow: inset 0 0 15px rgba(9, 212, 239, 0.3);
}

.cell.target {
    background: linear-gradient(145deg, rgba(255, 221, 89, 0.3), rgba(255, 221, 89, 0.15));
    border: 3px dashed var(--secondary-color);
    animation: target-pulse 2s ease-in-out infinite;
}

.target-landmark {
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px 3px;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 248, 214, 0.96));
    border: 1px solid rgba(243, 156, 18, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 1px 3px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: 4;
}

.target-landmark-icon {
    line-height: 1;
    font-size: clamp(0.72rem, 2.2vw, 1rem);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.target-landmark-label {
    max-width: 100%;
    color: var(--dark-color);
    font-size: clamp(0.38rem, 1vw, 0.56rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    text-wrap: balance;
}

@keyframes target-pulse {
    0%, 100% { box-shadow: inset 0 0 10px rgba(255, 221, 89, 0.3); }
    50% { box-shadow: inset 0 0 20px rgba(255, 221, 89, 0.5); }
}

/* Robot/Cabezal - Con movimiento suave deslizante 🤖 */
.robot {
    width: var(--robot-size);
    height: var(--robot-size);
    background: url('../4.2-243_20_E6_8B_B7_E8_B4_9D-500x500.webp') center/contain no-repeat;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0;
    box-shadow: none;
    z-index: 10;
    /* IMPORTANTE: Transición suave para el movimiento deslizante */
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.robot.up, .robot.direction-up { transform: rotate(180deg); }
.robot.right, .robot.direction-right { transform: rotate(270deg); }
.robot.down, .robot.direction-down { transform: rotate(0deg); }
.robot.left, .robot.direction-left { transform: rotate(90deg); }

.robot-cargo {
    position: absolute;
    left: 50%;
    top: calc(100% - 6px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 14px;
    padding: 2px 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(45, 52, 54, 0.12);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transform: translateX(-50%);
    transform-origin: center;
}

.robot.up .robot-cargo,
.robot.direction-up .robot-cargo { transform: translateX(-50%) rotate(-180deg); }
.robot.right .robot-cargo,
.robot.direction-right .robot-cargo { transform: translateX(-50%) rotate(-270deg); }
.robot.left .robot-cargo,
.robot.direction-left .robot-cargo { transform: translateX(-50%) rotate(-90deg); }

.robot-cargo-item {
    width: max(7px, calc(var(--ball-size) * 0.78));
    height: max(7px, calc(var(--ball-size) * 0.78));
    border-radius: 50%;
    box-shadow:
        inset -2px -2px 3px rgba(0, 0, 0, 0.26),
        inset 1px 1px 2px rgba(255, 255, 255, 0.45);
}

.robot-cargo-item.red { background: radial-gradient(circle at 30% 30%, #FF8A8A, var(--ball-red), #CC5555); }
.robot-cargo-item.blue { background: radial-gradient(circle at 30% 30%, #82C4FF, var(--ball-blue), #4080CC); }
.robot-cargo-item.green { background: radial-gradient(circle at 30% 30%, #50DBEF, var(--ball-green), #08A8D6); }
.robot-cargo-item.black { background: radial-gradient(circle at 30% 30%, #5A5A5A, var(--ball-black), #1A1A1A); }

.robot-cargo-count {
    color: var(--dark-color);
    font-size: 0.58rem;
    line-height: 1;
    font-weight: 900;
}

.robot.up::after,
.robot.down::after,
.robot.right::after,
.robot.left::after,
.robot.direction-up::after,
.robot.direction-down::after,
.robot.direction-right::after,
.robot.direction-left::after { content: ''; }

/* Efecto de movimiento del robot */
.robot.moving {
    animation: robot-hop 0.35s ease;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

@keyframes robot-hop {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.92; }
}

/* Balls/Bolitas - Más lindas y brillantes 🔵🔴🟢⚫ */
.balls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    max-width: calc(var(--board-cell-size) - 10px);
    z-index: 5;
}

.ball {
    width: var(--ball-size);
    height: var(--ball-size);
    border-radius: 50%;
    box-shadow: 
        inset -3px -3px 6px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    animation: ball-appear 0.4s ease;
}

@keyframes ball-appear {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.ball.red { 
    background: radial-gradient(circle at 30% 30%, #FF8A8A, var(--ball-red), #CC5555);
}
.ball.blue { 
    background: radial-gradient(circle at 30% 30%, #82C4FF, var(--ball-blue), #4080CC);
}
.ball.green { 
    background: radial-gradient(circle at 30% 30%, #50DBEF, var(--ball-green), #08A8D6);
}
.ball.black { 
    background: radial-gradient(circle at 30% 30%, #5A5A5A, var(--ball-black), #1A1A1A);
}

/* Code Panel - Panel de comandos 💻 */
.code-panel {
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 2px solid #E8F2F5;
    min-height: 0;
}

.code-panel h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.2rem;
}

.available-commands {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    padding-bottom: 1.2rem;
    border-bottom: 2px solid #E8F2F5;
}

.command-btn {
    padding: 0.6rem 1rem;
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    border: 2px solid #E8F2F5;
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.command-icon-ball {
    width: 0.95rem;
    height: 0.95rem;
    min-width: 0.95rem;
    border-radius: 50%;
    display: inline-block;
    font-size: 0;
    box-shadow:
        inset -2px -2px 4px rgba(0, 0, 0, 0.28),
        inset 1px 1px 3px rgba(255, 255, 255, 0.45),
        0 1px 3px rgba(0, 0, 0, 0.22);
}

.command-icon-ball.red {
    background: radial-gradient(circle at 30% 30%, #FF8A8A, var(--ball-red), #CC5555);
}

.command-icon-ball.blue {
    background: radial-gradient(circle at 30% 30%, #82C4FF, var(--ball-blue), #4080CC);
}

.command-icon-ball.green {
    background: radial-gradient(circle at 30% 30%, #50DBEF, var(--ball-green), #08A8D6);
}

.command-icon-ball.black {
    background: radial-gradient(circle at 30% 30%, #5A5A5A, var(--ball-black), #1A1A1A);
}

.command-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.command-btn.movement { 
    border-color: var(--primary-color); 
    background: var(--primary-light);
}
.command-btn.movement:hover {
    background: var(--primary-color);
    color: white;
}

.command-btn.action { 
    border-color: var(--secondary-color); 
    background: linear-gradient(145deg, var(--secondary-light) 0%, #FFF9E6 100%);
}
.command-btn.action:hover {
    background: var(--secondary-color);
    color: var(--dark-color);
}

.command-btn.control { 
    border-color: var(--accent-purple); 
    background: linear-gradient(145deg, #F0E6FF 0%, #EDE4FF 100%);
}
.command-btn.control:hover {
    background: var(--accent-purple);
    color: white;
}

.program-area {
    flex: 1;
    background: linear-gradient(145deg, #F8FEFF 0%, #F0FAFD 100%);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    overflow-y: auto;
    min-height: 200px;
    margin-bottom: 1rem;
    border: 3px dashed #D4F0EC;
    position: relative;
}

.program-area:empty::before {
    content: '🎯 Arrastra o haz clic en los comandos para crear tu programa';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
}

.program-command {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    animation: slide-in 0.3s ease;
}

.program-command-main {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.program-command-index,
.program-command-label {
    white-space: nowrap;
}

@keyframes slide-in {
    from { 
        opacity: 0; 
        transform: translateX(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

.program-command:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.program-command.executing {
    border-left-color: var(--secondary-color);
    background: linear-gradient(145deg, #FFFDE7 0%, #FFF9C4 100%);
    animation: executing-pulse 0.5s ease infinite;
}

@keyframes executing-pulse {
    0%, 100% { box-shadow: var(--shadow-sm); }
    50% { box-shadow: 0 0 20px rgba(255, 221, 89, 0.5); }
}

.program-command .remove-cmd {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.3rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.program-command .remove-cmd:hover {
    background: rgba(255, 107, 107, 0.1);
    transform: scale(1.2);
}

.execution-controls {
    display: flex;
    gap: 0.8rem;
}

.execution-controls .btn {
    flex: 1;
    font-size: 1rem;
    padding: 1rem;
}

/* ============================================
   Modal - Ventanas emergentes lindas 🎉
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    padding:
        calc(1rem + var(--safe-area-top))
        calc(1rem + var(--safe-area-right))
        calc(1rem + var(--safe-area-bottom))
        calc(1rem + var(--safe-area-left));
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    padding: clamp(1.25rem, 3vw, 3rem);
    border-radius: var(--border-radius-xl);
    text-align: center;
    max-width: 420px;
    width: 90%;
    animation: modalPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(9, 212, 239, 0.1);
    border: 3px solid rgba(9, 212, 239, 0.1);
    position: relative;
    overflow: hidden;
    max-height: calc(var(--app-height) - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--primary-color);
}

@keyframes modalPop {
    from {
        transform: scale(0.7) translateY(20px);
        opacity: 0;
    }
    50% {
        transform: scale(1.02);
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content.victory {
    background: linear-gradient(145deg, #FFFDE7 0%, #FFF9C4 50%, #FFFFFF 100%);
}

.modal-content.victory > i.fa-trophy {
    font-size: 6rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    animation: trophy-bounce 1s ease infinite;
    filter: drop-shadow(0 4px 8px rgba(255, 159, 67, 0.4));
}

.modal-content.victory .modal-buttons .btn i {
    font-size: 1rem;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: inherit;
    background-clip: unset;
    filter: none;
    animation: none;
    margin-bottom: 0;
}

@keyframes trophy-bounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.modal-content h2 {
    margin-bottom: 0.6rem;
    color: var(--dark-color);
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.8rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.modal .stars {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1.8rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.modal .stars i {
    animation: star-pop 0.4s ease forwards;
    opacity: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.modal .stars i:nth-child(1) { animation-delay: 0.2s; }
.modal .stars i:nth-child(2) { animation-delay: 0.4s; }
.modal .stars i:nth-child(3) { animation-delay: 0.6s; }

@keyframes star-pop {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.modal .stars i.empty {
    color: #E0E0E0;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
}

.modal-buttons .btn {
    flex: 1;
    font-size: 1rem;
}

/* ============================================
   Responsive Design 📱
   ============================================ */

@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    
    .instructions-panel {
        order: 1;
    }
    
    .game-board-container {
        order: 2;
    }
    
    .code-panel {
        order: 3;
    }
}

@media (max-width: 768px) {
    .cell {
        width: 50px;
        height: 50px;
    }
    
    .robot {
        width: 38px;
        height: 38px;
    }
    
    .ball {
        width: 10px;
        height: 10px;
    }
    
    .header-content h1 {
        font-size: 1.3rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .login-container {
        padding: 2rem;
        margin: 1rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .logo i {
        font-size: 3.5rem;
    }
    
    .menu-content h2 {
        font-size: 1.8rem;
    }
    
    .level-card {
        min-width: 80px;
    }
    
    .level-card .level-number {
        font-size: 1.5rem;
    }

    .game-board-container {
        padding: 1rem;
    }

    .instructions-panel {
        padding: 1.2rem;
    }

    .code-panel {
        padding: 1rem;
    }

    .command-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }

    .available-commands {
        gap: 0.4rem;
    }
}

/* Responsive extra para móviles muy pequeños - Game Board */
@media (max-width: 480px) {
    .cell {
        width: 42px;
        height: 42px;
        border-radius: 8px;
    }

    .robot {
        width: 32px;
        height: 32px;
    }

    .ball {
        width: 8px;
        height: 8px;
    }

    .balls-container {
        gap: 2px;
        max-width: 36px;
        bottom: 2px;
    }

    .game-board {
        padding: 4px;
        gap: 3px;
    }

    .game-board-container {
        padding: 0.7rem;
    }

    .command-btn {
        padding: 0.45rem 0.6rem;
        font-size: 0.8rem;
        gap: 0.3rem;
    }

    .available-commands {
        gap: 0.3rem;
        margin-bottom: 0.8rem;
        padding-bottom: 0.8rem;
    }

    .instructions-panel {
        padding: 1rem;
    }

    .instructions-panel h3 {
        font-size: 1rem;
    }

    .instructions-panel p {
        font-size: 0.9rem;
    }

    .code-panel {
        padding: 0.8rem;
    }

    .code-panel h3 {
        font-size: 1rem;
    }

    .objective {
        padding: 0.8rem;
    }

    .objective h4 {
        font-size: 0.95rem;
    }
}

/* ============================================
   Animations - Más animaciones divertidas 🎬
   ============================================ */

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

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

.robot.moving {
    animation: robot-move 0.35s ease;
}

@keyframes robot-move {
    0% { opacity: 1; }
    50% { opacity: 0.92; }
    100% { opacity: 1; }
}

.ball.dropping {
    animation: ball-drop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes ball-drop {
    0% { transform: translateY(-20px) scale(0); opacity: 0; }
    60% { transform: translateY(5px) scale(1.1); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Confetti animation para victoria */
@keyframes confetti-fall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: 0;
    animation: confetti-fall 3s linear infinite;
    z-index: 1001;
    pointer-events: none;
}

/* Hover effects extra */
.interactive-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   Level Editor Styles 🎨
   ============================================ */

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.menu-header h2 {
    margin: 0;
    color: var(--dark-color);
}

.btn-editor {
    background: linear-gradient(135deg, var(--accent-purple), #8B80F0);
    color: white;
    font-size: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 15px rgba(162, 155, 254, 0.4);
}

.btn-editor:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(162, 155, 254, 0.5);
}

.editor-content {
    padding: clamp(0.75rem, 2vw, 1.5rem);
    min-height: calc(var(--app-height) - 70px);
    height: auto;
    overflow: hidden;
}

.editor-layout {
    display: grid;
    grid-template-columns: 300px 1fr 320px;
    gap: 1.5rem;
    height: 100%;
    max-width: 1700px;
    margin: 0 auto;
    min-height: 0;
}

.editor-panel {
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    border: 2px solid #E8F2F5;
}

.editor-panel h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    color: var(--primary-color);
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.2rem;
}

.editor-panel h4 {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 1.2rem 0 0.7rem;
    font-weight: 700;
}

.config-section {
    margin-bottom: 1.8rem;
    padding-bottom: 1.3rem;
    border-bottom: 2px solid #E8F2F5;
}

.config-section:last-child {
    border-bottom: none;
}

.editor-panel .form-group {
    margin-bottom: 1rem;
}

.editor-panel .form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.editor-panel .form-group input,
.editor-panel .form-group select,
.editor-panel .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #E8F2F5;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.editor-panel .form-group input:focus,
.editor-panel .form-group select:focus,
.editor-panel .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.editor-panel .form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.size-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.commands-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.commands-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 8px;
    transition: background 0.2s ease;
    font-weight: 600;
}

.commands-checkboxes label:hover {
    background: var(--primary-light);
}

.commands-checkboxes input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}

/* Board Panel - Editor */
.board-panel {
    display: flex;
    flex-direction: column;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 1.2rem;
    background: linear-gradient(145deg, #F8FEFF 0%, #F0FAFD 100%);
    border-radius: var(--border-radius-md);
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    border: 2px solid #E8F2F5;
}

.toolbar h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 700;
}

.tool-buttons {
    display: flex;
    gap: 0.6rem;
}

.tool-btn {
    width: 48px;
    height: 48px;
    border: 3px solid #E8F2F5;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.tool-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-3px);
}

.tool-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(9, 212, 239, 0.4);
}

.color-selector {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.color-selector span {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.color-btn {
    width: 34px;
    height: 34px;
    border: 4px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        inset -2px -2px 4px rgba(0, 0, 0, 0.2),
        inset 2px 2px 4px rgba(255, 255, 255, 0.3);
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.active {
    border-color: white;
    box-shadow: 
        0 0 0 3px var(--primary-color),
        inset -2px -2px 4px rgba(0, 0, 0, 0.2),
        inset 2px 2px 4px rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.editor-board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(145deg, #F8FEFF 0%, #F0FAFD 100%);
    border-radius: var(--border-radius-md);
    padding: clamp(0.85rem, 2vw, 1.5rem);
    overflow: auto;
    border: 2px solid #E8F2F5;
    -webkit-overflow-scrolling: touch;
}

#editor-board .cell {
    position: relative;
    cursor: pointer;
}

#editor-board .cell:hover {
    background: linear-gradient(145deg, rgba(9, 212, 239, 0.15), rgba(9, 212, 239, 0.1));
    transform: scale(1.05);
}

.cell-coord {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.5;
    font-weight: 600;
}

.cell.objective-cell {
    background: linear-gradient(145deg, rgba(9, 212, 239, 0.25), rgba(9, 212, 239, 0.15));
    border: 3px solid var(--primary-color);
}

.editor-tips {
    padding: 1rem 1.2rem;
    background: linear-gradient(145deg, #FFF9E6 0%, #FFFDE7 100%);
    border-radius: var(--border-radius-md);
    margin-top: 1.2rem;
    border: 2px solid var(--secondary-color);
    position: relative;
}

.editor-tips::before {
    content: '💡';
    position: absolute;
    top: -12px;
    left: 15px;
    font-size: 1.3rem;
    background: white;
    padding: 0 5px;
    border-radius: 50%;
}

.editor-tips p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--dark-color);
    font-weight: 600;
}

/* Objectives Panel */
.add-objective-form {
    background: linear-gradient(145deg, #F8FEFF 0%, #F0FAFD 100%);
    padding: 1.2rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.2rem;
    border: 2px solid #E8F2F5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.objective-params {
    margin: 1rem 0;
}

.objectives-list-container {
    flex: 1;
}

.objectives-list-container h4 {
    margin-top: 0;
}

.objectives-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.objective-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: linear-gradient(145deg, #FFFFFF 0%, #F8FEFF 100%);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    border: 2px solid #E8F2F5;
    transition: all 0.3s ease;
}

.objective-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.objective-item span {
    flex: 1;
    color: var(--text-color);
    font-weight: 600;
}

.remove-obj-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.4rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.remove-obj-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    transform: scale(1.2);
}

.editor-bottom-actions {
    margin-top: auto;
    padding-top: 1.2rem;
}

/* Export Modal */
.export-modal-content {
    max-width: 650px;
    width: 95%;
}

.export-modal-content code {
    background: var(--primary-light);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--primary-dark);
    font-weight: 700;
}

.json-output {
    background: linear-gradient(145deg, #1A202C 0%, #2D3748 100%);
    color: #68C8D3;
    padding: 1.2rem;
    border-radius: var(--border-radius-md);
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 1.2rem 0;
    font-family: 'Consolas', 'Monaco', monospace;
    border: 2px solid #4A5568;
}

/* Editor Responsive */
@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .config-panel {
        order: 1;
    }
    
    .board-panel {
        order: 2;
        min-height: 450px;
    }
    
    .objectives-panel {
        order: 3;
    }
}

/* ============================================
   Scrollbar personalizado ✨
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F0FAFD;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
    border: 2px solid #F0FAFD;
}

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

/* ============================================
   Estilos adicionales para accesibilidad
   ============================================ */

:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animación de carga */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(9, 212, 239, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: var(--dark-color);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   Animaciones de confetti
   ============================================ */

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

/* ============================================
   Progress bar del usuario
   ============================================ */

.user-progress {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    color: white;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
}

.user-progress span {
    color: var(--secondary-color);
}

/* ============================================
   Estilos extra para pequeños detalles
   ============================================ */

/* Efecto de selección de texto */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Placeholder con mejor estilo */
::placeholder {
    color: #A0AEC0;
    font-style: italic;
}

/* Small text helper */
small {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Efecto de brillo en iconos del header */
header .fas {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Animación de entrada para las pantallas */
.screen.active {
    animation: screenFadeIn 0.4s ease;
}

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

/* Efecto hover extra para las cards de nivel */
.level-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.02) 100%);
    border-radius: inherit;
    pointer-events: none;
}

/* Ajuste para el emoji del título del menú */
.menu-content h2::after {
    display: inline-block;
    vertical-align: middle;
}

/* Responsive extra para móviles pequeños */
@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
        border-radius: var(--border-radius-lg);
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .logo i {
        font-size: 3rem;
    }
    
    .btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
    }
    
    .game-card {
        padding: 1.5rem;
    }
    
    .game-card .icon {
        font-size: 3.5rem;
    }
    
    .game-card h3 {
        font-size: 1.3rem;
    }
    
    .modal-content {
        padding: 2rem;
    }
    
    .modal-content h2 {
        font-size: 1.5rem;
    }
    
    .modal-content.victory i {
        font-size: 4rem;
    }
}

/* Ajuste del robot en el tablero */
#game-board {
    position: relative;
}

#game-robot {
    pointer-events: none;
}

/* Asegurar que las celdas no afecten la posición del robot */
.cell {
    overflow: visible;
}

/* ============================================
   SISTEMA DE REGISTRO CON ROLES
   ============================================ */

.role-label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-size: 0.95rem;
}

.role-selector {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.role-option {
    cursor: pointer;
}

.role-option input {
    display: none;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--light-color);
    border: 3px solid transparent;
    border-radius: var(--border-radius-md);
    transition: all 0.3s ease;
}

.role-option input:checked + .role-card {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: scale(1.05);
}

.role-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.role-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color);
}

.teacher-field,
.student-field {
    margin-top: 0.5rem;
}

.teacher-field select,
.student-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #E2E8F0;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-size: 0.95rem;
}

/* ============================================
   ESTILOS DE DASHBOARDS
   ============================================ */

.dashboard-header {
    text-align: center;
    padding: 2rem;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.dashboard-header h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.dashboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: var(--light-color);
    border-radius: var(--border-radius-lg);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: white;
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.tab-panel {
    display: none;
    animation: fadeInUp 0.3s ease;
}

.tab-panel.active {
    display: block;
}

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

.dashboard-content {
    padding: 0 1rem;
}

.dashboard-actions {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card.stat-primary {
    border-color: var(--primary-color);
}

.stat-card.stat-success {
    border-color: var(--success-color);
}

.stat-card.stat-info {
    border-color: var(--accent-cyan);
}

.stat-card.stat-warning {
    border-color: var(--secondary-color);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: var(--primary-dark);
    line-height: 1;
}

.stat-label {
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Quick Actions */
.quick-actions {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.quick-actions h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-action {
    padding: 1rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Recent Activity */
.recent-activity {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.recent-activity h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 1rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius-sm);
}

.activity-icon {
    font-size: 1.5rem;
}

.activity-text {
    flex: 1;
    font-weight: 600;
}

.activity-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.panel-header h2 {
    font-family: 'Fredoka One', cursive;
    color: var(--text-color);
}

/* Schools Grid */
.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.school-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.school-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.school-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.school-header h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
}

.school-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.school-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.school-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Buttons pequeños */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.btn-view {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-danger {
    background: #FFE5E5;
    color: var(--danger-color);
}

.btn-sm:hover {
    transform: scale(1.05);
}

/* Levels List */
.levels-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.level-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
}

.level-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.level-name {
    font-weight: 700;
}

.level-game {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.level-status .status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.published {
    background: #E6FFE6;
    color: var(--success-color);
}

.status-badge.draft {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.level-actions {
    display: flex;
    gap: 0.5rem;
}

/* Users Section */
.users-section {
    margin-bottom: 2rem;
}

.users-section h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 1rem;
}

.users-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
}

.user-name {
    font-weight: 700;
    min-width: 150px;
}

.user-email {
    color: var(--text-muted);
    flex: 1;
}

.user-school {
    color: var(--primary-dark);
    font-size: 0.9rem;
}

.user-actions {
    margin-left: auto;
}

/* Empty Message */
.empty-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* More Users */
.more-users {
    text-align: center;
    color: var(--text-muted);
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Level Editor Link */
.level-editor-link {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--light-color);
    border-radius: var(--border-radius-lg);
    text-align: center;
}

.level-editor-link p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay .modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #E2E8F0;
}

.modal-header h2 {
    font-family: 'Fredoka One', cursive;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

/* Form Styles */
.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #E2E8F0;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-body textarea {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-actions .btn-secondary {
    flex: 1;
}

.form-actions .btn-primary {
    flex: 2;
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
}

.notification-warning {
    border-left: 4px solid var(--secondary-color);
}

/* Students Grid */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.student-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all 0.3s ease;
}

.student-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.student-avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.student-info h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.student-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.student-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Invite Section */
.invite-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--secondary-light);
    border-radius: var(--border-radius-lg);
    text-align: center;
}

.invite-section h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 0.5rem;
}

.invite-code {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.invite-code code {
    background: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
}

/* Assignments List */
.assignments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assignment-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.assignment-card:hover {
    transform: translateX(5px);
}

.assignment-card.completed {
    opacity: 0.7;
}

.assignment-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.assignment-student {
    font-weight: 700;
}

.assignment-game {
    color: var(--primary-dark);
    font-size: 0.9rem;
}

.assignment-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.assignment-status .status-badge.pending {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.assignment-status .status-badge.completed {
    background: #E6FFE6;
    color: var(--success-color);
}

/* Progress Overview */
.progress-overview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.student-progress-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
}

.student-progress-card .student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.progress-bar-container {
    height: 12px;
    background: var(--light-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-bar.animated {
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Teacher Info */
.teacher-info {
    margin-bottom: 1.5rem;
}

.teacher-info .school-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--secondary-light);
    color: var(--secondary-dark);
    border-radius: var(--border-radius-md);
    font-weight: 700;
}

/* School Details */
.school-details .detail-section {
    margin-bottom: 1.5rem;
}

.school-details h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.mini-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.mini-stat {
    flex: 1;
    text-align: center;
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius-sm);
}

.mini-stat-value {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: var(--primary-color);
    display: block;
}

.mini-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Student Dashboard Specifics */
.student-header {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%) !important;
}

.student-welcome {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.welcome-avatar {
    font-size: 4rem;
}

.welcome-text h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.welcome-text p {
    color: var(--text-muted);
}

.student-stats .fun-stat {
    position: relative;
    overflow: hidden;
}

.student-stats .fun-stat::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pending Tasks */
.pending-tasks {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.pending-tasks h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 1rem;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--secondary-light);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-card:hover {
    transform: translateX(5px);
    background: var(--secondary-color);
}

.task-icon {
    font-size: 1.5rem;
}

.task-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.task-name {
    font-weight: 700;
}

.task-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.task-arrow {
    font-size: 1.2rem;
}

/* No Tasks */
.no-tasks {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
}

.no-tasks-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.no-tasks h3 {
    font-family: 'Fredoka One', cursive;
    color: var(--success-color);
    margin-bottom: 0.5rem;
}

/* Quick Play */
.quick-play {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.quick-play h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 0.5rem;
}

.quick-play p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.quick-games {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.quick-game-btn {
    flex: 1;
    min-width: 120px;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Student Assignments */
.student-assignment {
    cursor: pointer;
}

.student-assignment .assignment-icon {
    font-size: 2rem;
}

.student-assignment.overdue {
    border-left: 4px solid var(--danger-color);
}

.overdue-text {
    color: var(--danger-color) !important;
    font-weight: 700;
}

.btn-go {
    padding: 0.5rem 1rem !important;
}

.completion-badge {
    font-size: 1.2rem;
}

/* Game Progress Card */
.game-progress-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.game-progress-card .game-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.game-progress-card .game-icon {
    font-size: 1.5rem;
}

.game-progress-card .game-name {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.progress-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.progress-percentage {
    font-weight: 700;
    color: var(--primary-color);
}

.level-dots {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.level-dot {
    font-size: 0.9rem;
}

.level-dot.completed {
    color: var(--secondary-color);
}

.more-levels {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--light-color);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

.btn-continue {
    width: 100%;
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.achievement-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.achievement-card.unlocked {
    border: 2px solid var(--secondary-color);
}

.achievement-card:hover {
    transform: translateY(-3px);
}

.achievement-icon {
    font-size: 2rem;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-weight: 700;
    display: block;
    margin-bottom: 0.25rem;
}

.achievement-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.achievement-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--success-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.achievement-count {
    background: var(--secondary-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.achievement-motivation {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Student Dashboard Actions */
.student-actions .btn-play {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    animation: pulse 2s infinite;
}

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

/* Student Progress Detail Modal */
.student-progress-detail .student-info-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E2E8F0;
}

.student-avatar-large {
    font-size: 3rem;
}

.student-progress-detail h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 0.25rem;
}

.game-progress {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius-sm);
}

.game-progress h4 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 0.5rem;
}

.levels-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.level-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.level-badge.completed {
    background: #E6FFE6;
    color: var(--success-color);
}

.level-badge.attempted {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

/* Error message */
.error-message {
    background: #FFE5E5;
    color: var(--danger-color);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    text-align: center;
    margin-top: 1rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Button Link */
.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 1rem;
}

/* Dashboard screens padding */
#admin-dashboard,
#teacher-dashboard,
#student-dashboard {
    padding: clamp(1rem, 2.5vw, 2rem);
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   Educational Sessions Styles
   ============================================ */

/* Main Menu Educational Section */
.educational-section {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    border: 2px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.educational-section h3 {
    color: var(--primary-dark);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.educational-section p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.btn-educational {
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(9, 212, 239, 0.3);
}

.btn-educational:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(9, 212, 239, 0.4);
}

.divider {
    display: flex;
    align-items: center;
    margin: 2rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--board-border);
}

.divider span {
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.games-section-title {
    color: var(--text-color);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title {
    text-align: center;
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 2rem;
}

/* Grades Grid */
.grades-content {
    padding: clamp(1rem, 2.5vw, 2rem);
    max-width: 1200px;
    margin: 0 auto;
}

/* Responsive Dashboard */
@media (max-width: 768px) {
    .dashboard-header h1 {
        font-size: 1.5rem;
    }
    
    .dashboard-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .schools-grid,
    .students-grid {
        grid-template-columns: 1fr;
    }
    
    .panel-header {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-overlay .modal-content {
        max-width: 100%;
        margin: 1rem;
    }
    
    .student-welcome {
        flex-direction: column;
        text-align: center;
    }
    
    .quick-games {
        flex-direction: column;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
}

.grades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    padding: 1rem;
}

.grade-card {
    background: var(--card-background);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.grade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--grade-color, var(--primary-color));
}

.grade-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--grade-color, var(--primary-color));
}

.grade-card .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.grade-card h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.grade-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.grade-card .sessions-count {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
}

/* Sessions Grid */
.sessions-content {
    padding: clamp(1rem, 2.5vw, 2rem);
    max-width: 1360px;
    margin: 0 auto;
    display: grid;
    gap: 1.25rem;
    position: relative;
}

.sessions-showcase-bar,
.proposals-showcase-bar,
.exercises-showcase-bar {
    border-radius: 22px;
    padding: 1rem 1.4rem;
    text-align: center;
    color: white;
    box-shadow: 0 12px 30px rgba(17, 47, 64, 0.18);
}

.sessions-showcase-bar {
    background:
        radial-gradient(circle at 15% 30%, rgba(255, 255, 255, 0.12) 0%, transparent 16%),
        radial-gradient(circle at 85% 35%, rgba(255, 255, 255, 0.1) 0%, transparent 14%),
        linear-gradient(135deg, #25d3f1 0%, #11c3e7 100%);
}

.proposals-showcase-bar,
.exercises-showcase-bar {
    background:
        radial-gradient(circle at 12% 30%, rgba(255, 255, 255, 0.12) 0%, transparent 16%),
        radial-gradient(circle at 88% 34%, rgba(255, 255, 255, 0.08) 0%, transparent 13%),
        linear-gradient(135deg, #25d3f1 0%, #14c4e7 100%);
}

.sessions-showcase-bar h2,
.proposals-showcase-bar h2,
.exercises-showcase-bar h2 {
    margin: 0;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.sessions-showcase-bar p,
.proposals-showcase-bar p,
.exercises-showcase-bar p {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    opacity: 0.92;
}

.sessions-map-stage {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    min-height: 320px;
    padding: 1.5rem 1rem 1rem;
    background:
        radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.2) 0%, transparent 8%),
        radial-gradient(circle at 78% 24%, rgba(255, 255, 255, 0.14) 0%, transparent 7%),
        radial-gradient(circle at 25% 65%, rgba(214, 153, 255, 0.22) 0%, transparent 9%),
        radial-gradient(circle at 72% 72%, rgba(255, 214, 10, 0.14) 0%, transparent 8%),
        linear-gradient(180deg, #2f5872 0%, #214962 54%, #18384f 100%);
    box-shadow: 0 20px 45px rgba(14, 38, 53, 0.22);
}

.sessions-map-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 15%, rgba(255,255,255,0.75) 0 1px, transparent 2px),
        radial-gradient(circle at 30% 40%, rgba(255,255,255,0.55) 0 1px, transparent 2px),
        radial-gradient(circle at 55% 18%, rgba(255,255,255,0.6) 0 1px, transparent 2px),
        radial-gradient(circle at 73% 52%, rgba(255,255,255,0.5) 0 1px, transparent 2px),
        radial-gradient(circle at 90% 28%, rgba(255,255,255,0.7) 0 1px, transparent 2px),
        radial-gradient(circle at 82% 76%, rgba(255,255,255,0.55) 0 1px, transparent 2px);
    pointer-events: none;
}

.sessions-map-stage::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: -48px;
    height: 120px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(135deg, #97d66d 0%, #6cb248 100%);
    box-shadow: inset 0 8px 0 rgba(255,255,255,0.14);
}

.sessions-map {
    position: relative;
    z-index: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1.5rem 1rem 2.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.sessions-map-track {
    min-width: max-content;
    display: flex;
    align-items: center;
}

.sessions-map-link {
    width: clamp(54px, 8vw, 92px);
    border-top: 4px dotted rgba(255,255,255,0.4);
    margin: 0 0.2rem;
}

.sessions-map-link.available {
    border-top-color: rgba(255,255,255,0.7);
}

.sessions-map-link.completed {
    border-top-color: #ffe082;
}

.sessions-map-stop {
    min-width: 112px;
    border: none;
    background: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    padding: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.sessions-map-stop.is-high {
    transform: translateY(-18px);
}

.sessions-map-stop.is-low {
    transform: translateY(22px);
}

.sessions-map-stop:hover:not(:disabled) {
    transform: translateY(-24px) scale(1.04);
}

.sessions-map-stop.is-low:hover:not(:disabled) {
    transform: translateY(16px) scale(1.04);
}

.sessions-map-stop.locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.sessions-map-preview {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 1.1rem;
}

.sessions-map-node {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #b9da8c 0%, #8bc34a 100%);
    border: 4px solid rgba(255,255,255,0.95);
    box-shadow: 0 12px 28px rgba(8, 23, 31, 0.24);
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.25rem;
}

.sessions-map-stop.completed .sessions-map-node {
    background: linear-gradient(145deg, #ffd86b 0%, #ffb300 100%);
}

.sessions-map-stop.current .sessions-map-node {
    background: linear-gradient(145deg, #25d3f1 0%, #6ee8ff 100%);
    animation: session-map-pulse 1.8s ease-in-out infinite;
}

.sessions-map-stop.locked .sessions-map-node {
    background: linear-gradient(145deg, #c7d4dc 0%, #94a8b6 100%);
}

.sessions-map-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    opacity: 0.95;
}

.sessions-map-title {
    max-width: 108px;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.2;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.sessions-footer-band,
.proposals-footer-band,
.exercises-footer-band {
    padding: 1rem 1.4rem;
    border-radius: 18px;
    background: linear-gradient(135deg, #a45aa6 0%, #c57abd 100%);
    color: white;
    text-align: center;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: clamp(1rem, 2vw, 1.3rem);
    box-shadow: 0 18px 30px rgba(164, 90, 166, 0.2);
}

.robot-levels-section {
    padding: 1.5rem;
    margin: 0 1rem;
}

.robot-levels-title {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.4rem;
    color: var(--text-color, #2d3436);
    margin: 0 0 0.3rem 0;
}

.robot-levels-subtitle {
    color: var(--text-muted, #636e72);
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
}

.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    padding: 1rem;
}

.session-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid var(--board-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
}

.session-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.session-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
}

.session-card.completed {
    border-color: var(--success-color);
}

.session-card.completed::after {
    content: '✅';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
}

.session-card:not(.locked):hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.session-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.session-icon {
    font-size: 2.5rem;
    background: var(--primary-light);
    padding: 0.75rem;
    border-radius: 12px;
}

.session-info h4 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.session-info span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.session-objective-preview {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.session-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--board-border);
}

.session-badge-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-dark);
}

.session-progress-bar {
    width: 100px;
    height: 8px;
    background: var(--board-cell);
    border-radius: 4px;
    overflow: hidden;
}

.session-progress-bar .fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 4px;
    transition: width 0.3s;
}

/* Proposals Grid */
.proposals-content {
    padding: clamp(1rem, 2.5vw, 2rem);
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    gap: 1.25rem;
    background:
        radial-gradient(circle at 10% 15%, rgba(255,255,255,0.16) 0%, transparent 10%),
        radial-gradient(circle at 90% 20%, rgba(255,255,255,0.1) 0%, transparent 9%),
        linear-gradient(180deg, #2e5973 0%, #214962 56%, #18384f 100%);
    border-radius: 28px;
    box-shadow: 0 20px 48px rgba(13, 37, 52, 0.18);
}

.session-objective {
    background: rgba(255,255,255,0.94);
    border-radius: 20px;
    padding: 1.5rem;
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.session-objective h3 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-objective p {
    color: var(--text-color);
    font-size: 1.1rem;
}

.proposals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.proposal-card {
    background: rgba(255,255,255,0.96);
    border-radius: 24px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid rgba(31, 195, 231, 0.28);
    box-shadow: 0 12px 28px rgba(11, 34, 48, 0.16);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.proposal-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(11, 34, 48, 0.22);
    border-color: #1fc3e7;
}

.proposal-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.proposal-card-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #1fc3e7;
    color: white;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.2rem;
}

.proposal-card-icon {
    font-size: 2rem;
}

.proposal-card h3 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin: 0;
}

.proposal-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.proposal-exercises-count {
    background: #ffd34d;
    color: #6a5200;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    display: inline-block;
    font-weight: 700;
    align-self: flex-start;
}

/* Exercises Grid */
.exercises-content {
    padding: clamp(1rem, 2.5vw, 2rem);
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    gap: 1.25rem;
    background:
        radial-gradient(circle at 10% 15%, rgba(255,255,255,0.16) 0%, transparent 10%),
        radial-gradient(circle at 90% 20%, rgba(255,255,255,0.1) 0%, transparent 9%),
        linear-gradient(180deg, #2e5973 0%, #214962 56%, #18384f 100%);
    border-radius: 28px;
    box-shadow: 0 20px 48px rgba(13, 37, 52, 0.18);
}

.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 1.1rem;
}

.exercise-card {
    background: rgba(255,255,255,0.97);
    border-radius: 18px;
    padding: 1.2rem 1rem 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid rgba(31, 195, 231, 0.25);
    box-shadow: 0 12px 26px rgba(12, 35, 49, 0.14);
    text-align: center;
    position: relative;
    min-height: 252px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.exercise-card.locked {
    opacity: 0.52;
    cursor: not-allowed;
}

.exercise-card.completed {
    border-color: rgba(255, 211, 77, 0.9);
    background: rgba(255,255,255,0.99);
}

.exercise-card:not(.locked):hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 30px rgba(12, 35, 49, 0.2);
    border-color: #1fc3e7;
}

.exercise-card-top {
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
    margin-bottom: 0.75rem;
}

.exercise-number {
    width: 50px;
    height: 50px;
    background: #1fc3e7;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.exercise-complete-mark {
    position: absolute;
    right: 0;
    top: 0.1rem;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffd34d;
    color: #6a5200;
    font-weight: 900;
    font-size: 0.9rem;
}

.exercise-preview {
    width: 90px;
    height: 90px;
    margin-bottom: 0.8rem;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #f9fbff 0%, #eef6fb 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 6px 18px rgba(15, 48, 66, 0.08);
    font-size: 2.4rem;
}

.exercise-card.completed .exercise-number {
    background: #f3b521;
}

.exercise-card.locked .exercise-number {
    background: var(--text-muted);
}

.exercise-card h4 {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0.45rem;
    line-height: 1.3;
}

.exercise-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 0.7rem;
    line-height: 1.45;
    flex: 1;
}

.exercise-stars {
    display: flex;
    gap: 0.2rem;
    color: #f7ca3d;
    margin-bottom: 0.55rem;
    font-size: 0.82rem;
}

.exercise-stars .empty {
    color: #d7dde2;
}

.exercise-type-badge {
    background: #ffd34d;
    color: #6a5200;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    display: inline-block;
    margin-top: auto;
    font-weight: 700;
}

@keyframes session-map-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 241, 0.38); }
    50% { box-shadow: 0 0 0 10px rgba(37, 211, 241, 0); }
}

/* Exercise Screen */
.exercise-content {
    padding: clamp(0.75rem, 2vw, 1rem);
    min-height: calc(var(--app-height) - 70px);
    height: auto;
    display: flex;
    flex-direction: column;
}

.exercise-layout {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.exercise-instructions-panel {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
}

.exercise-instructions-panel h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exercise-area {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.exercise-action-panel {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.action-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--board-border);
}

.action-card {
    background: var(--primary-light);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 96px;
    min-height: 88px;
}

.action-card:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.action-card:active {
    cursor: grabbing;
}

.action-card.card-used {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.9);
    border-style: dashed;
}

.action-card .icon {
    font-size: 1.5rem;
}

.action-card .label {
    font-size: 0.75rem;
    color: var(--text-color);
}

.action-card.loop-card {
    background: #F3E5F5;
    border-color: #9C27B0;
}

.sequence-area {
    flex: 1;
    background: var(--board-cell);
    border-radius: 12px;
    padding: 1rem;
    min-height: 170px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-content: flex-start;
    overflow-y: auto;
}

.sequence-area.drop-zone {
    border: 2px dashed var(--primary-color);
}

.sequence-card {
    background: white;
    border: 2px solid var(--primary-dark);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 52px;
}

.sequence-card:hover {
    background: #FEE2E2;
    border-color: var(--danger-color);
}

.sequence-card.selected {
    background: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(9, 212, 239, 0.18);
}

.sequence-card .remove {
    color: var(--danger-color);
    font-weight: bold;
}

.exercise-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.exercise-buttons .btn {
    flex: 1;
    min-width: 100px;
}

/* Exercise Types Specific Styles */

/* Classification Exercise */
.classification-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 800px;
}

.items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.classify-item {
    background: var(--card-background);
    border: 2px solid var(--board-border);
    border-radius: 12px;
    padding: 1rem;
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 100px;
}

.classify-item:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.classify-item .icon {
    font-size: 2.5rem;
}

.classify-item .label {
    font-size: 0.85rem;
    color: var(--text-color);
}

.drop-zones {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.drop-zones.categories-3 {
    align-items: stretch;
}

.drop-zones.categories-3 .drop-zone {
    flex: 1;
    min-width: 180px;
    max-width: 240px;
}

.drop-zone {
    background: var(--board-cell);
    border: 3px dashed var(--board-border);
    border-radius: 16px;
    padding: 1.5rem;
    min-width: 200px;
    min-height: 150px;
    text-align: center;
    transition: all 0.2s;
}

.drop-zone.robot-zone {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.drop-zone.object-zone {
    border-color: var(--secondary-dark);
    background: #FFFDE7;
}

.drop-zone.drag-over {
    border-style: solid;
    transform: scale(1.02);
}

.drop-zone h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.category-zone h4 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.drop-zone .items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    min-height: 60px;
}

.exercise-scene-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(9, 212, 239, 0.14), rgba(255, 221, 89, 0.18));
    border: 1px solid rgba(9, 212, 239, 0.22);
    box-shadow: var(--shadow-sm);
}

.scene-icon {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    font-size: 1.8rem;
    box-shadow: 0 6px 18px rgba(9, 212, 239, 0.18);
}

.scene-copy h4 {
    margin: 0 0 0.25rem;
    color: var(--text-color);
    font-size: 1.05rem;
}

.scene-copy p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

/* ============================================
   Memory Game - Diseño Moderno y Divertido
   ============================================ */
.memory-game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    width: 100%;
    height: 100%;
}

.memory-game-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--primary-light);
    padding: 1rem 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.memory-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.memory-stat-icon {
    font-size: 1.8rem;
}

.memory-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.memory-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 700px;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(145deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 24px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.08),
        inset 0 -2px 0 rgba(0, 0, 0, 0.05);
}

.memory-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
    max-width: 540px;
}

/* Ajustar grid en móviles */
@media (max-width: 500px) {
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
        padding: 1rem;
    }
}

.memory-card {
    aspect-ratio: 1;
    perspective: 1200px;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: 18px;
}

.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front,
.memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

/* Parte frontal (contenido - oculta inicialmente) */
.memory-card-front {
    background: linear-gradient(145deg, #ffffff 0%, #F0FAFD 100%);
    border: 3px solid var(--primary-color);
    box-shadow: 
        0 6px 20px rgba(9, 212, 239, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    /* CRÍTICO: El frente está rotado 180deg para estar oculto inicialmente */
    transform: rotateY(180deg);
}

.memory-card-front .card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem;
    text-align: center;
}

.memory-card-front .card-content .card-emoji {
    font-size: 2.8rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.memory-card.flipped .memory-card-front .card-content .card-emoji {
    animation: cardReveal 0.4s ease-out;
}

.memory-card-front .card-content .robot-icon {
    font-size: 3rem;
    line-height: 1;
}

.memory-card-front .card-content .card-label {
    font-size: 0.75rem;
    color: var(--text-color);
    font-weight: 700;
    max-width: 95%;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

@keyframes cardReveal {
    from {
        transform: scale(0.5) rotateZ(-10deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotateZ(0);
        opacity: 1;
    }
}

/* Parte trasera (visible inicialmente - muestra 🤖) */
.memory-card-back {
    background: var(--primary-color);
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 25px rgba(9, 212, 239, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    /* Sin transformación - visible por defecto */
}

.memory-card-back::before {
    content: '🤖';
    font-size: 3rem;
    opacity: 0.9;
    animation: pulse 2s ease-in-out infinite;
}

.memory-card-back::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 60%
    );
    animation: cardShine 3s ease-in-out infinite;
}

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

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

/* Estados de las tarjetas */
.memory-card.matched .memory-card-front {
    background: linear-gradient(145deg, #e8f3f5 0%, #c8e2e6 100%);
    border-color: var(--success-color);
    box-shadow: 
        0 6px 20px rgba(9, 212, 239, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.memory-card.matched::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(9, 212, 239, 0.4);
    z-index: 10;
    animation: checkPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes checkPop {
    0% { transform: scale(0) rotate(-180deg); }
    70% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0); }
}

.memory-card.matched {
    cursor: default;
    pointer-events: none;
}

.memory-card.wrong .memory-card-inner {
    animation: cardShake 0.5s ease-in-out;
}

@keyframes cardShake {
    0%, 100% { transform: rotateY(180deg) translateX(0); }
    20%, 60% { transform: rotateY(180deg) translateX(-8px); }
    40%, 80% { transform: rotateY(180deg) translateX(8px); }
}

/* Hover y touch */
.memory-card:not(.flipped):not(.matched):hover .memory-card-inner {
    transform: scale(1.08) translateY(-4px);
}

.memory-card:not(.flipped):not(.matched):hover .memory-card-back {
    box-shadow: 
        0 15px 40px rgba(9, 212, 239, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.memory-card:not(.flipped):not(.matched):active .memory-card-inner {
    transform: scale(0.95);
}

/* Responsive para tablets */
@media (max-width: 768px) {
    .memory-card-front .card-content .card-emoji {
        font-size: 2.2rem;
    }
    .memory-card-front .card-content .card-label {
        font-size: 0.65rem;
    }
    .memory-card-back::before {
        font-size: 2.5rem;
    }
}

/* Cuando el panel de acciones está oculto, el exercise-area ocupa más espacio */
.exercise-layout:has(.exercise-action-panel[style*="display: none"]) {
    grid-template-columns: 250px 1fr;
}

/* Quiz Exercise */
.quiz-area {
    width: 100%;
    max-width: 600px;
}

.quiz-question {
    background: var(--primary-light);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.quiz-question h3 {
    font-size: 1.3rem;
    color: var(--text-color);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-option {
    background: var(--card-background);
    border: 2px solid var(--board-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 1rem;
}

.quiz-option:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.quiz-option.selected {
    border-color: var(--primary-dark);
    background: var(--primary-light);
}

.quiz-option.correct {
    border-color: var(--success-color);
    background: #e8f3f5;
}

.quiz-option.incorrect {
    border-color: var(--danger-color);
    background: #FFEBEE;
}

.quiz-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
}

/* Selection / Card-Selection Exercise */
.selection-area {
    width: 100%;
    max-width: 700px;
}

.selection-option {
    background: var(--card-background);
    border: 3px solid var(--board-border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 130px;
    text-align: center;
    user-select: none;
}

.selection-option .icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.3rem;
}

.selection-option .label {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
}

.selection-option .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.selection-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 25px rgba(9, 212, 239, 0.2);
}

.selection-option.correct {
    border-color: var(--success-color);
    background: #e8f3f5;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(9, 212, 239, 0.3);
}

.selection-option.incorrect {
    border-color: var(--danger-color);
    background: #FFEBEE;
    animation: shake 0.4s ease;
}

/* Comparison Exercise */
.comparison-area {
    width: 100%;
    max-width: 650px;
    text-align: center;
}

.comparison-area h4 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.comparison-options {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.comparison-option {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    background: var(--card-background);
    border: 3px solid var(--board-border);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 220px;
    display: flex;
    flex-direction: column;
}

.comparison-options.comparison-count-3 .comparison-option {
    min-width: 190px;
    max-width: 240px;
}

.comparison-option h5 {
    color: var(--primary-dark);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.comparison-option p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.comparison-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(9, 212, 239, 0.15);
}

.comparison-option.correct {
    border-color: var(--success-color);
    background: #e8f3f5;
}

.comparison-option.incorrect {
    border-color: var(--danger-color);
    background: #FFEBEE;
    animation: shake 0.4s ease;
}

.comp-label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.comp-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0;
}

.comp-step {
    background: var(--primary-light);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--primary-dark);
}

.comp-arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.comp-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.comp-explanation {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #e8f3f5;
    border-left: 4px solid var(--success-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.direction-legend {
    background: #eef7ff;
    border-left-color: #54A0FF;
}

/* Old assembly styles replaced by new .robot-body-outline styles above */

/* Target Indicator (Sequence exercises) */
.target-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #FFF8E1;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-color);
    border-left: 4px solid var(--secondary-color);
}

/* Result Display (Reverse Engineer) */
.result-display {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

/* Creative Build sub-sections */
.base-objects, .parts-palette {
    margin-bottom: 1rem;
}

.base-objects h4, .parts-palette h4, .build-result h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.build-result {
    margin-top: 1rem;
}

/* Matching sub-columns */
.left-column h4, .right-column h4 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Step Label */
.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Free Slot (Conditional Free) */
.free-slot {
    background: #FFF3E0;
    border-color: #FFB74D;
    min-width: 150px;
}

.free-slot:hover {
    border-color: #FF9800;
}

/* Coming Soon / Placeholder */
p.placeholder {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 1.5rem;
    font-size: 0.95rem;
}

.coming-soon {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.coming-soon span {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.coming-soon h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

/* Sequence Builder */
.sequence-builder {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

/* =============================================
   Sequence Progress View (sin robot)
   ============================================= */
.sequence-progress-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    min-height: 250px;
    gap: 1.8rem;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(224,247,250,0.3) 50%, rgba(255,255,255,0) 100%);
    border-radius: 16px;
}

.sequence-steps-timeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1rem;
}

.sequence-step-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    background: #f0f4f8;
    border: 3px dashed #b0bec5;
    border-radius: 16px;
    padding: 1rem 1.2rem;
    min-width: 80px;
    min-height: 90px;
    transition: all 0.4s ease;
    position: relative;
}

.sequence-step-slot .step-number {
    background: #78909c;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.sequence-step-slot .step-icon-placeholder {
    font-size: 2rem;
    color: #b0bec5;
    transition: all 0.3s ease;
}

.sequence-step-slot.step-filled {
    background: #e3f2fd;
    border-color: #42a5f5;
    border-style: solid;
    transform: scale(1.05);
}

.sequence-step-slot.step-filled .step-number {
    background: #42a5f5;
}

.sequence-step-slot.step-filled .step-icon-placeholder {
    color: #1e88e5;
    font-size: 2.2rem;
}

.sequence-step-slot.step-active {
    border-color: #ff9800;
    box-shadow: 0 0 16px rgba(255, 152, 0, 0.4);
    animation: step-pulse 0.6s ease-in-out infinite alternate;
    transform: scale(1.12);
}

.sequence-step-slot.step-active .step-number {
    background: #ff9800;
}

@keyframes step-pulse {
    0% { box-shadow: 0 0 8px rgba(255, 152, 0, 0.3); }
    100% { box-shadow: 0 0 20px rgba(255, 152, 0, 0.6); }
}

.sequence-step-slot.step-correct {
    background: #e8f3f5;
    border-color: #4CA5AF;
    border-style: solid;
}

.sequence-step-slot.step-correct .step-number {
    background: #4CA5AF;
}

.sequence-step-slot.step-wrong {
    background: #ffebee;
    border-color: #ef5350;
    border-style: solid;
    animation: shake-slot 0.5s ease;
}

.sequence-step-slot.step-wrong .step-number {
    background: #ef5350;
}

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

.step-slot-extra {
    border-style: dotted;
    opacity: 0.5;
    min-width: 60px;
    min-height: 70px;
}

.step-connector {
    color: #90a4ae;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.sequence-hint {
    color: #78909c;
    font-size: 0.95rem;
    font-style: italic;
    text-align: center;
    margin: 0;
}

/* Objectives / Checkpoints */
.sequence-objectives {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #e8f3f5, #e8f5fa);
    border-radius: 14px;
    border: 2px solid #A5D0D6;
}

.objectives-label {
    font-weight: 700;
    color: #38868E;
    font-size: 0.9rem;
}

.objective-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: white;
    border: 2px solid #66B0BB;
    border-radius: 20px;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(102, 187, 106, 0.2);
    transition: all 0.3s ease;
}

.objective-badge .objective-icon {
    font-size: 1.3rem;
}

.objective-badge .objective-label {
    font-weight: 600;
    color: #2E757D;
}

.objective-badge.objective-reached {
    background: #c8e2e6;
    border-color: #4398A0;
    transform: scale(1.05);
}

.objective-arrow {
    color: #66B0BB;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Responsive para timeline */
@media (max-width: 600px) {
    .sequence-step-slot {
        min-width: 60px;
        min-height: 70px;
        padding: 0.7rem 0.8rem;
    }
    .sequence-step-slot .step-icon-placeholder {
        font-size: 1.5rem;
    }
    .sequence-step-slot .step-number {
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
    }
    .step-connector {
        font-size: 0.9rem;
    }
}

.robot-preview {
    background: var(--board-cell);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.robot-animation {
    font-size: 4rem;
    transition: all 0.5s;
}

/* =============================================
   Gobstones-style Mini Grid Board
   ============================================= */
.mini-grid-board {
    display: grid;
    gap: 3px;
    background: #2c3e50;
    border: 3px solid #2c3e50;
    border-radius: 12px;
    padding: 3px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.mini-grid-cell {
    width: 60px;
    height: 60px;
    background: #ecf0f1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    position: relative;
    transition: all 0.3s ease;
}

.mini-grid-cell.robot-cell {
    background: #d5f5e3;
    box-shadow: inset 0 0 0 2px #09D4EF;
}

.mini-grid-cell.target-cell {
    background: #fdebd0;
    box-shadow: inset 0 0 0 2px #f39c12;
    animation: target-pulse 1.5s ease-in-out infinite;
}

@keyframes target-pulse {
    0%, 100% { box-shadow: inset 0 0 0 2px #f39c12; }
    50% { box-shadow: inset 0 0 0 3px #e67e22, 0 0 8px rgba(243, 156, 18, 0.4); }
}

.mini-robot {
    font-size: 1.8rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.mini-grid-cell.robot-turning {
    background: #fff9c4 !important;
    box-shadow: inset 0 0 0 2px #f9a825 !important;
}

.mini-grid-cell.robot-turning .mini-robot {
    animation: robot-turn-flash 0.4s ease;
}

@keyframes robot-turn-flash {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3) drop-shadow(0 0 6px #f9a825); }
    100% { filter: brightness(1); }
}

@keyframes robot-idle {
    from { filter: brightness(1); }
    to { filter: brightness(1.05); }
}

.mini-target {
    font-size: 1.8rem;
}

.mini-grid-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    background: #fff8e1;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border-left: 3px solid #f39c12;
    margin-top: 0.5rem;
}

.mini-target-icon {
    font-size: 1.2rem;
}

/* Robot path, success, error states for grid animation */
.mini-grid-cell.wrong-path-cell {
    background: #f5e0de;
    border: 2px dashed #e8a9a3;
}
.wrong-path-dot {
    font-size: 1.4rem;
    color: #d98880;
}
.mini-grid-cell.wrong-end-cell {
    background: #f2cdca;
    border: 2px solid #e74c3c;
}
.wrong-end-mark {
    font-size: 1.5rem;
    font-weight: 900;
    color: #e74c3c;
}

.mini-grid-cell.robot-path {
    background: #e8f8f5;
    box-shadow: inset 0 0 0 2px rgba(9, 212, 239, 0.3);
}

.mini-grid-cell.robot-path::after {
    content: '·';
    font-size: 2rem;
    color: var(--primary-color);
    opacity: 0.5;
}

.mini-grid-cell.robot-success {
    background: #d5f5e3 !important;
    box-shadow: inset 0 0 0 3px #09D4EF !important;
    animation: success-glow 0.6s ease-in-out;
}

@keyframes success-glow {
    0% { box-shadow: inset 0 0 0 3px #09D4EF; }
    50% { box-shadow: inset 0 0 0 4px #09D4EF, 0 0 20px rgba(9, 212, 239, 0.5); }
    100% { box-shadow: inset 0 0 0 3px #09D4EF; }
}

.mini-grid-cell.robot-error {
    background: #fdecea !important;
    box-shadow: inset 0 0 0 3px #e74c3c !important;
    animation: error-shake 0.5s ease-in-out;
}

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

/* Exercise feedback toast */
.exercise-feedback-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    z-index: 10000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    animation: toast-in 0.4s ease-out;
    white-space: nowrap;
}

.exercise-feedback-toast.error {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
}

.exercise-feedback-toast.success {
    background: #09D4EF;
    color: white;
}

.exercise-feedback-toast.fade-out {
    animation: toast-out 0.4s ease-in forwards;
}

@keyframes toast-in {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to { transform: translateX(-50%) translateY(20px); opacity: 0; }
}

/* Error message for sequence-fix */
.error-message {
    background: #fce4ec;
    color: #c62828;
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    border-left: 4px solid #c62828;
    margin-top: 0.5rem;
}

/* Sequence card states */
.sequence-card.selected {
    border-color: #1565c0;
    background: #e3f2fd;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.3);
    transform: scale(1.05);
}

.sequence-card.replaced {
    animation: flash-green 0.6s ease;
}

.sequence-card.correct-card {
    border-color: #2E757D;
    background: #e8f3f5;
}

@keyframes flash-green {
    0% { background: #A5D0D6; }
    100% { background: white; }
}

.sequence-area.hint-select {
    animation: hint-glow 0.8s ease;
}

@keyframes hint-glow {
    0% { box-shadow: inset 0 0 0 2px transparent; }
    50% { box-shadow: inset 0 0 0 3px #1565c0; }
    100% { box-shadow: inset 0 0 0 2px transparent; }
}

.sequence-fix-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--board-border);
}

.fix-mode-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    background: #E8F7FA;
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sequence-fix-reset {
    margin-left: auto;
}

.sequence-fix-help {
    margin-top: 0.9rem;
    padding: 0.85rem 1rem;
    background: #F5FBFF;
    border-radius: 14px;
    border: 1px solid rgba(84, 160, 255, 0.2);
}

.sequence-fix-help p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.sequence-fix-editor {
    align-items: center;
    justify-content: center;
}

.sequence-fix-editor .placeholder {
    width: 100%;
    text-align: center;
}

.sequence-insert-slot {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 2px dashed var(--board-border);
    background: white;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.sequence-insert-slot:hover,
.sequence-insert-slot.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* =============================================
   Improved Assembly Exercise
   ============================================= */
.assembly-area {
    width: 100%;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assembly-area-advanced .parts-list {
    gap: 0.9rem;
}

.assembly-area-advanced .assembly-part {
    min-width: 120px;
    min-height: 72px;
    justify-content: center;
}

.assembly-parts-tray {
    background: linear-gradient(135deg, #e8eaf6, #c5cae9);
    border-radius: 14px;
    padding: 0.75rem 1rem;
}

.assembly-parts-tray h4 {
    margin-bottom: 0.5rem;
    color: #283593;
    font-size: 0.9rem;
}

.parts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}

.assembly-part {
    background: white;
    border: 2px solid #5c6bc0;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.85rem;
}

.assembly-part:hover {
    transform: scale(1.06);
    box-shadow: 0 3px 10px rgba(92, 107, 192, 0.3);
}

.assembly-part.selected-part {
    border-color: #1565c0;
    background: #e3f2fd;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.3);
}

.assembly-part.dragging {
    opacity: 0.5;
}

.assembly-part.placed {
    opacity: 0.3;
    pointer-events: none;
    text-decoration: line-through;
}

.assembly-part .part-icon {
    font-size: 1.2rem;
}

.robot-body-outline {
    background: var(--card-background);
    border: 3px solid #37474f;
    border-radius: 16px;
    padding: 1rem;
    position: relative;
}

.robot-body-outline h4 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: #37474f;
}

.robot-body-outline .assembly-slot {
    background: var(--card-background);
    border: 2px solid var(--board-border);
    border-radius: 12px;
    padding: 0.5rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.4rem;
    transition: all 0.2s;
}

.robot-body-outline .assembly-slot .slot-icon {
    font-size: 1.4rem;
}

.robot-body-outline .assembly-slot .slot-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color);
    min-width: 70px;
}

.robot-body-outline .assembly-slot .slot-area {
    flex: 1;
    background: var(--board-cell);
    border: 2px dashed var(--board-border);
    border-radius: 10px;
    padding: 0.4rem 0.6rem;
    min-height: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.robot-body-outline .slot-area::before {
    content: attr(data-hint);
}

.robot-body-outline .slot-area.filled::before {
    content: '';
}

.robot-body-outline .slot-area.drag-over {
    border-color: #5c6bc0;
    background: #e8eaf6;
}

.robot-body-outline .slot-area.correct {
    border-color: var(--success-color);
    border-style: solid;
    background: #e8f3f5;
    font-weight: 700;
    color: #2E757D;
}

.robot-body-outline .slot-area.incorrect {
    border-color: var(--danger-color);
    animation: shake 0.3s;
}

/* Badge Earned Modal */
.badge-earned {
    text-align: center;
}

.badge-earned .badge-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 0.5s ease infinite alternate;
}

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

.badge-earned h2 {
    color: var(--secondary-dark);
    margin-bottom: 0.5rem;
}

.badge-earned .badge-description {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Exercise Screen Responsive */
@media (max-width: 1024px) {
    .exercise-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    
    .exercise-instructions-panel {
        order: 1;
    }
    
    .exercise-area {
        order: 2;
    }
    
    .exercise-action-panel {
        order: 3;
    }
}

@media (max-width: 768px) {
    .grades-grid,
    .sessions-grid,
    .proposals-grid,
    .exercises-grid {
        grid-template-columns: 1fr;
    }
    
    .drop-zones {
        flex-direction: column;
    }

    .drop-zones.categories-3 .drop-zone,
    .comparison-options.comparison-count-3 .comparison-option,
    .comparison-option {
        max-width: none;
        width: 100%;
    }

    .exercise-scene-banner {
        flex-direction: column;
        text-align: center;
    }
    
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== SCRATCH-STYLE BLOCK PROGRAMMING ===== */

/* Block Workspace Container */
.block-workspace {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: #FFFFFF;
    border-radius: 16px;
    min-height: 300px;
    border: 1px solid #E2E8F0;
}

/* Block Palette - Where blocks are picked from */
.block-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    border: 2px dashed var(--primary-light);
    min-height: 80px;
}

.block-palette h4 {
    width: 100%;
    margin: 0 0 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Block Canvas - Where program is built */
.block-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    border: 3px solid var(--primary);
    min-height: 200px;
    position: relative;
    transition: all 0.3s ease;
}

.block-canvas.drag-over {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.1);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.block-canvas h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.block-canvas-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
    border: 2px dashed #ddd;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.block-program {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Scratch-Style Blocks */
.scratch-block {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 
        0 3px 6px rgba(0,0,0,0.18),
        inset 0 2px 0 rgba(255,255,255,0.35),
        inset 0 -2px 0 rgba(0,0,0,0.1);
    border: none;
    position: relative;
    user-select: none;
    /* Forma tipo Scratch con muesca */
    clip-path: polygon(
        0 5px, 5px 5px, 5px 0, 18px 0, 18px 5px, 
        100% 5px, 100% calc(100% - 5px), 
        18px calc(100% - 5px), 18px 100%, 5px 100%, 5px calc(100% - 5px), 
        0 calc(100% - 5px)
    );
    min-height: 48px;
}

.scratch-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
}

.scratch-block:active,
.scratch-block.dragging {
    cursor: grabbing;
    opacity: 0.8;
    transform: scale(1.05);
    z-index: 100;
}

.scratch-block .block-icon {
    font-size: 1.2rem;
}

.scratch-block .block-icon.block-icon-ball {
    width: 0.95rem;
    height: 0.95rem;
    min-width: 0.95rem;
    border-radius: 50%;
    display: inline-block;
    font-size: 0;
    box-shadow:
        inset -2px -2px 4px rgba(0, 0, 0, 0.28),
        inset 1px 1px 3px rgba(255, 255, 255, 0.45),
        0 1px 3px rgba(0, 0, 0, 0.22);
}

.scratch-block .block-icon.block-icon-ball.red {
    background: radial-gradient(circle at 30% 30%, #FF8A8A, var(--ball-red), #CC5555);
}

.scratch-block .block-icon.block-icon-ball.blue {
    background: radial-gradient(circle at 30% 30%, #82C4FF, var(--ball-blue), #4080CC);
}

.scratch-block .block-icon.block-icon-ball.green {
    background: radial-gradient(circle at 30% 30%, #50DBEF, var(--ball-green), #08A8D6);
}

.scratch-block .block-icon.block-icon-ball.black {
    background: radial-gradient(circle at 30% 30%, #5A5A5A, var(--ball-black), #1A1A1A);
}

.scratch-block .block-label {
    white-space: nowrap;
}

.scratch-block .block-inline-control {
    border: none;
    border-radius: 8px;
    padding: 0.25rem 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #2d3436;
    background: rgba(255, 255, 255, 0.92);
    min-height: 28px;
    max-width: 130px;
}

.scratch-block .block-inline-control:focus {
    outline: 2px solid rgba(9, 212, 239, 0.4);
    outline-offset: 1px;
}

/* Block Categories - Movement */
.scratch-block.movement {
    background: linear-gradient(135deg, #4C97FF 0%, #3373CC 100%);
    color: white;
}

.scratch-block.movement:hover {
    background: linear-gradient(135deg, #5AA3FF 0%, #4080DD 100%);
}

/* Block Categories - Relative Movement */
.scratch-block.relative {
    background: linear-gradient(135deg, #9966FF 0%, #774DCB 100%);
    color: white;
}

.scratch-block.relative:hover {
    background: linear-gradient(135deg, #AA77FF 0%, #8855DD 100%);
}

/* Block Categories - Action */
.scratch-block.action {
    background: linear-gradient(135deg, #FFAB19 0%, #CF8B17 100%);
    color: white;
}

.scratch-block.action:hover {
    background: linear-gradient(135deg, #FFB833 0%, #DD9922 100%);
}

/* Block Categories - Control */
.scratch-block.control {
    background: linear-gradient(135deg, #FFBF00 0%, #E6AC00 100%);
    color: #333;
}

.scratch-block.control:hover {
    background: linear-gradient(135deg, #FFCC33 0%, #FFB800 100%);
}

/* Block Categories - Loop */
.scratch-block.loop {
    background: linear-gradient(135deg, #FF8C1A 0%, #DB6E00 100%);
    color: white;
}

/* Block in Program Area */
.scratch-block.in-program {
    width: 100%;
    justify-content: flex-start;
    border-radius: 8px;
    position: relative;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    margin-bottom: 2px;
    clip-path: polygon(
        0% 0%, 
        10px 0%, 
        15px 6px, 
        35px 6px, 
        40px 0%, 
        100% 0%, 
        100% 100%,
        40px 100%,
        35px calc(100% + 6px),
        15px calc(100% + 6px),
        10px 100%,
        0% 100%
    );
    animation: blockSlideIn 0.25s ease-out;
}

@keyframes blockSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.scratch-block.in-program:last-child {
    clip-path: polygon(
        0% 0%, 
        10px 0%, 
        15px 6px, 
        35px 6px, 
        40px 0%, 
        100% 0%, 
        100% 100%,
        0% 100%
    );
}

.scratch-block.in-program:first-child {
    clip-path: polygon(
        0% 0%, 
        100% 0%, 
        100% 100%,
        40px 100%,
        35px calc(100% + 6px),
        15px calc(100% + 6px),
        10px 100%,
        0% 100%
    );
}

.scratch-block.in-program:first-child:last-child {
    clip-path: polygon(
        0% 0%, 
        100% 0%, 
        100% 100%,
        0% 100%
    );
    border-radius: 8px;
}

/* Number indicator on left side */
.scratch-block.in-program::before {
    content: attr(data-index);
    position: absolute;
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Remove button on hover */
.scratch-block.in-program::after {
    content: '×';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    font-weight: 700;
    opacity: 0;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: opacity 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.scratch-block.in-program:hover::after {
    opacity: 0.8;
}

.scratch-block.in-program:hover::after:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
}

/* Block Remove Button */
.block-remove {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: none;
    color: white;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scratch-block.in-program:hover .block-remove {
    opacity: 0.8;
}

.block-remove:hover {
    background: rgba(255,0,0,0.5);
    opacity: 1 !important;
}

/* Block Drop Zone */
.block-drop-zone {
    min-height: 120px;
    border: 3px dashed var(--primary-light);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 1rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #F8FEFF 0%, #f0f7f9 100%);
    position: relative;
}

.block-drop-zone:empty::before {
    content: '🧩 Arrastra bloques aquí para crear tu programa';
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.block-drop-zone.drag-over {
    border-color: var(--primary-dark);
    border-style: solid;
    background: linear-gradient(135deg, rgba(9, 212, 239, 0.1) 0%, rgba(9, 212, 239, 0.15) 100%);
    box-shadow: 
        0 0 0 4px rgba(9, 212, 239, 0.2),
        inset 0 0 20px rgba(9, 212, 239, 0.1);
    transform: scale(1.01);
}

.block-drop-zone.drag-over::after {
    content: '¡Suelta aquí!';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    animation: bounceIn 0.3s ease;
}

.block-insert-marker {
    height: 8px;
    min-height: 8px;
    border-radius: 999px;
    background: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(9, 212, 239, 0.18);
    margin: 2px 0 6px;
    flex: 0 0 auto;
}

.block-drop-zone .scratch-block.in-program.dragging {
    position: relative;
    pointer-events: auto;
    opacity: 0.35;
    transform: scale(0.98);
    z-index: 2;
}

@keyframes bounceIn {
    0% { transform: translateX(-50%) scale(0); }
    50% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); }
}

/* Block Controls */
.block-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}

.block-controls button {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-run-blocks {
    background: var(--success);
    color: white;
    border: none;
}

.btn-run-blocks:hover {
    background: #459AA0;
    transform: translateY(-1px);
}

.btn-clear-blocks {
    background: #f0f0f0;
    color: var(--text-muted);
    border: 1px solid #ddd;
}

.btn-clear-blocks:hover {
    background: #e0e0e0;
    color: var(--danger);
    border-color: var(--danger);
}

/* Block Animation */
@keyframes blockPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.scratch-block.executing {
    animation: blockPulse 0.5s ease infinite;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
}

/* Dragging State */
.scratch-block.dragging {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* Block Workspace Responsive */
@media (max-width: 768px) {
    .block-workspace {
        padding: 0.75rem;
    }
    
    .block-palette {
        padding: 0.75rem;
    }
    
    .scratch-block {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .scratch-block .block-icon {
        font-size: 1rem;
    }
}

/* ============================================
   ROLE-BASED DASHBOARDS
   ============================================ */

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
}

.role-admin {
    background: #FFE0E0;
    color: #D32F2F;
}

.role-teacher {
    background: #E3F2FD;
    color: #1976D2;
}

.role-student {
    background: #e8f3f5;
    color: #38868E;
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-welcome {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: #FFFFFF;
    border-radius: 16px;
    border: 1px solid var(--board-border);
}

.dashboard-welcome h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.dashboard-welcome p {
    color: var(--text-muted);
}

/* Stats Cards */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--board-border);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Dashboard Sections */
.dashboard-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-section {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--board-border);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--board-border);
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark-color);
    font-size: 1.3rem;
}

.section-header h2 i {
    color: var(--primary-color);
}

/* Filters */
.users-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--board-border);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--board-border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: #FFFFFF;
    cursor: pointer;
    min-width: 180px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Data Tables */
.users-table-container,
.students-progress-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th {
    background: var(--primary-light);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--primary-color);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--board-border);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #FAFAFA;
}

.data-table .status-active {
    color: var(--success-color);
    font-weight: 500;
}

.data-table .status-inactive {
    color: var(--danger-color);
    font-weight: 500;
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

.data-table .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.data-table .btn-icon.edit {
    background: #E3F2FD;
    color: #1976D2;
}

.data-table .btn-icon.edit:hover {
    background: #1976D2;
    color: white;
}

.data-table .btn-icon.delete {
    background: #FFEBEE;
    color: #D32F2F;
}

.data-table .btn-icon.delete:hover {
    background: #D32F2F;
    color: white;
}

.data-table .btn-icon.view {
    background: #e8f3f5;
    color: #38868E;
}

.data-table .btn-icon.view:hover {
    background: #38868E;
    color: white;
}

/* Classes Grid */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.class-card {
    background: #FFFFFF;
    border: 2px solid var(--board-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.class-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.class-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.class-card h3 i {
    color: var(--primary-color);
}

.class-card .class-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.class-card .class-stats {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--board-border);
}

.class-card .class-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.class-card .class-stat i {
    color: var(--primary-color);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: #FFFFFF;
    border: 2px solid var(--board-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.quick-action-btn i {
    font-size: 2rem;
    color: var(--primary-color);
}

.quick-action-btn span {
    font-size: 0.9rem;
    color: var(--dark-color);
    font-weight: 500;
}

/* Form Modal */
.form-modal {
    max-width: 500px;
    width: 90%;
}

.form-modal h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.form-modal h2 i {
    color: var(--primary-color);
}

.form-modal .form-group {
    margin-bottom: 1rem;
}

.form-modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-modal .form-group input,
.form-modal .form-group select,
.form-modal .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--board-border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-modal .form-group input:focus,
.form-modal .form-group select:focus,
.form-modal .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-modal .form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-modal .modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--board-border);
}

/* Detail Modal */
.detail-modal {
    max-width: 600px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--board-border);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark-color);
}

.modal-header h2 i {
    color: var(--primary-color);
}

.student-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.mini-stat {
    text-align: center;
}

.mini-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.mini-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.student-badges-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #FAFAFA;
    border-radius: 12px;
    min-height: 60px;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.75rem;
    background: #FFFFFF;
    border: 1px solid var(--board-border);
    border-radius: 20px;
    font-size: 0.85rem;
}

.student-activity-log {
    max-height: 200px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--board-border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item i {
    color: var(--primary-color);
    width: 24px;
}

.activity-item .activity-text {
    flex: 1;
    font-size: 0.9rem;
}

.activity-item .activity-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-content {
        padding: 1rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card i {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .users-filters {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-action-btn {
        padding: 1rem;
    }
    
    .quick-action-btn i {
        font-size: 1.5rem;
    }
}

/* ============================================
   Touch Drag & Drop - Mejoras Táctiles
   ============================================ */

/* Elementos arrastrables base */
[data-draggable="true"] {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    cursor: grab;
}

/* Estado de holding (antes de arrastrar) */
.touch-holding {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Elemento mientras se arrastra */
.dragging {
    opacity: 0.35 !important;
    transform: scale(0.95) !important;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Clon visual durante touch drag */
.touch-drag-clone {
    border-radius: 16px !important;
    background: white !important;
    border: 2px solid var(--primary-color) !important;
    animation: cloneAppear 0.15s ease-out;
}

.touch-drag-clone.over-dropzone {
    box-shadow: 0 20px 60px rgba(9, 212, 239, 0.4), 0 8px 20px rgba(0, 0, 0, 0.2) !important;
    border-color: var(--primary-dark) !important;
}

@keyframes cloneAppear {
    from {
        opacity: 0.5;
        transform: translate3d(var(--start-x, 0), var(--start-y, 0), 0) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate3d(var(--start-x, 0), var(--start-y, 0), 0) scale(1.08);
    }
}

/* Zona de drop - estado normal con hint */
.drop-hint-active {
    border-color: var(--primary-color) !important;
    animation: dropHintPulse 1.5s ease-in-out infinite;
}

@keyframes dropHintPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(9, 212, 239, 0.2);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(9, 212, 239, 0);
    }
}

/* Zona de drop activa (elemento encima) */
.drag-over {
    border-style: solid !important;
    border-color: var(--primary-dark) !important;
    background: var(--primary-light) !important;
    transform: scale(1.03);
    box-shadow: 
        0 0 30px rgba(9, 212, 239, 0.4),
        inset 0 0 20px rgba(9, 212, 239, 0.1);
    transition: all 0.2s ease;
}

/* Items clasificables con mejor touch target */
.classify-item {
    min-height: 70px;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.85rem;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 2px solid var(--board-border);
    border-radius: 14px;
    background: var(--card-background);
}

.classify-item:active {
    cursor: grabbing;
}

.classify-item.touch-holding {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

/* Action cards con mejor touch target */
.action-card {
    min-height: 70px;
    min-width: 85px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card.touch-holding {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-dark);
}

/* Sequence cards táctiles */
.sequence-card {
    min-height: 50px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Animación de shake para errores */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-6px); }
    30%, 70% { transform: translateX(6px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
    border-color: var(--danger-color) !important;
}

/* ============================================
   Mobile Drag & Drop Improvements
   ============================================ */

@media (max-width: 768px) {
    /* Elementos más grandes para touch */
    .classify-item {
        min-height: 80px;
        min-width: 80px;
        padding: 1rem;
    }
    
    .classify-item .icon {
        font-size: 2.8rem;
    }
    
    .classify-item .label {
        font-size: 0.9rem;
        font-weight: 500;
    }
    
    .action-card {
        min-height: 75px;
        min-width: 90px;
        padding: 0.85rem 1rem;
    }
    
    .action-card .icon {
        font-size: 1.8rem;
    }
    
    .action-card .label {
        font-size: 0.85rem;
    }
    
    /* Drop zones más grandes */
    .drop-zone {
        min-height: 180px;
        padding: 1.5rem;
    }
    
    .drop-zone h4 {
        font-size: 1.1rem;
    }
    
    /* Sequence area más accesible */
    .sequence-area {
        min-height: 120px;
        padding: 1.25rem;
    }
    
    .sequence-card {
        min-height: 55px;
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }
    
    /* Items container con mejor espacio */
    .items-container {
        gap: 0.85rem;
        padding: 0.5rem;
    }
    
    /* Drop zones en columna en móvil */
    .drop-zones {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .drop-zones .drop-zone {
        width: 100%;
    }
    
    /* Feedback visual más prominente en mobile */
    .drag-over {
        transform: scale(1.02);
        border-width: 3px;
    }
    
    .touch-drag-clone {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .classify-item {
        min-height: 75px;
        min-width: 75px;
    }
    
    .classify-item .icon {
        font-size: 2.5rem;
    }
    
    .action-card {
        min-height: 70px;
        min-width: 80px;
    }
    
    .action-card .icon {
        font-size: 1.6rem;
    }
    
    .items-container {
        gap: 0.65rem;
    }
    
    /* Action cards en horizontal compacto */
    .action-cards {
        gap: 0.4rem;
        padding: 0.75rem 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    
    .action-cards::-webkit-scrollbar {
        display: none;
    }

    /* Mini grid responsive */
    .mini-grid-cell {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    .mini-robot, .mini-target {
        font-size: 1.3rem;
    }
    .mini-grid-legend {
        font-size: 0.8rem;
    }

    /* Assembly responsive */
    .assembly-parts-tray {
        padding: 0.75rem 1rem;
    }
    .assembly-part {
        padding: 0.5rem 0.7rem;
        font-size: 0.75rem;
    }
    .robot-body-outline {
        padding: 1rem;
    }
    .robot-body-outline .assembly-slot {
        padding: 0.6rem 0.8rem;
    }
}

/* ============================================
   Scratch Blocks Touch Improvements
   ============================================ */

.scratch-block {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    min-height: 50px;
}

.scratch-block.touch-holding {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.block-drop-zone {
    min-height: 150px;
    transition: all 0.2s ease;
}

.block-drop-zone.drag-over {
    background: var(--primary-light);
}

@media (max-width: 768px) {
    .scratch-block {
        min-height: 55px;
        padding: 0.75rem 1rem;
    }
    
    .scratch-block .block-icon {
        font-size: 1.5rem;
    }
    
    .block-drop-zone {
        min-height: 180px;
    }
    
    #block-palette {
        gap: 0.5rem;
        padding: 0.75rem;
    }
}

/* ============================================
   Modal Animations - Mejoras
   ============================================ */

.modal {
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal.active {
    animation: modalFadeIn 0.3s ease forwards;
}

.modal.closing {
    animation: modalFadeOut 0.2s ease forwards;
}

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

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

.modal-content {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-content {
    animation: modalContentIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal.closing .modal-content {
    animation: modalContentOut 0.2s ease forwards;
}

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

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

/* Victory modal estrellas */
.modal.victory .stars .fa-star {
    color: #FFDD59;
    font-size: 2.5rem;
    margin: 0 0.3rem;
    filter: drop-shadow(0 2px 4px rgba(255, 193, 7, 0.4));
}

.modal.victory .stars .fa-star.empty {
    color: #ddd;
    filter: none;
}

/* ============================================
   Block Programming - Mejoras Táctiles
   ============================================ */

.scratch-block {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.scratch-block:active {
    cursor: grabbing;
}

.scratch-block.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

#block-drop-zone {
    min-height: 200px;
    transition: all 0.25s ease;
}

#block-drop-zone.drag-over {
    background: rgba(9, 212, 239, 0.15);
    border-color: var(--primary-color);
    box-shadow: inset 0 0 20px rgba(9, 212, 239, 0.2);
}

/* ============================================
   Sequence Builder - Mejoras Táctiles
   ============================================ */

.action-card {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    min-height: 70px;
    min-width: 70px;
}

.action-card:active {
    transform: scale(0.95);
}

#sequence-area {
    min-height: 100px;
    transition: all 0.25s ease;
}

#sequence-area.drag-over {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.sequence-card {
    animation: slideIn 0.25s ease forwards;
}

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

/* ============================================
   Game Board - Mejoras de Transición
   ============================================ */

#game-board {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Robot smooth movement */
#game-robot {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#game-robot.moving {
    filter: drop-shadow(0 4px 8px rgba(9, 212, 239, 0.4));
}

/* ============================================
   Responsive Touch - Móviles y Tablets
   ============================================ */

@media (max-width: 768px) {
    /* Aumentar áreas táctiles */
    .classify-item {
        min-height: 70px;
        min-width: 70px;
        padding: 1rem;
    }
    
    .action-card {
        min-height: 80px;
        min-width: 80px;
    }
    
    /* Bloques de scratch para móvil */
    .scratch-block {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
        min-height: 50px;
        touch-action: none;
    }
    
    .scratch-block.in-program {
        padding: 0.85rem 2.5rem 0.85rem 0.8rem;
        margin-left: 30px;
    }
    
    .scratch-block.in-program::before {
        left: -25px;
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
    
    .scratch-block.in-program::after {
        right: 8px;
        font-size: 1.3rem;
        opacity: 0.6;
    }
    
    /* Drop zone para bloques */
    .block-drop-zone {
        min-height: 100px;
        padding: 0.8rem;
        padding-left: 2.5rem;
    }
    
    .block-drop-zone:empty::before {
        font-size: 0.9rem;
        padding: 1rem;
    }
    
    /* Mejor espaciado en zonas de drop */
    .drop-zone {
        min-height: 180px;
        padding: 1.5rem;
    }
    
    .drop-zone .items {
        gap: 0.75rem;
    }
    
    /* Botones más grandes para touch */
    .btn {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
    }
    
    /* Asegurar que los elementos no se peguen */
    .command-btn {
        margin: 0.25rem;
    }
    
    /* Controles de juego para móvil */
    .game-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .game-controls .btn {
        flex: 1 1 45%;
        min-width: 120px;
    }
}

@media (max-width: 576px) {
    .scratch-block {
        font-size: 0.9rem;
        padding: 0.875rem 1rem;
    }
    
    .scratch-block.in-program {
        margin-left: 26px;
    }
    
    .scratch-block.in-program::before {
        left: -22px;
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
    
    .block-drop-zone {
        padding-left: 2rem;
    }
    
    .block-drop-zone:empty::before {
        content: '🧩 Arrastra bloques aquí';
        font-size: 0.85rem;
    }
}

/* Prevenir selección de texto durante drag */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Confetti animation fix */
@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    animation: confetti-fall 3s ease-out forwards;
}

/* Mejora de rendimiento para animaciones */
.scratch-block,
.classify-item,
.action-card,
#game-robot {
    will-change: transform;
}

/* ============================================
   New Exercise Types - Styles
   ============================================ */

/* Shared exercise element styles */
.keyword {
    background: linear-gradient(135deg, #6c5ce7, #a855f7);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-block;
}

.big-icon { font-size: 4rem; display: block; text-align: center; margin: 1rem 0; }
.text-input { width: 100%; padding: 0.8rem; border: 2px solid var(--board-border); border-radius: 12px; font-size: 1rem; font-family: 'Nunito', sans-serif; }
.text-input:focus { border-color: var(--primary-color); outline: none; }

/* Drag Action */
.drag-action-area { display: flex; align-items: center; justify-content: center; gap: 2rem; padding: 2rem; flex-wrap: wrap; }
.drag-source { text-align: center; }
.action-card-drag { background: linear-gradient(135deg, #FFDD59, #FFC107); padding: 1.5rem 2rem; border-radius: 16px; cursor: grab; font-size: 1.2rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3); transition: transform 0.2s; }
.action-card-drag:hover { transform: scale(1.08); }
.action-card-drag .icon { font-size: 2.5rem; }
.drag-arrow { font-size: 2.5rem; }
.drag-target-zone { background: var(--board-cell); border: 3px dashed var(--primary-color); border-radius: 20px; padding: 2rem; min-width: 180px; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; transition: all 0.3s; }
.drag-target-zone.drag-over { border-style: solid; background: var(--primary-light); transform: scale(1.05); }
.target-robot { font-size: 4rem; transition: all 0.3s; }
.target-robot.active { animation: pulse 0.5s ease; }

/* Reverse Engineer */
.reverse-engineer-area { width: 100%; }
.shown-result { background: var(--primary-light); border-radius: 16px; padding: 1.5rem; margin-bottom: 1rem; }
.path-visual { display: flex; align-items: center; justify-content: center; gap: 0.3rem; flex-wrap: wrap; }
.path-step { font-size: 2rem; background: white; padding: 0.5rem; border-radius: 10px; box-shadow: var(--shadow-sm); }
.path-arrow { font-size: 1.2rem; color: var(--text-muted); }

/* Loop Intro */
.loop-intro-area { width: 100%; max-width: 600px; }
.loop-explanation { background: var(--primary-light); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; }
.loop-demo { display: flex; align-items: center; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; }
.without-loop, .with-loop { background: white; border-radius: 12px; padding: 1rem; min-width: 150px; text-align: center; }
.steps-list { display: flex; gap: 0.3rem; justify-content: center; flex-wrap: wrap; }
.step-item { font-size: 1.8rem; }
.vs-symbol { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); }
.loop-block-demo { background: linear-gradient(135deg, #6c5ce7, #a855f7); color: white; border-radius: 12px; padding: 1rem; text-align: center; }
.loop-header-demo { display: block; font-weight: 700; margin-bottom: 0.5rem; }
.loop-body-demo { display: block; background: rgba(255,255,255,0.2); border-radius: 8px; padding: 0.5rem; }

/* Loop Fix / Fix Options */
.loop-fix-area { width: 100%; max-width: 600px; }
.wrong-version { background: #FFEBEE; border-radius: 12px; padding: 1rem; margin-bottom: 1.5rem; }
.algo-display { padding: 0.8rem; border-radius: 8px; font-size: 1rem; word-break: break-word; }
.algo-display.wrong { background: #FFCDD2; }
.fix-options { display: flex; flex-direction: column; gap: 1rem; }
.fix-option { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 1rem; cursor: pointer; transition: all 0.2s; }
.fix-option:hover { border-color: var(--primary-color); transform: translateY(-2px); }
.fix-option.correct { border-color: var(--success-color); background: #e8f3f5; }
.fix-option.incorrect { border-color: var(--danger-color); background: #FFEBEE; }

/* Calc / Nested Loop Calc */
.calc-area { width: 100%; max-width: 500px; text-align: center; }
.calc-visual { background: var(--primary-light); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; }
.grid-visual { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.grid-row { font-size: 1.5rem; letter-spacing: 0.5rem; }
.calc-options { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.calc-option { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 1rem 2rem; cursor: pointer; font-size: 1.5rem; font-weight: 700; transition: all 0.2s; min-width: 60px; }
.calc-option:hover { border-color: var(--primary-color); transform: scale(1.05); }
.calc-option.correct { border-color: var(--success-color); background: #e8f3f5; color: var(--success-color); }
.calc-option.incorrect { border-color: var(--danger-color); background: #FFEBEE; }

/* Multi Selection */
.multi-selection-area { width: 100%; max-width: 600px; }
.selection-hint { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; text-align: center; color: var(--text-color); }
.multi-options-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.multi-option { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 1rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; transition: all 0.2s; }
.multi-option:hover { border-color: var(--primary-color); }
.multi-option.selected { border-color: var(--primary-dark); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(9, 212, 239, 0.2); }
.multi-option.incorrect { border-color: var(--danger-color); background: #FFEBEE; animation: shake 0.4s; }
.multi-option .icon { font-size: 2.5rem; }

/* Creative Build */
.creative-build-area { width: 100%; max-width: 600px; }
.assembly-builder-free {
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.creative-build-area #complete-build {
    display: block;
    width: auto;
    min-width: 180px;
    margin: 1.5rem auto 0;
    padding: 0.8rem 2rem;
    font-size: 1rem;
}
.base-grid, .parts-grid, .commands-grid { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 0.5rem 0 1rem; }
.base-option, .part-option, .part-toggle, .cmd-toggle { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 0.8rem 1rem; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s; }
.base-option:hover, .part-option:hover, .part-toggle:hover, .cmd-toggle:hover { border-color: var(--primary-color); }
.base-option.selected, .part-option.selected, .part-toggle.selected, .cmd-toggle.selected { border-color: var(--primary-dark); background: var(--primary-light); }
.robot-build-zone { background: var(--board-cell); border-radius: 16px; padding: 1.5rem; min-height: 80px; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: center; }
.build-part { font-size: 2.5rem; animation: popIn 0.3s ease; }

.assembly-builder-free .parts-grid {
    justify-content: center;
}

.assembly-builder-free .part-option {
    min-width: 140px;
    min-height: 80px;
    justify-content: center;
}

.assembly-builder-free .robot-build-zone {
    min-height: 130px;
    padding: 1.75rem;
}

/* Creative Sequence */
.creative-sequence-area { width: 100%; max-width: 500px; }
.robot-name-input { margin-bottom: 1rem; }
.robot-name-input label { display: block; margin-bottom: 0.3rem; font-weight: 600; }
.functions-area { margin-bottom: 1rem; }
.function-item { background: var(--card-background); border: 1px solid var(--board-border); border-radius: 8px; padding: 0.5rem 1rem; margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center; }
.remove-func { cursor: pointer; color: var(--danger-color); font-weight: 700; }
.add-function { display: flex; gap: 0.5rem; }
.add-function .text-input { flex: 1; }

/* Labeling */
.labeling-area { width: 100%; max-width: 600px; display: flex; flex-direction: column; gap: 1.5rem; }
.labeling-robot { text-align: center; }
.robot-display { font-size: 6rem; margin-bottom: 1rem; }
.label-slots { display: flex; flex-direction: column; gap: 0.5rem; }
.label-slot { display: flex; align-items: center; gap: 1rem; background: var(--card-background); padding: 0.5rem 1rem; border-radius: 10px; }
.position-label { font-size: 0.85rem; min-width: 100px; }
.label-drop { background: var(--board-cell); border: 2px dashed var(--board-border); border-radius: 8px; padding: 0.5rem 1rem; min-width: 80px; text-align: center; cursor: pointer; transition: all 0.2s; }
.label-drop.correct { border-color: var(--success-color); border-style: solid; background: #e8f3f5; }
.label-drop.incorrect { border-color: var(--danger-color); animation: shake 0.3s; }
.label-options { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.label-tag { background: linear-gradient(135deg, #54A0FF, #2E86DE); color: white; padding: 0.5rem 1rem; border-radius: 10px; cursor: grab; font-weight: 600; transition: all 0.2s; }
.label-tag:hover { transform: scale(1.05); }
.label-tag.active { box-shadow: 0 0 0 3px rgba(84, 160, 255, 0.4); }

/* Matching */
.matching-area { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; width: 100%; }
.matching-column { display: flex; flex-direction: column; gap: 0.8rem; }
.match-item { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 1rem; cursor: pointer; transition: all 0.2s; text-align: center; min-width: 140px; }
.match-item:hover { border-color: var(--primary-color); }
.match-item.selected { border-color: var(--primary-dark); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(9, 212, 239, 0.3); }
.match-item.matched { border-color: var(--success-color); background: #e8f3f5; opacity: 0.8; cursor: default; }
.match-item.incorrect { border-color: var(--danger-color); animation: shake 0.3s; }

/* Fix Missing */
.fix-missing-area { width: 100%; max-width: 500px; }
.problem-display { background: #FFF3E0; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; text-align: center; }
.missing-options h4 { margin-bottom: 1rem; text-align: center; }
.missing-option { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 1rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; transition: all 0.2s; }
.missing-option:hover { border-color: var(--primary-color); transform: translateY(-2px); }
.missing-option.correct { border-color: var(--success-color); background: #e8f3f5; }
.missing-option.incorrect { border-color: var(--danger-color); background: #FFEBEE; }
.missing-option .icon { font-size: 2rem; }
.options-grid { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Pattern Exercises */
.pattern-area, .pattern-fix-area, .pattern-completion-area, .pattern-builder-area { width: 100%; max-width: 600px; text-align: center; }
.pattern-display { display: flex; gap: 0.5rem; justify-content: center; align-items: center; flex-wrap: wrap; margin: 1.5rem 0; }
.pattern-item { font-size: 2.5rem; background: white; padding: 0.5rem; border-radius: 12px; box-shadow: var(--shadow-sm); min-width: 50px; transition: all 0.2s; }
.pattern-item.clickable { cursor: pointer; }
.pattern-item.clickable:hover { transform: scale(1.1); }
.pattern-item.selected { box-shadow: 0 0 0 3px var(--primary-color); }
.pattern-blank { font-size: 2.5rem; background: var(--board-cell); padding: 0.5rem; border-radius: 12px; border: 2px dashed var(--board-border); min-width: 50px; transition: all 0.2s; }
.pattern-blank.correct { border-color: var(--success-color); border-style: solid; background: #e8f3f5; }
.pattern-blank.incorrect { border-color: var(--danger-color); animation: shake 0.3s; }
.pattern-options { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.pattern-choice { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 0.8rem 1.2rem; cursor: pointer; font-size: 1.5rem; transition: all 0.2s; }
.pattern-choice:hover { border-color: var(--primary-color); transform: scale(1.08); }
.pattern-choice.correct { border-color: var(--success-color); background: #e8f3f5; }
.pattern-choice.incorrect { border-color: var(--danger-color); background: #FFEBEE; }
.pattern-palette { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1rem; }
.pattern-color { font-size: 2rem; background: white; border: 2px solid var(--board-border); border-radius: 10px; padding: 0.5rem; cursor: pointer; transition: all 0.2s; }
.pattern-color:hover { transform: scale(1.15); }
.pattern-build-zone { display: flex; flex-direction: column; gap: 0.8rem; }
.pattern-row { display: flex; align-items: center; gap: 0.8rem; justify-content: center; }
.row-label { font-weight: 600; font-size: 0.9rem; min-width: 90px; text-align: right; }
.pattern-slots { display: flex; gap: 0.3rem; min-height: 50px; background: var(--board-cell); padding: 0.5rem; border-radius: 10px; }
.pattern-slot { font-size: 2rem; padding: 0.3rem; cursor: pointer; }
.pattern-slot.filled { background: white; border-radius: 8px; box-shadow: var(--shadow-sm); }

/* Conditional Exercises */
.conditional-area, .conditional-fix-area, .conditional-seq-area, .conditional-builder-area,
.conditional-free-area, .if-else-area, .if-else-builder-area { width: 100%; max-width: 600px; }
.condition-display { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; background: var(--primary-light); padding: 1.5rem; border-radius: 16px; margin-bottom: 1.5rem; justify-content: center; font-size: 1.1rem; }
.condition-value { font-size: 2rem; }
.action-options { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.action-option { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 14px; padding: 1.2rem 1.5rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; transition: all 0.2s; min-width: 120px; }
.action-option:hover { border-color: var(--primary-color); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.action-option.correct { border-color: var(--success-color); background: #e8f3f5; }
.action-option.incorrect { border-color: var(--danger-color); background: #FFEBEE; }
.action-option .icon { font-size: 2rem; }
.scenario-display { background: var(--board-cell); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; text-align: center; }
.seq-progress { text-align: center; font-weight: 600; color: var(--primary-dark); margin-bottom: 0.5rem; }

/* Builder Template */
.builder-template { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; background: #F3E5F5; padding: 1.5rem; border-radius: 16px; margin-bottom: 1.5rem; justify-content: center; }
.builder-row { display: flex; align-items: center; gap: 0.8rem; width: 100%; }
.builder-slot { background: white; border: 2px dashed var(--board-border); border-radius: 10px; padding: 0.8rem 1.2rem; min-width: 120px; text-align: center; cursor: pointer; transition: all 0.2s; color: var(--text-muted); }
.builder-slot.correct { border-color: var(--success-color); border-style: solid; background: #e8f3f5; color: var(--text-color); }
.builder-options { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.builder-options > div { min-width: 150px; }
.builder-options h5 { margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }
.builder-option { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 10px; padding: 0.6rem 1rem; cursor: pointer; margin-bottom: 0.4rem; transition: all 0.2s; }
.builder-option:hover { border-color: var(--primary-color); background: var(--primary-light); }

/* If-Else Branches */
.branches { display: flex; gap: 1.5rem; justify-content: center; margin: 1.5rem 0; flex-wrap: wrap; }
.branch { background: var(--card-background); border: 3px solid var(--board-border); border-radius: 16px; padding: 1.5rem 2rem; cursor: pointer; transition: all 0.2s; min-width: 150px; text-align: center; font-size: 1.1rem; }
.branch:hover { transform: translateY(-3px); }
.if-branch { border-color: #81BFC7; }
.if-branch:hover { background: #e8f3f5; }
.else-branch { border-color: #E57373; }
.else-branch:hover { background: #FFEBEE; }
.branch.correct { border-color: var(--success-color); background: #e8f3f5; }
.branch.incorrect { border-color: var(--danger-color); background: #FFEBEE; animation: shake 0.3s; }

/* Loop with Condition */
.loop-condition-area { width: 100%; max-width: 600px; }
.simulation { margin-top: 1.5rem; text-align: center; }
.sim-items { display: flex; gap: 0.5rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.sim-item { font-size: 2rem; background: white; padding: 0.5rem; border-radius: 10px; box-shadow: var(--shadow-sm); transition: all 0.3s; }
.sim-item.active { transform: scale(1.3); box-shadow: 0 0 15px rgba(9, 212, 239,0.5); }
.sim-item.done { opacity: 0.5; }

/* Loop If-Else */
.loop-ifelse-area { width: 100%; max-width: 500px; text-align: center; }
.item-display { background: var(--board-cell); border-radius: 16px; padding: 2rem; margin: 1rem 0; }
.basket-options { display: flex; gap: 1.5rem; justify-content: center; }
.basket-option { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 14px; padding: 1.2rem 2rem; cursor: pointer; transition: all 0.2s; font-size: 1.1rem; }
.basket-option:hover { transform: scale(1.05); }
.basket-option.correct { border-color: var(--success-color); background: #e8f3f5; }
.basket-option.incorrect { border-color: var(--danger-color); background: #FFEBEE; }
.progress { font-weight: 600; color: var(--primary-dark); }

/* Loop Counter */
.loop-counter-area { width: 100%; max-width: 500px; text-align: center; }
.items-display { display: flex; gap: 0.5rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.counter-item { font-size: 2rem; background: white; padding: 0.5rem; border-radius: 8px; box-shadow: var(--shadow-sm); }

/* Loop Selection */
.loop-selection-area { width: 100%; max-width: 500px; text-align: center; }
.loop-options { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.loop-opt { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 1rem 2rem; cursor: pointer; font-size: 1.1rem; transition: all 0.2s; }
.loop-opt:hover { border-color: var(--primary-color); transform: scale(1.05); }
.loop-opt.correct { border-color: var(--success-color); background: #e8f3f5; }
.loop-opt.incorrect { border-color: var(--danger-color); background: #FFEBEE; }

/* Comparison Table */
.comparison-table-area { width: 100%; max-width: 600px; }
.comparison-table { width: 100%; border-collapse: separate; border-spacing: 0; background: white; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; }
.comparison-table th { background: var(--primary-color); color: white; padding: 0.8rem; font-weight: 700; }
.comparison-table td { padding: 0.8rem; border-bottom: 1px solid var(--board-border); text-align: center; }
.table-slot { cursor: pointer; background: var(--board-cell); transition: all 0.2s; }
.table-slot:hover { background: var(--primary-light); }
.table-slot.correct { background: #e8f3f5; color: var(--success-color); font-weight: 600; }
.table-slot.incorrect { background: #FFEBEE; animation: shake 0.3s; }
.answer-bank { margin-top: 1rem; }
.answer-bank h5 { margin: 0.5rem 0; color: var(--text-muted); font-size: 0.85rem; }
.answer-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.answer-tag { background: linear-gradient(135deg, #54A0FF, #2E86DE); color: white; padding: 0.4rem 0.8rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem; transition: all 0.2s; }
.answer-tag:hover { transform: scale(1.05); }
.answer-tag.active { box-shadow: 0 0 0 3px rgba(84, 160, 255, 0.4); }

/* Sequence Execution */
.execution-area { width: 100%; max-width: 600px; text-align: center; }
.sequence-preview { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.exec-step { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 10px; padding: 0.8rem; display: flex; align-items: center; gap: 0.5rem; transition: all 0.3s; }
.exec-step.executing { border-color: var(--primary-color); background: var(--primary-light); transform: scale(1.1); box-shadow: 0 0 15px rgba(9, 212, 239,0.3); }
.exec-step.done { opacity: 0.5; border-color: var(--success-color); }
.step-num { background: var(--primary-color); color: white; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.step-icon { font-size: 1.3rem; }
.robot-exec-area { margin: 1.5rem 0; min-height: 80px; }
.robot-visual { font-size: 4rem; transition: all 0.5s; display: inline-block; }

/* Mission Planning */
.mission-planning-area { width: 100%; max-width: 500px; }
.mission-steps { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.mission-step { background: var(--card-background); border: 2px solid var(--board-border); border-radius: 12px; padding: 0.8rem 1rem; cursor: grab; display: flex; align-items: center; gap: 0.8rem; transition: all 0.2s; user-select: none; }
.mission-step:hover { border-color: var(--primary-color); }
.mission-step.dragging { opacity: 0.4; }
.mission-step.selected-move { border-color: var(--primary-dark); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(9, 212, 239, 0.2); }
.mission-steps.error { animation: shake 0.4s; }
.grip { color: var(--text-muted); font-size: 1.2rem; cursor: grab; }

/* Final Project */
.final-project-area { width: 100%; max-width: 600px; text-align: center; }
.phase-progress { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1.5rem; }
.phase-dot { font-size: 1.8rem; padding: 0.3rem; border-radius: 50%; transition: all 0.3s; opacity: 0.3; }
.phase-dot.done { opacity: 0.6; }
.phase-dot.active { opacity: 1; transform: scale(1.2); }
.phase-content { background: var(--board-cell); border-radius: 16px; padding: 1.5rem; margin: 1rem 0; min-height: 100px; text-align: left; }
.project-summary { text-align: center; }
.success-msg { color: var(--success-color); font-weight: 700; font-size: 1.3rem; margin-top: 1rem; }

/* Combined Algorithm */
.combined-area { width: 100%; }
.conditions-ref { background: #FFF3E0; border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.cond-tag { display: inline-block; background: white; padding: 0.3rem 0.8rem; border-radius: 8px; margin: 0.2rem; font-size: 0.9rem; box-shadow: var(--shadow-sm); }

/* Animations */
@keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Responsive for new exercise types */
@media (max-width: 768px) {
    .drag-action-area { flex-direction: column; }
    .matching-area { flex-direction: column; align-items: center; }
    .branches { flex-direction: column; }
    .builder-template { flex-direction: column; }
    .builder-options { flex-direction: column; align-items: center; }
    .basket-options { flex-direction: column; }
    .action-options { flex-direction: column; align-items: center; }
    .pattern-item, .pattern-blank { font-size: 2rem; }
    .comparison-table { font-size: 0.85rem; }
    .comparison-table th, .comparison-table td { padding: 0.5rem; }
}

/* ============================================
   Mobile / Tablet Foundation
   ============================================ */

@media (max-width: 1024px) {
    .game-layout,
    .exercise-layout,
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
    }

    .instructions-panel,
    .exercise-instructions-panel,
    .code-panel,
    .exercise-action-panel,
    .editor-panel {
        max-height: none;
    }

    .game-content,
    .editor-content,
    .exercise-content {
        overflow: visible;
    }
}

@media (max-width: 768px) {
    header {
        padding-inline: 1rem;
    }

    .header-content {
        align-items: flex-start;
    }

    .header-content h1 {
        font-size: clamp(1.15rem, 4vw, 1.45rem);
        line-height: 1.1;
    }

    .header-content .user-info,
    .header-content .user-progress,
    .header-content .session-badge,
    .header-content .exercise-progress,
    .header-content .exercise-controls,
    .header-content .level-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .menu-header,
    .dashboard-header,
    .section-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .menu-content h2,
    .section-title {
        font-size: clamp(1.35rem, 5vw, 1.9rem);
    }

    .games-grid,
    .grades-grid,
    .sessions-grid,
    .proposals-grid,
    .exercises-grid {
        grid-template-columns: 1fr;
    }

    .levels-hero {
        grid-template-columns: 1fr;
    }

    .levels-map-panel {
        min-height: 220px;
    }

    .levels-grid {
        grid-template-columns: 1fr;
    }

    .game-board-container,
    .editor-board-container,
    .exercise-gobstones-board {
        padding: 0.75rem;
    }

    .instructions-panel,
    .code-panel,
    .editor-panel,
    .exercise-area,
    .exercise-action-panel,
    .exercise-instructions-panel {
        padding: 1rem;
    }

    .available-commands {
        gap: 0.45rem;
    }

    .btn,
    .btn-small,
    .command-btn,
    .tab-btn,
    .dash-tab,
    .btn-educational,
    .btn-editor {
        min-height: var(--mobile-touch-target);
    }

    .cell {
        width: var(--board-cell-size);
        height: var(--board-cell-size);
    }

    .robot {
        width: var(--robot-size);
        height: var(--robot-size);
    }

    .ball {
        width: var(--ball-size);
        height: var(--ball-size);
    }

    .game-board {
        gap: var(--board-gap);
        padding: var(--board-padding);
    }

    .modal {
        align-items: flex-start;
    }

    .modal-content {
        width: min(100%, 560px);
        max-height: calc(var(--app-height) - 2rem);
    }

    .modal-buttons {
        flex-direction: column;
    }

    .dashboard-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    :root {
        --board-cell-size: 42px;
        --robot-size: 34px;
        --ball-size: 10px;
        --board-gap: 3px;
        --board-padding: 4px;
    }

    .login-container {
        padding: 1.25rem;
        margin: 0.75rem;
    }

    .menu-content,
    .levels-content,
    .grades-content,
    .sessions-content,
    .proposals-content,
    .exercises-content {
        padding: 1rem;
    }

    .game-content,
    .editor-content,
    .exercise-content {
        padding: 0.75rem;
    }

    .game-board-container,
    .editor-board-container,
    .exercise-gobstones-board {
        padding: 0.5rem;
    }

    .command-btn {
        padding: 0.55rem 0.7rem;
        font-size: 0.82rem;
    }

    .level-card {
        min-width: 84px;
    }

    .modal-content {
        width: 100%;
        border-radius: 24px;
    }

    .dashboard-content,
    .dashboard-main {
        padding: 0.75rem;
    }
}

/* ============================================
   Dashboard Styles - Admin & Teacher
   ============================================ */

/* --- Layout --- */
.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* --- Dashboard Tabs --- */
.dashboard-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    flex-wrap: wrap;
}

.dash-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #636E72;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    border-radius: 8px 8px 0 0;
}

.dash-tab:hover {
    color: #2D3436;
    background: rgba(0,0,0,0.03);
}

.dash-tab.active {
    color: #08BDD6;
    border-bottom-color: #09D4EF;
    background: rgba(9, 212, 239, 0.06);
}

/* --- Panels --- */
.dash-panels {
    min-height: 400px;
}

.dash-panel {
    display: none;
}

.dash-panel.active {
    display: block;
    animation: fadeInPanel 0.3s ease;
}

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

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-grid.four-col { grid-template-columns: repeat(4, 1fr); }
.stats-grid.three-col { grid-template-columns: repeat(3, 1fr); }

.stat-card {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-left: 4px solid #ccc;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.stat-card.c-blue { border-left-color: #4A90D9; }
.stat-card.c-green { border-left-color: #09D4EF; }
.stat-card.c-purple { border-left-color: #A29BFE; }
.stat-card.c-orange { border-left-color: #FFAA33; }

.stat-icon {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
    opacity: 0.85;
}

.stat-card.c-blue .stat-icon { color: #4A90D9; }
.stat-card.c-green .stat-icon { color: #09D4EF; }
.stat-card.c-purple .stat-icon { color: #A29BFE; }
.stat-card.c-orange .stat-icon { color: #FFAA33; }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: #2D3436;
}

.stat-label {
    font-size: 0.85rem;
    color: #636E72;
    margin-top: 0.25rem;
}

/* --- Overview Grid --- */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.overview-card {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.overview-card h3 {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    color: #2D3436;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.overview-card h3 i { color: #08BDD6; opacity: 0.8; }

/* --- Mini Table (student rows) --- */
.mini-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mini-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
    transition: background 0.15s;
}

.mini-row:hover { background: rgba(0,0,0,0.06); }

.mr-avatar {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.mr-rank {
    font-weight: 700;
    color: #FFAA33;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.mr-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.92rem;
    color: #2D3436;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mr-grade {
    font-size: 0.8rem;
    color: #636E72;
    white-space: nowrap;
}

.mr-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #636E72;
    min-width: 100px;
    flex-shrink: 0;
}

/* --- Progress Bar (Small) --- */
.progress-bar-sm {
    height: 8px;
    background: rgba(0,0,0,0.08);
    border-radius: 4px;
    overflow: hidden;
    flex: 1;
    min-width: 60px;
}

.progress-bar-sm .fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent, #09D4EF);
    transition: width 0.5s ease;
}

.progress-bar-sm .fill.high { background: #09D4EF; }
.progress-bar-sm .fill.medium { background: #FFDD59; }
.progress-bar-sm .fill.low { background: #FF6B6B; }

/* --- Quick Actions --- */
.quick-actions-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.qa-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2D3436;
    transition: all 0.2s;
}

.qa-btn:hover {
    background: #09D4EF;
    color: #fff;
    border-color: #09D4EF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(9, 212, 239, 0.25);
}

.qa-btn i { font-size: 1.1rem; }

/* --- Section Bar --- */
.section-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.section-bar h2 {
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2D3436;
}

.section-bar h2 i { color: #08BDD6; }

/* --- Classes Grid (Admin) --- */
.classes-grid-admin {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.class-card-admin {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid rgba(255,255,255,0.7);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.class-card-admin:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: rgba(9, 212, 239,0.3);
}

.cc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.cc-header h3 {
    margin: 0;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2D3436;
}

.cc-header h3 i { color: #08BDD6; }

.cc-actions {
    display: flex;
    gap: 0.4rem;
}

.cc-meta {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    color: #666;
}

.cc-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.cc-meta i { color: #aaa; }

.cc-students {
    border-top: 1px solid #f0f0f0;
    padding-top: 0.75rem;
    margin-bottom: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.cc-student-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.cc-student-row:hover { background: #f5f5ff; }

.cc-grade {
    font-size: 0.8rem;
    color: #999;
}

/* --- Button Icon Small --- */
.btn-icon-sm {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.6);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #636E72;
    transition: all 0.15s;
}

.btn-icon-sm:hover {
    background: #6C63FF;
    color: #fff;
}

.btn-icon-sm.danger:hover {
    background: #FF4757;
    color: #fff;
}

/* --- Button Outline --- */
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color, #6C63FF);
    color: var(--primary-color, #6C63FF);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-outline:hover {
    background: var(--primary-color, #6C63FF);
    color: #fff;
}

/* --- Users Section Block --- */
.users-section-block {
    margin-bottom: 2rem;
}

.users-section-block h3 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2D3436;
}

.users-section-block h3 i { color: var(--primary-color, #6C63FF); opacity: 0.8; }

.users-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-row-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.15s;
}

.user-row-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.ur-avatar {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ur-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ur-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2D3436;
}

.ur-email {
    font-size: 0.82rem;
    color: #888;
}

.ur-classes {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    white-space: nowrap;
}

.ur-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 110px;
}

/* --- Grade Row (overview) --- */
.grade-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: rgba(0,0,0,0.03);
    margin-bottom: 0.5rem;
}

.gr-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #2D3436;
    min-width: 110px;
}

.gr-students {
    font-size: 0.82rem;
    color: #636E72;
    min-width: 80px;
}

.gr-levels {
    font-size: 0.82rem;
    color: #636E72;
    min-width: 70px;
}

.gr-pct {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2D3436;
    min-width: 40px;
    text-align: right;
}

/* --- Assign Student List --- */
.assign-student-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 350px;
    overflow-y: auto;
}

.assign-student-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
}

.assign-student-row span:first-child { flex: 1; font-weight: 600; }

.assign-grade {
    font-size: 0.82rem;
    color: #636E72;
}

/* --- Empty Message --- */
.empty-msg {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #aaa;
    font-style: italic;
    font-size: 0.92rem;
}

/* --- Dashboard Footer Actions --- */
.dashboard-footer-actions {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(0,0,0,0.08);
    text-align: center;
}

/* --- Welcome Banner (Teacher) --- */
.welcome-banner {
    background: linear-gradient(135deg, #6C63FF 0%, #A29BFE 100%);
    color: #fff;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.welcome-banner h2 {
    margin: 0 0 0.3rem;
    font-size: 1.4rem;
}

.welcome-banner p {
    margin: 0;
    opacity: 0.85;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* --- Teacher Class Card --- */
.teacher-class-card {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 1.25rem;
}

.tcc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.tcc-header h3 {
    margin: 0;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2D3436;
}

.tcc-header h3 i { color: #08BDD6; }

.tcc-avg {
    font-weight: 700;
    color: #08BDD6;
    font-size: 0.95rem;
}

.tcc-students {
    overflow-x: auto;
}

/* --- Dash Table --- */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dash-table th,
.dash-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.dash-table th {
    font-weight: 700;
    color: #636E72;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: rgba(0,0,0,0.03);
    border-bottom: 2px solid rgba(0,0,0,0.08);
}

.dash-table tbody tr:hover {
    background: rgba(0,0,0,0.02);
}

.dash-table td.empty-msg {
    text-align: center;
    font-style: italic;
    color: #aaa;
    padding: 2rem;
}

/* --- Student Cell --- */
.student-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sc-avatar {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* --- Grade Badge Small --- */
.grade-badge-sm {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(108, 99, 255, 0.15);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent, #09D4EF);
}

/* --- Stars Small --- */
.stars-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #FFAA33;
    font-weight: 700;
    font-size: 0.9rem;
}

.stars-sm i { font-size: 0.85rem; }

/* --- Percent Label --- */
.pct-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #636E72;
    display: inline-block;
    margin-top: 0.15rem;
}

/* --- Last Active Text --- */
.la-text {
    font-size: 0.85rem;
    color: #888;
}

.la-text.recent { color: #09D4EF; font-weight: 600; }

/* --- Status Pill --- */
.status-pill {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill.st-active {
    background: rgba(0, 184, 148, 0.15);
    color: #08BDD6;
}

.status-pill.st-attention {
    background: rgba(243, 156, 18, 0.15);
    color: #F39C12;
}

.status-pill.st-regular {
    background: rgba(33, 150, 243, 0.15);
    color: #2196F3;
}

/* --- Class Summary Row (Teacher overview) --- */
.class-summary-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.15s;
}

.class-summary-row:hover { background: rgba(0,0,0,0.06); }

.csr-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #2D3436;
    min-width: 100px;
}

.csr-count {
    font-size: 0.82rem;
    color: #888;
    min-width: 80px;
}

.csr-pct {
    font-weight: 700;
    font-size: 0.9rem;
    color: #636E72;
    min-width: 40px;
    text-align: right;
}

/* --- Student Detail View (modal) --- */
.student-detail-view h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
    color: #2D3436;
}

.sdv-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.sdv-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(108, 99, 255, 0.1);
    border-radius: 12px;
}

.sdv-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color, #6C63FF);
}

.sdv-lbl {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.1rem;
}

/* --- Detail Game (student detail) --- */
.detail-game {
    background: rgba(0,0,0,0.03);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.dg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.dg-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2D3436;
}

.dg-completed {
    font-size: 0.82rem;
    color: #888;
}

.dg-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dg-level {
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.dg-level.done {
    background: rgba(0, 184, 148, 0.15);
    color: #08BDD6;
}

.dg-level.pending {
    background: rgba(0,0,0,0.05);
    color: #999;
}

/* --- Modal (Dashboard shared) --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    padding: 1.5rem;
    box-sizing: border-box;
}

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

.modal-box {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 20px;
    width: 90%;
    max-width: 560px;
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.modal-box-header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: #2D3436;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #636E72;
    transition: all 0.15s;
}

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

.modal-box-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-box-body .form-group {
    margin-bottom: 1rem;
}

.modal-box-body .form-group label {
    display: block;
    font-weight: 700;
    font-size: 0.88rem;
    color: #636E72;
    margin-bottom: 0.35rem;
}

.modal-box-body .form-group input,
.modal-box-body .form-group select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: rgba(255,255,255,0.8);
    color: #2D3436;
}

.modal-box-body .form-group input:focus,
.modal-box-body .form-group select:focus {
    outline: none;
    border-color: #09D4EF;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* --- Notification Toast --- */
.dash-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    z-index: 10001;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.dash-notification.show {
    transform: translateX(0);
}

.dash-notif-success {
    background: #09D4EF;
    color: #fff;
}

.dash-notif-info {
    background: #4A90D9;
    color: #fff;
}

.dash-notif-error {
    background: #FF4757;
    color: #fff;
}

/* --- Filter Select --- */
.filter-select {
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    background: rgba(255,255,255,0.8);
    color: #2D3436;
}

.filter-select:focus {
    outline: none;
    border-color: #09D4EF;
}

/* --- Dashboard Responsive --- */
@media (max-width: 900px) {
    .stats-grid.four-col { grid-template-columns: repeat(2, 1fr); }
    .stats-grid.three-col { grid-template-columns: repeat(2, 1fr); }
    .overview-grid { grid-template-columns: 1fr; }
    .classes-grid-admin { grid-template-columns: 1fr; }
    .grade-row { flex-wrap: wrap; }
    .sdv-stats { flex-wrap: wrap; }
}

@media (max-width: 600px) {
    .dashboard-tabs { flex-direction: column; }
    .dash-tab { text-align: left; }
    .stats-grid.four-col,
    .stats-grid.three-col { grid-template-columns: 1fr; }
    .section-bar { flex-direction: column; align-items: flex-start; }
    .quick-actions-row { flex-direction: column; }
    .qa-btn { justify-content: center; }
    .dash-table { font-size: 0.82rem; }
    .dash-table th, .dash-table td { padding: 0.5rem; }
    .modal-box { width: 95%; max-width: 100%; border-radius: 16px; }
    .welcome-banner { padding: 1rem 1.25rem; }
    .welcome-banner h2 { font-size: 1.15rem; }
}

/* ============================================
   Admin / Teacher Dashboards – UI Components
   ============================================ */

/* Tabs (dash-tab) */
.dashboard-tabs { display:flex; gap:.5rem; flex-wrap:wrap; padding:.75rem 1rem; border-bottom:1px solid rgba(0,0,0,0.08); background:rgba(255,255,255,0.45); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); border-radius:16px 16px 0 0; }
.dash-tab { padding:.5rem 1rem; border:1px solid rgba(0,0,0,0.08); border-radius:8px; background:transparent; color:#636E72; cursor:pointer; font-size:.88rem; transition:.2s; }
.dash-tab.active, .dash-tab:hover { background:#09D4EF; color:#fff; border-color:#09D4EF; font-weight:600; }

/* Panel sections */
.dash-panels { padding:1rem; }
.dash-panel { display:none; }
.dash-panel.active { display:block; }

.section-bar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.75rem; margin-bottom:1.25rem; }
.section-bar h2 { margin:0; font-size:1.1rem; display:flex; align-items:center; gap:.5rem; color:#2D3436; }
.count-badge { background:#09D4EF; color:#fff; border-radius:12px; padding:2px 8px; font-size:.78rem; font-weight:700; }

/* Loading panel */
.loading-panel { display:flex; align-items:center; justify-content:center; gap:.75rem; padding:3rem; color:#636E72; font-size:1.05rem; }

/* Stats grid */
.stats-grid.four-col { grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); }

/* Grade progress rows */
.grade-row { display:flex; align-items:center; gap:.75rem; padding:.6rem .75rem; margin-bottom:.5rem; border-radius:8px; background:rgba(0,0,0,0.03); }
.gr-name { font-weight:600; width:90px; flex-shrink:0; font-size:.9rem; color:#2D3436; }
.gr-students { color:#636E72; font-size:.82rem; width:72px; flex-shrink:0; }
.gr-levels { color:#636E72; font-size:.82rem; width:50px; flex-shrink:0; }
.gr-pct { width:36px; text-align:right; font-size:.85rem; font-weight:600; color:#2D3436; }

/* Classes grid */
.classes-grid-admin { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:1.25rem; }
.class-card-admin { background:rgba(255,255,255,0.55); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,0.7); border-radius:12px; padding:1.1rem; box-shadow:0 2px 12px rgba(0,0,0,0.06); }
.cc-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:.6rem; }
.cc-header h3 { margin:0; font-size:1rem; color:#2D3436; }
.cc-grade-tag { display:inline-block; background:rgba(9, 212, 239,0.12); border-radius:6px; padding:2px 8px; font-size:.78rem; margin-top:.3rem; color:#08BDD6; }
.cc-actions { display:flex; gap:.4rem; }
.cc-meta { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; font-size:.83rem; color:#636E72; margin-bottom:.6rem; }
.cc-avg { font-weight:600; color:#08BDD6; }
.cc-class-id-hint { background:rgba(0,0,0,0.04); border-radius:6px; padding:.35rem .65rem; font-size:.78rem; color:#636E72; margin-bottom:.7rem; display:flex; align-items:center; gap:.4rem; }
.cc-class-id-hint code { font-family:monospace; font-size:.82rem; color:#E17055; }
.btn-copy { background:none; border:none; cursor:pointer; color:#636E72; padding:0 .3rem; font-size:.9rem; }
.btn-copy:hover { color:#08BDD6; }
.cc-students { margin-bottom:.75rem; max-height:150px; overflow-y:auto; }
.cc-student-row { display:flex; align-items:center; justify-content:space-between; padding:.3rem .4rem; font-size:.85rem; border-radius:6px; }
.cc-student-row:hover { background:rgba(0,0,0,0.04); }
.cc-footer-actions { padding-top:.6rem; border-top:1px solid rgba(0,0,0,0.08); }

/* Users list */
.users-list { display:flex; flex-direction:column; gap:.6rem; }
.user-row-card { display:flex; align-items:center; gap:.75rem; padding:.75rem 1rem; background:rgba(255,255,255,0.5); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); border:1px solid rgba(255,255,255,0.6); border-radius:10px; flex-wrap:wrap; box-shadow:0 1px 4px rgba(0,0,0,0.05); }
.ur-avatar { font-size:1.6rem; flex-shrink:0; }
.ur-info { flex:1; min-width:140px; }
.ur-name { display:block; font-weight:600; font-size:.95rem; color:#2D3436; }
.ur-email { display:block; font-size:.8rem; color:#636E72; }
.ur-classes-chips { display:flex; flex-wrap:wrap; gap:.4rem; flex:2; }
.ur-progress { display:flex; align-items:center; gap:.5rem; }
.ur-actions { display:flex; gap:.4rem; margin-left:auto; }

/* Chips */
.chip { background:rgba(9, 212, 239,.12); color:#08BDD6; border-radius:12px; padding:2px 10px; font-size:.78rem; }
.chip-empty { background:rgba(0,0,0,.05); color:#636E72; }
.chip-grade { background:rgba(108,99,255,.1); color:#6C63FF; }

/* Student filters */
.students-filters { display:flex; gap:.75rem; flex-wrap:wrap; margin-bottom:.5rem; }
.students-filters input.filter-select { flex:1; min-width:160px; }

/* Quick actions */
.quick-actions-row { display:flex; gap:.75rem; flex-wrap:wrap; margin-top:1.25rem; }
.qa-btn { padding:.6rem 1.1rem; border:1px solid rgba(0,0,0,0.08); border-radius:8px; background:rgba(255,255,255,0.6); color:#2D3436; cursor:pointer; font-size:.88rem; transition:.2s; display:flex; align-items:center; gap:.4rem; backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }
.qa-btn:hover { background:#09D4EF; color:#fff; border-color:#09D4EF; }

/* Buttons */
.btn-icon-sm { background:none; border:1px solid rgba(0,0,0,0.1); border-radius:6px; color:#636E72; padding:4px 8px; cursor:pointer; font-size:.82rem; transition:.2s; }
.btn-icon-sm:hover { background:rgba(0,0,0,.05); color:#2D3436; }
.btn-icon-sm.danger:hover { background:rgba(255,82,82,.1); color:#FF5252; border-color:#FF5252; }
.btn-outline { border:1px solid #09D4EF; color:#08BDD6; background:none; }
.btn-outline:hover { background:#09D4EF; color:#fff; }

/* Assign student modal list */
.assign-student-list { max-height:280px; overflow-y:auto; }
.assign-student-row { display:flex; align-items:center; justify-content:space-between; padding:.45rem .5rem; border-radius:6px; font-size:.88rem; }
.assign-student-row:hover { background:rgba(0,0,0,.04); }
.assign-grade { color:#636E72; font-size:.8rem; }

/* Modal box (admin) */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; z-index:9999; opacity:0; pointer-events:none; transition:opacity .2s; }
.modal-overlay.active { opacity:1; pointer-events:all; }
.modal-box { background:rgba(255,255,255,0.92); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); border:1px solid rgba(255,255,255,0.8); border-radius:16px; width:min(480px,95vw); max-height:85vh; overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,.15); }
.modal-box-header { display:flex; align-items:center; justify-content:space-between; padding:1rem 1.25rem; border-bottom:1px solid rgba(0,0,0,.08); }
.modal-box-header h2 { margin:0; font-size:1.05rem; color:#2D3436; }
.modal-close-btn { background:none; border:none; font-size:1.4rem; color:#636E72; cursor:pointer; line-height:1; padding:0 .25rem; }
.modal-close-btn:hover { color:#FF4757; }
.modal-box-body { padding:1.25rem; }
.modal-buttons { display:flex; gap:.75rem; justify-content:flex-end; margin-top:1.25rem; }

/* Form helpers */
.form-group { margin-bottom:1rem; }
.form-group label { display:block; font-size:.85rem; color:#636E72; margin-bottom:.35rem; }
.form-group input, .form-group select { width:100%; padding:.55rem .75rem; background:rgba(255,255,255,0.8); border:1px solid rgba(0,0,0,0.12); border-radius:8px; color:#2D3436; font-size:.92rem; }
.form-group input:focus, .form-group select:focus { outline:none; border-color:#09D4EF; }
.form-error { color:#FF5252; font-size:.83rem; margin-top:.4rem; padding:.5rem .75rem; background:rgba(255,82,82,.08); border-radius:6px; }
.pass-input-wrap { position:relative; display:flex; }
.pass-input-wrap input { flex:1; border-radius:8px 0 0 8px; }
.btn-pass-toggle { background:rgba(255,255,255,0.8); border:1px solid rgba(0,0,0,0.12); border-left:none; border-radius:0 8px 8px 0; padding:0 .75rem; color:#636E72; cursor:pointer; }
.btn-pass-toggle:hover { color:#08BDD6; }

/* Overview cards */
.overview-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:1.25rem; margin:1.25rem 0; }
.overview-card { background:rgba(255,255,255,0.55); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,0.7); border-radius:12px; padding:1.1rem; box-shadow:0 2px 12px rgba(0,0,0,0.06); }
.overview-card h3 { margin:0 0 .9rem 0; font-size:.95rem; color:#2D3436; }
.mini-table { display:flex; flex-direction:column; gap:.4rem; }
.mini-row { display:flex; align-items:center; gap:.6rem; padding:.35rem 0; font-size:.85rem; }
.mr-avatar { font-size:1.1rem; }
.mr-name { flex:1; color:#2D3436; }
.mr-grade { color:#636E72; font-size:.78rem; width:60px; }
.mr-progress { display:flex; align-items:center; gap:.4rem; color:#636E72; }
.mr-rank { width:20px; text-align:center; font-weight:700; color:#08BDD6; }

/* Small progress bar */
.progress-bar-sm { width:80px; height:6px; background:rgba(0,0,0,.08); border-radius:3px; overflow:hidden; flex-shrink:0; }
.progress-bar-sm .fill { height:100%; background:#09D4EF; border-radius:3px; transition:width .4s; }
.progress-bar-sm .fill.high { background:#09D4EF; }
.progress-bar-sm .fill.medium { background:#FFDD59; }
.progress-bar-sm .fill.low { background:#FF5252; }

/* Dashboard notification toast */
.dash-notification { position:fixed; bottom:1.5rem; left:50%; transform:translateX(-50%) translateY(30px); background:rgba(255,255,255,0.95); backdrop-filter:blur(12px); border:1px solid rgba(0,0,0,0.1); border-radius:10px; padding:.65rem 1.25rem; color:#2D3436; font-size:.9rem; z-index:10000; opacity:0; pointer-events:none; transition:.3s; white-space:nowrap; box-shadow:0 6px 24px rgba(0,0,0,.1); }
.dash-notification.show { opacity:1; transform:translateX(-50%) translateY(0); }
.dash-notif-success { border-color:#09D4EF; color:#08BDD6; }
.dash-notif-error { border-color:#FF5252; color:#FF5252; }
.dash-notif-info { border-color:#09D4EF; color:#0984E3; }

/* Filter select */
.filter-select { padding:.45rem .7rem; background:rgba(255,255,255,0.8); border:1px solid rgba(0,0,0,0.1); border-radius:8px; color:#2D3436; font-size:.85rem; cursor:pointer; }
.filter-select:focus { outline:none; border-color:#09D4EF; }

/* ============================================
   Import Wizard – bulk-import.js UI
   ============================================ */
.import-wizard { max-width:720px; margin:0 auto; }
.import-header { margin-bottom:1.5rem; }
.import-header h2 { margin:0 0 .35rem 0; font-size:1.15rem; }
.import-header p { margin:0; color:#636E72; font-size:.88rem; }
.import-type-tabs { display:flex; gap:.5rem; margin-bottom:1.5rem; }
.import-type-btn { padding:.55rem 1.2rem; border-radius:8px; border:1px solid rgba(0,0,0,0.1); background:rgba(255,255,255,0.5); color:#636E72; cursor:pointer; font-size:.9rem; transition:.2s; }
.import-type-btn.active { background:#09D4EF; color:#fff; border-color:#09D4EF; font-weight:600; }
.import-section { margin-bottom:1.75rem; }
.import-steps { display:flex; flex-direction:column; gap:.9rem; }
.import-step { display:flex; gap:1rem; align-items:flex-start; }
.step-badge { width:28px; height:28px; border-radius:50%; background:#09D4EF; color:#fff; font-weight:700; font-size:.82rem; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.step-body h4 { margin:0 0 .35rem 0; font-size:.92rem; }
.step-body p { margin:0; color:#636E72; font-size:.83rem; }

/* File drop zone */
.file-drop-zone { border:2px dashed rgba(0,0,0,0.15); border-radius:12px; padding:2rem; text-align:center; cursor:pointer; transition:.2s; background:rgba(255,255,255,0.4); }
.file-drop-zone.drag-active, .file-drop-zone:hover { border-color:#09D4EF; background:rgba(9, 212, 239,.08); }
.file-drop-zone i { font-size:2rem; color:#08BDD6; display:block; margin-bottom:.6rem; }
.file-hint { margin-top:.5rem; font-size:.8rem; color:#636E72; }

/* Preview */
.preview-summary { font-size:.88rem; color:#636E72; margin-bottom:.6rem; }
.preview-scroll { max-height:220px; overflow-y:auto; border:1px solid rgba(0,0,0,0.1); border-radius:8px; }
.preview-scroll table { width:100%; border-collapse:collapse; font-size:.82rem; }
.preview-scroll th { background:rgba(0,0,0,.04); padding:.4rem .65rem; text-align:left; font-weight:600; position:sticky; top:0; color:#2D3436; }
.preview-scroll td { padding:.35rem .65rem; border-bottom:1px solid rgba(0,0,0,.06); color:#2D3436; }
.preview-scroll tr:last-child td { border-bottom:none; }

/* Progress bar for import */
.import-progress-wrap { margin:1rem 0; }
.import-progress-bar { height:8px; background:rgba(0,0,0,.08); border-radius:4px; overflow:hidden; }
.import-progress-fill { height:100%; background:#09D4EF; border-radius:4px; transition:width .3s; }
.import-progress-label { font-size:.82rem; color:#636E72; margin-top:.4rem; }

/* Import results */
.import-results { border-radius:10px; padding:.9rem 1.1rem; background:rgba(0,0,0,.03); }
.ir-summary { display:flex; gap:1.5rem; margin-bottom:.75rem; font-size:.9rem; }
.ir-ok { color:#09D4EF; font-weight:600; }
.ir-fail { color:#FF5252; font-weight:600; }
.ir-error-details { max-height:120px; overflow-y:auto; }
.ir-error-row { font-size:.8rem; color:#FF5252; padding:.25rem 0; border-bottom:1px solid rgba(255,82,82,.15); }

/* Teacher class card */
.teacher-class-card { background:rgba(255,255,255,0.55); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,0.7); border-radius:12px; padding:1.1rem; margin-bottom:1.25rem; box-shadow:0 2px 12px rgba(0,0,0,0.06); }
.tcc-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:.9rem; }
.tcc-header h3 { margin:0; font-size:1rem; }
.tcc-avg { font-size:.88rem; color:var(--accent,#09D4EF); font-weight:600; }

/* Student detail view */
.student-detail-view h3 { margin:1rem 0 .6rem; font-size:.95rem; }
.sdv-stats { display:flex; gap:1.5rem; margin-bottom:1rem; }
.sdv-stat { text-align:center; }
.sdv-val { display:block; font-size:1.5rem; font-weight:700; color:var(--accent,#09D4EF); }
.sdv-lbl { font-size:.78rem; color:#636E72; }
.detail-game { margin-bottom:.9rem; border:1px solid rgba(0,0,0,0.08); border-radius:8px; overflow:hidden; }
.dg-header { display:flex; justify-content:space-between; padding:.5rem .75rem; background:rgba(0,0,0,.03); font-size:.88rem; }
.dg-name { font-weight:600; color:#2D3436; }
.dg-completed { color:#636E72; font-size:.82rem; }
.dg-levels { display:flex; flex-wrap:wrap; gap:.3rem; padding:.6rem .75rem; }
.dg-level { font-size:.78rem; padding:.2rem .55rem; border-radius:6px; background:rgba(0,0,0,.04); color:#636E72; }
.dg-level.done { background:rgba(9, 212, 239,.15); color:#08BDD6; }

/* Empty states */
.empty-msg { color:#636E72; font-size:.88rem; padding:.75rem 0; text-align:center; }

/* ============================================
   Tablet Horizontal (Landscape) 769px – 1100px
   Asegura que los layouts de 3 columnas no se
   colapsen innecesariamente en tablets giradas.
   ============================================ */

/* --- Paneles del juego: 2 columnas en vez de 1 --- */
@media (min-width: 769px) and (max-width: 1100px) {
    /* Game layout: instrucciones | tablero+código */
    .game-layout {
        grid-template-columns: 230px 1fr;
        grid-template-rows: 1fr auto;
        gap: 1rem;
        height: 100%;
    }

    .instructions-panel {
        order: 1;
        grid-row: 1 / 3; /* ocupa ambas filas de la columna izquierda */
    }

    .game-board-container {
        order: 2;
    }

    .code-panel {
        order: 3;
    }

    /* Exercise layout: instrucciones | área+acciones */
    .exercise-layout {
        grid-template-columns: 220px 1fr;
        grid-template-rows: 1fr auto;
        gap: 1rem;
    }

    .exercise-instructions-panel {
        order: 1;
        grid-row: 1 / 3;
    }

    .exercise-area {
        order: 2;
    }

    .exercise-action-panel {
        order: 3;
    }

    /* Editor layout: config | tablero */
    .editor-layout {
        grid-template-columns: 260px 1fr;
        grid-template-rows: 1fr auto;
    }

    .config-panel  { order: 1; }
    .board-panel   { order: 2; min-height: 400px; }
    .objectives-panel { order: 3; grid-column: 1 / -1; }

    /* Celdas del tablero ligeramente más pequeñas */
    .cell {
        width: 54px;
        height: 54px;
    }

    .robot {
        width: 42px;
        height: 42px;
    }

    /* Paneles con menos padding para aprovechar el espacio */
    .instructions-panel,
    .exercise-instructions-panel {
        padding: 1.2rem;
    }

    .game-board-container,
    .code-panel,
    .exercise-area,
    .exercise-action-panel {
        padding: 1rem;
    }

    /* Header más compacto */
    .header-content h1 {
        font-size: 1.4rem;
    }

    #user-name {
        font-size: 0.88rem;
        padding: 0.4rem 0.8rem;
    }

    /* Grids de juegos: 2 columnas garantizadas */
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Stats dashboard: mantener 4 cols si cabe, sino 2 */
    .stats-grid.four-col  { grid-template-columns: repeat(2, 1fr); }
    .stats-grid.three-col { grid-template-columns: repeat(2, 1fr); }
    .overview-grid        { grid-template-columns: 1fr 1fr; }

    /* Modal no desborda la pantalla */
    .modal-content {
        max-height: 82vh;
        overflow-y: auto;
    }

    .modal-box {
        max-height: 82vh;
        overflow-y: auto;
    }
}

/* -----------------------------------------------------------
   Tablet landscape con altura reducida (≤ 768px de alto)
   Reduce padding vertical para que todo entre sin scroll.
   ----------------------------------------------------------- */
@media (orientation: landscape) and (max-height: 768px) and (min-width: 769px) {
    /* Header más delgado */
    header {
        padding: 0.6rem 1.5rem;
    }

    .header-content h1 {
        font-size: 1.3rem;
    }

    /* Pantallas: menos padding vertical */
    .screen {
        padding: 0.75rem 1rem;
    }

    /* Paneles del juego compactos */
    .instructions-panel,
    .exercise-instructions-panel {
        padding: 1rem;
    }

    .instructions-panel h3,
    .exercise-instructions-panel h3 {
        font-size: 1.05rem;
        margin-bottom: 0.8rem;
    }

    .instructions-panel p {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
    }

    .game-board-container,
    .code-panel,
    .exercise-area,
    .exercise-action-panel {
        padding: 0.85rem;
    }

    /* Código: menos margen */
    .code-panel h3 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }

    .available-commands {
        gap: 0.35rem;
        margin-bottom: 0.6rem;
        padding-bottom: 0.6rem;
    }

    .command-btn {
        padding: 0.45rem 0.65rem;
        font-size: 0.82rem;
    }

    /* Menú principal */
    .menu-content h2 {
        font-size: 1.7rem;
        margin-bottom: 1rem;
    }

    .level-card {
        min-width: 70px;
        padding: 0.75rem 0.5rem;
    }

    /* Login más compacto */
    .login-container {
        padding: 1.75rem 2rem;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .logo i {
        font-size: 3rem;
    }

    /* Dashboard con menos padding */
    .dashboard-content,
    .dashboard-main {
        padding: 0.85rem 1rem;
    }

    .dashboard-welcome {
        padding: 1rem 1.5rem;
        margin-bottom: 1rem;
    }

    /* Modales que no desborden verticalmente */
    .modal-content {
        max-height: 80vh;
        overflow-y: auto;
        padding: 1.5rem;
    }

    .modal-box {
        max-height: 80vh;
        overflow-y: auto;
    }

    /* Selector de niveles */
    .level-selector {
        padding: 0.85rem 1.25rem;
    }

    /* Scratch blocks más compactos */
    .block-drop-zone {
        min-height: 120px;
    }

    .scratch-block {
        min-height: 44px;
        padding: 0.6rem 0.85rem;
    }
}

/* -----------------------------------------------------------
   Tablet landscape como experiencia principal
   Optimiza juego y ejercicios para tablets en horizontal.
   ----------------------------------------------------------- */
@media (orientation: landscape) and (min-width: 900px) and (max-width: 1366px) {
    header {
        padding: calc(0.75rem + var(--safe-area-top)) 1.25rem 0.75rem;
    }

    .header-content {
        flex-wrap: nowrap;
        gap: 0.85rem;
        align-items: center;
    }

    .header-content > * {
        min-width: 0;
    }

    .header-content h1 {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        font-size: clamp(1.25rem, 1.7vw, 1.6rem);
        line-height: 1.1;
    }

    .header-content .user-info,
    .header-content .user-progress,
    .header-content .session-badge,
    .header-content .exercise-progress,
    .header-content .exercise-controls,
    .header-content .level-controls {
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-end;
    }

    .menu-content,
    .levels-content,
    .grades-content,
    .sessions-content,
    .proposals-content,
    .exercises-content {
        max-width: 1360px;
        padding: 1.2rem 1.4rem;
    }

    .game-content,
    .exercise-content {
        height: calc(var(--app-height) - 104px);
        min-height: 0;
        padding: 0.9rem 1rem;
        overflow: hidden;
    }

    .game-layout,
    .exercise-layout {
        height: 100%;
        min-height: 0;
        align-items: stretch;
        gap: 1rem;
    }

    .instructions-panel,
    .game-board-container,
    .code-panel,
    .exercise-instructions-panel,
    .exercise-area,
    .exercise-action-panel,
    .exercise-gobstones-board {
        min-height: 0;
        max-height: 100%;
    }

    .instructions-panel,
    .game-board-container,
    .code-panel,
    .exercise-instructions-panel,
    .exercise-area,
    .exercise-action-panel,
    .exercise-gobstones-board {
        padding: 1rem;
    }

    .instructions-panel h3,
    .exercise-instructions-panel h3,
    .code-panel h3 {
        font-size: 1.05rem;
        margin-bottom: 0.7rem;
    }

    .instructions-panel p,
    .exercise-instructions-panel p {
        font-size: 0.94rem;
        line-height: 1.55;
    }

    .objective {
        padding: 1rem;
    }

    .code-panel,
    .exercise-action-panel {
        overflow: hidden;
    }

    .available-commands,
    .action-cards {
        flex: 0 0 auto;
        max-height: 34%;
        overflow-y: auto;
        align-content: flex-start;
        justify-content: flex-start;
        padding-right: 0.2rem;
    }

    .program-area,
    .sequence-area {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        max-height: none;
    }

    .exercise-buttons {
        margin-top: auto;
    }

    #block-programming-area {
        display: flex;
        flex: 1 1 auto;
        min-height: 0;
    }

    .block-workspace,
    .block-canvas {
        flex: 1 1 auto;
        min-height: 0;
        height: 100%;
    }

    .block-workspace {
        padding: 0.85rem;
    }

    .block-palette {
        flex: 0 0 auto;
        max-height: 36%;
        overflow-y: auto;
        align-content: flex-start;
    }

    .block-drop-zone {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        max-height: none;
    }

    .command-btn,
    .action-card,
    .scratch-block {
        min-height: 42px;
    }
}

@media (orientation: landscape) and (min-width: 900px) and (max-width: 1180px) {
    .games-grid,
    .grades-grid,
    .sessions-grid,
    .proposals-grid,
    .exercises-grid {
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }

    .game-layout {
        grid-template-columns: 230px minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) minmax(250px, 38%);
    }

    .instructions-panel {
        grid-row: 1 / 3;
    }

    .exercise-layout {
        grid-template-columns: 230px minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) minmax(260px, 40%);
    }

    .exercise-instructions-panel {
        grid-row: 1 / 3;
    }

    .levels-grid {
        max-width: 980px;
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (orientation: landscape) and (min-width: 1181px) and (max-width: 1366px) {
    .games-grid,
    .grades-grid,
    .sessions-grid,
    .proposals-grid,
    .exercises-grid {
        grid-template-columns: repeat(3, minmax(220px, 1fr));
    }

    .game-layout {
        grid-template-columns: 240px minmax(0, 1fr) 300px;
    }

    .exercise-layout {
        grid-template-columns: 240px minmax(0, 1fr) 320px;
    }

    .levels-grid {
        max-width: 1120px;
        grid-template-columns: repeat(3, minmax(220px, 1fr));
    }
}

/* ============================================
   SCHOOLS MANAGEMENT - Admin Dashboard
   ============================================ */

.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.school-card {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.school-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: rgba(9, 212, 239,0.3);
}

.school-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.25rem .75rem;
    background: linear-gradient(135deg, rgba(9, 212, 239,0.06), transparent);
}

.school-card-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.school-card-title {
    flex: 1;
    min-width: 0;
}

.school-card-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: #2D3436;
}

.school-address {
    font-size: 0.82rem;
    color: #636E72;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.school-card-body {
    padding: 0.75rem 1.25rem;
}

.school-stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.school-stat {
    flex: 1;
    text-align: center;
    background: rgba(9, 212, 239,0.06);
    border-radius: 10px;
    padding: 0.6rem 0.5rem;
}

.school-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #08BDD6;
}

.school-stat-label {
    font-size: 0.72rem;
    color: #636E72;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.school-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.school-detail {
    font-size: 0.85rem;
    color: #636E72;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.school-detail i {
    width: 16px;
    text-align: center;
    color: #08BDD6;
    font-size: 0.8rem;
}

.school-card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.school-teachers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.empty-msg-sm {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.35);
    font-style: italic;
}

.stat-card.c-teal {
    border-left-color: #00B4D8;
}
.stat-card.c-teal .stat-icon { color: #00B4D8; }
.stat-card.c-teal .stat-value { color: #00B4D8; }

.stats-grid.five-col {
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 900px) {
    .schools-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid.five-col {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid.five-col {
        grid-template-columns: repeat(2, 1fr);
    }
    .school-stats-row {
        flex-wrap: wrap;
    }
}

/* ============================================
   CLASSROOM CODES - Admin & Teacher
   ============================================ */

.cc-class-code-area { margin-bottom: .75rem; }

.cc-code-display {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: linear-gradient(135deg, rgba(9, 212, 239,.08), rgba(9, 212, 239,.02));
    border: 1px solid rgba(9, 212, 239,.25);
    border-radius: 10px;
    padding: .5rem .75rem;
    margin-bottom: .4rem;
}

.cc-code-label { font-size: .8rem; color: #636E72; }

.cc-code-value {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #08BDD6;
    background: rgba(9, 212, 239,.1);
    padding: .2rem .6rem;
    border-radius: 6px;
}

/* Teacher class code area */
.tcc-class-code-area {
    background: linear-gradient(135deg, rgba(9, 212, 239,.06), rgba(9, 212, 239,.01));
    border: 1px dashed rgba(9, 212, 239,.2);
    border-radius: 12px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}

.tcc-code-display {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.tcc-code-label {
    font-size: .85rem;
    color: #636E72;
}

.tcc-code-value {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #08BDD6;
    background: rgba(9, 212, 239,.12);
    padding: .3rem .8rem;
    border-radius: 8px;
    user-select: all;
}

.tcc-code-hint {
    font-size: .78rem;
    color: #636E72;
    margin-top: .3rem;
    font-style: italic;
}

/* ============================================
   STUDENT - Join Class
   ============================================ */

.no-class-area {
    text-align: center;
    padding: 2rem;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px dashed rgba(0,0,0,0.12);
    margin-bottom: 1.5rem;
}

.no-class-icon { font-size: 3rem; margin-bottom: .5rem; }

.my-class-info {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255,255,255,0.7);
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.my-class-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mcc-icon {
    font-size: 2.5rem;
    background: #09D4EF;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mcc-details h3 { margin: 0 0 .3rem; }
.mcc-details p { margin: .2rem 0; font-size: .9rem; color: #636E72; }

.join-class-section {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.join-class-section h3 {
    margin: 0 0 .5rem;
    font-size: 1.1rem;
}

.join-class-desc {
    font-size: .85rem;
    color: #636E72;
    margin-bottom: 1rem;
}

.join-class-form {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}

.join-code-input {
    flex: 1;
    min-width: 180px;
    max-width: 260px;
    padding: .75rem 1rem;
    background: rgba(255,255,255,0.8);
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    color: #2D3436;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-weight: 700;
    transition: border-color .2s;
}

.join-code-input:focus {
    border-color: #09D4EF;
    outline: none;
    box-shadow: 0 0 0 3px rgba(9, 212, 239,.15);
}

.join-feedback { margin-top: .75rem; }

.join-success {
    color: #09D4EF;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.join-error {
    color: #FF6B6B;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* ============================================
   BULK ASSIGN MODAL
   ============================================ */

.bulk-assign-layout { display: flex; flex-direction: column; gap: 1rem; }
.ba-info { font-size: .9rem; color: #636E72; }

.assign-student-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .88rem;
}

.assign-student-check:hover { background: rgba(0,0,0,.04); }
.assign-student-check input[type=checkbox] { accent-color: #09D4EF; }
.assign-student-check .assign-grade { margin-left: auto; font-size: .78rem; color: #636E72; }

/* ============================================
   INSTRUCTION MODAL (Consigna centrada)
   ============================================ */

.instruction-modal .instruction-modal-content {
    max-width: 560px;
    padding: 2.5rem 3rem;
}

.instruction-modal-icon {
    font-size: 4rem;
    margin-bottom: 0.8rem;
    animation: bounce-in 0.6s ease;
}

@keyframes bounce-in {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.instruction-modal-content h2 {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.6rem;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.instruction-modal-text {
    font-size: 1.15rem !important;
    line-height: 1.8 !important;
    color: var(--text-color) !important;
    text-align: left !important;
    font-weight: 500 !important;
    margin-bottom: 1.2rem !important;
}

.instruction-modal-objective {
    background: var(--primary-light);
    padding: 1rem 1.3rem;
    border-radius: var(--border-radius-md);
    border-left: 5px solid var(--primary-color);
    text-align: left;
    margin-bottom: 1.5rem;
}

.instruction-modal-objective h4 {
    color: var(--primary-dark);
    margin-bottom: 0.4rem;
    font-weight: 700;
}

.instruction-modal-objective p {
    color: var(--dark-color);
    margin-bottom: 0 !important;
    font-size: 1.05rem !important;
}

/* Audio / Listen Buttons */
.btn-listen {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.btn-listen:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.btn-listen.speaking {
    background: var(--primary-color);
    color: white;
    animation: pulse-speak 1s ease infinite;
}

@keyframes pulse-speak {
    0%, 100% { box-shadow: 0 0 0 0 rgba(9, 212, 239, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(9, 212, 239, 0); }
}

.btn-listen-big {
    background: linear-gradient(135deg, #54A0FF, #2E86DE) !important;
    color: white !important;
    border: none;
    font-size: 1.05rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-listen-big:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(46, 134, 222, 0.4);
}

.btn-listen-big.speaking {
    animation: pulse-speak 1s ease infinite;
}

/* ============================================
   GOBSTONES VISUAL STYLE
   ============================================ */

/* Gobstones board in exercises */
.exercise-gobstones-board {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(145deg, #FFFFFF 0%, #F0FAFD 100%);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 2px solid #E8F2F5;
    margin-bottom: 1rem;
}

/* Gobstones-style cell overlay (bolitas count) */
.cell .gobstones-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: 800;
    color: white;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Cabezal highlight (Gobstones current cell) */
.cell.cabezal-highlight {
    box-shadow: inset 0 0 0 3px var(--primary-color), 0 0 12px rgba(9, 212, 239, 0.5);
}

/* ============================================
   SCRATCH BLOCKS FOR CONDITIONALS
   ============================================ */

.scratch-conditional-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.block-palette-conditionals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 1rem;
    background: #F8F9FA;
    border-radius: var(--border-radius-md);
    border: 2px dashed #DEE2E6;
}

.scratch-block-cond {
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    cursor: grab;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    user-select: none;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.scratch-block-cond:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0,0,0,0.2);
}

.scratch-block-cond.block-si {
    background: linear-gradient(135deg, #FFDD59, #FFB800);
    color: #6B4E00;
    border-color: #E6A800;
}

.scratch-block-cond.block-entonces {
    background: linear-gradient(135deg, #00D2A0, #00B894);
    color: #FFF;
    border-color: #00A381;
}

.scratch-block-cond.block-sino {
    background: linear-gradient(135deg, #FF6B6B, #E64545);
    color: #FFF;
    border-color: #C83737;
}

.scratch-block-cond.block-condition {
    background: linear-gradient(135deg, #A29BFE, #7C6FE0);
    color: #FFF;
    border-color: #6C5FCE;
}

.scratch-block-cond.block-action {
    background: linear-gradient(135deg, #54A0FF, #2E86DE);
    color: #FFF;
    border-color: #2472C8;
}

/* Conditional build area */
.conditional-build-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: var(--border-radius-lg);
    border: 3px solid #E8F2F5;
    min-height: 120px;
}

.cond-drop-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 50px;
}

.cond-drop-zone {
    flex: 1;
    min-height: 46px;
    border: 2px dashed #CED4DA;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ADB5BD;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    padding: 0.4rem;
}

.cond-drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(9, 212, 239, 0.08);
    box-shadow: 0 0 0 3px rgba(9, 212, 239, 0.15);
}

.cond-drop-zone.filled {
    border-style: solid;
    border-color: transparent;
}

.cond-keyword {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    white-space: nowrap;
}

.cond-keyword.kw-si {
    background: linear-gradient(135deg, #FFDD59, #FFB800);
    color: #6B4E00;
}

.cond-keyword.kw-entonces {
    background: linear-gradient(135deg, #00D2A0, #00B894);
    color: #FFF;
}

.cond-keyword.kw-sino {
    background: linear-gradient(135deg, #FF6B6B, #E64545);
    color: #FFF;
}

/* Conditional execution animation */
.cond-drop-zone .scratch-block-cond.executing {
    animation: block-glow 0.8s ease infinite;
}

@keyframes block-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(9, 212, 239, 0.5); }
    50% { box-shadow: 0 0 15px 5px rgba(9, 212, 239, 0.3); }
}

.conditional-result {
    text-align: center;
    padding: 1rem;
    border-radius: var(--border-radius-md);
    font-weight: 700;
    font-size: 1.1rem;
    animation: fade-in 0.4s ease;
}

.conditional-result.correct {
    background: rgba(0, 210, 160, 0.1);
    color: #00B894;
    border: 2px solid #00B894;
}

.conditional-result.incorrect {
    background: rgba(255, 107, 107, 0.1);
    color: #E64545;
    border: 2px solid #E64545;
}

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

/* Run button for conditional exercises */
.cond-controls {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.cond-controls .btn {
    min-width: 120px;
}

.multi-rule-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.multi-rule-row {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 0.8rem;
    align-items: center;
    padding: 0.9rem;
    background: #FFFFFF;
    border: 2px solid #E8F2F5;
    border-radius: 12px;
}

.multi-rule-row.correct {
    border-color: var(--success-color);
    background: #E8F8F0;
}

.multi-rule-row.incorrect {
    border-color: var(--danger-color);
    background: #FFEBEE;
}

.rule-condition {
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rule-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.rule-action-option {
    border: 2px solid #DDEAF0;
    background: #FFFFFF;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rule-action-option:hover,
.rule-action-option.selected {
    border-color: var(--primary-color);
    background: rgba(9, 212, 239, 0.1);
    transform: translateY(-1px);
}

/* ============================================
   Scratch Blocks - Ajustes de usabilidad visual
   ============================================ */

.block-workspace {
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFCFD 100%);
    border: 1px solid #DDEAF0;
}

.block-palette {
    background: #F7FBFD;
    border: 2px dashed #CFE6EF;
    gap: 0.65rem;
    align-content: flex-start;
}

.scratch-block {
    clip-path: none;
    border-radius: 12px;
    min-height: 44px;
    padding: 0.62rem 0.9rem;
    box-shadow:
        0 2px 7px rgba(24, 39, 75, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.scratch-block:hover {
    transform: translateY(-1px);
}

.scratch-block.dragging {
    position: relative !important;
    pointer-events: auto !important;
    opacity: 0.84;
    transform: scale(1.02);
}

.scratch-block.control {
    flex-wrap: wrap;
    row-gap: 0.45rem;
}

.scratch-block .block-label {
    font-size: 0.86rem;
}

.scratch-block .block-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scratch-block .block-inline-control {
    flex: 1 1 110px;
    min-width: 88px;
    max-width: 100%;
    height: 30px;
    border-radius: 9px;
}

.scratch-block .for-count.block-inline-control {
    flex: 0 0 58px;
    min-width: 58px;
    max-width: 58px;
    text-align: center;
}

.block-drop-zone {
    border-color: #CBE5EF;
    background: linear-gradient(145deg, #F7FCFE 0%, #EEF7FB 100%);
}

.block-drop-zone:empty::before {
    line-height: 1.35;
}

.scratch-block.in-program::after {
    content: none;
}

/* ============================================
   Action Stack Scroll
   Mantiene el stack con scroll interno para que
   no estire la pantalla completa hacia abajo.
   ============================================ */
.block-canvas {
    min-height: 0;
}

.program-area,
.block-drop-zone {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.program-area {
    flex: 0 0 min(44vh, 420px);
    height: min(44vh, 420px);
    min-height: min(44vh, 420px);
    max-height: min(44vh, 420px);
}

.block-drop-zone {
    flex: 0 0 min(44vh, 420px);
    height: min(44vh, 420px);
    min-height: min(44vh, 420px);
    max-height: min(44vh, 420px);
}

@media (max-width: 768px) {
    .program-area,
    .block-drop-zone {
        flex-basis: min(34vh, 300px);
        height: min(34vh, 300px);
        min-height: min(34vh, 300px);
        max-height: min(34vh, 300px);
    }

    .scratch-block.control .block-inline-control {
        flex: 1 1 100%;
        min-width: 0;
    }

    .scratch-block .for-count.block-inline-control {
        flex: 0 0 62px;
        min-width: 62px;
        max-width: 62px;
    }
}

@media (orientation: landscape) and (min-width: 900px) and (max-width: 1366px) {
    .program-area,
    .block-drop-zone {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        max-height: none;
    }
}

/* ===== PROGRESSIVE HINT BANNER ===== */
.exercise-hint-banner {
    background: linear-gradient(135deg, #FFF3CD, #FFEEBA);
    border: 2px solid #F0C36D;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: #856404;
    animation: hintSlideIn 0.4s ease-out;
    line-height: 1.4;
}

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

/* ===== IMPROVED EXERCISE LAYOUT FOR 1ST GRADERS ===== */
/* Larger cards, bigger touch targets, more visible items */

.exercise-area .classification-area {
    width: 100%;
}

.exercise-area .classification-area .items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.exercise-area .classify-item {
    min-height: 52px;
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
}

.exercise-area .classify-item .icon {
    font-size: 1.6rem;
}

/* Larger memory cards for young students */
.memory-game-container {
    width: 100%;
    max-width: 600px;
}

.memory-grid {
    gap: 0.6rem;
}

.memory-card {
    min-height: 80px;
    font-size: 1.1rem;
}

.memory-card .card-emoji {
    font-size: 2rem;
}

/* Larger action cards for sequence builders */
.action-card {
    min-height: 56px;
    min-width: 85px;
}

.action-card .icon {
    font-size: 1.6rem;
}

.action-card .label {
    font-size: 0.8rem;
}

/* Sequence cards bigger */
.sequence-card {
    min-height: 44px;
    font-size: 0.95rem;
    padding: 0.5rem 0.8rem;
}

/* Better visibility for sequence area */
#sequence-area {
    min-height: 80px;
}

/* Progress timeline step slots bigger */
.sequence-step-slot {
    min-width: 60px;
    min-height: 60px;
}

/* Make exercise area use more space on tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    .exercise-layout {
        grid-template-columns: 200px 1fr 260px;
    }
    
    .exercise-area {
        min-height: 400px;
    }
}

/* Full-width stacked layout on mobile - maximize viewable area */
@media (max-width: 768px) {
    .exercise-area {
        padding: 1rem;
        min-height: 300px;
    }

    .exercise-action-panel {
        padding: 0.75rem;
    }

    .action-card {
        min-width: 70px;
        padding: 0.5rem 0.7rem;
    }

    .sequence-area {
        min-height: 70px;
    }

    .memory-card {
        min-height: 65px;
    }

    .memory-card .card-emoji {
        font-size: 1.5rem;
    }
}

/* ===== Exercise choice tray and classification visibility ===== */

.exercise-layout {
    grid-template-columns: clamp(190px, 16vw, 240px) minmax(360px, 1fr) minmax(380px, 30vw, 460px);
}

.exercise-layout.exercise-layout-expanded,
.exercise-layout:has(.exercise-action-panel[style*="display: none"]) {
    grid-template-columns: clamp(190px, 16vw, 240px) minmax(0, 1fr);
}

.exercise-action-panel {
    overflow-x: hidden;
    overflow-y: auto;
}

.exercise-action-panel .action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 0.55rem;
    justify-content: stretch;
    align-items: stretch;
    max-height: none;
    overflow: visible;
    padding: 0 0 0.75rem;
}

.exercise-action-panel .action-card {
    min-width: 0;
    min-height: 60px;
    padding: 0.55rem 0.6rem;
    cursor: pointer;
    touch-action: manipulation;
}

.exercise-action-panel .action-card .icon {
    font-size: 1.45rem;
}

.exercise-action-panel .action-card .label {
    font-size: 0.78rem;
    line-height: 1.15;
    text-align: center;
}

.exercise-action-panel .sequence-area {
    flex: 1 1 120px;
    min-height: 105px;
    max-height: clamp(120px, 30vh, 260px);
}

.exercise-area .classification-area {
    max-width: min(1120px, 100%);
    gap: 1rem;
}

.exercise-area .classification-area .items-container,
.exercise-area #drag-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 0.55rem;
    width: 100%;
    margin-bottom: 0.35rem;
    align-items: stretch;
}

.exercise-area .classify-item {
    min-width: 0;
    min-height: 58px;
    padding: 0.55rem 0.45rem;
    gap: 0.25rem;
    cursor: pointer;
    touch-action: manipulation;
}

.exercise-area .classify-item.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(9, 212, 239, 0.16);
    transform: translateY(-2px);
}

.exercise-area .classify-item .icon {
    font-size: 1.55rem;
}

.exercise-area .classify-item .label {
    font-size: 0.76rem;
    line-height: 1.12;
    text-align: center;
}

.exercise-area .drop-zones {
    width: 100%;
    gap: 0.75rem;
}

.exercise-area .drop-zones.categories-3 .drop-zone,
.exercise-area .drop-zone {
    min-width: 0;
    max-width: none;
    min-height: 110px;
    padding: 0.8rem;
}

.exercise-area .drop-zone .items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
    gap: 0.45rem;
    align-items: stretch;
}

.exercise-area .drop-zone h4 {
    margin-bottom: 0.65rem;
    font-size: 0.95rem;
}

@media (max-width: 1100px) {
    .exercise-layout,
    .exercise-layout.exercise-layout-expanded,
    .exercise-layout:has(.exercise-action-panel[style*="display: none"]) {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        overflow: visible;
    }

    .exercise-instructions-panel,
    .exercise-area,
    .exercise-action-panel {
        grid-column: 1;
    }

    .exercise-action-panel .action-cards {
        grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
    }
}

@media (orientation: landscape) and (min-width: 769px) {
    .exercise-action-panel .action-cards {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .exercise-action-panel .action-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
        overflow: visible;
        padding-inline: 0;
    }

    .exercise-action-panel .sequence-area {
        max-height: none;
    }

    .exercise-area .classification-area .items-container,
    .exercise-area #drag-items {
        grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    }

    .exercise-area .drop-zones {
        gap: 0.75rem;
    }
}

