:root {
    --border-radius-soft: 12px;
    --border-radius-round: 18px;
    --border-radius-pill: 50px;
    --transition-std: all 0.35s ease-in-out;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --primary-text-color: #e0e0e0;
    --secondary-text-color: rgba(224, 224, 224, 0.7);
    --muted-text-color: rgba(224, 224, 224, 0.5);
    --border-color-subtle: rgba(255, 255, 255, 0.1);
    --border-color-strong: rgba(255, 255, 255, 0.25);
    --background-color-page: #000000;
    --glass-base-bg: rgba(0, 0, 0, 0.5);
    --button-primary-bg: #f0f0f0;
    --button-primary-text: #0a0a0a;
    --button-primary-hover-bg: #ffffff;
    --success-color: #90ee90;
    --error-color: #ff8f92;
    --info-color: #87ceeb;
    --accent-color: #bdbdbd;
    --image-fade: rgba(0, 0, 0, 1);
    --gradient-start: rgba(0, 0, 0, 0);
    --gradient-middle: rgba(0, 0, 0, 0.5);
    --gradient-end: rgba(0, 0, 0, 1);
    --gradient-middle-pos: 40%;
    --gradient-end-pos: 70%;
}

body.light-theme {
    --border-radius-soft: 12px;
    --border-radius-round: 18px;
    --border-radius-pill: 50px;
    --transition-std: all 0.35s ease-in-out;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --primary-text-color: #1d1d1f;
    --secondary-text-color: rgba(29, 29, 31, 0.7);
    --muted-text-color: rgba(29, 29, 31, 0.5);
    --border-color-subtle: rgba(0, 0, 0, 0.1);
    --border-color-strong: rgba(0, 0, 0, 0.2);
    --background-color-page: #f5f5f7;
    --glass-base-bg: rgba(255, 255, 255, 0.6);
    --button-primary-bg: #000000;
    --button-primary-text: #ffffff;
    --button-primary-hover-bg: #000000;
    --accent-color: #000000;
    --image-fade: rgba(255, 255, 255, 1);
    --gradient-start: rgba(255, 255, 255, 0);
    --gradient-middle: rgba(255, 255, 255, 0.5);
    --gradient-end: rgba(255, 255, 255, 1);
    --gradient-middle-pos: 40%;
    --gradient-end-pos: 70%;
}

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

html {
    height: 100%;
}

body {
    position: relative;
    background-color: var(--background-color-page);
    background-image:
        linear-gradient(to right, var(--border-color-subtle) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border-color-subtle) 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: center;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    transition: background-color 0.4s ease;
    padding: 1rem;
    overflow-x: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: linear-gradient(to bottom,
            var(--gradient-start) 0%,
            var(--gradient-middle) var(--gradient-middle-pos),
            var(--gradient-end) var(--gradient-end-pos));
    z-index: 0;
}

body::-webkit-scrollbar {
    display: none;
}

html,
body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--cursor-x) var(--cursor-y), hsla(0, 0%, 100%, 0.1) 50px, hsla(0, 0%, 100%,
                0.05) 150px, transparent 300px);
    mask-image: linear-gradient(to right, white 1px, transparent 1px), linear-gradient(to bottom, white 1px, transparent 1px);
    -webkit-mask-image: linear-gradient(to right, white 1px, transparent 1px), linear-gradient(to bottom, white 1px,
            transparent 1px);
    mask-size: 60px 60px;
    mask-position: center;
    opacity: var(--cursor-opacity, 0);
    transition: opacity 0.3s ease-out;
    z-index: -1;
}

body.light-theme::after {
    background: radial-gradient(circle at var(--cursor-x) var(--cursor-y), rgba(0, 0, 0, 0.08) 50px, rgba(0, 0, 0, 0.04) 150px, transparent 300px);
}

.top-right-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1001;
}

.icon-button,
.theme-switcher {
    width: 50px;
    height: 50px;
    background-color: var(--glass-base-bg);
    border: 1px solid var(--border-color-subtle);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-std);
    backdrop-filter: blur(10px);
    cursor: pointer;
    color: var(--secondary-text-color);
    font-size: 1.1rem;
}

.icon-button:hover,
.theme-switcher:hover {
    transform: scale(1.1) rotate(15deg);
}

.theme-switcher .sun-icon {
    color: #f39c12;
}

.theme-switcher .moon-icon {
    color: #f1c40f;
}

main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.main-content-wrapper {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    text-align: center;
}

@keyframes gentle-swell {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-in {
    animation: gentle-swell 0.8s cubic-bezier(0.25, 1, 0.5, 1) both;
}

.hero-header {
    animation-delay: 0.1s;
}

.hero-header h1 {
    font-size: clamp(2.8rem, 8vw, 4rem);
    font-weight: 700;
    color: var(--primary-text-color);
    letter-spacing: -2px;
    margin-bottom: 0.5rem;
}

.hero-header .subtitle {
    font-size: clamp(1rem, 4vw, 1.2rem);
    color: var(--secondary-text-color);
    max-width: 500px;
    margin: 0 auto 1.5rem;
}

.interactive-border {
    position: relative;
    background-color: var(--glass-base-bg);
    border: 1px solid var(--border-color-subtle);
    backdrop-filter: blur(14px);
    transition: all 0.3s ease;
}

.interactive-border:hover {
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.2);
    border-color: var(--border-color-strong);
}

