:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6c757d;
    --background: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e9ecef;
    --hover-color: #f1f3f5;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background);
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

h2 {
    color: var(--primary-color);
    margin: 20px 0 15px;
    font-size: 1.5rem;
}

.search-container {
    display: flex;
    justify-content: center;
    margin: 20px auto;
    max-width: 600px;
    width: 100%;
    padding: 0 15px;
}

#searchInput {
    flex: 1;
    max-width: 500px;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 30px 0 0 30px;
    font-size: 1rem;
    color: var(--text-color);
    background: var(--card-bg);
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

#searchBtn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 0 30px 30px 0;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#searchBtn:hover {
    background: #3a5a80;
    transform: translateY(-1px);
}

#searchBtn:active {
    transform: translateY(0);
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 16px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.tab-btn:hover {
    background-color: var(--hover-color);
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.character-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    position: relative;
    overflow: hidden;
    color-scheme: animate-3d;
}

.character-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.character {
    font-size: 2rem;
    margin-bottom: 5px;
    transition: transform 0.3s ease;
}

.character-name {
    font-size: 0.7rem;
    color: var(--secondary-color);
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.4em;
    line-height: 1.2;
    transition: all 0.3s ease;
}

.character-details {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s ease;
    font-size: 0.7rem;
    text-align: left;
    overflow: auto;
}

.character-card:hover .character-details {
    opacity: 1;
    transform: translateY(0);
}

.character-card:hover .character,
.character-card:hover .character-name {
    opacity: 0;
    transform: translateY(-20px);
}

.detail-row {
    margin: 3px 0;
    line-height: 1.3;
}

.detail-label {
    font-weight: bold;
    color: var(--primary-color);
    display: inline-block;
    min-width: 60px;
}

.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Character Popup */
.character-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.character-popup.show {
    display: flex;
    opacity: 1;
}

.popup-content {
    background: #2d3748;
    padding: 2rem;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.2s;
}

.popup-close:hover {
    color: #fff;
}

.popup-char {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.popup-details {
    color: #e2e8f0;
}

.popup-name {
    margin: 0 0 1.5rem;
    color: #fff;
    text-align: center;
    font-size: 1.5rem;
}

.popup-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #a0aec0;
    min-width: 100px;
}

.info-value {
    flex: 1;
    word-break: break-all;
}

.copy-btn {
    background: none;
    border: none;
    color: #63b3ed;
    cursor: pointer;
    margin-left: 0.5rem;
    font-size: 1rem;
    transition: color 0.2s;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.copy-btn:hover {
    color: #90cdf4;
    background: rgba(99, 179, 237, 0.1);
}

.copy-char-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
}

.copy-char-btn:hover {
    background: #3182ce;
}

.copy-char-btn i {
    margin-right: 0.5rem;
}

/* Copy icon on character cards */
.character-card {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.character-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.copy-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    font-size: 0.9rem;
}

.character-card:hover .copy-icon {
    opacity: 1;
}

.copy-icon:hover {
    background: #4299e1;
}

/* Notification */
#notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #38a169;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1001;
    pointer-events: none;
}

#notification.show {
    opacity: 1;
    transform: translate(-50%, -10px);
}

/* Dark theme adjustments */
.dark .popup-content {
    background: #2d3748;
}

.dark .popup-info {
    background: rgba(0, 0, 0, 0.2);
}

.dark .info-row {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-container {
        margin: 15px 0;
    }
    
    #searchInput {
        padding: 10px 12px;
    }
    
    #searchBtn {
        padding: 0 15px;
    }
    
    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
    }
    
    .character {
        font-size: 1.5rem;
    }
    
    .search-container {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .character {
        font-size: 1.3rem;
    }
    
    .character-name {
        font-size: 0.6rem;
    }
}

@media (max-width: 640px) {
    .popup-content {
        padding: 1.5rem;
    }
    
    .popup-char {
        font-size: 3rem;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .info-label {
        margin-bottom: 0.25rem;
    }
}

/* Emoji Subcategory Tabs */
.emoji-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.emoji-tab {
    padding: 6px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: all 0.2s ease;
    text-transform: capitalize;
}

.emoji-tab:hover {
    background: var(--hover-color);
    transform: translateY(-1px);
}

.emoji-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 500;
}

/* Subcategory Headers */
.subcategory-header {
    grid-column: 1 / -1;
    font-size: 1.2rem;
    margin: 20px 0 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
    text-transform: capitalize;
}

/* Adjust character grid for subcategories */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .emoji-tabs {
        overflow-x: auto;
        padding-bottom: 5px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .emoji-tab {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 4px 10px;
    }
    
    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
}

@media (max-width: 480px) {
    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .subcategory-header {
        font-size: 1rem;
    }
}

/* 3D and Animation Effects */
.animate-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    will-change: transform, box-shadow;
}

.animate-3d:hover {
    transform: translateY(-5px) rotateX(5deg) rotateY(5deg);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.15);
}

.animate-3d:active {
    transform: translateY(2px) scale(0.98);
    transition: transform 0.1s ease;
}

@keyframes float {
    0% { transform: translateY(0px) rotateY(0deg); }
    50% { transform: translateY(-10px) rotateY(5deg); }
    100% { transform: translateY(0px) rotateY(0deg); }
}

.float-animate {
    animation: float 6s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

.flip-container {
    perspective: 1000px;
}

.flip-container:hover .flipper {
    transform: rotateY(180deg);
}

.flipper {
    transition: 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

.front, .back {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.front {
    z-index: 2;
    transform: rotateY(0deg);
}

.back {
    transform: rotateY(180deg);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-7px); }
}

.bounce {
    animation: bounce 2s infinite;
}

/* How to Use Section */
.how-to-use {
    max-width: 800px;
    margin: 20px auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.how-to-toggle {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 20px;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.how-to-toggle:hover {
    background: var(--primary-dark);
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.how-to-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
}

.how-to-content.show {
    max-height: 1000px; /* Adjust based on content */
    padding: 20px;
}

.how-to-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-content h4 {
    margin: 0 0 5px 0;
    color: var(--text-color);
    font-size: 1rem;
}

.step-content p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.4;
}

.keyboard-shortcuts {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.keyboard-shortcuts h4 {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: 1rem;
}

.keyboard-shortcuts ul {
    margin: 0;
    padding-left: 20px;
}

.keyboard-shortcuts li {
    margin-bottom: 5px;
    color: var(--text-light);
    font-size: 0.9rem;
}

kbd {
    background: #f1f1f1;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    color: #333;
    display: inline-block;
    font-family: Arial, sans-serif;
    font-size: 0.75em;
    line-height: 1;
    padding: 2px 4px;
    white-space: nowrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .how-to-steps {
        grid-template-columns: 1fr;
    }
    
    .step {
        margin-bottom: 15px;
    }
    
    .step:last-child {
        margin-bottom: 0;
    }
}
