  @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap');

:root {
    /* Colors */
    --bg-gradient-start: #0f0c29;
    --bg-gradient-mid: #302b63;
    --bg-gradient-end: #24243e;
    --primary-bg: rgba(0, 20, 40, 0.7);
    --secondary-bg: rgba(0, 30, 60, 0.7);
    --header-bg: #09174d;
    --nav-btn-bg: #1e2c6e;
    --nav-btn-hover-bg: #3246a8;

    --text-light: #fff;
    --text-secondary: #87e7ff;
    --accent-color: #ffffff;
    --correct-color: #00ff00;
    --incorrect-color: #ff0000;

    --border-color: rgba(0, 204, 255, 0.3);
    --shadow-color: rgba(0, 204, 255, 0.2);

    /* Fonts */
    --font-primary: 'Poppins', sans-serif;
    --font-display: 'Orbitron', sans-serif;
    --font-mono: 'Courier New', monospace;

    --radius-medium: 10px;
}

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

body {
    font-family: var(--font-primary);
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* ------------------- FOOTER ------------------- */
.footer {
  background: linear-gradient(to top, #102361, var(--header-bg));
  color: var(--text-secondary);
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 15px;
  margin-top: auto;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
}


/* ------------------- LAYOUT ------------------- */
.main-container {
    flex: 1;
    display: flex;
    padding: 10px;
    margin-top: 5px;
    gap: 10px;
}

.left-panel {
    width: 30%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 5px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    border-radius: var(--radius-medium);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
    
}

.right-panel {
    width: 70%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    border-radius: var(--radius-medium);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
   
}

/* ------------------- STATS ------------------- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.stat {
    text-align: center;
    color: var(--text-light);
    padding: 5px;
    background: rgba(0,0,0,0.1);
    border-radius: 5px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.stat:last-child {
    border-right: none;
}

.stat-label {
    font-size: 0.8em;
    margin-bottom: 3px;
    color: var(--accent-color);
}

.stat-value {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-light);
    font-family: var(--font-display);
}

/* ------------------- OVERALL PROGRESS BAR ------------------- */
.overall-progress-container {
    grid-column: 1 / -1; /* Span all columns in the grid */
    padding-top: 10px;
    margin-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar-label {
    font-size: 0.8em;
    color: var(--accent-color);
    margin-bottom: 5px;
    font-family: var(--font-display);
    text-align: center;
}

.progress-bar-bg {
    width: 100%;
    background-color: rgba(0,0,0,0.3);
    border-radius: 5px;
    height: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
    border: 1px solid rgba(0,0,0,0.4);
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #87e7ff);
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.progress-bar-text {
    font-size: 0.8em;
    margin-top: 4px;
    color: var(--text-light);
    font-family: var(--font-display);
    text-align: center;
}

/* ------------------- MISSION ------------------- */
.mission-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    font-size: 0.9rem;
}

.mission-info, .pattern-info {
    color: var(--accent-color);
}

/* ------------------- LESSON SELECTOR ------------------- */
.lesson-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
}

.lesson-btn {
    background: linear-gradient(to bottom, rgba(0, 60, 110, 0.5), rgba(0, 30, 60, 0.5));
    color: var(--accent-color);
    border: none;
    border-bottom: 2px solid rgba(0, 0, 0, 0.5);
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.1);
}

.lesson-btn:hover {
    background: linear-gradient(to bottom, rgba(0, 80, 130, 0.6), rgba(0, 50, 80, 0.6));
    box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.lesson-btn.active {
    background: linear-gradient(to top, #3c58d8, var(--nav-btn-hover-bg));
    color: var(--text-light);
    transform: translateY(1px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 2px 3px rgba(0,0,0,0.3);
}

.lesson-btn:disabled {
    background: rgba(30, 30, 50, 0.4);
    color: rgba(135, 231, 255, 0.3);
    cursor: not-allowed;
    transform: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ------------------- TYPING AREA ------------------- */
.typing-container {
    padding: 15px;
    box-sizing: border-box;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bjBox {
    font-size: 1.5rem;
    letter-spacing: 0.2em;
    font-family: var(--font-mono);
    margin: 10px auto;
    text-align: center;
    min-height: 60px;
    padding: 15px;
    background-color: rgba(0, 10, 20, 0.6);
    border-radius: 8px;
    width: 80%;
    line-height: 1.5;
    box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.5);
    color: var(--text-light);
}

.error-notification {
    color: var(--incorrect-color);
    margin: 5px 0;
    font-size: 0.9rem;
    height: 18px;
    text-align: center;
}
.typing-instruction {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
    background: rgba(0, 20, 40, 0.5);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.typing-instruction i {
    margin-right: 5px;
}

/* ------------------- VIRTUAL KEYBOARD ------------------- */
.virtual_keyboard {
    display: flex;
    width: 80%;
    flex-direction: column;
    margin-top: 6px;
    backdrop-filter: blur(10px);
    padding: 5px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
}

.row {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 3px 0;
}

.key {
    flex: 1;
    min-width: 30px;
    height: 40px;
    margin: 1px;
    background: linear-gradient(to bottom, rgba(0, 40, 80, 0.378), rgba(0, 25, 50, 0.6));
    color: var(--accent-color);
    border: none;
    border: 1px solid rgba(0, 60, 100, 0.5);
    border-bottom: 3px solid rgba(0, 20, 40, 0.7);
    font-family: var(--font-primary);
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s ease, background-color 0.2s ease, box-shadow 0.1s ease, border-color 0.1s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.key:hover {
    background: linear-gradient(to bottom, rgba(0, 60, 120, 0.7), rgba(0, 40, 80, 0.7));
    border-color: rgba(0, 100, 150, 0.6);
}

.key.active {
    transform: translateY(2px);
    background: linear-gradient(to top, rgba(93, 170, 248, 0.8), rgba(0, 25, 50, 0.8));
    color: var(--text-light);
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 20, 40, 0.7);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4), inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.wide-key {
    flex: 2;
    font-size: 11px;
}

.extra-wide-key {
    flex: 2;
    font-size: 11px;
}

.space-key {
    flex: 6;
}

.base-char {
    font-size: 12px;
}

.special-key {
    background: rgba(0, 31, 63, 0.7);
    padding: 3px 4px;
}

/* --- FINGER POSITION COLORS --- */
.key.finger-left-pinky, .key.finger-right-pinky { background: linear-gradient(to bottom, #E57373, #D32F2F); } /* Red */
.key.finger-left-ring, .key.finger-right-ring { background: linear-gradient(to bottom, #FFB74D, #F57C00); } /* Orange */
.key.finger-left-middle, .key.finger-right-middle { background: linear-gradient(to bottom, #81C784, #388E3C); } /* Green */
.key.finger-left-index, .key.finger-right-index { background: linear-gradient(to bottom, #64B5F6, #1976D2); } /* Blue */
.key.finger-thumb { background: linear-gradient(to bottom, #BA68C8, #7B1FA2); } /* Purple */

.key.finger-left-pinky:hover, .key.finger-right-pinky:hover { background: linear-gradient(to bottom, #EF9A9A, #E53935); }
.key.finger-left-ring:hover, .key.finger-right-ring:hover { background: linear-gradient(to bottom, #FFCC80, #FB8C00); }
.key.finger-left-middle:hover, .key.finger-right-middle:hover { background: linear-gradient(to bottom, #A5D6A7, #43A047); }
.key.finger-left-index:hover, .key.finger-right-index:hover { background: linear-gradient(to bottom, #90CAF9, #1E88E5); }
.key.finger-thumb:hover { background: linear-gradient(to bottom, #CE93D8, #8E24AA); }

/* Override for active key to ensure it's visible */
.key.active {
    transform: translateY(2px);
    background: linear-gradient(to top, rgba(93, 170, 248, 0.8), rgba(0, 25, 50, 0.8)) !important;
    color: var(--text-light);
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 20, 40, 0.7);
    box-shadow: 0 0 15px var(--accent-color), inset 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Adjusting original key styles to not conflict */
.key:not([class*="finger-"]):hover {
    background: linear-gradient(to bottom, rgba(0, 60, 120, 0.7), rgba(0, 40, 80, 0.7));
    border-color: rgba(0, 100, 150, 0.6);
}

/* --- HIDE FINGER COLORS --- */
.colors-hidden .key[class*="finger-"] {
    background: linear-gradient(to bottom, rgba(0, 40, 80, 0.378), rgba(0, 25, 50, 0.6)) !important;
}
.colors-hidden .key[class*="finger-"]:hover {
    background: linear-gradient(to bottom, rgba(0, 60, 120, 0.7), rgba(0, 40, 80, 0.7)) !important;
}

/* ------------------- FINGER LEGEND ------------------- */
.finger-legend {
    width: 80%;
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-wrap: wrap;
    transition: all 0.3s ease-in-out;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.finger-legend h4 {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--accent-color);
    font-family: var(--font-display);
    font-size: 0.9rem;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.legend-toggle-icon {
    transition: transform 0.3s ease;
}

.legend-body {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-height: 100px; /* for transition */
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
                padding 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
                opacity 0.3s ease-in-out;
}

.finger-legend.collapsed .legend-body {
    max-height: 0;
    opacity: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.3);
}

.finger-legend.collapsed .legend-toggle-icon {
    transform: rotate(-180deg);
}

/* ------------------- SETTINGS PANEL ------------------- */
.settings-panel {
    padding: 10px 15px;
    margin-top: 10px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(0, 10, 20, 0.5), rgba(0, 40, 70, 0.5));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
}

.settings-panel h4 {
    color: var(--accent-color);
    font-family: var(--font-display);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { display: none; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: #1976D2; }
input:checked + .slider:before { transform: translateX(20px); }



/* ------------------- CONTROLS ------------------- */
.controlss {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.btn {
    background: linear-gradient(to bottom, rgba(0, 60, 110, 0.5), rgba(0, 30, 60, 0.5));
    color: var(--text-light);
    border: none;
    border-bottom: 2px solid rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.1);
}

.btn:hover {
    background: linear-gradient(to bottom, rgba(0, 80, 130, 0.6), rgba(0, 50, 80, 0.6));
    box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.reset-all-btn {
    width: 100%;
    margin-top: 10px;
    background: linear-gradient(to bottom, #b71c1c, #7f0000);
    color: #ffcdd2;
    border-color: #4c0000;
    font-weight: bold;
}

.reset-all-btn:hover {
    background: linear-gradient(to bottom, #c62828, #8f0000);
    color: #ffffff;
}

/* ------------------- STATES ------------------- */
.correct {
    color: var(--correct-color);
    font-weight: bold;
}

.incorrect {
    color: var(--incorrect-color);
    background-color: rgba(255, 0, 0, 0.2);
    border-radius: 3px;
    padding: 0 2px;
    font-weight: bold;
}

.blinking-cursor {
    animation: blink 1s infinite;
    color: var(--accent-color);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.completion-message {
    background: rgba(0, 40, 80, 0.8);
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 15px var(--shadow-color);
    display: none;
    font-size: 0.9rem;
}

.countdown {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-top: 5px;
}

.ad-label {
    font-size: 0.7rem;
    color: var(--accent-color);
    text-align: center; 
    margin-top: 5px;
}

/* ------------------- LEVEL UNLOCKED MODAL ------------------- */
.level-unlocked-modal {
    position: fixed;
    top: 0;
    left: 0; 
    width: 100%;
    height: 100%;
    background: rgba(0, 15, 30, 0.85);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.level-unlocked-modal.show { display: flex; }
.level-unlocked-modal.show {
    opacity: 1;
    pointer-events: all;
}

.level-unlocked-content {
    text-align: center;
    color: #fff;
    width: 90%;
    max-width: 450px;
    padding: 40px;
    border-radius: 15px;
    background: linear-gradient(145deg, var(--bg-gradient-mid), var(--bg-gradient-start));
    border: 2px solid #ffd700;
    box-shadow: 0 0 30px 10px rgba(255, 215, 0, 0.4);
    transform: scale(0.7);
    transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.level-unlocked-modal.show .level-unlocked-content {
    transform: scale(1);
}

.level-unlocked-content h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: #ffd700;
    text-shadow: 0 0 15px #ffc400;
    margin: 10px 0;
    animation: text-glow 2s infinite alternate;
}

.level-unlocked-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.level-unlocked-content .star-icon {
    font-size: 4rem;
    color: #ffd700;
    animation: star-spin 5s linear infinite;
}

@keyframes star-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes text-glow { from { text-shadow: 0 0 10px #ffc400; } to { text-shadow: 0 0 25px #ffc400, 0 0 10px #fff; } }

#skipLevelUnlockBtn {
    margin-top: 20px;
    background: linear-gradient(to bottom, #4a4a4a, #2a2a2a);
    border-color: #1a1a1a;
    font-size: 0.9rem;
}

#skipLevelUnlockBtn:hover {
    background: linear-gradient(to bottom, #5a5a5a, #3a3a3a);
}

    @keyframes glitch {
        0% { transform: translate(0); }
        20% { transform: translate(-5px, 5px); }
        40% { transform: translate(-5px, -5px); }
        60% { transform: translate(5px, 5px); }
        80% { transform: translate(5px, -5px); }
        100% { transform: translate(0); }
    }

    .glitch-effect {
        animation: glitch 0.5s infinite;
    }

/* ------------------- RESPONSIVE BREAKPOINTS ------------------- */

/* Mobile First */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
    padding: 0 5px;
    align-items: stretch;
  }
  .content {
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    min-height: 40px;
  }
  .virtual_keyboard {
    width: 100%;
  }
  .finger-legend {
    width: 100%;
  }
  .mission-row {
    display: none;
  }
  .lesson-selector {
    justify-content: center;
    align-items: center;
  }
  .left-panel, .right-panel {
    width: 100%;
  }


  .key {
    min-width: 20px;
    height: 30px;
    font-size: 10px;
  }
   header {
        flex-wrap: nowrap;
      }

      .nav-links {
        display: none;
        flex-direction: column;
        background: var(--nav-btn-bg);
        position: absolute;
        top: 100%;
        right: 0;
        width: 180px;
        padding: 10px;
        border-radius: 0 0 8px 8px;
        z-index: 1000;
      }

      .nav-links.show {
        display: flex;
      }

      .hamburger {
        display: flex;
      }

      .logo-section {
        gap: 6px;
      }




   .footer {
            font-size: 10px;
            padding: 8px 0;
        }
        .footer-content {
            padding: 0 5px;
            gap: 5px;
        }
        .footer-social a {
            font-size: 16px;
            gap: 8px;
        }
        .footer-copyright {
            font-size: 9px;
        }
}

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
  .main-container {
    flex-direction: column;
    align-items: center;
  }

  .key {
    font-size: 11px;
  }
}

/* Large Screens / TVs */
@media (min-width: 1400px) {
  body {
    font-size: 1.2rem;
  }

  .key {
    height: 30px;
    font-size: 14px;
  }
}