/* Modern Morse Master Styles */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent-orange: #f97316;
    --accent-orange-light: #fb923c;
    --accent-orange-dark: #ea580c;
    --border-color: #e2e8f0;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.app {
    min-height: 100vh;
    position: relative;
}

/* Page transitions */
.page {
    display: none;
    min-height: 100vh;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

/* Welcome Page Styles */
.welcome-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.welcome-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, var(--accent-orange)10 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, var(--accent-orange)08 0%, transparent 50%);
    pointer-events: none;
}

.logo-section {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.morse-lines {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.line {
    background: var(--accent-orange);
    border-radius: 2px;
    animation: morseGlow 2s ease-in-out infinite alternate;
}

.line.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation-delay: 0s;
}

.line.dash {
    width: 24px;
    height: 8px;
    animation-delay: 0.3s;
}

@keyframes morseGlow {
    0% { opacity: 0.6; box-shadow: 0 0 10px var(--accent-orange)40; }
    100% { opacity: 1; box-shadow: 0 0 20px var(--accent-orange)60; }
}

.logo h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 2px 10px var(--shadow-light);
    animation: titleFloat 3s ease-in-out infinite;
}

.logo h1 .letter {
    display: inline-block;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.logo h1 .letter.blinking {
    opacity: 1;
    color: var(--accent-orange);
    text-shadow: 0 0 20px var(--accent-orange), 0 2px 10px var(--shadow-light);
    animation: morseLetterBlink 0.6s ease-in-out;
}

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

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

.tagline {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.5s forwards;
}

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

.welcome-content {
    max-width: 600px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.intro-text {
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.8s forwards;
}

.intro-text p {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeInUp 1s ease-out 1.1s forwards;
}

/* Button Styles */
.btn-primary {
    position: relative;
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-orange)40;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-orange)50;
    background: var(--accent-orange-light);
}

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

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover .btn-glow {
    left: 100%;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow-light);
}

/* Page Container Styles */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.back-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px var(--shadow-light);
    position: relative;
    overflow: hidden;
}

.back-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.1), transparent);
    transition: left 0.6s;
}

.back-btn:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
    transform: translateX(-5px) scale(1.05);
    box-shadow: 0 8px 25px var(--accent-orange)40;
}

.back-btn:hover::before {
    left: 100%;
}

.back-btn:active {
    transform: translateX(-3px) scale(1.02);
    transition: all 0.1s ease;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Settings Page */
.settings-content {
    display: grid;
    gap: 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.setting-group {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.setting-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--shadow-light);
}

.setting-group label {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.setting-control input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    outline: none;
    appearance: none;
    cursor: pointer;
}

.setting-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-orange);
    cursor: pointer;
    box-shadow: 0 2px 10px var(--accent-orange)40;
    transition: all 0.3s ease;
}

.setting-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.setting-control span {
    font-weight: 600;
    color: var(--accent-orange);
    min-width: 3rem;
    text-align: center;
}

.theme-selector {
    display: flex;
    gap: 0.5rem;
}

.theme-btn {
    flex: 1;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-btn.active {
    background: var(--accent-orange);
    color: white;
    border-color: var(--accent-orange);
}

.theme-btn:hover:not(.active) {
    background: var(--bg-primary);
    border-color: var(--accent-orange);
}

.test-audio-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.test-audio-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s;
}

.test-audio-btn:hover {
    background: linear-gradient(135deg, #10b981 0%, var(--success) 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.test-audio-btn:hover::before {
    left: 100%;
}

.test-audio-btn:active {
    transform: translateY(0) scale(1);
    transition: all 0.1s ease;
}

.test-audio-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.test-info {
    text-align: center;
}

.test-info small {
    color: var(--text-muted);
    font-style: italic;
}

.version-footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem 0;
}

.version-footer span {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.6;
    font-weight: 400;
}

/* Mode Selection Page */
.mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.mode-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.mode-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px var(--shadow-medium);
    border-color: var(--accent-orange);
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent-orange)10, transparent);
    transition: left 0.5s;
}

.mode-card:hover::before {
    left: 100%;
}

.mode-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: grayscale(20%);
    transition: all 0.3s ease;
}

.mode-card:hover .mode-icon {
    filter: none;
    transform: scale(1.1);
}

.mode-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.mode-card p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.select-mode-btn {
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.select-mode-btn:hover {
    background: var(--accent-orange-light);
    transform: translateY(-2px);
}

/* Level Selection Page */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.level-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-medium);
    border-color: var(--accent-orange);
}

.level-card.completed {
    background: linear-gradient(135deg, var(--success)20, var(--bg-secondary));
    border-color: var(--success);
    position: relative;
}

.level-card.completed::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 15px;
    color: var(--success);
    font-size: 1.5rem;
    font-weight: bold;
}

