:root {
    /* Light mode (default) */
    --bg-color: #f8f9fa;
    --text-color: #333;
    --container-bg: white;
    --card-bg: #f8f9fa;
    --border-color: #e9ecef;
    --highlight-color: #3498db;
    --accent-color: #2ecc71;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --hint-bg: #e8f4f8;
    --tip-bg: #eafaf1;
    --code-bg: #f1f3f5;
    --button-bg: #3498db;
    --button-hover: #2980b9;
    --button-text: white;
    --nav-bg: #f1f3f5;
    --nav-text: #333;
    --input-bg: white;
    --secondary-text-color: #6c757d;
    --secondary-bg-color: #f1f3f5;
    --active-bg: #e8f4f8;
    --card-radius: 12px;
    --button-radius: 8px;
    --input-radius: 8px;
}

[data-theme="dark"] {
    /* Dark mode */
    --bg-color: #212529;
    --text-color: #f8f9fa;
    --container-bg: #343a40;
    --card-bg: #495057;
    --border-color: #495057;
    --highlight-color: #4dabf7;
    --accent-color: #51cf66;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --success-color: #51cf66;
    --error-color: #ff6b6b;
    --hint-bg: #364fc7;
    --tip-bg: #2b8a3e;
    --code-bg: #495057;
    --button-bg: #4dabf7;
    --button-hover: #339af0;
    --button-text: white;
    --nav-bg: #343a40;
    --nav-text: #f8f9fa;
    --input-bg: #495057;
    --secondary-text-color: #adb5bd;
    --secondary-bg-color: #495057;
    --active-bg: #364fc7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px 20px;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.8em;
    color: var(--text-color);
    line-height: 1.3;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
}

h2 {
    font-size: 1.8rem;
}

h3 {
    font-size: 1.4rem;
}

p {
    margin-bottom: 1rem;
}

/* Modern Navigation */
.main-nav {
    margin-bottom: 30px;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    background-color: var(--nav-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.main-nav li {
    flex: 1;
    text-align: center;
}

.main-nav a {
    display: block;
    padding: 15px 20px;
    color: var(--nav-text);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.main-nav a:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.main-nav a.active {
    background-color: var(--highlight-color);
    color: white;
}

/* Mode/Training Selectors */
.mode-selector, .training-mode-selector, .character-selector {
    background-color: var(--container-bg);
    padding: 20px;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 15px var(--shadow-color);
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s;
}

.mode-selector {
    flex-direction: row;
    justify-content: center;
}

.selector-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.mode-btn {
    padding: 12px 24px;
    margin: 0 10px;
    border: none;
    border-radius: var(--button-radius);
    background-color: var(--nav-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 0.95rem;
}

.mode-btn:hover {
    background-color: var(--button-hover);
    color: white;
}

.mode-btn.active {
    background-color: var(--highlight-color);
    color: white;
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3);
}

.checkbox-group, .radio-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 10px 15px;
    background-color: var(--card-bg);
    border-radius: var(--button-radius);
    transition: all 0.3s;
}

.checkbox-label:hover, .radio-label:hover {
    background-color: var(--active-bg);
}

.checkbox-label input, .radio-label input {
    margin-right: 10px;
    cursor: pointer;
}

/* Training Area & Challenge */
.training-area, .challenge-area, .content-section {
    background-color: var(--container-bg);
    padding: 25px;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 15px var(--shadow-color);
    margin-bottom: 30px;
    transition: all 0.3s;
}

#challenge, #challenge-question, .practice-challenge {
    font-size: 30px;
    text-align: center;
    margin-bottom: 20px;
    min-height: 45px;
    font-weight: 500;
}

#morse-display, #challenge-morse-display, .practice-morse, .display-morse {
    font-size: 25px;
    text-align: center;
    margin-bottom: 25px;
    min-height: 36px;
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
    color: var(--highlight-color);
    font-weight: 600;
}

.controls {
    display: flex;
    justify-content: center;
    margin: 25px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.control-btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--button-radius);
    background-color: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-weight: 500;
}

.control-btn:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

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

