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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
    touch-action: pan-y;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* Top Section - 50% */
.top-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid #333;
    position: relative;
    padding: 20px;
}

.clear-button {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px;
    background: #ff3b30;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 32px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
    transition: all 0.2s;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.clear-button:active {
    transform: scale(0.95);
    background: #ff2d20;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    cursor: pointer;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #1c1c1e;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff3b30;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
}

.close-modal:active {
    transform: scale(0.9);
    background: #ff2d20;
}

.instructions h2 {
    color: #007aff;
    margin: 20px 0 15px 0;
    font-size: 24px;
}

.instructions h2:first-child {
    margin-top: 0;
}

.instructions h3 {
    color: #fff;
    margin: 15px 0 10px 0;
    font-size: 18px;
}

.instructions ol, .instructions ul {
    color: #ccc;
    line-height: 1.8;
    padding-left: 25px;
}

.instructions li {
    margin: 8px 0;
}

.instructions hr {
    border: none;
    border-top: 1px solid #3a3a3c;
    margin: 30px 0;
}

.emoji-display-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    align-items: center;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 20px 0;
}

.emoji-display-container::-webkit-scrollbar {
    display: none;
}

.emoji-line {
    display: flex;
    gap: 12px;
    padding: 0 20px;
    min-width: 100%;
    align-items: center;
}

.emoji-line .emoji-item-display {
    font-size: 80px;
    line-height: 1;
    flex-shrink: 0;
    cursor: pointer;
    animation: emojiPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.1s;
}

.emoji-line .emoji-item-display:active {
    transform: scale(0.8);
}

@keyframes emojiPop {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Bottom Section - 50% */
.bottom-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1c1c1e;
    overflow: hidden;
}

.category-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 16px;
    background: #2c2c2e;
    border-bottom: 1px solid #3a3a3c;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    background: #3a3a3c;
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-tab.active {
    background: #007aff;
    transform: scale(1.1);
}

.category-tab:active {
    transform: scale(0.95);
}

/* Emoji Grid Container */
.emoji-grid-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.emoji-grid-container::-webkit-scrollbar {
    display: none;
}

.emoji-grid {
    display: flex;
    gap: 0;
    padding: 16px;
    height: 100%;
    width: max-content;
}

.emoji-category-section {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(6, 1fr);
    row-gap: 6px;
    column-gap: 6px;
    padding-right: 20px;
    scroll-snap-align: start;

.emoji-category-section:first-child {
    padding-left: 20px;
}

.emoji-category-section:last-child {
    padding-right: 20px;
}

.emoji-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: #2c2c2e;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    scroll-snap-align: start;
}
.emoji-item:active {
    transform: scale(0.9);
    background: #3a3a3c;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .emoji-item {
        width: 50px;
        height: 50px;
        font-size: 32px;
    }
    
    .emoji-line .emoji-item-display {
        font-size: 70px;
    }
    
    .clear-button {
        font-size: 16px;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .emoji-item {
        width: 45px;
        height: 45px;
        font-size: 28px;
    }
    
    .emoji-line .emoji-item-display {
        font-size: 60px;
    }
    
    .category-tab {
        font-size: 20px;
        padding: 6px 12px;
    }
    
    .clear-button {
        font-size: 28px;
        width: 50px;
        height: 50px;
        top: 15px;
        right: 15px;
    }
    
    .modal-content {
        padding: 20px;
        font-size: 14px;
    }
    
    .instructions h2 {
        font-size: 20px;
    }
    
    .instructions h3 {
        font-size: 16px;
    }
}
