:root {
    --border-radius: 20px;
    --main-color: rgba(40, 30, 80, 0.4);
    --accent-color: rgba(140, 100, 255, 0.3);
    --bg-dark: #0a0a14;
}

body {
    opacity: 0;
    transition: opacity 0.5s ease;
    height: 100vh;
    margin: 0;
    background: var(--bg-dark);
    color: #d0d0ff;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

body.css-loaded {
    opacity: 1;
}

.background-overlay, #bg-video {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: filter 0.5s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#bg-video {
    z-index: -3;
}

.top-bar {
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
}

.clock-container {
    text-align: right;
    background: var(--main-color);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-color);
    min-width: 200px;
}

.clock {
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1;
    margin-bottom: 5px;
}

.date {
    font-size: 0.9rem;
    opacity: 0.6;
}

.settings-btn {
    background: var(--main-color);
    border: 1px solid var(--accent-color);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, background 0.3s ease;
}

.animations-on .settings-btn:hover {
    transform: translateY(-2px);
    background: var(--accent-color);
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1;
    padding-bottom: 5vh;
}

.search-container {
    position: relative;
    width: min(600px, 90%);
    margin-bottom: 4rem;
}

.search-input {
    width: 100%;
    padding: 1.2rem 3.5rem 1.2rem 1.5rem;
    font-size: 1.2rem;
    background: var(--main-color);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius) !important;
    color: #fff;
    outline: none;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.animations-on .search-input:focus {
    transform: scale(1.03);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.search-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    pointer-events: none;
    font-size: 1.2rem;
}

.links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1000px;
}

.link-wrapper {
    position: relative;
    z-index: 1;
}

.link {
    background: var(--main-color);
    padding: 1rem;
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: white;
    text-align: center;
    border: 1px solid var(--accent-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
}

.animations-on .link:hover {
    transform: translateY(-8px);
    background: rgba(140, 100, 255, 0.2);
    border-color: rgba(140, 100, 255, 0.4);
}

.site-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    border-radius: 10px;
    object-fit: contain;
}

.delete-link {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff4444;
    color: white;
    border: 2px solid var(--bg-dark);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 16px;
    display: none;
    z-index: 10;
    align-items: center;
    justify-content: center;
}

.link-wrapper:hover .delete-link {
    display: flex;
}

.settings-panel {
    position: fixed;
    right: -350px;
    top: 0;
    width: 320px;
    height: 100vh;
    background: rgba(10, 5, 20, 0.95);
    backdrop-filter: blur(30px);
    padding: 2rem;
    z-index: 100;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid rgba(140, 100, 255, 0.2);

    overflow-y: auto;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.settings-panel.active {
    right: 0;
}

.settings-content {
    padding-bottom: 50px;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
    opacity: 0.8;
}

.custom-input-field {
    display: none;
    margin-top: 10px;
}

.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: block;
    width: 100%;
    margin-bottom: 5px;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.custom-btn {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    background: #443388;
    transition: 0.3s;
}

.custom-btn.small {
    padding: 0.6rem;
    font-size: 0.8rem;
    background: var(--accent-color);
}

.custom-btn.danger {
    background: rgba(255, 50, 50, 0.2);
    border: 1px solid rgba(255, 50, 50, 0.3);
}

.custom-btn:hover {
    filter: brightness(1.2);
}

input[type="text"], select {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
}

.setting-hr {
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    animation: float 15s linear infinite;
}

@keyframes float {
    0% { transform: translateY(110vh); opacity: 0; }
    20% { opacity: 0.5; }
    80% { opacity: 0.5; }
    100% { transform: translateY(-10vh); opacity: 0; }
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox input {
    cursor: pointer;
}

.add-link-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
}

#add-link-btn {
    background: #5c44bb;
    margin-top: 5px;
}

#add-link-btn:hover {
    background: #6e55d3;
}

@media (max-width: 768px) {
    .top-bar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .clock-container {
        text-align: center;
        min-width: 160px;
        padding: 0.8rem;
    }

    .clock {
        font-size: 2rem;
    }

    .settings-panel {
        width: 100%;
        right: -100%;
        padding: 1.5rem;
    }

    .search-container {
        width: 95%;
        margin-bottom: 2rem;
    }

    .search-input {
        padding: 1rem 3rem 1rem 1rem;
        font-size: 1rem;
    }

    .links {
        gap: 1rem;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        width: 90%;
        padding: 0 10px;
    }

    .link {
        width: auto;
        height: 75px;
        padding: 0.5rem;
    }

    .site-icon {
        width: 28px;
        height: 28px;
        margin-bottom: 8px;
    }

    .link .text {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    .add-link-form input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .links {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (pointer: coarse) {
    .delete-link {
        display: flex;
        opacity: 0.7;
    }
}

.close-settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 101;
    opacity: 0.6;
    transition: opacity 0.3s;
    line-height: 1;
    padding: 10px;
}

.close-settings-btn:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .close-settings-btn {
        top: 10px;
        right: 15px;
        font-size: 2.5rem;
    }
}