.control-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Input Area */
.input-area {
    display: flex;
    margin: 20px 0;
}

.UserIn, #challenge-input {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--input-radius) 0 0 var(--input-radius);
    font-size: 16px;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s;
}

.UserIn:focus, #challenge-input:focus {
    outline: none;
    border-color: var(--highlight-color);
}

.submit-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 0 var(--input-radius) var(--input-radius) 0;
    background-color: var(--success-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.submit-btn:hover {
    background-color: #27ae60;
}

#feedback, #challenge-feedback, #practice-feedback {
    text-align: center;
    min-height: 24px;
    font-weight: 600;
    margin: 15px 0;
    padding: 10px;
    border-radius: var(--input-radius);
    transition: all 0.3s;
}

.correct {
    color: var(--success-color);
    background-color: rgba(46, 204, 113, 0.1);
}

.incorrect {
    color: var(--error-color);
    background-color: rgba(231, 76, 60, 0.1);
}

/* Reference Table */
.morse-reference {
    background-color: var(--container-bg);
    padding: 25px;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 15px var(--shadow-color);
}

.morse-reference h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

/* Reference Table - Verbesserte Styles */
.morse-reference, .table-container {
    background-color: var(--container-bg);
    padding: 25px;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 15px var(--shadow-color);
    margin-bottom: 25px;
}

.morse-reference h3, .category-section h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.4rem;
    position: relative;
    color: var(--highlight-color);
    padding-bottom: 8px;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.morse-reference h3:after, .category-section h3:after {
    content: "";
    position: absolute;
    width: 50%;
    height: 3px;
    background: var(--highlight-color);
    bottom: 0;
    left: 25%;
    border-radius: 2px;
}

/* Kategorie-Sektionen untereinander anordnen */
.category-section {
    margin-bottom: 30px;
    width: 100%;
    display: block;
}

#reference-table, #learn-reference-table {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.reference-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px dashed var(--border-color);
}

.reference-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.category-title {
    grid-column: 1 / -1;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--highlight-color);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
}

.reference-item {
    text-align: center;
    padding: 15px 10px;
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    transition: all 0.3s;
    box-shadow: 0 3px 8px var(--shadow-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
    border: 1px solid transparent;
}

.reference-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-color);
    border-color: var(--highlight-color);
    z-index: 1;
}

.reference-char {
    font-weight: bold;
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.reference-morse {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    color: var(--highlight-color);
    font-size: 18px;
    font-weight: 600;
}

.learn-play-btn {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 5px 10px;
    border-radius: var(--button-radius);
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.learn-play-btn:hover {
    background-color: var(--button-hover);
    transform: scale(1.05);
}

/* Kategorie-Farben für die Referenz-Items */
.reference-item.alphabet {
    border-top: 3px solid var(--highlight-color);
}

.reference-item.digit {
    border-top: 3px solid var(--accent-color);
}

.reference-item.special {
    border-top: 3px solid var(--error-color);
}

/* Learning Pages Elements */
.basic-elements {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    margin: 25px 0;
    gap: 20px;
}

.element-card, .method-card, .char-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: all 0.3s;
    flex: 1;
    min-width: 250px;
}

.element-card:hover, .method-card:hover, .char-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.element-card h3, .method-card h3 {
    margin-bottom: 15px;
    color: var(--highlight-color);
}

.play-btn, .learn-play-btn {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 8px 15px;
    border-radius: var(--button-radius);
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s;
}

.play-btn:hover, .learn-play-btn:hover {
    background-color: var(--button-hover);
}

.learning-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    margin-top: 20px;
}

.method-card ul {
    margin-left: 20px;
}

.char-card-letter {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var (--highlight-color);
}

.char-card-morse {
    font-family: monospace;
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 15px;
}

/* Interactive Characters */
.interactive-example {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--card-radius);
    margin-top: 25px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

#interactive-chars {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
    justify-content: center;
}

.char-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    background-color: var(--container-bg);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    transition: all 0.3s;
}

.char-btn:hover {
    background-color: var(--active-bg);
    transform: translateY(-2px);
}

.char-btn.active {
    background-color: var(--highlight-color);
    color: white;
    border-color: var(--highlight-color);
}

