:root {
    --bg-dark: #060816;
    --bg-card: rgba(13, 19, 38, 0.9);
    --bg-input: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.14);
    --text-primary: #f5f7ff;
    --text-secondary: #9aa8c7;
    --accent: #6ee7ff;
    --accent-strong: #4f8cff;
    --accent-hover: #8ef1ff;
    --accent-dark: #07111f;
    --accent-glow: rgba(110, 231, 255, 0.25);
    --error: #ff6b7a;
    --font-primary: 'Inter', sans-serif;
    --font-mono: 'Roboto Mono', monospace;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes textPopIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    font-family: var(--font-primary);
    color: var(--text-primary);
    background:
        radial-gradient(circle at top left, rgba(79, 140, 255, 0.2), transparent 35%),
        linear-gradient(135deg, #04060f 0%, #091224 45%, #0c1227 100%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.background-glow {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(110, 231, 255, 0.16), transparent 22%);
    pointer-events: none;
}

[data-animation] {
    opacity: 0;
    animation-fill-mode: forwards;
}

.loaded [data-animation] {
    animation-name: fadeInDown;
    animation-duration: 0.7s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.loaded [data-animation="fade-in-up"] {
    animation-name: fadeInUp;
}

.loaded [data-animation-delay="100"] {
    animation-delay: 0.1s;
}

.loaded [data-animation-delay="150"] {
    animation-delay: 0.15s;
}

.loaded [data-animation-delay="200"] {
    animation-delay: 0.2s;
}

.loaded [data-animation-delay="300"] {
    animation-delay: 0.3s;
}

.container {
    width: 100%;
    max-width: 860px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 1;
}

.hero {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.hero-badge {
    display: inline-block;
    margin-bottom: 0.8rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(110, 231, 255, 0.1);
    border: 1px solid rgba(110, 231, 255, 0.2);
    color: var(--accent);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0 0 0.35rem;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: clamp(1.8rem, 3.2vw, 2.7rem);
    font-weight: 700;
    text-shadow: 0 0 28px rgba(110, 231, 255, 0.2);
}

.hero h1 .char {
    display: inline-block;
    opacity: 0;
    animation: textPopIn 0.45s forwards cubic-bezier(0.5, 0, 0.2, 1);
}

.byline {
    margin: 0 0 0.7rem;
    color: var(--accent);
    font-weight: 600;
}

.subtitle {
    margin: 0 auto;
    max-width: 680px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.input-card,
.stats-card,
.results-wrapper {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
}

.input-card {
    margin-bottom: 1rem;
}

.input-label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.input-form {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 0.55rem;
}

#urlInput {
    flex: 1;
    padding: 0.95rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#urlInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

#scanButton {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.95rem 1.1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: var(--accent-dark);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#scanButton:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(79, 140, 255, 0.24);
}

#scanButton:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

#scanButton:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.helper-text {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stats-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.stat {
    padding: 0.8rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.stat span {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stat small {
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.results-wrapper {
    padding: 0;
    overflow: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

#status-container {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.92rem;
    min-height: 1.2rem;
}

.blinking-cursor {
    animation: blink 1s step-end infinite;
    color: var(--accent);
}

#copyButton {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 0.55rem 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

#copyButton:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

#copyButton:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.results-actions {
    display: inline-flex;
    gap: 0.6rem;
    align-items: center;
}

#exportButton,
#historyButton {
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

#exportButton[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.results-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.result-group {
    padding: 0.8rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
}

.result-group h4 {
    margin: 0 0 0.5rem 0;
    color: var(--accent);
}

.result-item {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 0.92rem;
    word-break: break-all;
    padding: 0.15rem 0;
}

.history-panel {
    position: fixed;
    right: 20px;
    top: 80px;
    width: 340px;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(8, 12, 20, 0.95);
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 60;
}

.history-entry {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.history-entry:last-child {
    border-bottom: none;
}

.history-entry button {
    margin-top: 6px;
}

.results-container {
    padding: 1rem;
    min-height: 280px;
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    transform: translateZ(0);
}

.results-container::-webkit-scrollbar {
    width: 8px;
}

.results-container::-webkit-scrollbar-track {
    background: transparent;
}

.results-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

#resultsOutput {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 0.9s linear infinite;
    margin: 1.2rem auto;
}

footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    body {
        padding: 14px;
    }

    .container {
        padding: 1rem;
    }

    .input-form {
        flex-direction: column;
    }

    .stats-card {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
}