body {
    background: var(--primary-bg);
    overflow: hidden;
    font-family: var(--font-display);
    position: relative;
    height: 100vh;
}

.grid-background {
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.08) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: grid-pulse 6s ease-in-out infinite alternate;
}

.scanning-lines {
    background: linear-gradient(0deg,
            transparent 97%,
            rgba(0, 212, 255, 0.1) 98%,
            rgba(0, 212, 255, 0.2) 99%,
            transparent 100%);
    background-size: 100% 6px;
    animation: scan 12s linear infinite;
}

/* Access Container */
.access-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
}

.access-frame {
    width: 100%;
    max-width: 600px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    padding: 40px;
    position: relative;
    box-shadow:
        0 0 50px rgba(0, 212, 255, 0.1),
        inset 0 0 50px rgba(0, 212, 255, 0.02);
    animation: frame-glow 4s ease-in-out infinite alternate;
}

@keyframes frame-glow {
    0% {
        box-shadow:
            0 0 50px rgba(0, 212, 255, 0.1),
            inset 0 0 50px rgba(0, 212, 255, 0.02);
    }

    100% {
        box-shadow:
            0 0 80px rgba(0, 212, 255, 0.2),
            inset 0 0 80px rgba(0, 212, 255, 0.05);
    }
}

/* Enhanced Corners */
.card-corners .corner {
    width: 20px;
    height: 20px;
    border-width: 3px;
    animation: corner-pulse 3s ease-in-out infinite alternate;
}

@keyframes corner-pulse {
    0% {
        border-color: var(--accent-cyan);
        filter: drop-shadow(0 0 5px var(--glow-cyan));
    }

    100% {
        border-color: var(--border-active);
        filter: drop-shadow(0 0 15px var(--glow-cyan));
    }
}

/* Terminal Header */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.system-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.system-label {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--glow-cyan);
}

.status-indicators {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.active {
    background: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

@keyframes pulse {

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

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.status-text {
    font-family: var(--font-display);
    font-size: 10px;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.4);
}

.access-level {
    text-align: right;
}

.level-label {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--accent-orange);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px var(--glow-orange);
}

/* Logo Section */
.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo-frame {
    position: relative;
    display: inline-block;
    padding: 30px 40px;
    margin: auto;
    border: 1px solid var(--border-color);
    background: rgba(20, 20, 40, 0.8);
}

.logo-corners {
    position: absolute;
    inset: -1px;
    pointer-events: none;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0;
    text-shadow: 0 0 20px rgba(230, 243, 255, 0.3);
}

.logo-accent {
    color: var(--accent-cyan);
    text-shadow: 0 0 20px var(--glow-cyan);
}

.logo-subtitle {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 8px;
    opacity: 0.8;
}

/* Access Form */
.access-form {
    margin-bottom: 30px;
}

.form-section {
    text-align: center;
    margin-bottom: 40px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 0 15px 0;
    text-shadow: 0 0 15px var(--glow-cyan);
}

.section-description {
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Input Group */
.input-group {
    margin-bottom: 30px;
}

.input-label {
    display: block;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-shadow: 0 0 8px var(--glow-cyan);
}

.input-frame {
    position: relative;
    margin-bottom: 8px;
}

.access-input {
    width: 100%;
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 16px 20px;
    text-align: center;
    transition: all 0.3s ease;
    outline: none;
}

.access-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.access-input:focus {
    border-color: var(--border-active);
    box-shadow:
        0 0 25px var(--glow-cyan),
        inset 0 0 25px rgba(0, 212, 255, 0.1);
    background: rgba(0, 212, 255, 0.05);
    text-shadow: 0 0 8px var(--glow-cyan);
}

.input-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg,
            transparent,
            rgba(0, 212, 255, 0.2),
            transparent,
            rgba(0, 212, 255, 0.2),
            transparent);
    background-size: 400% 400%;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: glow-move 3s ease-in-out infinite;
}

.access-input:focus+.input-glow {
    opacity: 1;
}

@keyframes glow-move {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.input-hint {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    opacity: 0.7;
}

/* Access Button */
.action-section {
    text-align: center;
    margin-bottom: 30px;
}

.access-button {
    position: relative;
    width: 100%;
    background: transparent;
    border: 2px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 18px 30px;
    cursor: pointer;
    transition: all 0.4s ease;
    overflow: hidden;
    text-shadow: 0 0 10px var(--glow-cyan);
}

.access-button:hover {
    background: rgba(0, 212, 255, 0.1);
    box-shadow:
        0 0 30px var(--glow-cyan),
        inset 0 0 30px rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.access-button:active {
    transform: translateY(0);
}

.button-scanner {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(0, 212, 255, 0.4),
            transparent);
    transition: left 0.6s ease;
}

.access-button:hover .button-scanner {
    left: 100%;
}

.button-text {
    position: relative;
    z-index: 2;
}

/* Status Section */
.status-section {
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-bottom: 20px;
}

.status-section.visible {
    opacity: 1;
}

.status-message {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.status-message.success {
    color: #00ff88;
    border-color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
}

.status-message.error {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
    text-shadow: 0 0 10px var(--glow-orange);
}

.status-message.processing {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--glow-cyan);
    animation: processing-pulse 1s ease-in-out infinite alternate;
}

@keyframes processing-pulse {
    0% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg,
            var(--accent-cyan),
            rgba(0, 212, 255, 0.7),
            var(--accent-cyan));
    background-size: 200% 100%;
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-shimmer 2s linear infinite;
}

