* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Fredoka One', 'Nunito', 'Comic Neue', 'Comic Sans MS', 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 30px;
    padding: 30px;
    max-width: 1100px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2.5em;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Reduce font size for tablet 7 inch */
@media (min-width: 1024px) and (max-width: 1200px) and (orientation: landscape) {
    h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    min-height: 600px;
}

/* Universal Landscape Layout */
@media (orientation: landscape) and (min-width: 768px) {
    body {
        overflow: hidden;
        padding: 10px;
    }

    .container {
        max-width: 100%;
        height: calc(100vh - 40px);
        overflow: visible;
    }

    .main-content {
        height: calc(100% - 80px);
        align-items: stretch;
        min-height: 0;
        overflow: visible;
    }

    .keyboard {
        box-sizing: border-box;
        margin: 0;
        padding: 0 0 15px 0;
    }

    .key {
        box-sizing: border-box;
        margin: 0;
    }

    .center-section {
        overflow: visible;
    }
}

.center-section {
    flex: 1;
    width: 100%;
    overflow: visible;
    min-width: 0;
}

.color-palette-left,
.color-palette-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
}

.color-palette-left {
    order: 0;
}

.color-palette-right {
    order: 2;
}

.color-option {
    width: 50px;
    height: 50px;
    border: 3px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    background-color: #FF6B6B;
    background-image: none !important;
}

.color-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
}

.color-option:hover::before {
    width: 100%;
    height: 100%;
}

.color-option:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.color-option.active {
    transform: scale(1.25);
    border-color: #fff;
    box-shadow: 0 0 0 3px #6C5CE7, 0 5px 20px rgba(0, 0, 0, 0.4);
    animation: pulse 2s infinite;
    z-index: 100;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px #6C5CE7, 0 5px 20px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 0 5px #A29BFE, 0 5px 25px rgba(0, 0, 0, 0.5);
    }
}

.display-area {
    background: rgb(64, 64, 64);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    cursor: pointer;
}

.display-area:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.display-area:active {
    transform: scale(0.98);
}

.capslock-btn {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    font-family: 'Nunito', 'Comic Neue', sans-serif;
    z-index: 10;
}

.capslock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

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

.capslock-btn.active {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    animation: pulse 2s infinite;
}

.display-area::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
}

.big-letter {
    font-size: 12em;
    font-weight: bold;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    animation: bounce 0.8s ease-in-out;
    color: #6C5CE7;
    display: inline-block;
    padding: 20px;
    border-radius: 20px;
    margin: 10px;
    position: relative;
    overflow: visible;
    filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3));
    z-index: 1;
    user-select: none;
    cursor: pointer;
}

.pronunciation {
    font-size: 2em;
    color: #636e72;
    margin-top: 10px;
    font-family: 'Nunito', 'Comic Neue', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.15) rotate(-3deg);
    }
    75% {
        transform: scale(1.15) rotate(3deg);
    }
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f0f0;
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.toggle-label {
    font-size: 1.1em;
    font-weight: bold;
    color: #2d3436;
    font-family: 'Nunito', 'Comic Neue', sans-serif;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    background: #ccc;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-switch.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(30px);
}

.toggle-text {
    font-size: 1.3em;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0 0 20px 0;
    width: 100%;
    box-sizing: border-box;
}

.key {
    padding: 22px;
    font-size: 1.8em;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: white;
    position: relative;
    overflow: hidden;
    font-family: 'Nunito', 'Comic Neue', sans-serif;
    margin: 0;
    box-sizing: border-box;
}

.key::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.key:active::before {
    width: 300px;
    height: 300px;
}

