* {
    box-sizing: border-box;
}

html {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

:root {
    --green-dim: rgba(128, 255, 16, 0.6);
    --green-muted: rgba(128, 255, 16, 0.5);
}

body {
    font-family: 'Share Tech Mono', monospace;
    margin: 0;
    padding: 0;
    background: #000;
    color: #80ff10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Scanning line animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #80ff10, transparent);
    animation: scan 3s linear infinite;
    z-index: 1000;
}

@keyframes scan {
    0% { transform: translateY(0vh); }
    100% { transform: translateY(100vh); }
}

.container {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #80ff10;
    padding: 1.25rem;
    box-shadow: 
        0 0 20px rgba(128, 255, 16, 0.3),
        inset 0 0 20px rgba(128, 255, 16, 0.1);
    text-align: center;
    max-width: 600px;
    width: 90%;
    min-width: 0;
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.container::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, #80ff10, transparent, #80ff10);
    z-index: -1;
    animation: borderGlow 2s ease-in-out infinite alternate;
}

/* Responsive: prevent overflow on small screens */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
        width: 95%;
    }

    #authSection,
    #authForm {
        max-width: 100%;
        overflow-x: hidden;
    }

    #authSection > *,
    #authForm > * {
        min-width: 0;
    }

    .modal-content {
        padding: 1rem;
        width: 95%;
        min-height: auto;
        max-height: 85vh;
    }
}

/* Flex form rows: stack vertically on narrow viewports to prevent overflow */
@media (max-width: 480px) {
    .form-row .form-field {
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }

    input, .btn {
        max-width: 100%;
    }
}

@keyframes borderGlow {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

h1 {
    color: var(--green-muted);
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 8px var(--green-glow-muted);
    font-weight: normal;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--green-primary), transparent);
    box-shadow: 0 0 10px var(--green-glow-muted);
}

p {
    color: #80ff10;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.status-text {
    color: var(--green-dim);
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    margin-bottom: 0.25rem;
}

.warning-text {
    color: var(--green-muted);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.btn {
    background: transparent;
    color: #80ff10;
    padding: 10px 24px;
    border: 1px solid #80ff10;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(128, 255, 16, 0.08),
        transparent
    );
    transition: left 0.4s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: #80ff10;
    color: #000;
    box-shadow: 0 0 20px rgba(128, 255, 16, 0.6);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    color: #80ff10;
    pointer-events: none;
}

/* Primary action button (Login) */
.btn-primary {
    background: #80ff10;
    color: #000;
    border-color: #80ff10;
    box-shadow: 0 0 10px rgba(128, 255, 16, 0.4);
    font-weight: bold;
    letter-spacing: 3px;
    padding: 12px 32px;
}

.btn-primary:hover {
    background: #80ff10;
    color: #000;
    box-shadow: 0 0 20px rgba(128, 255, 16, 0.6), 0 0 40px rgba(128, 255, 16, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(128, 255, 16, 0.4);
}

/* Secondary action button (Register / Create Account) */
.btn-secondary {
    background: transparent;
    border: 1px solid rgba(128, 255, 16, 0.5);
    color: rgba(128, 255, 16, 0.8);
    opacity: 0.85;
    padding: 12px 32px;
}

.btn-secondary:hover {
    opacity: 1;
    background: rgba(128, 255, 16, 0.08);
    border-color: #80ff10;
    color: #80ff10;
    box-shadow: 0 0 12px rgba(128, 255, 16, 0.25);
    transform: translateY(-1px);
}

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

/* Google / external auth button */
.btn-google {
    background: #0a0a0a;
    border: 1px solid #333;
    color: #ccc;
    padding: 10px 24px;
    letter-spacing: 1.5px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-google:hover {
    border-color: #80ff10;
    color: #fff;
    background: rgba(128, 255, 16, 0.05);
    box-shadow: 0 0 10px rgba(128, 255, 16, 0.15);
    transform: translateY(-1px);
}

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

.btn-google .google-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Auth prompt terminal line */
.auth-prompt {
    color: rgba(128, 255, 16, 0.6);
    font-size: 0.8rem;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-align: center;
}

.auth-prompt span {
    color: #80ff10;
    animation: promptBlink 1.2s step-end infinite;
}

@keyframes promptBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Auth divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0.75rem 0;
    color: rgba(128, 255, 16, 0.3);
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(128, 255, 16, 0.25), transparent);
}

.logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #80ff10;
    text-shadow: 0 0 20px rgba(128, 255, 16, 0.8);
}