#selected-char-display {
    display: flex;
    align-items: center;
    margin: 20px 0;
    font-size: 20px;
    padding: 15px;
    background-color: var(--active-bg);
    border-radius: var(--card-radius);
}

.selected-char {
    font-weight: bold;
    font-size: 30px;
    margin-right: 20px;
    color: var(--highlight-color);
}

.selected-morse {
    font-family: monospace;
    letter-spacing: 3px;
    font-size: 22px;
}

/* Guide Elements */
.guide-intro p {
    margin-bottom: 20px;
    line-height: 1.7;
    font-size: 1.05rem;
}

.progress-container {
    margin: 30px 0;
    text-align: center;
}

.progress-bar {
    height: 20px;
    background-color: var(--card-bg);
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

#progress-indicator {
    height: 100%;
    background-color: var(--success-color);
    border-radius: 10px;
    transition: width 0.5s;
}

.progress-text {
    font-weight: 600;
    margin-top: 8px;
    color: var(--secondary-text-color);
}

.guide-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.lesson-title {
    margin: 0;
}

.lesson-level {
    background-color: var(--highlight-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.lesson-content {
    margin-bottom: 25px;
}

.chars-to-learn {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    margin: 25px 0;
}

.lesson-hint, .lesson-tip {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: var(--card-radius);
    position: relative;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.lesson-hint {
    background-color: var(--hint-bg);
    border-left: 5px solid var(--highlight-color);
}

.lesson-tip {
    background-color: var(--tip-bg);
    border-left: 5px solid var(--success-color);
}

.learned-chars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 12px;
    margin-top: 25px;
}

.learned-char-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.3s;
}

.learned-char-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow-color);
    background-color: var(--active-bg);
}

.learned-char-letter {
    font-weight: bold;
    font-size: 20px;
    margin-bottom: 5px;
    color: var(--highlight-color);
}

.learned-char-morse {
    font-family: monospace;
    font-size: 14px;
}

/* Learning Mode Selector */
.learning-mode-selector {
    margin: 30px 0;
}

.learning-mode-selector h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-color);
}

.mode-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
}

.mode-option {
    cursor: pointer;
    user-select: none;
}

.mode-option input {
    display: none;
}

.mode-card {
    width: 240px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.mode-option input:checked + .mode-card {
    border-color: var(--highlight-color);
    background-color: var(--active-bg);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.2);
}

.mode-icon {
    font-size: 32px;
    margin-bottom: 15px;
    color: var(--highlight-color);
    font-weight: bold;
}

.mode-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-color);
}

.mode-desc {
    font-size: 14px;
    color: var(--secondary-text-color);
    line-height: 1.5;
}

/* Challenge Page Elements */
.challenge-setup {
    background-color: var(--container-bg);
    padding: 25px;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 15px var(--shadow-color);
    margin-bottom: 30px;
}

.challenge-setup h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-color);
}

.difficulty-selector, .challenge-type-selector {
    display: flex;
    flex-direction: column;
    margin-bottom: 25px;
    gap: 12px;
}

.challenge-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }
    
    .mode-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .mode-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .mode-options {
        flex-direction: column;
        align-items: center;
    }
    
    .chars-to-learn {
        flex-direction: column;
    }
    
    .guide-controls {
        flex-direction: column;
    }
    
    .reference-item {
        width: 70px;
    }
    
    .lesson-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .lesson-level {
        align-self: center;
    }
}

/* Darkmode toggle styles */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 8px 15px;
    z-index: 1000;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: all 0.3s;
}

.dark-mode-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.dark-mode-toggle i {
    font-size: 18px;
    margin-right: 8px;
    color: var(--highlight-color);
}

/* Lesson Navigation */
.lesson-navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    gap: 15px;
}

.skip-review-option {
    margin: 5px 0;
}

.lesson-select-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}

.lesson-select {
    padding: 8px 12px;
    border-radius: var(--input-radius);
    border: 2px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    transition: all 0.3s;
}

.lesson-select:focus {
    outline: none;
    border-color: var(--highlight-color);
}

