:root {
    --bg-image: url('https://plus.unsplash.com/premium_photo-1685148902854-9b9bb49fff08?q=80&w=9080&auto=jpeg&fit=crop');
    --primary-color: #ffffff;
    --text-color: #e0e0e0;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --hover-bg: rgba(255, 255, 255, 0.2);
    --hover-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    --font-main: 'Noto Sans SC', sans-serif;
    --font-title: 'ZCOOL KuaiLe', cursive;
}

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

body {
    font-family: var(--font-main);
    background-color: #0a0a1a;
    color: var(--text-color);
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    overflow-x: hidden;
}

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

.site-header {
    text-align: center;
    padding: 4rem 0;
    text-shadow: 0 0 15px rgba(0,0,0,0.7);
}

.site-title {
    font-family: var(--font-title);
    font-size: 4.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.site-subtitle {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.controls {
    position: relative; /* Crucial for z-index context */
    z-index: 10; /* Lifts the control bar above the grid */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 2rem;
}

.search-box {
    flex-grow: 1;
    margin-right: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}
.search-input:focus {
    outline: none;
    box-shadow: var(--hover-shadow);
    background: rgba(0,0,0,0.5);
}

.lang-switcher {
    position: relative;
}

.lang-btn {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.5rem;
    display: flex;
    align-items: center;
}

.lang-btn img {
    width: 32px;
    height: 32px;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.5rem;
    display: none;
    z-index: 1100; /* High z-index to be on top */
}

.lang-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 5px;
}
.lang-dropdown a:hover {
    background: var(--hover-bg);
}

.lang-switcher:hover .lang-dropdown {
    display: block;
}

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

.category-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.category-card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: var(--hover-shadow);
    background: var(--hover-bg);
}

.category-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 5px rgba(173, 216, 230, 0.8));
}

.category-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.modal-title {
    font-size: 1.8rem;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.modal-close:hover {
    transform: rotate(90deg);
}

.link-list a {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.link-list a:hover {
    background: rgba(0,0,0,0.4);
    color: var(--primary-color);
    transform: translateX(5px);
}

.link-lang {
    font-weight: bold;
    color: #82aaff;
    margin-right: 10px;
    min-width: 100px;
}

/* Warning Modal */
#warningModal .modal-content {
    text-align: center;
}

#warning-char {
    width: 150px;
    height: auto;
    margin-bottom: 1rem;
}

#warning-text {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.modal-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#confirm-redirect-btn {
    background-color: #4a90e2;
    color: white;
}
#confirm-redirect-btn:hover {
    background-color: #5aa1f2;
    box-shadow: 0 0 15px #4a90e2;
}

#cancel-redirect-btn {
    background-color: rgba(255,255,255,0.3);
    color: white;
}
#cancel-redirect-btn:hover {
    background-color: rgba(255,255,255,0.5);
}