.status {
    margin: 0.5rem 0;
    padding: 10px;
    border: 1px solid;
    font-weight: bold;
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Compact auth/session form spacing */
.auth-form .form-field,
.auth-form [id$="Field"] {
    margin-bottom: 0.5rem !important;
}

#authSection .auth-form input,
#authSection input {
    padding: 7px 10px !important;
    font-size: 0.9rem !important;
}

#authSection .auth-form label,
#authSection label {
    margin-bottom: 0.2rem !important;
    font-size: 0.85rem !important;
}

.status.loading {
    background-color: rgba(128, 255, 16, 0.1);
    color: #80ff10;
    border-color: #80ff10;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status.success {
    background-color: rgba(128, 255, 16, 0.2);
    color: #80ff10;
    border-color: #80ff10;
    box-shadow: 0 0 15px rgba(128, 255, 16, 0.4);
}

.status.error {
    background-color: rgba(255, 64, 128, 0.1);
    color: #ff4080;
    border-color: #ff4080;
    box-shadow: 0 0 15px rgba(255, 64, 128, 0.4);
}

.hidden {
    display: none;
}

#statusContainer {
    margin-top: 2rem;
    width: 100%;
    min-height: 60px;
    padding: 1rem 0;
    position: relative;
    z-index: 10;
}

#statusContainer:not(.hidden) {
    display: block !important;
    visibility: visible !important;
}

#statusMessage {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 40px;
    line-height: 1.5;
}

.countdown {
    font-size: 1.2rem;
    margin: 1rem 0;
    color: #80ff10;
    text-shadow: 0 0 10px rgba(128, 255, 16, 0.6);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Terminal cursor effect */
.cursor::after {
    content: '█';
    animation: blink 1s infinite;
    color: #80ff10;
}

/* Grid overlay effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(128, 255, 16, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(128, 255, 16, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

/* Tooltip styles */
.difficulty-tooltip {
    position: relative;
    display: inline-block;
}

.difficulty-tooltip .tooltip-text {
    visibility: hidden;
    width: 280px;
    max-width: min(280px, calc(100vw - 2rem));
    background-color: rgba(0, 0, 0, 0.95);
    color: #80ff10;
    text-align: left;
    border: 1px solid #80ff10;
    border-radius: 4px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: calc(100% + 10px);
    left: 0;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    font-size: 0.75rem;
    line-height: 1.4;
    box-shadow: 0 0 15px rgba(128, 255, 16, 0.4);
    pointer-events: none;
    white-space: normal;
}

/* Right-align tooltip for last two options so it doesn't overflow right */
.difficulty-tooltip:nth-last-child(-n+2) .tooltip-text {
    left: auto;
    right: 0;
}

.difficulty-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 20px;
    border-width: 5px;
    border-style: solid;
    border-color: #80ff10 transparent transparent transparent;
}

.difficulty-tooltip:nth-last-child(-n+2) .tooltip-text::after {
    left: auto;
    right: 20px;
}

.difficulty-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-title {
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: uppercase;
    color: #80ff10;
    text-shadow: 0 0 5px rgba(128, 255, 16, 0.6);
}

.tooltip-content {
    color: rgba(128, 255, 16, 0.9);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #80ff10;
    padding: 2rem;
    margin: 3% auto;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    min-height: 500px;
    overflow-x: visible;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    box-shadow: 
        0 0 30px rgba(128, 255, 16, 0.5),
        inset 0 0 20px rgba(128, 255, 16, 0.1);
    position: relative;
    animation: slideDown 0.3s ease;
}

.modal-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(128, 255, 16, 0.3);
}

.modal-header h2 {
    margin: 0;
    font-size: 1rem;
    color: #80ff10;
}

.close-modal {
    background: transparent;
    border: 1px solid #ff4080;
    color: #ff4080;
    font-size: 1.5rem;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-family: 'Share Tech Mono', monospace;
}

.close-modal:hover {
    background: rgba(255, 64, 128, 0.2);
    box-shadow: 0 0 10px rgba(255, 64, 128, 0.5);
}

/* Password validation styles */
.password-requirements {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: rgba(128, 255, 16, 0.7);
    line-height: 1.4;
}

.password-requirement {
    margin: 0.2rem 0;
    display: flex;
    align-items: center;
}

.password-requirement.valid {
    color: #80ff10;
}

.password-requirement.invalid {
    color: rgba(128, 255, 16, 0.5);
}

.password-match-message {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    display: none;
}

.password-match-message.match {
    color: #80ff10;
    display: block;
}

.password-match-message.no-match {
    color: #ff4080;
    display: block;
}

.password-input.valid {
    border-color: #80ff10;
    box-shadow: 0 0 5px rgba(128, 255, 16, 0.3);
}

.password-input.invalid {
    border-color: #ff4080;
    box-shadow: 0 0 5px rgba(255, 64, 128, 0.3);
}

