:root {
    --bg-color: #0f1115;
    --card-bg: rgba(30, 34, 42, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #8b9bb4;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --input-bg: rgba(15, 17, 21, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

.background-glob {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, #1e293b 0%, #0f1115 50%);
    z-index: -1;
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 3.5rem;
    font-weight: 300;
    font-family: sans-serif;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 400;
}

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

textarea {
    width: 100%;
    height: 150px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.char-count {
    position: absolute;
    bottom: 1px;
    right: 1px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: inherit;
    border-bottom-right-radius: 16px;
}

button {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.primary-btn:active {
    transform: translateY(0);
}

.divider {
    text-align: center;
    margin: 2rem 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
    z-index: -1;
}

.divider span {
    background: var(--bg-color);
    padding: 0 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Code Inputs */
.code-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.code-digit {
    width: 100%;
    aspect-ratio: 1;
    /* Square */
    max-width: 50px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.code-digit:focus {
    outline: none;
    border-color: var(--accent);
    transform: scale(1.1);
    z-index: 2;
}

/* Hide Spinners */
.code-digit::-webkit-outer-spin-button,
.code-digit::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.code-digit {
    -moz-appearance: textfield;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Logic Results */
.hidden {
    display: none !important;
}

#result-display {
    margin-top: 1.5rem;
    text-align: center;
    animation: fadeIn 0.5s ease;
    background: rgba(30, 30, 30, 0.5);
    padding: 1rem;
    border-radius: 16px;
}

.code-output {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

#generated-code {
    font-size: 2rem;
    letter-spacing: 0.5rem;
    font-weight: 600;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

#copy-btn {
    width: auto;
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
}

#copy-btn:hover {
    color: var(--text-primary);
    transform: none;
}

.expiry-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.overlay-content {
    background: #1e293b;
    border: 1px solid var(--accent);
    border-radius: 24px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.2);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: auto;
    background: none;
    font-size: 2rem;
    padding: 0;
    color: var(--text-secondary);
}

.close-btn:hover {
    color: white;
}

pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 12px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
    font-family: inherit;
    margin: 1.5rem 0;
    font-size: 1.1rem;
    max-height: 400px;
    overflow-y: auto;
}

.status-msg {
    color: #ef4444;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* User Menu */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--accent);
    transition: transform 0.2s;
    background-size: cover;
    background-position: center;
    background-color: var(--input-bg);
}

.user-icon:hover {
    transform: scale(1.1);
}

.dropdown-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 150px;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.google-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: #333;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.google-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.x-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #000;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.2s;
    border: 1px solid #333;
}

.x-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    background: #111;
}