@keyframes progress-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Security Notice */
.security-notice {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(255, 107, 53, 0.05);
    border: 1px solid var(--accent-orange);
    border-left: 4px solid var(--accent-orange);
}

.notice-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.warning-icon {
    font-size: 16px;
    color: var(--accent-orange);
    text-shadow: 0 0 10px var(--glow-orange);
}

.notice-title {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-orange);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.notice-content p {
    font-family: var(--font-primary);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 5px;
}

.notice-content p:last-child {
    margin-bottom: 0;
}

/* System Footer */
.system-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 10px;
}

.system-version,
.system-timestamp {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.version-label,
.timestamp-label {
    font-family: var(--font-display);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.version-number,
.timestamp-value {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent-cyan);
    text-shadow: 0 0 5px var(--glow-cyan);
}

/* Background Particles */
.access-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--glow-cyan);
    animation: particle-float 8s linear infinite;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 6s;
}

.particle:nth-child(2) {
    left: 20%;
    animation-delay: 1s;
    animation-duration: 8s;
}

.particle:nth-child(3) {
    left: 50%;
    animation-delay: 2s;
    animation-duration: 7s;
}

.particle:nth-child(4) {
    left: 70%;
    animation-delay: 3s;
    animation-duration: 9s;
}

.particle:nth-child(5) {
    left: 90%;
    animation-delay: 4s;
    animation-duration: 5s;
}

@keyframes particle-float {
    0% {
        top: 100vh;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: -10px;
        opacity: 0;
    }
}

/* ==========================================================================
   INVITE PAGE - ENHANCED RESPONSIVE DESIGN
   ========================================================================== */

/* Default styles mantengono il comportamento attuale per desktop */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .access-frame {
        max-width: 650px;
        padding: 50px;
    }

    .logo-text {
        font-size: 32px;
    }

    .section-title {
        font-size: 24px;
    }

    .access-input {
        font-size: 18px;
        padding: 20px 24px;
    }

    .access-button {
        font-size: 16px;
        padding: 20px 35px;
    }
}

/* Desktop (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .access-frame {
        max-width: 600px;
        padding: 45px;
    }

    .logo-text {
        font-size: 30px;
    }
}

/* Tablet (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .access-container {
        padding: 15px;
    }

    .access-frame {
        max-width: 100%;
        padding: 35px 30px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .logo-text {
        font-size: 26px;
    }

    .logo-frame {
        padding: 25px 35px;
        margin: auto;
    }

    .section-title {
        font-size: 18px;
    }

    .section-description {
        font-size: 13px;
        max-width: 350px;
    }

    .access-input {
        padding: 18px 22px;
        letter-spacing: 2px;
    }

    .access-button {
        font-size: 13px;
        padding: 16px 28px;
    }

    .system-footer {
        flex-direction: row;
        gap: 20px;
    }
}

/* Mobile Large (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {

    /* ✨ KEY CHANGE: Container da fixed a relative per permettere scroll */
    body {
        overflow: auto;
        /* Era: hidden */
    }

    .access-container {
        position: relative;
        /* Era: fixed */
        top: auto;
        /* Era: 0 */
        left: auto;
        /* Era: 0 */
        width: 100%;
        height: auto;
        /* Era: 100% */
        min-height: 100vh;
        /* Nuovo: mantiene altezza minima */
        display: block;
        /* Era: flex */
        align-items: stretch;
        justify-content: stretch;
        padding: 20px 15px;
        overflow-y: auto;
    }

    .access-frame {
        position: static;
        width: 100%;
        max-width: 100%;
        max-height: none;
        margin: 0;
        padding: 30px 25px;
        overflow-y: visible;
        border-radius: 0;
    }

    /* Logo adjustments mobile */
    .logo-section {
        margin-bottom: 35px;
    }

    .logo-frame {
        padding: 20px 30px;
        margin: auto;
    }

    .logo-text {
        font-size: 22px;
        line-height: 1.2;
    }

    .logo-subtitle {
        font-size: 9px;
        letter-spacing: 2px;
        margin-top: 6px;
    }

    /* Form section mobile */
    .form-section {
        margin-bottom: 35px;
    }

    .section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .section-description {
        font-size: 12px;
        line-height: 1.5;
        max-width: 100%;
    }

    /* Input group mobile */
    .input-group {
        margin-bottom: 25px;
    }

    .input-label {
        font-size: 11px;
        margin-bottom: 10px;
    }

    .access-input {
        padding: 16px 20px;
        letter-spacing: 2px;
    }

    .input-hint {
        font-size: 9px;
        margin-top: 6px;
    }

    /* Button mobile */
    .action-section {
        margin-bottom: 25px;
    }

    .access-button {
        font-size: 12px;
        padding: 16px 25px;
        letter-spacing: 1.5px;
    }

    /* Status section mobile */
    .status-section {
        margin-bottom: 20px;
    }

    .status-message {
        font-size: 11px;
        padding: 8px;
    }

    /* Security notice mobile */
    .security-notice {
        padding: 15px;
        margin-bottom: 20px;
    }

    .notice-title {
        font-size: 11px;
    }

    .notice-content p {
        font-size: 10px;
    }

    /* System footer mobile */
    .system-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        font-size: 9px;
        padding-top: 15px;
    }

    .system-version,
    .system-timestamp {
        align-items: center;
    }

}