.level-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.level-card .level-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-orange);
    margin-bottom: 0.5rem;
}

.level-card .level-letters {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.level-card .new-letters {
    color: var(--accent-orange);
    font-weight: 600;
}

/* Game Page Styles */
.game-layout {
    display: flex;
    min-height: 100vh;
}

.level-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 2px solid var(--border-color);
    padding: 1rem;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 2rem;
}

.sidebar-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.mode-selector {
    margin: 1rem 0;
}

.mode-selector-label {
    display: none;
}

.mode-toggle-container {
    position: relative;
}

.mode-toggle {
    position: relative;
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 16px;
    padding: 6px;
    border: 2px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 20px var(--shadow-light);
}

.mode-toggle:hover {
    border-color: var(--accent-orange);
    box-shadow: 0 8px 30px var(--accent-orange)20;
    transform: translateY(-2px);
}

.mode-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-light) 100%);
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px var(--accent-orange)40;
}

.toggle-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    border-radius: 8px;
}

.toggle-icon {
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.toggle-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Active state styles */
#receiveMode:checked ~ .toggle-slider {
    transform: translateX(0);
}

#sendMode:checked ~ .toggle-slider {
    transform: translateX(100%);
}

#receiveMode:checked ~ label[for="receiveMode"] .toggle-text,
#sendMode:checked ~ label[for="sendMode"] .toggle-text {
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

#receiveMode:checked ~ label[for="receiveMode"] .toggle-icon,
#sendMode:checked ~ label[for="sendMode"] .toggle-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Hover effects */
.toggle-label:hover {
    transform: scale(1.05);
}

.toggle-label:hover .toggle-icon {
    transform: scale(1.15);
}

/* Focus styles */
#receiveMode:focus ~ label[for="receiveMode"],
#sendMode:focus ~ label[for="sendMode"] {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

.level-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.level-menu-item {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-primary);
}

.level-menu-item:hover {
    border-color: var(--accent-orange);
    background: var(--accent-orange)10;
}

.level-menu-item.active {
    background: var(--accent-orange);
    color: white;
    border-color: var(--accent-orange);
}

.level-menu-item.completed {
    border-color: var(--success);
}

.level-menu-item.completed::after {
    content: ' ✓';
    color: var(--success);
    font-weight: bold;
}

.level-menu-item.active.completed::after {
    color: white;
}

.game-container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.game-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.mode-indicator {
    background: var(--accent-orange);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

.current-level {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    border: 2px solid var(--border-color);
}

/* Global Settings Button */
.settings-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.settings-btn:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 15px var(--accent-orange)30;
}

.settings-btn svg {
    width: 20px;
    height: 20px;
}

.level-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.level-selector label {
    font-weight: 600;
    color: var(--text-secondary);
}

.level-selector select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-selector select:focus {
    outline: none;
    border-color: var(--accent-orange);
}

/* Level Introduction */
.level-intro {
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.level-intro h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.letter-showcase {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.letter-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    min-width: 120px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.letter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-light);
    border-color: var(--accent-orange);
}

