:root {
    --key-bg: #ffffff;
    --key-border: #000000;
    --key-text: #000000;
    --key-radius: 8px;
    --keyboard-bg: #f5f5f5;
    --highlight-glow: #007bff;
}

/* Font face definitions for all languages */
@font-face {
    font-family: 'KrutiDev';
    src: url('assets/fonts/KrutiDev010.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'TamilFont';
    src: url('assets/fonts/tamil-font.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'UrduFont';
    src: url('assets/fonts/urdu-font.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'SpanishFont';
    src: url('assets/fonts/spanish-font.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* Language-specific font application */
.wptt-container[data-keyboard-layout="krutidev"],
.wptt-container[data-keyboard-layout="krutidev"] #wptt-text-display,
.wptt-container[data-keyboard-layout="krutidev"] .wptt-keyboard,
.wptt-container[data-keyboard-layout="krutidev"] .wptt-key {
    font-family: 'KrutiDev', sans-serif !important;
}
.wptt-container[data-keyboard-layout="tamil"],
.wptt-container[data-keyboard-layout="tamil"] #wptt-text-display,
.wptt-container[data-keyboard-layout="tamil"] .wptt-keyboard,
.wptt-container[data-keyboard-layout="tamil"] .wptt-key {
    font-family: 'TamilFont', sans-serif !important;
}
.wptt-container[data-keyboard-layout="urdu"],
.wptt-container[data-keyboard-layout="urdu"] #wptt-text-display,
.wptt-container[data-keyboard-layout="urdu"] .wptt-keyboard,
.wptt-container[data-keyboard-layout="urdu"] .wptt-key {
    font-family: 'UrduFont', sans-serif !important;
    direction: rtl;
    text-align: right;
}
.wptt-container[data-keyboard-layout="spanish"],
.wptt-container[data-keyboard-layout="spanish"] #wptt-text-display,
.wptt-container[data-keyboard-layout="spanish"] .wptt-keyboard,
.wptt-container[data-keyboard-layout="spanish"] .wptt-key {
    font-family: 'SpanishFont', sans-serif !important;
}
/* Add these new font styles to your existing frontend.css */

/* New Font Faces */
@font-face {
    font-family: 'SolaimanLipi';
    src: url('assets/fonts/SolaimanLipi.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansBengali';
    src: url('assets/fonts/NotoSansBengali.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Geetanjali';
    src: url('assets/fonts/Geetanjali.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Kalinga';
    src: url('assets/fonts/Kalinga.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansOriya';
    src: url('assets/fonts/NotoSansOriya.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Shruti';
    src: url('assets/fonts/Shruti.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansGujarati';
    src: url('assets/fonts/NotoSansGujarati.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Tunga';
    src: url('assets/fonts/Tunga.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansKannada';
    src: url('assets/fonts/NotoSansKannada.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Gautami';
    src: url('assets/fonts/Gautami.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansTelugu';
    src: url('assets/fonts/NotoSansTelugu.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Raavi';
    src: url('assets/fonts/Raavi.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'AnmolLipi';
    src: url('assets/fonts/AnmolLipi.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Mangal';
    src: url('assets/fonts/Mangal.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansHebrew';
    src: url('assets/fonts/NotoSansHebrew.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'DavidLibre';
    src: url('assets/fonts/DavidLibre.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansSC';
    src: url('assets/fonts/NotoSansSC.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'SimSun';
    src: url('assets/fonts/SimSun.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansJP';
    src: url('assets/fonts/NotoSansJP.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Meiryo';
    src: url('assets/fonts/Meiryo.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansKR';
    src: url('assets/fonts/NotoSansKR.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'MalgunGothic';
    src: url('assets/fonts/MalgunGothic.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansThai';
    src: url('assets/fonts/NotoSansThai.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'THSarabun';
    src: url('assets/fonts/THSarabun.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NotoSansJavanese';
    src: url('assets/fonts/NotoSansJavanese.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* Language-specific font application for new languages */
.wptt-container[data-keyboard-layout*="bengali"],
.wptt-container[data-keyboard-layout*="bengali"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="bengali"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="bengali"] .wptt-key {
    font-family: 'SolaimanLipi', 'NotoSansBengali', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="assamese"],
.wptt-container[data-keyboard-layout*="assamese"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="assamese"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="assamese"] .wptt-key {
    font-family: 'NotoSansBengali', 'Geetanjali', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="odia"],
.wptt-container[data-keyboard-layout*="odia"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="odia"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="odia"] .wptt-key {
    font-family: 'Kalinga', 'NotoSansOriya', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="gujarati"],
.wptt-container[data-keyboard-layout*="gujarati"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="gujarati"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="gujarati"] .wptt-key {
    font-family: 'Shruti', 'NotoSansGujarati', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="kannada"],
.wptt-container[data-keyboard-layout*="kannada"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="kannada"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="kannada"] .wptt-key {
    font-family: 'Tunga', 'NotoSansKannada', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="telugu"],
.wptt-container[data-keyboard-layout*="telugu"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="telugu"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="telugu"] .wptt-key {
    font-family: 'Gautami', 'NotoSansTelugu', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="punjabi"],
.wptt-container[data-keyboard-layout*="punjabi"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="punjabi"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="punjabi"] .wptt-key {
    font-family: 'Raavi', 'AnmolLipi', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="sindhi"],
.wptt-container[data-keyboard-layout*="sindhi"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="sindhi"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="sindhi"] .wptt-key {
    font-family: 'NotoNastaliq', 'Mangal', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="hebrew"],
.wptt-container[data-keyboard-layout*="hebrew"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="hebrew"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="hebrew"] .wptt-key {
    font-family: 'NotoSansHebrew', 'DavidLibre', sans-serif !important;
    direction: rtl;
    text-align: right;
}

.wptt-container[data-keyboard-layout*="chinese"],
.wptt-container[data-keyboard-layout*="chinese"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="chinese"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="chinese"] .wptt-key {
    font-family: 'NotoSansSC', 'SimSun', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="japanese"],
.wptt-container[data-keyboard-layout*="japanese"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="japanese"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="japanese"] .wptt-key {
    font-family: 'NotoSansJP', 'Meiryo', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="korean"],
.wptt-container[data-keyboard-layout*="korean"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="korean"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="korean"] .wptt-key {
    font-family: 'NotoSansKR', 'MalgunGothic', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="thai"],
.wptt-container[data-keyboard-layout*="thai"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="thai"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="thai"] .wptt-key {
    font-family: 'NotoSansThai', 'THSarabun', sans-serif !important;
}

.wptt-container[data-keyboard-layout*="javanese"],
.wptt-container[data-keyboard-layout*="javanese"] #wptt-text-display,
.wptt-container[data-keyboard-layout*="javanese"] .wptt-keyboard,
.wptt-container[data-keyboard-layout*="javanese"] .wptt-key {
    font-family: 'NotoSansJavanese', sans-serif !important;
}

/* RTL languages special handling */
.wptt-container[data-keyboard-layout*="hebrew"] .wptt-text-display,
.wptt-container[data-keyboard-layout*="sindhi"] .wptt-text-display,
.wptt-container[data-keyboard-layout*="pashto"] .wptt-text-display,
.wptt-container[data-keyboard-layout*="kashmiri"] .wptt-text-display {
    direction: rtl;
    text-align: right;
    word-wrap: break-word;
    word-break: keep-all;
}

.wptt-container[data-keyboard-layout*="hebrew"] .wptt-text-display span,
.wptt-container[data-keyboard-layout*="sindhi"] .wptt-text-display span,
.wptt-container[data-keyboard-layout*="pashto"] .wptt-text-display span,
.wptt-container[data-keyboard-layout*="kashmiri"] .wptt-text-display span {
    unicode-bidi: isolate;
}
/* Base Styling for Text Display and Input */
#wptt-text-display,
#wptt-input {
    font-size: 1.5rem;
    line-height: 2;
    letter-spacing: 1.5px;
}

/* Guest Notice */
.wptt-guest-notice {
    text-align: center;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

/* Container */
.wptt-container {
    background: var(--keyboard-bg);
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 12px;
    max-width: 1000px;
    margin: 20px auto;
    box-sizing: border-box;
}

/* Updated Header Structure */
.wptt-header {
    background: linear-gradient(135deg, #f8f9fa, #e3f2fd);
    border: 2px dashed #007bff;
    border-radius: 16px;
    padding: 12px 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* HEADER LEFT–RIGHT FIX */
.wptt-header-top-row {
    display: flex;
    justify-content: space-between;  /* Left & Right में विभाजित */
    align-items: center;
    width: 100%;
}

/* LEFT SIDE */
.wptt-user-greeting {
    font-weight: bold;
    display: flex;
    gap: 10px;
}

/* RIGHT SIDE */
.wptt-stats {
    margin-left: auto;
    text-align: right;
}

/* Bottom Row - Test Info, Dropdowns, and Mute Button */
.wptt-header-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

.wptt-test-info {
    background: #fff;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dropdown Filter Bar (now inside header) */
.wptt-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.wptt-filter {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    min-width: 90px;
    max-width: 110px;
    font-size: 0.85rem;
    flex: 0 0 auto;
}

.wptt-sound-btn {
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 50%;
    padding: 8px 12px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.wptt-sound-btn:hover {
    background: #e3f2fd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Timer and Progress Bar Container */
.wptt-timer-progress-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}
.wptt-timer {
    font-size: 1.3rem;
    font-weight: bold;
    color: #0d6efd;
    background: #fff;
    padding: 3px 7px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}
.wptt-timer::before {
  content: "\23F1"; /* ⏱ — Unicode stopwatch (text-style, compact) */
  font-size: 1.2rem;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3rem;
}
.wptt-progress-container {
    width: 90%;
    background-color: #e9ecef;
    border-radius: 0.375rem;
    height: 8px;
}

.wptt-progress-bar {
    height: 100%;
    background-color: #0d6efd;
    border-radius: 0.375rem;
    transition: width 0.5s ease-in-out;
}
/* Test Information */
.wptt-test-info {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 5px;
}

.wptt-language {
    font-weight: bold;
    color: #0d6efd;
}

.wptt-course {
    font-weight: bold;
    color: #198754;
}

.wptt-level {
    font-weight: bold;
    color: #dc3545;
}

/* Typing Text Display */
.wptt-text-display {
margin-bottom: 15px;
background: #fff;
padding: 15px;
border-radius: 8px;
user-select: none;
letter-spacing: 1.5px;
max-height: 6000px;
overflow-y: auto;
font-size: 1.5rem;
line-height: 2;
color: #333;
border: 1px solid #ddd;
}
/* मोबाइल पर भी वही ऊंचाई */
@media (max-width:500px){
.wptt-text-display{ max-height: calc(1.4rem * 2 * 3); }
}


.wptt-text-display span.correct {
    color: #90EE90;
}

.wptt-text-display span.incorrect {
    color: #d63638;
    background: #fdd;
    text-decoration: underline;
    animation: shakeError 0.4s ease-in-out;
}

.wptt-text-display span.current {
    background-color: #cfe2ff;
    border-radius: 3px;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}
/* Hidden Input */
.wptt-input {
    opacity: 0;
    height: 1px;
    position: absolute;
    left: -9999px;
}

/* Results Section */
.wptt-results {
    text-align: center;
    background: linear-gradient(to right, #fdfbfb, #ebedee);
    padding: 30px 20px;
    border-radius: 16px;
    border: 2px dashed #28a745;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.15);
    margin-top: 30px;
}

.wptt-results ul {
    list-style: none;
    padding: 0;
    margin: 20px auto;
    display: inline-block;
    text-align: left;
    font-size: 1.2rem;
    color: #333;
}

.wptt-results-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

.wptt-btn {
    background: linear-gradient(135deg, #28a745, #218838);
    border: none;
    color: #fff;
    font-weight: bold;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s;
}

.wptt-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* Keyboard Layout */
.wptt-keyboard-area {
    margin-top: 20px;
    user-select: none;
    display: flex;
    justify-content: center;
    width: 100%;
}

.wptt-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.wptt-key-row {
    display: flex;
    gap: 8px;
    justify-content: stretch;
    width: 100%;
}

/* Keys */
.wptt-key {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 500;
    color: var(--key-text);
    background: var(--key-bg);
    border: 2px solid var(--key-border);
    border-radius: var(--key-radius);
    flex: 1 1 auto;
    height: 52px;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.07s ease;
    cursor: pointer;
    text-align: center;
    background-image: linear-gradient(to bottom, #ffffff, #eaeaea);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
}

.wptt-key:active,
.wptt-key.active {
    background-color: #ddd;
    transform: translateY(2px);
    box-shadow: inset 0 2px 3px rgba(0,0,0,0.2);
}

.wptt-key.next-key {
    border-color: var(--highlight-glow);
    box-shadow: 0 0 8px var(--highlight-glow);
}

.wptt-key .key-sub {
    font-size: 0.8em;
    line-height: 1;
}

.wptt-key .key-main {
    font-size: 1.1em;
    line-height: 1;
}

.wptt-key .key-icon {
    font-size: 1.2em;
    line-height: 1;
}

.wptt-key .key-text {
    font-size: 0.7em;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.key-mod-text .key-main {
    font-size: 0.8em;
    letter-spacing: 1px;
}

.key-mod-text .key-icon {
    font-size: 1em;
}

/* Key Sizes */
.key-size-1-25 { flex-grow: 1.25; }
.key-size-1-5 { flex-grow: 1.5; }
.key-size-1-75 { flex-grow: 1.75; }
.key-size-2 { flex-grow: 2; }
.key-size-2-25 { flex-grow: 2.25; }
.key-size-2-75 { flex-grow: 2.75; }
.key-size-space { flex-grow: 5.5; }

/* ============================= */
/* 🔤 Urdu RTL Typing Support */
/* ============================= */
.wptt-keyboard[style*="direction: rtl"] .wptt-key-row {
    flex-direction: row-reverse;
}
.wptt-keyboard[style*="direction: rtl"] .wptt-key {
    text-align: right;
}

/* Typing area RTL adjustments */
.wptt-textarea[dir="rtl"] {
    direction: rtl;
    text-align: right;
    unicode-bidi: bidi-override;
}

/* ============================= */
/* 📱 Responsive Design (Final Version with Fixed + Scrollable Filter Buttons) */
/* ============================= */
@media (max-width: 960px) {
    .wptt-container {
        padding: 15px;
    }

    .wptt-keyboard-area {
        padding: 0;
    }

    .wptt-keyboard {
        padding: 5px;
        gap: 6px;
    }

    .wptt-key-row {
        gap: 6px;
    }

    .wptt-key {
        height: 40px;
        font-size: 0.9em;
        border-width: 1.5px;
    }

    /* Header responsive layout */
    .wptt-header-bottom-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    /* ✅ Filter bar with fixed + scrollable buttons */
    .wptt-filter-bar {
        display: flex;
        gap: 8px;
        position: relative;
        overflow-x: hidden;
    }

    .wptt-fixed-buttons {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
    }

    .wptt-scrollable-buttons {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        position: relative;
    }

    .wptt-scrollable-buttons::-webkit-scrollbar {
        display: none;
    }

    .wptt-scrollable-buttons button,
    .wptt-scrollable-buttons select {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .wptt-scrollable-buttons::before,
    .wptt-scrollable-buttons::after {
        content: "";
        position: absolute;
        top: 0;
        width: 25px;
        height: 100%;
        pointer-events: none;
        z-index: 1;
    }

    .wptt-scrollable-buttons::before {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
    }

    .wptt-scrollable-buttons::after {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
    }

    .wptt-test-info {
        justify-content: center;
    }

    /* Timer and progress bar layout for mobile */
    .wptt-timer-progress-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .wptt-progress-container {
        width: 90%;
    }
}

@media (max-width: 500px) {
    .wptt-keyboard {
        gap: 4px;
        padding: 0;
    }

    .wptt-key-row {
        gap: 4px;
    }

    .wptt-key {
        height: 36px;
        border-radius: 6px;
        padding: 0;
    }

    .wptt-key .key-sub,
    .wptt-key .key-text {
        display: none;
    }

    .wptt-key .key-main,
    .wptt-key .key-icon {
        font-size: 0.95em;
    }

    /* More compact header on very small screens */
    .wptt-header-top-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .wptt-user-greeting {
        text-align: center;
    }

    /* Timer and progress bar layout for small mobile */
    .wptt-timer-progress-container {
        flex-direction: column;
    }

    .wptt-progress-container {
        width: 100%;
    }

    /* ✅ Filter bar with fixed + scrollable buttons */
    .wptt-filter-bar {
        display: flex;
        gap: 6px;
        position: relative;
        overflow-x: hidden;
    }
    
    .wptt-fixed-buttons {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    .wptt-scrollable-buttons {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        position: relative;
    }

    .wptt-scrollable-buttons::-webkit-scrollbar {
        display: none;
    }

    .wptt-scrollable-buttons button,
    .wptt-scrollable-buttons select {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .wptt-scrollable-buttons::before,
    .wptt-scrollable-buttons::after {
        content: "";
        position: absolute;
        top: 0;
        width: 25px;
        height: 100%;
        pointer-events: none;
        z-index: 1;
    }

    .wptt-scrollable-buttons::before {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
    }

    .wptt-scrollable-buttons::after {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
    }
}

/* ============================================
   Triple-Layer Inner Layout (Preserve old key sizes)
   ============================================ */
.key-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 3px 6px;
    display: block;
    box-sizing: border-box;
}
/* 🅰 Physical key label — नीचे दाईं ओर */
.key-physical {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #444;
    opacity: 0.75;
}
/* ⬆️ Shift/Sub character — ऊपर बाईं ओर */
.key-sub {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 13px;
    opacity: 0.85;
    font-weight: 500;
}
/* 🔡 Main/Base character — नीचे बाईं ओर */
.key-main {
    position: absolute;
    bottom: 4px;
    left: 6px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
}
/* जब key highlight हो (Next key) */
.wptt-key.next-key {
    box-shadow: 0 0 6px #2d8cff, inset 0 -3px 0 rgba(45, 140, 255, 0.4);
    border-color: #2d8cff;
}
/* Shift, Enter, Backspace जैसी key-text वाली keys के लिए */
.key-mod-text .key-icon {
    display: block;
    font-size: 1.3em;
}
.key-mod-text .key-text {
    display: block;
    font-size: 0.8em;
    letter-spacing: 0.3px;
    font-weight: 600;
    margin-top: 2px;
}
/* RTL keyboards (Urdu) */
.wptt-keyboard[style*="direction: rtl"] .wptt-key-row {
    flex-direction: row-reverse;
}
.wptt-keyboard[style*="direction: rtl"] .wptt-key {
    text-align: right;
}
/* Blink keyboard */
.wptt-key.next-key {
    animation: wptt-blink 1.2s infinite;
    background-color: #ffeb3b !important;
    border-color: #ff9800 !important;
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}
@keyframes wptt-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@media (max-width: 768px) {
    .wptt-filter-bar {
        position: sticky !important;
        top: 0 !important;
        z-index: 9999 !important;
        background: linear-gradient(135deg, #f8f9fa, #e3f2fd) !important;
        padding: 12px !important;
        margin: -20px -20px 20px -20px !important;
        border-bottom: 2px solid #007bff !important;
        border-radius: 12px 12px 0 0 !important;
        box-shadow: 0 4px 12px rgba(0,123,255,0.2) !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .wptt-filter {
        flex: 1 !important;
        min-width: 100px !important;
        padding: 10px !important;
        font-size: 16px !important;
        border: 1px solid #007bff !important;
        border-radius: 8px !important;
    }
}
/* Game Container Styling */
#wptt-game-container {
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    border: 4px solid #333;
    margin-bottom: 20px;
}

/* गेम मोड में होने पर स्टैंडर्ड टेक्स्ट डिस्प्ले को छुपाएं */
.wptt-mode-game #wptt-text-display {
    display: none !important;
}

.wptt-mode-game #wptt-game-container {
    display: block !important;
}

/* UI Elements inside game */
#wptt-game-ui {
    text-shadow: 1px 1px 2px black;
    z-index: 10;
}

/* Animations for Game elements (CSS Fallback) */
@keyframes pop {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}
.game-particle {
    position: absolute;
    pointer-events: none;
    animation: pop 0.5s ease-out forwards;
}
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.wptt-next-level-button {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0 10px;
}

.wptt-next-level-button:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.wptt-next-level-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
/* Shift Key Active State */
.wptt-key.active-shift {
    background-color: #ffeb3b !important;
    border-color: #ff9800 !important;
    box-shadow: 0 0 8px #ff9800;
    transform: translateY(2px);
}

/* ✅ IMPROVED: Backspace Block Button Styling */
#wptt-backspace-block-btn {
    background: #e8f5e9; /* Default green for allowed */
    border: 2px solid #4caf50;
    border-radius: 8px; /* Changed from 50% to 8px for better appearance */
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    min-height: 50px;
    color: #2e7d32;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
    margin: 0 5px;
    outline: none !important;
}

#wptt-backspace-block-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

#wptt-backspace-block-btn:active {
    transform: scale(0.95);
}

#wptt-backspace-block-btn.backspace-blocked {
    background: #ffebee !important;
    border-color: #f44336 !important;
    color: #d32f2f !important;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.2);
}

#wptt-backspace-block-btn.backspace-allowed {
    background: #e8f5e9 !important;
    border-color: #4caf50 !important;
    color: #2e7d32 !important;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

#wptt-backspace-block-btn span {
    font-size: 0.7rem;
    margin-top: 2px;
    font-weight: 600;
    display: block;
}

/* ✅ NEW: Input focus styles */
#wptt-input:focus {
    outline: 2px solid #4caf50 !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* ✅ NEW: Button container alignment */
.wptt-control-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

/* ✅ NEW: Focus indicator for active elements */
*:focus {
    outline: 2px solid #4caf50 !important;
}

/* ✅ NEW: Fix for button focus issue */
#wptt-backspace-block-btn:focus {
    outline: 2px solid #2196f3 !important;
    outline-offset: 2px;
}

/* ✅ NEW: Active state for better UX */
#wptt-backspace-block-btn.active {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Shake animation for blocked backspace attempt */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.wptt-input.shake {
    animation: shake 0.5s ease-in-out;
}

/* Notification styling */
.wptt-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.wptt-notification.success {
    background: #4caf50;
    color: white;
    border-left: 4px solid #2e7d32;
}

.wptt-notification.error {
    background: #f44336;
    color: white;
    border-left: 4px solid #d32f2f;
}

.wptt-notification.info {
    background: #2196f3;
    color: white;
    border-left: 4px solid #0d47a1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
/* बैकस्पेस चार्ट्स के लिए स्टाइलिंग */
.wptt-chart-backspace {
    color: #8b5cf6;
    font-weight: 600;
}

.backspace-item {
    border-left: 4px solid #8b5cf6;
    background: linear-gradient(to right, rgba(139, 92, 246, 0.05), rgba(139, 92, 246, 0.1));
}

/* टाइम फॉर्मेटिंग */
.wptt-breakdown-value.time-value {
    font-family: monospace;
    font-size: 1.1em;
}

/* रिस्पॉन्सिव टाइम डिस्प्ले */
@media (max-width: 768px) {
    .wptt-breakdown-value {
        font-size: 0.9em;
    }
}