:root {
    --primary: #8a2be2;
    --primary-hover: #9932cc;
    --bg-dark: #0a0a14;
    --panel-bg: rgba(20, 20, 30, 0.65);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-main: #e0e0e0;
    --text-muted: #9e9e9e;
    --accent: #00e5ff;
    --danger: #ff5252;
}

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

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

.return-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(138, 43, 226, 0.2);
    border: 1px solid var(--primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    z-index: 100;
}

.return-btn:hover {
    background: var(--primary);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
}

.bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(5px) brightness(0.6);
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, var(--bg-dark) 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease;
}

.logo-title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    text-shadow: 0 4px 12px rgba(0, 229, 255, 0.3);
}

.site-notice {
    padding: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    font-size: 0.95rem;
}

.disclaimer {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.search-panel {
    padding: 2rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.search-main {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.flex-grow {
    flex-grow: 1;
}

.input-text, .input-select {
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-text:focus, .input-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(138, 43, 226, 0.3);
}

.input-select option {
    background: var(--bg-dark);
    color: #fff;
}

.btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 43, 226, 0.6);
}

.advanced-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.hidden {
    display: none !important;
}

.error-message {
    background: rgba(255, 82, 82, 0.1);
    border-left: 4px solid var(--danger);
    color: var(--danger);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
}

.quick-categories {
    padding: 2rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

.quick-categories h2 {
    margin-bottom: 1.5rem;
    color: #fff;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.cat-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    padding: 1rem;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.cat-btn img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.cat-btn:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.results-container {
    padding: 2rem;
    animation: fadeIn 0.5s ease;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 1rem;
}

.badge {
    background: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.item-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.item-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.item-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    background: #000;
    border-radius: 4px;
    padding: 2px;
}

.item-info h4 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.item-info .en-name {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.country-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: #ff9800;
    color: #000;
    margin-left: 5px;
    vertical-align: middle;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.page-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    color: #fff;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

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

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    animation: zoomIn 0.3s ease;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

.item-detail-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.item-large-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid var(--panel-border);
}

.item-detail-info h2 {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.item-detail-info p {
    margin-bottom: 0.3rem;
}

.attr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
}

.attr-item .label {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: block;
}

.attr-item .val {
    font-weight: 600;
    font-size: 1rem;
}

.item-desc-script {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .item-detail-header {
        flex-direction: column;
    }
}

.desc-box, .script-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 1.5rem;
}

.desc-box h3, .script-box h3 {
    color: var(--accent);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

.desc-content {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.95rem;
}

.script-content {
    font-family: monospace;
    white-space: pre-wrap;
    color: #a5d6ff;
    font-size: 0.9rem;
    background: #0d1117;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading {
    text-align: center;
    padding: 3rem;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
