/* Modern Color Palette */
:root {
    --primary-color: #4a6fa5;
    --primary-light: #7b9ed9;
    --primary-dark: #1a4b8c;
    --secondary-color: #6c5b7b;
    --accent-color: #c06c84;
    --background-start: #2c3e50;
    --background-end: #4a6fa5;
    --text-primary: #2c3e50;
    --text-secondary: #5d6d7e;
    --text-light: #ecf0f1;
    --border-color: #d5d8dc;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
}

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

body {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    margin-bottom: 0.2rem;
    width: 100%;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    max-width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    margin-bottom: 0.3rem;
}

.logo {
    height: 32px;
    width: auto;
    border-radius: 4px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.logo:hover {
    transform: scale(1.05);
}

.header-text {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-text h1 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
}

.tabs {
    display: flex;
    background: rgba(255,255,255,0.1);
    border-radius: 10px 10px 0 0;
    backdrop-filter: blur(10px);
    overflow: hidden;
    flex-shrink: 0;
}

.tab-button {
    flex: 1;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 6px 6px 0 0;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.tab-button.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    background: rgba(255,255,255,0.95);
    border-radius: 0 0 3px 3px;
    padding: 3px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    background-color: #d0d2d5;
    border-radius: 3px;
    padding: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.top-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.sound-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ==========================================================================
   Custom Speaker Dropdown
   ========================================================================== */

.custom-speaker-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    font-family: inherit;
}

.dropdown-toggle:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.25);
}

.dropdown-toggle:hover:not(:disabled) {
    border-color: var(--primary-color);
}

.dropdown-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dropdown-toggle-text {
    flex: 1;
    text-align: left;
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.custom-speaker-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    padding: 4px 0;
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
    min-width: 180px;
}

.custom-speaker-dropdown.open .dropdown-options {
    display: block;
}

.speaker-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
}

.speaker-option[aria-selected="true"] {
    background-color: rgba(74, 111, 165, 0.1);
}

.speaker-name {
    flex: 1;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    font-size: 15px;
    color: var(--text-primary);
    min-height: 44px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.speaker-name:hover {
    background-color: rgba(74, 111, 165, 0.1);
}

.speaker-name:active {
    background-color: rgba(74, 111, 165, 0.2);
}

.speaker-preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: none;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 0;
    margin-right: 4px;
    flex-shrink: 0;
}

.speaker-preview-btn:hover {
    background-color: var(--primary-dark);
    transform: scale(1.1);
}

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

.speaker-preview-btn .preview-play-icon {
    display: inline;
}

.speaker-preview-btn .preview-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: speaker-preview-spin 0.8s linear infinite;
}

.speaker-preview-btn.loading .preview-play-icon {
    display: none;
}

.speaker-preview-btn.loading .preview-spinner {
    display: inline-block;
}

.speaker-preview-btn.loading {
    opacity: 0.8;
    cursor: wait;
}

.speaker-preview-btn.playing {
    background-color: var(--accent-color);
    animation: speaker-preview-pulse 1s ease-in-out infinite;
}

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

@keyframes speaker-preview-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.speak-btn {
    padding: 6px 12px;
    font-size: 1.1em;
}

.sound-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.sound-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.text-area {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    font-size: 20px;
    line-height: 1.5;
    width: 100%;
    min-height: 50px;
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    resize: none;
    transition: border-color 0.3s;
    background-color: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.text-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.25);
}

.font-size-btn {
    font-weight: 700;
    font-size: 0.85em !important;
    padding: 6px 10px !important;
    min-width: 38px !important;
    letter-spacing: -0.5px;
}