#go-to-lesson {
    padding: 8px 15px;
    font-size: 14px;
}

/* Practice note */
.practice-note {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    margin-bottom: 20px;
    padding: 12px 15px;
    background-color: var(--secondary-bg-color);
    border-radius: var(--card-radius);
    border-left: 3px solid var(--highlight-color);
}

/* Review components */
.review-question {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--card-radius);
    margin: 25px 0;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.review-progress {
    margin-top: 15px;
    font-size: 14px;
    color: var(--secondary-text-color);
}

.review-summary {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--card-radius);
    margin: 25px 0;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.review-summary h3 {
    margin-bottom: 20px;
    color: var(--highlight-color);
}

#start-review, #finish-review {
    display: block;
    margin: 25px auto;
    padding: 12px 25px;
    font-size: 16px;
}

.highlight-next {
    background-color: var(--success-color) !important;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* Animations und Übergänge für moderne UI */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Verbesserungen für Touch-Geräte */
@media (hover: none) {
    .control-btn:hover,
    .mode-btn:hover,
    .element-card:hover,
    .method-card:hover,
    .char-card:hover,
    .char-btn:hover,
    .mode-card:hover,
    .reference-item:hover,
    .learned-char-item:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Verbesserter Kontrast im Dark Mode */
[data-theme="dark"] .lesson-hint {
    background-color: rgba(54, 79, 199, 0.3);
}

[data-theme="dark"] .lesson-tip {
    background-color: rgba(43, 138, 62, 0.3);
}

/* Verbessertes Input Handling */
.UserIn:focus, 
#challenge-input:focus, 
#practice-input:focus,
.lesson-select:focus {
    border-color: var(--highlight-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}

/* Tastaturbenutzer-Fokus-Styles */
:focus-visible {
    outline: 3px solid var(--highlight-color);
    outline-offset: 2px;
}

/* Performance-Optimierungen */
.training-area, 
.content-section, 
.char-btn, 
.reference-item,
.method-card,
.char-card {
    will-change: transform;
}

/* Verbesserte Darstellung auf kleinen Geräten */
@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .control-btn, 
    .mode-btn, 
    .submit-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .reference-item {
        width: 60px;
        padding: 8px;
    }
    
    .dark-mode-toggle {
        top: 10px;
        right: 10px;
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    .dark-mode-toggle i {
        font-size: 14px;
    }
    
    .controls {
        gap: 8px;
    }
    
    #interactive-chars {
        gap: 5px;
    }
    
    .char-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Touch-optimierte Stile für mobile Geräte */
.touch-active {
    transform: scale(0.95) !important;
    box-shadow: 0 1px 3px var(--shadow-color) !important;
    transition: transform 0.1s, box-shadow 0.1s !important;
}

/* Morse-Tastatur für Touch-Geräte */
.morse-keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--container-bg);
    border-top: 2px solid var(--border-color);
    padding: 15px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s;
}

/* Große Touch-Pads für Morse-Eingabe */
.morse-touch-pads {
    display: flex;
    margin-bottom: 15px;
    height: 150px;
    gap: 15px;
}

.morse-touch-pad {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--card-radius);
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.morse-touch-pad.dot-pad {
    background-color: var(--highlight-color);
}

.morse-touch-pad.dash-pad {
    background-color: var(--accent-color);
}

.morse-touch-pad .pad-symbol {
    font-size: 60px;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
}

.morse-touch-pad .pad-label {
    font-size: 18px;
    color: white;
    font-weight: bold;
}

.morse-touch-pad.touch-active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Container für die regulären Morse-Tasten */
.morse-keys-container {
    display: flex;
    justify-content: space-between;
}

/* Reguläre Morse-Tasten */
.morse-key {
    flex: 1;
    padding: 15px 0;
    margin: 0 5px;
    border: none;
    border-radius: var(--button-radius);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

/* Verbesserte Mobile-Anpassungen für die Morse-Eingabe */
@media (max-width: 768px) {
    .morse-touch-pads {
        height: 120px;
    }
    
    .morse-touch-pad .pad-symbol {
        font-size: 48px;
    }
    
    .morse-key {
        padding: 15px 0;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .morse-touch-pads {
        height: 100px;
    }
    
    .morse-touch-pad .pad-symbol {
        font-size: 36px;
    }
    
    .morse-key {
        padding: 12px 0;
        font-size: 18px;
    }
}

/* Verbesserte Morse-Tastatur für Touch-Geräte */
.morse-keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--container-bg);
    border-top: 2px solid var(--border-color);
    padding: 10px 15px 20px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Header für die Morse-Tastatur */
.morse-keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.morse-keyboard-title {
    font-weight: bold;
    color: var(--highlight-color);
    font-size: 0.9rem;
}

.morse-keyboard-close {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    line-height: 1;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: var(--button-radius);
    transition: background-color 0.2s;
}

.morse-keyboard-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Container für die Eingabe-Anzeige */
.morse-display-container {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--input-radius);
    padding: 8px 12px;
    margin-bottom: 12px;
    min-height: 24px;
    text-align: center;
}

.morse-input-display {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    color: var(--highlight-color);
    word-break: break-all;
    letter-spacing: 1px;
}

/* Große Touch-Pads für Morse-Eingabe */
.morse-touch-pads {
    display: flex;
    margin-bottom: 12px;
    height: 130px;
    gap: 12px;
}

.morse-touch-pad {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--card-radius);
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.morse-touch-pad.dot-pad {
    background-color: var(--highlight-color);
}

.morse-touch-pad.dash-pad {
    background-color: var(--accent-color);
}

.morse-touch-pad .pad-symbol {
    font-size: 60px;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.morse-touch-pad .pad-label {
    font-size: 16px;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.morse-touch-pad.touch-active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* Effekt für langes Drücken */
.morse-touch-pad.long-press::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: inherit;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

/* Container für die regulären Morse-Tasten */
.morse-keys-container {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

/* Reguläre Morse-Tasten */
.morse-key {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-radius: var(--button-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--secondary-bg-color);
    color: var(--text-color);
}

.morse-key.space-key {
    flex: 2;
}

.morse-key.submit-key {
    background-color: var(--success-color);
    color: white;
}

.morse-key.delete-key {
    background-color: var(--error-color);
    color: white;
}

.morse-key.touch-active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Animationen für die Tastatur */
.keyboard-visible {
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.keyboard-hidden {
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Allgemeine Touch-Verbesserungen */
.touch-device button,
.touch-device .char-btn,
.touch-device .reference-item,
.touch-device .control-btn,
.touch-device .mode-btn {
    -webkit-tap-highlight-color: transparent;
}

.touch-device input[type="text"],
.touch-device input[type="email"],
.touch-device input[type="search"] {
    font-size: 16px; /* Verhindert Zoom auf iOS */
}

/* Verbesserte Rückmeldung bei Touch-Input */
input.touch-input-active {
    border-color: var(--highlight-color) !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3) !important;
}

/* Verbesserte Medienabfragen für verschiedene Geräte */
@media (max-width: 480px) {
    .morse-touch-pads {
        height: 110px;
    }
    
    .morse-touch-pad .pad-symbol {
        font-size: 48px;
    }
    
    .morse-key {
        padding: 10px 0;
        font-size: 14px;
    }
    
    .morse-display-container {
        padding: 6px 10px;
    }
    
    .morse-input-display {
        font-size: 16px;
    }
}

/* Extra kleine Bildschirme */
@media (max-width: 320px) {
    .morse-touch-pads {
        height: 90px;
    }
    
    .morse-touch-pad .pad-symbol {
        font-size: 40px;
        margin-bottom: 5px;
    }
    
    .morse-touch-pad .pad-label {
        font-size: 14px;
    }
    
    .morse-key {
        padding: 8px 0;
        font-size: 13px;
    }
}

/* Druckbare Zeichen für die Morse-Tasten */
.morse-key.submit-key::before {
    content: "\2713"; /* Checkmark */
    display: inline-block;
    margin-right: 5px;
}

.morse-key.delete-key::before {
    content: "\232B"; /* Backspace */
    display: inline-block;
    margin-right: 5px;
}