.letter-card .letter {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.letter-card .morse {
    font-size: 1.5rem;
    color: var(--accent-orange);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.play-btn:not(.modern-play-btn) {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-btn:not(.modern-play-btn):hover {
    background: #059669;
    transform: scale(1.05);
}

/* Modern play button styles - FORCED OVERRIDE */
.modern-play-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ff8c42 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 54px !important;
    height: 54px !important;
    cursor: pointer !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 
        0 8px 25px rgba(255, 107, 53, 0.4),
        0 4px 10px rgba(255, 107, 53, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    position: relative !important;
    overflow: hidden !important;
    padding: 0 !important;
    font-size: 0 !important;
}

.modern-play-btn svg {
    width: 18px;
    height: 18px;
    color: white;
    z-index: 2;
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.modern-play-btn:hover {
    transform: translateY(-4px) scale(1.15);
    box-shadow: 
        0 15px 35px rgba(255, 107, 53, 0.6),
        0 8px 15px rgba(255, 107, 53, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.modern-play-btn:hover svg {
    transform: scale(1.2);
}

.modern-play-btn:active {
    transform: translateY(-2px) scale(1.08);
    transition: all 0.1s ease;
}

.modern-play-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s;
}

.modern-play-btn:hover::before {
    left: 100%;
}

/* Game Area */
.game-area {
    display: grid;
    gap: 2rem;
}

.game-mode {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.game-display {
    text-align: center;
    margin-bottom: 2rem;
}

.morse-display {
    font-size: 3rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-orange);
    margin-bottom: 1rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 4px;
}

.audio-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.audio-btn:not(.modern-audio-btn) {
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.audio-btn:not(.modern-audio-btn):hover {
    background: var(--accent-orange-light);
    transform: translateY(-2px);
}

/* Sexy modern audio buttons - FORCED OVERRIDE */
.modern-audio-btn {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 25px !important;
    color: white !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.4),
        0 3px 8px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    position: relative !important;
    overflow: hidden !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

/* Override for replay button - make it orange like play buttons */
.audio-btn.modern-audio-btn.modern-play-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ff8c42 100%) !important;
    box-shadow: 
        0 8px 25px rgba(255, 107, 53, 0.4),
        0 4px 10px rgba(255, 107, 53, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    padding: 0 !important;
    gap: 0 !important;
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
}

.audio-btn.modern-audio-btn.modern-play-btn:hover {
    transform: translateY(-4px) scale(1.15) !important;
    box-shadow: 
        0 15px 35px rgba(255, 107, 53, 0.6),
        0 8px 15px rgba(255, 107, 53, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.audio-btn.modern-audio-btn.modern-play-btn span {
    display: none;
}

.audio-btn.modern-audio-btn.modern-play-btn svg {
    width: 18px !important;
    height: 18px !important;
    color: white !important;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)) !important;
}

.modern-audio-btn:first-child:not(.modern-play-btn) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.4),
        0 3px 8px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.modern-audio-btn:last-child {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    box-shadow: 
        0 6px 20px rgba(245, 87, 108, 0.4),
        0 3px 8px rgba(245, 87, 108, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.modern-audio-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    z-index: 2;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
}

.modern-audio-btn span {
    z-index: 2;
}

.modern-audio-btn:hover {
    transform: translateY(-3px) scale(1.08);
}

.modern-audio-btn:first-child:hover {
    box-shadow: 
        0 12px 35px rgba(102, 126, 234, 0.6),
        0 6px 15px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modern-audio-btn:last-child:hover {
    box-shadow: 
        0 12px 35px rgba(245, 87, 108, 0.6),
        0 6px 15px rgba(245, 87, 108, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modern-audio-btn:active {
    transform: translateY(-1px) scale(1.04);
    transition: all 0.1s ease;
}

.modern-audio-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.modern-audio-btn:hover::before {
    left: 100%;
}

.game-result {
    font-size: 1.25rem;
    font-weight: 600;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-result.correct {
    color: var(--success);
    animation: successPulse 0.5s ease-out;
}

.game-result.incorrect {
    color: var(--error);
    animation: errorShake 0.5s ease-out;
}

.game-result.level-complete {
    color: var(--success);
    font-size: 1.5rem;
    animation: successPulse 0.5s ease-out;
}

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

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Listening Indicator */
.listening-indicator {
    text-align: center;
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.sound-icon {
    font-size: 3rem;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.sound-icon.playing {
    opacity: 1;
    animation: soundPulse 0.6s ease-in-out infinite alternate;
    color: var(--accent-orange);
}

@keyframes soundPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

.sound-waves {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sound-waves.active {
    opacity: 1;
}

.wave {
    width: 4px;
    background: var(--accent-orange);
    border-radius: 2px;
    animation: soundWave 1.2s ease-in-out infinite;
}

.wave:nth-child(1) { animation-delay: 0s; }
.wave:nth-child(2) { animation-delay: 0.2s; }
.wave:nth-child(3) { animation-delay: 0.4s; }

@keyframes soundWave {
    0%, 100% {
        height: 8px;
        opacity: 0.5;
    }
    50% {
        height: 32px;
        opacity: 1;
    }
}

/* Keyboard Styles */
.keyboard-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 3rem 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px var(--shadow-light);
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.key {
    width: 60px;
    height: 60px;
    background: var(--bg-tertiary);
    border: 3px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: not-allowed;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.key.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--accent-orange);
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow-medium);
}

.key.active:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

/* Disable hover effects on keyboard keys in send mode */
.send-mode .key.active:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: none;
    box-shadow: 0 4px 15px var(--shadow-medium);
}

.key.active:active {
    transform: translateY(-1px) scale(1.02);
}

/* Visual feedback for physical keyboard presses */
.key.key-pressed {
    background: var(--accent-orange);
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px var(--accent-orange)40;
}

/* Progress visualization - solid color filling from bottom */
.key.active.progress-20 {
    background: linear-gradient(to top, #10b981 20%, var(--bg-primary) 20%) !important;
    border-color: #10b981 !important;
}

.key.active.progress-40 {
    background: linear-gradient(to top, #10b981 40%, var(--bg-primary) 40%) !important;
    border-color: #10b981 !important;
}

.key.active.progress-60 {
    background: linear-gradient(to top, #10b981 60%, var(--bg-primary) 60%) !important;
    border-color: #10b981 !important;
}

.key.active.progress-80 {
    background: linear-gradient(to top, #10b981 80%, var(--bg-primary) 80%) !important;
    border-color: #10b981 !important;
}

.key.active.progress-100 {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.key.active.progress-20:hover {
    background: linear-gradient(to top, #10b981 20%, var(--bg-primary) 20%) !important;
    color: var(--text-primary) !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.key.active.progress-40:hover {
    background: linear-gradient(to top, #10b981 40%, var(--bg-primary) 40%) !important;
    color: var(--text-primary) !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.key.active.progress-60:hover {
    background: linear-gradient(to top, #10b981 60%, var(--bg-primary) 60%) !important;
    color: var(--text-primary) !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.key.active.progress-80:hover {
    background: linear-gradient(to top, #10b981 80%, var(--bg-primary) 80%) !important;
    color: var(--text-primary) !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.key.active.progress-100:hover {
    background: #10b981 !important;
    color: white !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* Disable hover effects on progress keys in send mode - maintain original colors */
.send-mode .key.active.progress-20:hover {
    background: linear-gradient(to top, #10b981 20%, var(--bg-primary) 20%) !important;
    color: var(--text-primary) !important;
    transform: none !important;
    box-shadow: 0 4px 15px var(--shadow-medium) !important;
}

.send-mode .key.active.progress-40:hover {
    background: linear-gradient(to top, #10b981 40%, var(--bg-primary) 40%) !important;
    color: var(--text-primary) !important;
    transform: none !important;
    box-shadow: 0 4px 15px var(--shadow-medium) !important;
}

.send-mode .key.active.progress-60:hover {
    background: linear-gradient(to top, #10b981 60%, var(--bg-primary) 60%) !important;
    color: var(--text-primary) !important;
    transform: none !important;
    box-shadow: 0 4px 15px var(--shadow-medium) !important;
}

.send-mode .key.active.progress-80:hover {
    background: linear-gradient(to top, #10b981 80%, var(--bg-primary) 80%) !important;
    color: var(--text-primary) !important;
    transform: none !important;
    box-shadow: 0 4px 15px var(--shadow-medium) !important;
}

.send-mode .key.active.progress-100:hover {
    background: #10b981 !important;
    color: white !important;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
}

/* Send Mode Styles */
.send-display {
    text-align: center;
}

.target-letter h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.perfect-message {
    font-size: 2rem;
    color: var(--success);
    font-weight: 600;
    animation: perfectAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

@keyframes perfectAppear {
    0% {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateY(0) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.target-morse {
    font-size: 2.5rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 2rem;
    letter-spacing: 4px;
    opacity: 0.5;
    font-style: italic;
}

.input-area {
    margin: 2rem 0;
}

.morse-input {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    font-size: 2rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-orange);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    letter-spacing: 3px;
}

.morse-input:not(:empty) {
    border-color: var(--accent-orange);
    border-style: solid;
}

.input-method-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.input-method-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-method-btn.active {
    background: var(--accent-orange);
    color: white;
    border-color: var(--accent-orange);
}

.manual-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.morse-btn {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.morse-btn:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    transform: translateY(-2px);
}

.submit-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.clear-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.game-controls {
    text-align: center;
    margin-top: 2rem;
}

.level-complete-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .welcome-container {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .intro-text p {
        font-size: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .game-layout {
        flex-direction: column;
    }
    
    .level-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
    }
    
    .level-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .level-menu-item {
        min-width: 100px;
        text-align: center;
    }
    
    .game-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-info {
        justify-content: space-between;
    }
    
    .keyboard-row {
        gap: 0.5rem;
    }
    
    .key {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .mode-selection {
        grid-template-columns: 1fr;
    }
    
    .level-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .letter-showcase {
        flex-direction: column;
        align-items: center;
    }
}

/* AdSense Advertisement Styles - Fixed Bottom Banner */
.ad-banner-bottom {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 15px var(--shadow-medium);
    padding: 0.3rem;
    text-align: center;
    transition: all 0.3s ease;

    /* Force AdSense to behave */
    max-width: 728px !important;
    width: 90% !important;
    max-height: 90px !important;
    overflow: hidden !important;
}

.ad-banner-bottom .adsbygoogle {
    max-width: 728px !important;
    max-height: 90px !important;
    width: 100% !important;
    height: auto !important;
}

.ad-banner-bottom:hover {
    box-shadow: 0 4px 20px var(--shadow-medium);
}

@media (max-width: 768px) {
    .ad-banner-bottom {
        max-width: 320px !important;
        width: 95% !important;
        max-height: 50px !important;
        padding: 0.2rem;
        bottom: 5px;
    }

    .ad-banner-bottom .adsbygoogle {
        max-width: 320px !important;
        max-height: 50px !important;
    }
}