.text-controls {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 3px 0;
    padding: 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.control-btn {
    padding: 10px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 1.2em;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.control-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.control-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    border: 2px solid #999;
}

.control-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.whatsapp-btn {
    padding: 8px 12px;
}

@media (max-width: 768px) {
    .text-area {
        font-size: 16px;
        padding: 8px;
    }

    .top-controls {
        justify-content: space-between;
        gap: 6px;
    }
    
    .text-controls {
        gap: 4px;
    }
    
    .control-btn {
        padding: 6px 8px;
        font-size: 1.1em;
        min-width: 36px;
    }
    
    .whatsapp-btn {
        padding: 4px 6px;
    }
    
    .whatsapp-btn img {
        width: 18px !important;
        height: 18px !important;
    }
    
    .dropdown-toggle {
        padding: 6px 10px;
        font-size: 14px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .text-controls {
        gap: 3px;
    }
    
    .control-btn {
        padding: 5px 6px;
        font-size: 1em;
        min-width: 32px;
    }
    
    .whatsapp-btn {
        padding: 3px 5px;
    }
    
    .whatsapp-btn img {
        width: 16px !important;
        height: 16px !important;
    }
}

.keyboard {
    display: grid;
    gap: 4px;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2px;
    width: 100%;
    flex-shrink: 0;
}

.keyboard-row {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    padding-bottom: 2px;
}

.key {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    font-size: 19px;
    padding: 8px 4px;
    min-width: 35px;
    height: 45px;
    background-color: #ffffff;
    border: 1px solid #d5d8dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 60px;
    color: #2c3e50 !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.key:hover {
    background-color: #f8f9fa;
    color: #2c3e50 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: #b0b5ba;
}

.key:active {
    transform: translateY(0);
    background-color: #e9ecef;
    color: #2c3e50 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    border-color: #adb5bd;
}

.key.special-char {
    background: linear-gradient(145deg, #f8d5e4, #f2a8c2);
    background-color: #f8d5e4;
    color: #1a4b8c !important;
    font-weight: 600;
    border-color: #e8b8cc;
}

.key.function {
    background-color: #f0f0f0;
    color: #2c3e50 !important;
    border-color: #d0d0d0;
}

.key.function:hover {
    background-color: #e5e5e5;
    border-color: #c0c0c0;
}

.key.space {
    min-width: 120px;
    max-width: 200px;
    flex-grow: 3;
    background-color: #f5f5f5;
    color: #2c3e50 !important;
}

.key.enter, .key.shift, .key.backspace, .key.delete {
    font-size: 0.9em;
    min-width: 50px;
}

.key.enter {
    min-width: 50px;
    font-size: 1.2em;
    background: linear-gradient(145deg, #e6e6e6, #c7c7c7);
    background-color: #e6e6e6;
    color: #2c3e50 !important;
    border-color: #b8b8b8;
}

.key.enter:hover {
    background: linear-gradient(145deg, #d9d9d9, #b8b8b8);
    background-color: #d9d9d9;
    color: #2c3e50 !important;
    border-color: #a8a8a8;
}

.key.enter:active {
    background: linear-gradient(145deg, #c7c7c7, #a8a8a8);
    background-color: #c7c7c7;
    color: #2c3e50 !important;
    border-color: #989898;
}

.key.shift {
    min-width: 50px;
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    background-color: #e3f2fd;
    color: #1a4b8c !important;
    font-weight: 600;
    border-color: #90caf9;
}

.key.shift:hover {
    background: linear-gradient(145deg, #d4e9fc, #a8d4f7);
    background-color: #d4e9fc;
    border-color: #7bb8e8;
}

.key.shift.active {
    background: linear-gradient(145deg, #bbdefb, #90caf9);
    background-color: #bbdefb;
    color: #1a4b8c !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
    border-color: #64b5f6;
}

.key.shift svg {
    width: 20px;
    height: 20px;
    fill: #1a4b8c;
}

/* Responsive keyboard for small to medium phones */
@media (max-width: 480px) {
    .container {
        padding: 2px;
    }
    
    .tab-content {
        padding: 3px 3px;
    }
    
    .text-area {
        min-height: 80px;
        font-size: 14px;
        padding: 8px;
    }
    
    .keyboard {
        gap: 2px;
        padding: 0;
    }

    .keyboard-row {
        gap: 2px;
        padding-bottom: 2px;
    }
    
    .key {
        min-width: 28px;
        max-width: 50px;
        height: 38px;
        font-size: 16px;
        padding: 4px 2px;
        border-radius: 5px;
    }

    .key.space {
        min-width: 90px;
        max-width: 150px;
    }

    .key.enter, .key.shift, .key.backspace, .key.delete {
        font-size: 14px;
        min-width: 40px;
    }
    
    .key.shift svg {
        width: 16px;
        height: 16px;
    }
}

/* Extra small phones and narrow displays (OnePlus 8T, etc.) */
@media (max-width: 400px) {
    .container {
        padding: 2px;
    }
    
    .header-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .logo {
        height: 30px;
    }

    .header-text h1 {
        font-size: 1.1rem;
    }
    
    .tab-content {
        padding: 3px 3px;
    }
    
    .text-area {
        min-height: 60px;
        font-size: 13px;
        padding: 6px;
    }
    
    .keyboard {
        gap: 2px;
    }

    .keyboard-row {
        gap: 1.5px;
    }
    
    .key {
        min-width: 25px;
        max-width: 45px;
        height: 36px;
        font-size: 15px;
        padding: 3px 1px;
        border-radius: 4px;
    }

    .key.space {
        min-width: 75px;
        max-width: 130px;
    }

    .key.enter, .key.shift, .key.backspace, .key.delete {
        font-size: 13px;
        min-width: 35px;
    }
    
    .key.shift svg {
        width: 14px;
        height: 14px;
    }
}

/* Very small displays */
@media (max-width: 360px) {
    .key {
        min-width: 23px;
        max-width: 40px;
        height: 34px;
        font-size: 14px;
        padding: 2px 1px;
    }

    .key.space {
        min-width: 65px;
        max-width: 110px;
    }
    
    .key.enter, .key.shift, .key.backspace, .key.delete {
        font-size: 12px;
        min-width: 32px;
    }

    .keyboard {
        gap: 1.5px;
    }

    .keyboard-row {
        gap: 1px;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding: 2px;
    }
    
    .header-content {
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .logo {
        height: 28px;
    }
    
    .header-text h1 {
        font-size: 1rem;
    }
    
    .tab-content {
        padding: 3px;
        min-height: auto;
    }
    
    .text-area {
        min-height: 50px;
        font-size: 12px;
    }
    
    .keyboard {
        gap: 1.5px;
    }

    .keyboard-row {
        gap: 1px;
        padding-bottom: 1px;
    }

    .key {
        height: 32px;
        font-size: 14px;
        padding: 2px 2px;
        min-width: 24px;
    }
    
    .key.space {
        min-width: 70px;
    }
    
    .key.enter, .key.shift {
        min-width: 35px;
        height: 32px;
    }
    
    .key.shift svg {
        width: 12px;
        height: 12px;
    }
}

/* High DPI displays (OnePlus 8T has ~402 PPI) */
@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 3dppx) {
    .key {
        border-width: 0.5px;
    }
}

/* Viewport height constraints - ensure keyboard fits on smaller screens */
@media (max-height: 700px) {
    .text-area {
        min-height: 60px;
    }
    
    .tab-content {
        padding: 3px 3px;
    }
    
    .keyboard {
        gap: 2px;
    }
    
    .key {
        height: 36px;
    }
}

@media (max-height: 650px) {
    .header-content {
        padding: 0.4rem 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .logo {
        height: 30px;
    }
    
    .header-text h1 {
        font-size: 1.1rem;
    }
    
    .text-area {
        min-height: 50px;
        font-size: 13px;
    }
    
    .tab-content {
        padding: 3px;
    }
    
    .keyboard {
        gap: 2px;
    }
    
    .keyboard-row {
        gap: 1.5px;
    }
    
    .key {
        height: 34px;
        font-size: 15px;
    }
    
    .key.enter, .key.shift {
        height: 34px;
    }
}

/* Combined small screen with limited height (like OnePlus 8T in portrait with keyboard open) */
@media (max-width: 480px) and (max-height: 800px) {
    .container {
        padding: 2px;
    }
    
    .header-content {
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .tab-content {
        padding: 3px 3px;
    }
    
    .text-area {
        min-height: 60px;
    }
    
    .text-controls {
        margin-bottom: 3px;
    }
}

.learning-content {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.learning-content::-webkit-scrollbar {
    width: 8px;
}

.learning-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.learning-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.learning-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.learning-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    padding: 15px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-items: center;
    flex-wrap: wrap;
}

.char-button, .word-button {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    padding: 12px 18px;
    border: 1px solid #d5d8dc;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 60px;
    background-color: #ffffff;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.char-button {
    background: linear-gradient(145deg, #667eea, #764ba2);
    background-color: #667eea;
    color: #ffffff !important;
    border-color: #5a6fd8;
}

.char-button:hover {
    background: linear-gradient(145deg, #5a6fd8, #6a4190);
    background-color: #5a6fd8;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border-color: #4a5fc8;
}

.char-button:active {
    background: linear-gradient(145deg, #4a5fc8, #5a3180);
    background-color: #4a5fc8;
    color: #ffffff !important;
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.word-button {
    background: linear-gradient(145deg, #ffeaa7, #fab1a0);
    background-color: #ffeaa7;
    color: #2d3436 !important;
    border-color: #f5d97a;
}

.word-button:hover {
    background: linear-gradient(145deg, #fdcb6e, #e17055);
    background-color: #fdcb6e;
    color: #2d3436 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 203, 110, 0.3);
    border-color: #f0b64a;
}

.word-button:active {
    background: linear-gradient(145deg, #f0b64a, #d45f45);
    background-color: #f0b64a;
    color: #2d3436 !important;
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(253, 203, 110, 0.2);
}

.highlight {
    color: #e74c3c;
    font-weight: bold;
    background: rgba(231, 76, 60, 0.1);
    padding: 0px 0px;
    border-radius: 3px;
}

/* Learning Tab Styles */
.learning-content {
    /* background: white; */
    background: #b0b2b5;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 15px;
}

.character-section, .word-section {
    margin-bottom: 2rem;
}

.section-title {
    color: var(--primary-color);
    font-size: 1.2em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.character-buttons, .word-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}

/* Note: char-button and word-button base styles are defined above with gradients */
/* These rules add additional text/box properties without overriding background */

/* Character-specific styling */
.char-button {
    font-size: 1.4em;
    padding: 15px 0;
    font-weight: 500;
}

/* Word-specific styling */
.word-button {
    font-size: 1em;
    padding: 10px 5px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

/* Responsive adjustments for learning tab */
@media (max-width: 768px) {
    .character-buttons, .word-buttons {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }

    .char-button {
        font-size: 1.2em;
        padding: 12px 0;
    }

    .word-button {
        font-size: 0.9em;
        padding: 8px 4px;
        min-height: 50px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 2px;
    }

    .header-content {
        gap: 0.75rem;
        padding: 0.5rem;
    }

    .logo {
        height: 36px;
    }

    .header-text h1 {
        font-size: 1.3rem;
    }

    .tab-content {
        padding: 3px;
        min-height: auto;
    }

    .text-area {
        min-height: 80px;
        font-size: 14px;
    }

    .learning-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .char-button, .word-button {
        width: 100%;
        font-size: 1em;
    }
}

footer {
    text-align: center;
    margin-top: 0;
    padding: 0.15rem;
    color: white;
    font-size: 0.75rem;
    opacity: 0.9;
    line-height: 1.1;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .tab-button {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    footer {
        font-size: 0.75rem;
        padding: 0.15rem;
    }
}

/* Paste Modal Styles */
.paste-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.paste-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

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

.paste-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.paste-modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

.paste-modal-content h3 {
    margin: 0 0 16px 0;
    color: var(--primary-color);
    font-size: 1.3em;
}

.paste-instructions {
    text-align: left;
    color: var(--text-primary);
    line-height: 1.6;
}

.paste-instructions p {
    margin: 12px 0 8px 0;
    font-weight: 500;
}

.paste-instructions ol {
    margin: 0;
    padding-left: 24px;
    color: var(--text-secondary);
}

.paste-instructions li {
    margin-bottom: 6px;
}

.paste-instructions kbd {
    background: linear-gradient(145deg, #f5f5f5, #e0e0e0);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 0.95em;
    box-shadow: 0 2px 0 #999;
}

.paste-modal-btn {
    margin-top: 20px;
    width: 100%;
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.paste-modal-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

@media (max-width: 480px) {
    .paste-modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .paste-modal-content h3 {
        font-size: 1.1em;
    }
    
    .paste-instructions {
        font-size: 0.95em;
    }
}

/* keyboard_pro.css */

/* Dark mode styles - disabled to ensure consistent light appearance */
/* Force light mode for keyboard to ensure text visibility */
@media (prefers-color-scheme: dark) {
    /* Override dark mode preferences to keep keyboard readable */
    .keyboard .key {
        background-color: #ffffff !important;
        color: #2c3e50 !important;
        border-color: #d5d8dc !important;
    }
    
    .keyboard .key:hover {
        background-color: #f8f9fa !important;
        color: #2c3e50 !important;
    }
    
    .keyboard .key.special-char {
        background: linear-gradient(145deg, #f8d5e4, #f2a8c2) !important;
        color: #1a4b8c !important;
    }
    
    .keyboard .key.shift {
        background: linear-gradient(145deg, #e3f2fd, #bbdefb) !important;
        color: #1a4b8c !important;
    }
    
    .keyboard .key.enter {
        background: linear-gradient(145deg, #e6e6e6, #c7c7c7) !important;
        color: #2c3e50 !important;
    }
    
    .keyboard .key.function {
        background-color: #f0f0f0 !important;
        color: #2c3e50 !important;
    }
    
    .tab-content {
        background-color: rgba(255, 255, 255, 0.95) !important;
    }
    
    .text-area {
        background-color: #ffffff !important;
        color: #2c3e50 !important;
        border-color: #d5d8dc !important;
    }
    
    .char-button {
        background: linear-gradient(145deg, #667eea, #764ba2) !important;
        color: #ffffff !important;
        border-color: #5a6fd8 !important;
    }
    
    .word-button {
        background: linear-gradient(145deg, #ffeaa7, #fab1a0) !important;
        color: #2d3436 !important;
        border-color: #f5d97a !important;
    }
    
    .learning-content {
        /* background-color: #ffffff !important; */
        background-background: #b0b2b5;
        color: #2c3e50 !important;
    }
    
    .learning-row {
        background: linear-gradient(145deg, #f8f9fa, #e9ecef) !important;
    }
}
