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

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2.5rem;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}

/* Search */
.search-container {
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.search-input {
    width: 100%;
    padding: 1rem 3rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.search-input:not(:placeholder-shown) + .clear-btn {
    opacity: 1;
}

.clear-btn:hover {
    color: var(--text);
}

/* Categories */
.categories-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.category-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Results Info */
.results-info {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Characters Grid */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.char-card {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.char-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.char-card:active {
    transform: translateY(0);
}

.char-symbol {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.char-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 0 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.char-copied {
    position: absolute;
    inset: 0;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}

.char-card.copied .char-copied {
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 450px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-char {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.modal-name {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.modal-info {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 100px;
    flex-shrink: 0;
}

.info-value {
    flex: 1;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text);
    word-break: break-all;
}

.copy-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.copy-char-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.copy-char-btn:hover {
    background: var(--primary-hover);
}

.copy-char-btn svg {
    width: 20px;
    height: 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-text {
    font-size: 1.1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .search-input {
        padding: 0.875rem 2.75rem;
        font-size: 0.95rem;
    }

    .category-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.5rem;
    }

    .char-symbol {
        font-size: 1.75rem;
    }

    .char-name {
        font-size: 0.6rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-char {
        font-size: 4rem;
    }

    .info-label {
        width: 80px;
        font-size: 0.8rem;
    }

    .info-value {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .categories-container {
        gap: 0.4rem;
    }

    .category-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    .char-symbol {
        font-size: 1.5rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