.interactive-border::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid transparent;
    background: radial-gradient(400px circle at var(--x) var(--y), var(--accent-color), transparent 40%) border-box;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: var(--opacity, 0);
    transition: opacity 0.3s ease-out;
}

.url-form-container {
    animation-delay: 0.2s;
}

.url-form {
    display: flex;
    align-items: center;
    border-radius: var(--border-radius-pill);
    padding: 0.6rem;
    gap: 0.5rem;
}

.form-icon {
    font-size: 1.1rem;
    color: var(--muted-text-color);
    padding: 0 0.5rem 0 1.25rem;
}

#url {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--primary-text-color);
    font-size: 1.1rem;
    padding: 0.5rem;
}

.discord-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.4rem;
    color: var(--secondary-text-color);
    border-radius: var(--border-radius-pill);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
}

.discord-button .fa-discord {
    margin-right: 0.6rem;
    font-size: 1.2em;
}

.discord-button:hover {
    color: var(--button-primary-text);
    background-color: var(--button-primary-bg);
}

body.light-theme .discord-button:hover {
    color: var(--button-primary-text);
}

.clear-button {
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%) scale(0.8);
    background: transparent;
    color: var(--secondary-text-color);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
    cursor: pointer;
}

.clear-button.visible {
    transform: translateY(-50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

#submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    width: 48px;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-std);
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

#submit-button:hover:not(:disabled) {
    transform: scale(1.1);
}

#submit-button .icon-container {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.5, -0.5, 0.5, 1.5);
}

#submit-button.loading .icon-go {
    opacity: 0;
    transform: rotate(45deg) scale(0.5);
}

#submit-button .spinner {
    opacity: 0;
    transform: rotate(-45deg) scale(0.5);
    animation: spin 1s linear infinite;
}

#submit-button.loading .spinner {
    opacity: 1;
    transform: rotate(0) scale(1);
}

@keyframes spin {
    to {
        transform: rotate(360deg) scale(1);
    }
}

.about-text {
    color: var(--secondary-text-color);
    line-height: 1.7;
    max-width: 550px;
    margin: 0 auto;
    animation-delay: 0.4s;
    font-size: 0.95rem;
}

.about-text a {
    color: var(--primary-text-color);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color-strong);
    transition: var(--transition-std);
}

.about-text a:hover {
    border-bottom-color: var(--accent-color);
}

.page-footer {
    width: 100%;
    padding: 1.5rem 0;
    text-align: center;
    color: var(--muted-text-color);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color-subtle);
    margin-top: auto;
    z-index: 1000;
}

.page-footer a {
    color: var(--secondary-text-color);
    text-decoration: none;
    transition: var(--transition-std);
    margin: 0 0.75rem;
}

.page-footer a:hover {
    color: var(--primary-text-color);
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    transition: opacity 0.3s ease;
}

#history-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 90%;
    max-width: 700px;
    height: 80%;
    max-height: 600px;
    border-radius: var(--border-radius-round);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#modal-overlay.hidden,
#history-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

#history-modal.hidden {
    transform: translate(-50%, -50%) scale(0.95);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color-subtle);
    flex-shrink: 0;
}

.modal-header h2 {
    color: var(--primary-text-color);
    font-size: 1.2rem;
}

.modal-header h2 i {
    margin-right: 0.75rem;
    color: var(--secondary-text-color);
}

#modal-close-button {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--muted-text-color);
    cursor: pointer;
    transition: var(--transition-std);
}

#modal-close-button:hover {
    color: var(--primary-text-color);
    transform: rotate(90deg);
}

.modal-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0.5rem 1.5rem;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color-strong);
    border-radius: 6px;
}

#history-list {
    list-style: none;
}

#history-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0.25rem;
    border-bottom: 1px solid var(--border-color-subtle);
}

#history-list li:last-child {
    border-bottom: none;
}

#history-list a {
    color: var(--secondary-text-color);
    text-decoration: none;
    transition: var(--transition-std);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

#history-list a:hover {
    color: var(--primary-text-color);
}

#history-list span {
    color: var(--muted-text-color);
    font-size: 0.9rem;
    margin-left: 1rem;
    white-space: nowrap;
}

#history-list .no-history {
    color: var(--muted-text-color);
    text-align: center;
    padding: 2rem;
    border: none;
    justify-content: center;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color-subtle);
    text-align: right;
    flex-shrink: 0;
}

#clear-history-button {
    background: transparent;
    border: 1px solid rgba(255, 143, 146, 0.5);
    color: var(--error-color);
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-pill);
    cursor: pointer;
    transition: var(--transition-std);
    font-weight: 500;
}

#clear-history-button:hover {
    background: var(--error-color);
    border-color: var(--error-color);
    color: #000;
}

@media screen and (max-width: 480px) {
    body {
        padding: 0.75rem;
    }

    .top-right-controls {
        top: 15px;
        right: 15px;
    }

    .icon-button,
    .theme-switcher {
        width: 45px;
        height: 45px;
    }

    .main-content-wrapper {
        gap: 1.25rem;
        padding: 0 0.5rem;
    }

    .url-form {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .form-icon {
        padding: 0 0.25rem 0 0.75rem;
    }

    #url {
        font-size: 1rem;
    }

    #submit-button {
        width: 44px;
        height: 44px;
    }

    .clear-button {
        right: 65px;
    }

    .page-footer nav {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
    }

    .page-footer a {
        margin: 0;
    }
}