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

#effectsCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

body {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100dvh; /* Use dynamic viewport height to account for mobile browser UI */
    overflow: hidden;
    padding: clamp(2rem, 5dvh, 4rem);
}

.container {
    background: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: clamp(15px, 3vmin, 30px);
    overflow: hidden;
    box-shadow: 0 clamp(10px, 2vh, 20px) clamp(30px, 5vh, 60px) rgba(0, 0, 0, 0.3);
}

header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: clamp(1rem, 3vh, 2rem);
    text-align: center;
    position: relative;
    flex-shrink: 0;
}

h1 {
    color: white;
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.case-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: clamp(1rem, 3vw, 2rem);
    background: white;
    border: none;
    border-radius: 15px;
    padding: clamp(0.5rem, 1.5vh, 1rem) clamp(0.8rem, 2vw, 1.5rem);
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.3s;
}

.case-toggle:hover {
    transform: translateY(-50%) scale(1.05);
    background-color: #fff3cd;
}

.case-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 3px solid #dee2e6;
    flex-shrink: 0;
}

.tab-button {
    flex: 1;
    padding: clamp(0.8rem, 2vh, 1.5rem) clamp(0.5rem, 1vw, 1rem);
    background: transparent;
    border: none;
    font-size: clamp(0.85rem, 2vw, 1.3rem);
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab-button:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-button.active {
    color: #f5576c;
    background: white;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: #f5576c;
}

main {
    flex: 1;
    overflow: auto;
    padding: clamp(1rem, 2vh, 2rem);
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.display-area {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 20px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    margin-top: clamp(0.5rem, 2vh, 1.5rem);
    min-height: 0;
}

.display-area:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.display-area:active {
    transform: translateY(-2px);
}

.letter-display {
    font-size: 4rem; /* Default fallback, will be overridden by JavaScript */
    font-weight: bold;
    color: #333;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
    user-select: none;
    animation: fadeIn 0.3s ease-in;
    line-height: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.consonants-selector {
    background: #f8f9fa;
    border-radius: 15px;
    padding: clamp(1rem, 2vh, 1.5rem);
    flex-shrink: 0;
}

.consonants-selector h3 {
    color: #495057;
    margin-bottom: clamp(0.8rem, 2vh, 1.2rem);
    font-size: clamp(1rem, 2vw, 1.3rem);
}

.consonants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(40px, 8vw, 60px), 1fr));
    gap: clamp(0.4rem, 1vw, 0.8rem);
}

.consonant-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.2rem, 0.5vh, 0.4rem);
}

.consonant-item input[type="checkbox"] {
    width: clamp(16px, 3vw, 20px);
    height: clamp(16px, 3vw, 20px);
    cursor: pointer;
}

.consonant-item label {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-weight: bold;
    color: #495057;
    cursor: pointer;
    user-select: none;
}

.consonant-item input[type="checkbox"]:checked + label {
    color: #f5576c;
}

.slider-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: clamp(1rem, 2vh, 1.5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.8rem, 2vh, 1.2rem);
    flex-shrink: 0;
}

.slider-container label {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: #495057;
    font-weight: bold;
}

input[type="range"] {
    width: min(100%, 400px);
    height: 8px;
    border-radius: 5px;
    background: #dee2e6;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #f5576c;
    cursor: pointer;
    transition: transform 0.2s;
}

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

input[type="range"]::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #f5576c;
    cursor: pointer;
    border: none;
}

#sliderValue {
    font-size: clamp(1.3rem, 3vw, 2rem);
    color: #f5576c;
}
