:root {
    --primary: #00d2ff;
    --secondary: #3a7bd5;
    --accent: #ff007a;
    --bg-dark: #0a0b10;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --radius: 16px;
    --font: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 210, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 0, 122, 0.1) 0%, transparent 40%);
    color: var(--text-main);
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

/* ── Language Picker ─────────────────────────────────── */
.lang-picker {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    color: var(--text-main);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.lang-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 210, 255, 0.08);
}

.lang-arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.lang-btn[aria-expanded="true"] .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    background: rgba(10, 11, 20, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    list-style: none;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.15s ease;
}

.lang-dropdown.open {
    display: block;
}

.lang-dropdown li {
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.15s ease, color 0.15s ease;
    letter-spacing: 0.3px;
}

.lang-dropdown li:hover {
    background: rgba(0, 210, 255, 0.08);
    color: var(--text-main);
}

.lang-dropdown li.active {
    color: var(--primary);
    font-weight: 700;
    background: rgba(0, 210, 255, 0.06);
}

.glow-text {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0, 210, 255, 0.4));
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 1px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
}

.unified-input-section {
    margin-bottom: 2rem;
}


.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input[type="text"], select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.options-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.check-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.check-group input {
    accent-color: var(--primary);
    width: 1.2rem;
    height: 1.2rem;
}

.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn.primary {
    background: transparent;
    color: white;
}

.btn.primary:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
}

.result-wrapper {
    margin-top: 2rem;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.link-area {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.link-area input {
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid var(--primary);
    border-radius: 8px;
    flex-grow: 1;
    color: var(--primary);
    font-weight: 600;
    padding: 0.8rem;
}

.icon-btn {
    width: 50px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.preview-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detection-badge {
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 0.2rem 0.8rem;
    display: inline-block;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.badge-text {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.feedback-toast {
    font-size: 0.8rem;
    color: var(--primary);
    margin-top: 0.5rem;
    font-weight: 600;
    transition: opacity 0.3s ease;
    text-align: center;
}

.unified-input-section {
    margin-bottom: 2rem;
}

#rawProtocol {
    color: var(--accent);
    word-break: break-all;
}

/* Redirection Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.overlay.hidden {
    display: none;
}

.loader {
    width: 80px;
    height: 80px;
    border: 5px solid var(--glass-border);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 2rem;
    animation: spin 1s linear infinite;
}

.countdown-container {
    margin-bottom: 2rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

#countdown {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.2rem;
}

.overlay-actions {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    align-items: center;
}

.btn.link-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: underline;
    width: auto;
    padding: 0;
    cursor: pointer;
}

.btn.link-text:hover {
    color: white;
}

.overlay-content h1 {
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, white, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.overlay-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.btn.secondary {
    background: transparent;
    border: none;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
    box-shadow: none;
}

.btn-group {
    display: flex;
    gap: 0;
    width: 100%;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 20px -5px rgba(0, 210, 255, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-group:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -5px rgba(0, 210, 255, 0.5);
}

#generateAndCopyBtn {
    flex: 2;
    border-radius: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

#generateBtn {
    flex: 1;
    border-radius: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stats Bar - Discrete Popout */
.stats-bar {
    position: relative;
    z-index: 1;
    width: fit-content;
    margin: -35px auto 2rem;
    padding: calc(35px + 0.6rem) 1.2rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: rgba(10, 10, 20, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    font-size: 0.7rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-item .label {
    font-size: 0.55rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-item .value {
    font-weight: 800;
    color: var(--primary);
}

.stat-divider {
    width: 1px;
    height: 10px;
    background: var(--glass-border);
}

.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    .glow-text {
        font-size: 2.2rem;
    }
    .stats-bar {
        padding: calc(35px + 0.5rem) 1rem 0.5rem;
        gap: 0.8rem;
    }
    .stat-item .label {
        display: none;
    }
}

.site-disclaimer {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.6;
    padding: 0 1rem;
    line-height: 1.4;
    max-width: 500px;
    width: 100%;
    z-index: 100;
    pointer-events: none; /* Don't interfere with clicks */
}