/* Mobile Small (320px - 575px) */
@media (max-width: 575px) {

    /* Container adjustments for very small screens */
    .access-container {
        padding: 15px 10px;
        min-height: 100vh;
    }

    .access-frame {
        padding: 25px 20px;
        border-width: 1px;
    }

    /* Logo very small screens */
    .logo-text {
        font-size: 18px;
        line-height: 1.1;
    }

    .logo-frame {
        padding: 15px 25px;
        margin: auto;
    }

    .logo-subtitle {
        font-size: 8px;
        letter-spacing: 1px;
    }

    /* Form very small */
    .section-title {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .section-description {
        font-size: 11px;
        line-height: 1.4;
    }

    /* Input very compact */
    .input-label {
        font-size: 10px;
        letter-spacing: 1px;
    }

    .access-input {
        padding: 14px 18px;
        letter-spacing: 1px;
    }

    .input-hint {
        font-size: 8px;
    }

    /* Button very compact */
    .access-button {
        font-size: 11px;
        padding: 14px 20px;
        letter-spacing: 1px;
    }

    /* Status compact */
    .status-message {
        font-size: 10px;
        padding: 6px;
    }

    /* Security notice compact */
    .security-notice {
        padding: 12px;
    }

    .notice-title {
        font-size: 10px;
    }

    .notice-content p {
        font-size: 9px;
        line-height: 1.3;
    }

    /* Footer compact */
    .system-footer {
        font-size: 8px;
        gap: 10px;
    }

    .version-label,
    .timestamp-label {
        font-size: 8px;
    }

    .version-number,
    .timestamp-value {
        font-size: 9px;
    }
}

/* Extra Small Mobile (max 319px) */
@media (max-width: 319px) {
    .access-container {
        padding: 10px 8px;
    }

    .access-frame {
        padding: 20px 15px;
    }

    .logo-text {
        font-size: 16px;
    }

    .logo-frame {
        margin: auto;
        padding: 12px 20px;
    }

    .section-title {
        font-size: 12px;
    }

    .section-description {
        font-size: 10px;
    }

    .access-input {
        padding: 12px 16px;
    }

    .access-button {
        font-size: 10px;
        padding: 12px 18px;
    }

    .security-notice {
        padding: 10px;
    }

    .system-footer {
        font-size: 7px;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .access-container {
        padding: 10px;
        min-height: auto;
    }

    .access-frame {
        padding: 20px 25px;
        max-height: none;
    }

    .logo-section {
        margin-bottom: 20px;
    }

    .logo-frame {
        margin: auto;
        padding: 15px 25px;
    }

    .form-section {
        margin-bottom: 20px;
    }

    .input-group {
        margin-bottom: 15px;
    }

    .action-section {
        margin-bottom: 15px;
    }

    .security-notice {
        padding: 10px;
        margin-bottom: 15px;
    }

    .system-footer {
        padding-top: 10px;
    }
}

/* High DPI screens adjustments */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .logo-text,
    .section-title,
    .access-input,
    .access-button {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .corner,
    .card-corners .corner,
    .logo-corners .corner {
        border-width: 2px;
    }

    .access-frame {
        border-width: 2px;
    }
}

/* Accessibility and motion preferences */
@media (prefers-reduced-motion: reduce) {

    .access-frame,
    .corner,
    .status-message.processing,
    .particle,
    .input-glow,
    .button-scanner,
    .progress-fill,
    .status-dot {
        animation: none !important;
    }

    .corner {
        border-color: var(--accent-cyan);
        filter: drop-shadow(0 0 8px var(--glow-cyan));
    }

    .access-button:hover .button-scanner {
        left: 0;
        opacity: 0.1;
    }
}

/* Print styles (if needed) */
@media print {
    .access-container {
        position: static;
        height: auto;
        background: white;
        color: black;
    }

    .access-frame {
        background: white;
        border: 2px solid black;
        box-shadow: none;
        backdrop-filter: none;
    }

    .grid-background,
    .scanning-lines,
    .access-particles {
        display: none;
    }

    .access-input,
    .access-button {
        border-color: black;
        color: black;
    }
}

/* Focus management for keyboard navigation */
@media (any-hover: none) {
    .access-button:hover {
        background: rgba(0, 212, 255, 0.15);
    }

    .access-input:focus {
        outline: 2px solid var(--accent-cyan);
        outline-offset: 2px;
    }
}