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

body, html {
    position: fixed; /* THIS IS THE MAGIC BULLET */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #87CEEB; 
    font-family: 'Nunito', sans-serif; 
    color: #2d3436;
    overscroll-behavior: none;
    touch-action: none;
}


#webgl-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1; pointer-events: none; }

.ui-container {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    display: flex; justify-content: center; align-items: center; z-index: 2; pointer-events: none;
}

.lang-selector-container {
    position: absolute; top: 20px; right: 20px; z-index: 100; pointer-events: auto;
}

select#lang-select {
    appearance: none; background: #ffffff; border: 3px solid #f1f2f6; border-radius: 20px;
    padding: 10px 40px 10px 20px; font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800;
    color: #2d3436; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.1); outline: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%232d3436" viewBox="0 0 16 16"><path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg>');
    background-repeat: no-repeat; background-position: right 15px center; background-size: 12px;
}

.home-menu {
    text-align: center; pointer-events: auto;
    opacity: 0; transition: opacity 1s ease;
}

.home-menu.visible {
    opacity: 1;
}

h1 { font-size: 2rem; line-height: 1.1; font-weight: 900; color: #ffffff; text-shadow: 0 4px 12px rgba(0,0,0,0.3); margin-bottom: 10px; }
h1 em { color: #FFE66D; font-style: normal; } 

.home-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    max-width: 400px; margin-left: auto; margin-right: auto;
    max-height: 55vh; overflow-y: auto; padding-bottom: 20px;
    overscroll-behavior: contain;
    touch-action: pan-y; /* This allows ONLY vertical scrolling here */
}


.home-grid::-webkit-scrollbar { display: none; } 

.category-btn {
    border: none; color: #ffffff; padding: 1rem; font-size: 1.1rem; font-weight: 800; 
    font-family: 'Nunito', sans-serif; border-radius: 20px; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    box-shadow: 0 6px 0 rgba(0,0,0,0.15);
}
.category-btn span.icon { font-size: 2rem; }
.category-btn:active { transform: translateY(6px); box-shadow: 0 0 0 rgba(0,0,0,0); }

.bg-orange { background: #FF9F43; } .bg-red { background: #EE5253; }
.bg-blue { background: #0ABDE3; } .bg-mint { background: #1DD1A1; }
.bg-green { background: #10AC84; } .bg-purple { background: #5F27CD; }
.bg-pink { background: #FD79A8; } .bg-yellow { background: #FECA57; }

.app-screen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 10;
    background: #F8F9FA; display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.app-screen.active { transform: translateX(0); }

.app-header {
    height: 65px; background: #ffffff; display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); flex-shrink: 0; z-index: 2;
}
.app-header h2 { font-size: 1.3rem; font-weight: 800; color: #2d3436; flex-grow: 1; text-align: center; }

.icon-btn {
    width: 45px; height: 45px; border: none; background: #f1f2f6; font-size: 1.2rem; color: #2d3436; 
    cursor: pointer; font-weight: 900; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background 0.2s;
}
.icon-btn:active { background: #dfe6e9; transform: scale(0.95); }
.header-spacer { width: 45px; } 

.search-bar-container { padding: 10px 20px; background: #ffffff; border-bottom: 2px solid #f1f2f6; }
.search-bar {
    width: 100%; padding: 12px 20px; border-radius: 25px; border: 2px solid #dfe6e9;
    font-size: 1rem; font-family: 'Nunito', sans-serif; font-weight: 600; outline: none; transition: border-color 0.2s;
}
.search-bar:focus { border-color: #74b9ff; }

.app-content { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 20px; 
    overscroll-behavior: contain;
    touch-action: pan-y; /* This allows ONLY vertical scrolling here */
}



.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 15px; }

.word-card {
    background: #ffffff; border-radius: 20px; padding: 20px 10px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); border: 2px solid #f1f2f6; cursor: pointer;
}
.word-card:active { transform: scale(0.95); border-color: #74b9ff; }
.word-card img { width: 65px; height: 65px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.1)); }
.word-card span { font-weight: 800; color: #2d3436; font-size: 1.1rem; text-align: center; }

.detail-container {
    display: flex; flex-direction: column; align-items: center; background: #ffffff; 
    border-radius: 30px; padding: 40px 24px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); 
    border: 3px solid #f1f2f6; margin-top: 10px; text-align: center;
}

.detail-img-wrapper {
    width: 140px; height: 140px; background: #f8f9fa; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; margin-bottom: 24px; 
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.05);
}
.detail-img-wrapper img { width: 90px; height: 90px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.15)); }

.english-text { font-size: 2.5rem; font-weight: 900; color: #2d3436; margin-bottom: 5px; text-transform: capitalize; }
.translated-text { font-size: 2.2rem; font-weight: 800; color: #0984e3; margin-bottom: 20px; }

.audio-buttons-container {
    display: flex; gap: 15px; width: 100%; justify-content: center; margin-top: 10px;
}
.audio-btn {
    background: #dfe6e9; border: none; padding: 10px 20px; border-radius: 25px;
    font-size: 1rem; font-weight: 800; color: #2d3436; cursor: pointer;
    display: flex; align-items: center; gap: 8px; transition: background 0.2s, transform 0.1s;
}
.audio-btn:active { transform: scale(0.95); }
.audio-btn.en-btn { background: #ffeaa7; color: #d35400; }
.audio-btn.tr-btn { background: #74b9ff; color: #ffffff; }
    