.key:active {
    transform: scale(0.95);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

.key:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Warna-warni untuk keyboard ABC & Angka */
.key.color-1 { background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%); }
.key.color-2 { background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%); }
.key.color-3 { background: linear-gradient(135deg, #FFE66D 0%, #FFBE0B 100%); color: #333; }
.key.color-4 { background: linear-gradient(135deg, #A8E6CF 0%, #56C596 100%); }
.key.color-5 { background: linear-gradient(135deg, #FF8B94 0%, #FF6F7D 100%); }
.key.color-6 { background: linear-gradient(135deg, #95E1D3 0%, #38A3A5 100%); }
.key.color-7 { background: linear-gradient(135deg, #F3A683 0%, #F08A5D 100%); }
.key.color-8 { background: linear-gradient(135deg, #C7CEEA 0%, #9FA8DA 100%); }
.key.color-9 { background: linear-gradient(135deg, #FFDAC1 0%, #FFAAA5 100%); }
.key.color-10 { background: linear-gradient(135deg, #B8E6B8 0%, #7ED957 100%); }
.key.color-11 { background: linear-gradient(135deg, #FFB6D9 0%, #FF85B3 100%); }
.key.color-12 { background: linear-gradient(135deg, #D4A5A5 0%, #B68888 100%); }
.key.color-13 { background: linear-gradient(135deg, #A2D2FF 0%, #6AAEFF 100%); }

.sound-btn {
    margin: 30px auto 20px;
    display: block;
    padding: 18px 50px;
    font-size: 1.5em;
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    font-family: 'Nunito', 'Comic Neue', sans-serif;
}

.sound-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

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

.mute-btn {
    padding: 18px 40px;
    font-size: 1.5em;
    background: linear-gradient(135deg, #636e72 0%, #2d3436 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    min-width: 180px;
}

.mute-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

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

.mute-btn.muted {
    background: linear-gradient(135deg, #d63031 0%, #74b9ff 100%);
}

/* Floating buttons for mobile and easy access */

.mute-btn.floating, .fullscreen-btn.small.floating {
    position: fixed !important;
    z-index: 9999;
    padding: 12px 16px;
    font-size: 1.2em;
    min-width: auto;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: none !important;
}

.mute-btn.floating {
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
}

.fullscreen-btn.small.floating {
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #00cec9 0%, #55a3ff 100%);
}

.mute-btn.floating:hover, .fullscreen-btn.small.floating:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.mute-btn.floating:active, .fullscreen-btn.small.floating:active {
    transform: scale(0.95) !important;
}

.fullscreen-btn {
    padding: 18px 40px;
    font-size: 1.5em;
    background: linear-gradient(135deg, #00cec9 0%, #55a3ff 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    min-width: 180px;
    font-family: 'Nunito', 'Comic Neue', sans-serif;
}

.fullscreen-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

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

.fullscreen-btn.fullscreen {
    background: linear-gradient(135deg, #e17055 0%, #fdcb6e 100%);
}

.score {
    text-align: center;
    font-size: 1.5em;
    color: #2d3436;
    margin-top: 20px;
    font-weight: bold;
    font-family: 'Nunito', 'Comic Neue', sans-serif;
    display: none;
}

.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5em;
    animation: pop 0.5s;
    pointer-events: none;
    z-index: 1000;
}

@keyframes pop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Universal Responsive Layout - Single Screen */
@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .container {
        padding: 15px;
        max-width: 100%;
        width: 100%;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 8px;
    }

    .main-content {
        flex-direction: column;
        gap: 12px;
        height: auto;
        min-height: auto;
    }

    .color-palette-left,
    .color-palette-right {
        flex-direction: row;
        order: 3;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .center-section {
        order: 1;
        min-width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .color-option {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
        border-width: 2px;
    }

    .big-letter {
        font-size: 5em;
        padding: 10px;
        margin: 5px;
        border-radius: 15px;
    }

    .pronunciation {
        font-size: 1.3em;
        margin-top: 5px;
    }

    .display-area {
        padding: 20px;
        min-height: 180px;
        margin-bottom: 15px;
    }

    .capslock-btn {
        padding: 8px 16px;
        font-size: 1em;
    }

    .key {
        padding: 12px;
        font-size: 1.3em;
    }

    .keyboard {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 6px;
        margin: 0;
        padding: 0 0 15px 0;
    }

    .score {
        font-size: 1.1em;
        margin-top: 10px;
    }

    /* Mobile: Use floating buttons */
    .controls .mute-btn {
        display: none !important;
    }

    .mute-btn.floating, .fullscreen-btn.small.floating {
        display: block !important;
        top: 10px;
        padding: 8px 12px;
        font-size: 1em;
    }

    .mute-btn.floating {
        left: 10px;
    }

    .fullscreen-btn.small.floating {
        right: 10px;
    }
}

@media (min-width: 1601px) and (orientation: landscape) {
    body {
        padding: 20px;
        overflow: hidden;
    }

    .container {
        padding: 30px;
        max-width: 100%;
        height: calc(100vh - 40px);
        overflow: visible;
    }

    .main-content {
        flex-direction: row;
        gap: 25px;
        height: 100%;
        overflow: visible;
    }

    .center-section {
        overflow: visible;
    }

    .color-palette-left,
    .color-palette-right {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .color-option {
        width: 55px;
        height: 55px;
    }

    .center-section {
        display: flex;
        flex-direction: column;
        gap: 20px;
        flex: 1;
    }

    .display-area {
        margin-bottom: 20px;
        min-height: 250px;
        padding: 40px;
    }

    .big-letter {
        font-size: 12em;
        padding: 20px;
        margin: 10px;
    }

    .pronunciation {
        font-size: 2.2em;
    }

    .keyboard {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 10px;
        width: 100%;
        margin: 0;
        padding: 0 0 20px 0;
    }

    .key {
        padding: 18px;
        font-size: 1.8em;
        margin: 0;
        box-sizing: border-box;
    }

    .capslock-btn {
        padding: 12px 25px;
        font-size: 1.2em;
    }
}

@media (min-width: 1201px) and (max-width: 1600px) and (orientation: landscape) {
    body {
        padding: 15px;
        overflow: hidden;
    }

    .container {
        padding: 25px;
        max-width: 100%;
        height: calc(100vh - 50px);
        overflow: visible;
    }

    .main-content {
        flex-direction: row;
        gap: 20px;
        height: 100%;
        overflow: visible;
    }

    .center-section {
        overflow: visible;
    }

    .color-palette-left,
    .color-palette-right {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .color-option {
        width: 50px;
        height: 50px;
    }

    .center-section {
        display: flex;
        flex-direction: column;
        gap: 15px;
        flex: 1;
    }

    .display-area {
        margin-bottom: 10px;
        min-height: 220px;
        padding: 30px;
    }

    .big-letter {
        font-size: 11em;
        padding: 18px;
        margin: 8px;
    }

    .pronunciation {
        font-size: 2em;
    }

    .keyboard {
        grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
        gap: 8px;
        width: 100%;
        margin: 0;
        padding: 0 0 15px 0;
    }

    .key {
        padding: 15px;
        font-size: 1.6em;
        margin: 0;
        box-sizing: border-box;
    }

    .capslock-btn {
        padding: 10px 22px;
        font-size: 1.1em;
    }
}

@media (min-width: 769px) and (orientation: portrait) {
    body {
        padding: 10px;
    }

    .container {
        max-width: 100%;
        width: 100%;
        padding: 20px;
    }

    .main-content {
        flex-direction: row;
        gap: 15px;
        height: calc(100vh - 180px);
    }

    .color-palette-left,
    .color-palette-right {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        flex-shrink: 0;
    }

    .color-option {
        width: 40px;
        height: 40px;
        border-width: 2px;
    }

    .center-section {
        display: flex;
        flex-direction: column;
        gap: 15px;
        flex: 1;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 15px;
    }

    .display-area {
        min-height: 220px;
        padding: 30px;
        margin-bottom: 15px;
    }

    .big-letter {
        font-size: 8em;
        padding: 12px;
        margin: 5px;
    }

    .pronunciation {
        font-size: 1.8em;
    }

    .keyboard {
        grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
        gap: 8px;
        margin: 0;
        padding: 0 0 15px 0;
    }

    .key {
        padding: 14px;
        font-size: 1.4em;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .capslock-btn {
        padding: 8px 18px;
        font-size: 1em;
    }

    .controls .sound-btn, .controls .mute-btn {
        display: none !important;
    }

    .control-btn-floating, .mute-btn.floating, .fullscreen-btn.small.floating {
        display: flex !important;
    }

    .mute-btn.floating, .fullscreen-btn.small.floating {
        top: 15px;
        padding: 10px 14px;
        font-size: 1.1em;
    }

    .mute-btn.floating {
        left: 15px;
    }

    .fullscreen-btn.small.floating {
        right: 15px;
    }
}

@media (min-width: 769px) and (orientation: landscape) and (max-width: 1024px) {
    .color-palette-left,
    .color-palette-right {
        flex-direction: column;
        gap: 6px;
        padding: 5px;
        flex-shrink: 0;
    }

    .color-option {
        width: 35px;
        height: 35px;
        border-width: 2px;
    }

    .center-section {
        display: flex;
        flex-direction: column;
        gap: 5px;
        flex: 1;
        align-items: stretch;
        min-height: 0;
        overflow: visible;
    }

    .display-area {
        margin-bottom: 5px;
        min-height: 180px;
        padding: 15px;
        overflow: visible;
    }

    .big-letter {
        font-size: 8em;
        padding: 10px;
        margin: 3px;
        overflow: visible;
    }

    .pronunciation {
        font-size: 1.5em;
    }

    .keyboard {
        grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
        gap: 5px;
        width: 100%;
        margin: 0;
        padding: 0 0 5px 0;
        min-height: 0;
        overflow: visible;
    }

    .key {
        padding: 8px;
        font-size: 1.3em;
        border-radius: 10px;
        margin: 0;
        box-sizing: border-box;
    }

    .capslock-btn {
        padding: 5px 12px;
        font-size: 0.9em;
        border-radius: 15px;
    }

    .mute-btn.floating, .fullscreen-btn.small.floating {
        top: 10px;
        padding: 8px 12px;
        font-size: 1em;
    }

    .mute-btn.floating {
        left: 10px;
    }

    .fullscreen-btn.small.floating {
        right: 10px;
    }

    /* Scale down hover effects for tablet */
    .display-area:hover {
        transform: scale(1.005);
    }

    .display-area:active {
        transform: scale(0.985);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .main-content {
        gap: 8px;
    }

    .big-letter {
        font-size: 6em;
        padding: 10px;
        margin: 5px;
        border-radius: 15px;
    }

    .display-area:hover {
        transform: scale(1.005);
    }

    .display-area:active {
        transform: scale(0.985);
    }

    .color-option {
        width: 35px;
        height: 35px;
    }

    .key {
        padding: 12px;
        font-size: 1.3em;
    }

    .sound-btn {
        margin: 20px auto 15px;
        padding: 12px 30px;
        font-size: 1.2em;
    }

    .mute-btn {
        padding: 12px 30px;
        font-size: 1.2em;
    }

    .controls {
        gap: 10px;
    }

    .toggle-container {
        padding: 6px 12px;
    }

    .toggle-label {
        font-size: 0.9em;
    }

    .toggle-switch {
        width: 50px;
        height: 26px;
    }

    .toggle-slider {
        width: 20px;
        height: 20px;
    }

    .toggle-switch.active .toggle-slider {
        transform: translateX(24px);
    }

    .toggle-text {
        font-size: 1em;
    }


    .capslock-btn {
        padding: 8px 15px;
        font-size: 1em;
    }

  .mute-btn.floating, .fullscreen-btn.small.floating {
        top: 10px;
        padding: 8px 12px;
        font-size: 1em;
    }

    .mute-btn.floating {
        left: 10px;
    }

    .fullscreen-btn.small.floating {
        right: 10px;
    }
}

.hidden {
    display: none;
}
