/* Fix for border-box issue */
* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box !important;
    -moz-box-sizing: border-box !important;
    box-sizing: border-box !important;
}

/* Override any border-box declarations that might be causing issues */
[style*="border-box"] {
    -webkit-box-sizing: border-box !important;
    -moz-box-sizing: border-box !important;
    box-sizing: border-box !important;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0b3443 0%, #9090ae 50%, #102025 100%);
    min-height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Welcome Page Styles */
.welcome-container {
    display: flex;
    margin-top: 20px;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    color: #FBE9D0;
    padding: 20px;
}

.welcome-content {
    background: rgba(11, 52, 67, 0.85);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(16, 32, 37, 0.2);
    border: 1px solid rgba(16, 32, 37, 0.3);
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

.welcome-content h1 {
    margin: 0 0 20px 0;
    font-size: 2.5em;
    font-weight: bold;
    background: linear-gradient(45deg, #0b3443, #9090ae, #102025);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(16, 32, 37, 0.5);
    animation: shimmer 3s ease-in-out infinite;
}

.welcome-content h1 img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

.welcome-content p {
    margin: 0 0 30px 0;
    font-size: 1.2em;
    color: #FBE9D0;
    text-shadow: 0 0 15px rgba(251, 233, 208, 0.3);
}

.input-container {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

#user-code {
    padding: 15px 20px;
    border: 2px solid rgba(16, 32, 37, 0.4);
    border-radius: 25px;
    font-size: 16px;
    background: rgba(11, 52, 67, 0.7);
    color: #FBE9D0;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

#user-code:focus {
    border-color: rgba(16, 32, 37, 0.7);
    box-shadow: 0 0 20px rgba(16, 32, 37, 0.3);
}

#enter-btn {
    background: linear-gradient(45deg, #0b3443, #9090ae);
    color: #FBE9D0;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(16, 32, 37, 0.3);
}

#enter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 32, 37, 0.5);
}

#enter-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}



/* Error message styles */
.error-message {
    background: rgba(11, 52, 67, 0.9);
    color: #FBE9D0;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    margin: 20px auto;
    border: 2px solid rgba(16, 32, 37, 0.3);
}

.error-message h3 {
    color: #9090ae;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.error-message button {
    background: linear-gradient(45deg, #0b3443, #9090ae);
    color: #FBE9D0;
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.error-message button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 32, 37, 0.5);
}

/* Camera Interface Styles */
#camera-interface {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #000;
}

/* Embedded Frame Container Styles */
#embedded-frame-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: #000;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#embedded-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    background: #000;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    z-index: 1;
}

.button-container {
    position: absolute;
    left: 50%;
    bottom: 30%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 2;
}

#capture-btn {
    background: linear-gradient(45deg, #0b3443, #9090ae);
    color: #FBE9D0;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(16, 32, 37, 0.3);
}

#capture-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 32, 37, 0.5);
}

#switch-camera-btn {
    background: rgba(11, 52, 67, 0.8);
    color: #FBE9D0;
    border: 2px solid rgba(16, 32, 37, 0.4);
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

#switch-camera-btn:hover {
    background: rgba(11, 52, 67, 0.9);
    border-color: rgba(16, 32, 37, 0.7);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(16, 32, 37, 0.3);
}

#countdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: min(30.25vw, 30.25vh);
    line-height: 1;
    font-weight: 900;
    color: white;
    text-shadow: 6px 6px 12px rgba(0, 0, 0, 0.9);
    background-color: transparent;
    z-index: 1000;
    margin: 0;
    padding: 0;
    width: auto;
    height: auto;
}

#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #FBE9D0;
    z-index: 1000;
}

.spinner {
    border: 4px solid rgba(16, 32, 37, 0.3);
    border-top: 4px solid #f0ac54;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#result {
    max-width: 100vw;
    text-align: center;
    margin: 0;
}

#result img {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

/* Copyright/Privacy notice */
.privacy-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ddd;
    text-align: center;
    padding: 8px 15px;
    font-size: 0.8rem;
    z-index: 100;
    cursor: pointer;
}

/* Privacy notice for embedded frame (step 3) - needs higher z-index */
#privacy-notice-step3 {
    z-index: 1001;
}

/* Powered by section */
.powered-by {
    margin-top: 5px;
    font-size: 0.8rem;
    color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.footer-logo {
    height: 1em;
    width: auto;
    vertical-align: middle;
}

.privacy-notice a {
    color: transparent;
    text-decoration: none;
    display: inline-block;
    margin-left: 5px;
    width: 16px;
    height: 16px;
    background-color: transparent;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    font-size: 0.75rem;
    position: absolute;
    opacity: 0;
}

/* Camera mirroring and countdown animations */
.mirrored {
    transform: scaleX(-1);
}

.countdown-animation {
    animation: pulseScale 1s ease-in-out;
}

@keyframes pulseScale {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .welcome-container {
        min-height: 100vh;
        padding: 15px;
        align-items: center;
        margin-top: 20px;
    }
    
    .welcome-content {
        padding: 30px 20px;
        margin: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .welcome-content h1 {
        font-size: 2em;
    }
    
    video {
        max-width: 100vw;
        margin: 0;
    }
    
    .button-container {
        flex-direction: row;
        gap: 10px;
    }
    
    #capture-btn {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    #switch-camera-btn {
        width: 44px;
        height: 44px;
        padding: 10px;
    }
    
    #countdown {
        font-size: min(48.4vw, 48.4vh);
        text-shadow: 8px 8px 16px rgba(0, 0, 0, 0.95);
        z-index: 9999;
    }
}

@media (max-width: 480px) {
    .welcome-container {
        min-height: 100vh;
        padding: 10px;
        align-items: center;
        margin-top: 20px;
    }
    
    .welcome-content {
        padding: 25px 15px;
        margin: 0;
        max-width: 100%;
        width: 100%;
    }
    
    #countdown {
        font-size: min(54.45vw, 54.45vh);
    }
    
    .privacy-notice {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* Landing Page Styles */
.landing-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #244855 0%, #90AEAD 50%, #244855 100%);
    position: relative;
    overflow: hidden;
}

/* Background logo with effects */
.background-logo {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 1;
    animation: float 8s ease-in-out infinite;
}

.logo-bg {
    width: 540px;
    height: auto;
    filter: 
        drop-shadow(0 0 60px rgba(230, 72, 51, 0.6)) 
        drop-shadow(0 0 100px rgba(144, 174, 173, 0.4))
        drop-shadow(0 0 140px rgba(36, 72, 85, 0.3))
        blur(0.5px);
    animation: 
        pulse 6s ease-in-out infinite,
        rotate 40s linear infinite,
        glow 4s ease-in-out infinite;
    transform-origin: center;
}

/* Multiple background logos for layered effect */
.background-logo::before,
.background-logo::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(230, 72, 51, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    animation: ripple 10s ease-in-out infinite;
    z-index: -1;
}

.background-logo::after {
    width: 900px;
    height: 900px;
    background: radial-gradient(circle, rgba(144, 174, 173, 0.6) 0%, transparent 70%);
    animation: ripple 15s ease-in-out infinite reverse;
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) translateY(0px) rotate(0deg); }
    25% { transform: translate(-50%, -50%) translateY(-15px) rotate(1deg); }
    50% { transform: translate(-50%, -50%) translateY(-25px) rotate(0deg); }
    75% { transform: translate(-50%, -50%) translateY(-10px) rotate(-1deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

@keyframes glow {
    0%, 100% { 
        filter: 
            drop-shadow(0 0 40px rgba(230, 72, 51, 0.4)) 
            drop-shadow(0 0 80px rgba(144, 174, 173, 0.3))
            drop-shadow(0 0 120px rgba(36, 72, 85, 0.2))
            blur(0.5px);
    }
    50% { 
        filter: 
            drop-shadow(0 0 60px rgba(230, 72, 51, 0.6)) 
            drop-shadow(0 0 100px rgba(144, 174, 173, 0.4))
            drop-shadow(0 0 140px rgba(36, 72, 85, 0.3))
            blur(0.5px);
    }
}

@keyframes ripple {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

/* Header with burger menu */
.landing-container .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(36, 72, 85, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(230, 72, 51, 0.3);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Container for burger menu and home button */
.landing-container .menu-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-container .logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.landing-container .logo {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(230, 72, 51, 0.3));
}

.landing-container .logo-text {
    color: #FBE9D0;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(251, 233, 208, 0.3);
}

/* Burger menu positioned top left */
.landing-container .burger-menu {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    z-index: 1001;
}

.landing-container .burger-menu:hover {
    background: rgba(230, 72, 51, 0.2);
}

.landing-container .burger-line {
    width: 25px;
    height: 3px;
    background: #FBE9D0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.landing-container .burger-menu:hover .burger-line {
    background: #f0ac54;
    box-shadow: 0 0 10px rgba(230, 72, 51, 0.5);
}

/* Home button */
.landing-container .home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    z-index: 1001;
}

.landing-container .home-button:hover {
    background: rgba(230, 72, 51, 0.2);
    transform: scale(1.1);
}

.landing-container .home-icon {
    width: 25px;
    height: 25px;
    filter: drop-shadow(0 0 5px rgba(251, 233, 208, 0.3));
    transition: all 0.3s ease;
}

.landing-container .home-button:hover .home-icon {
    filter: drop-shadow(0 0 10px rgba(230, 72, 51, 0.5));
}

/* Navigation menu */
.landing-container .nav-menu {
    position: fixed;
    top: 80px;
    left: -300px;
    width: 280px;
    height: calc(100vh - 80px);
    background: rgba(36, 72, 85, 0.95);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(230, 72, 51, 0.3);
    transition: left 0.3s ease;
    z-index: 999;
    padding: 20px;
}

.landing-container .nav-menu.active {
    left: 0;
}

.landing-container .nav-menu a {
    display: block;
    color: #FBE9D0;
    text-decoration: none;
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.landing-container .nav-menu a:hover {
    background: rgba(230, 72, 51, 0.2);
    border-color: rgba(230, 72, 51, 0.4);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(230, 72, 51, 0.2);
}

/* Main content */
.landing-container .main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 20px 40px;
    position: relative;
    z-index: 2;
}

.landing-container .content-card {
    background: rgba(11, 52, 67, 0.85);
    backdrop-filter: blur(1px);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(16, 32, 37, 0.2);
    border: 1px solid rgba(16, 32, 37, 0.3);
    max-width: 800px;
    width: 90%;
    text-align: center;
}

.landing-container .content-card h1 {
    margin: 0 0 30px 0;
    font-size: 3em;
    font-weight: bold;
    background: linear-gradient(45deg, #0b3443, #9090ae, #102025);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(16, 32, 37, 0.5);
    animation: shimmer 3s ease-in-out infinite;
}

.landing-container .content-card h2 {
    color: #FBE9D0;
    font-size: 1.8em;
    margin: 30px 0 20px 0;
    text-shadow: 0 0 15px rgba(251, 233, 208, 0.3);
}

.landing-container .content-card p {
    margin: 0 0 25px 0;
    font-size: 1.3em;
    color: #FBE9D0;
    text-shadow: 0 0 15px rgba(251, 233, 208, 0.3);
    line-height: 1.6;
}

.landing-container .wikipedia-link {
    display: inline-block;
    background: linear-gradient(45deg, #0b3443, #9090ae);
    color: #FBE9D0;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    margin: 20px 10px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(16, 32, 37, 0.3);
}

.landing-container .wikipedia-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 32, 37, 0.5);
}

.landing-container .squid-info {
    background: rgba(230, 72, 51, 0.1);
    border: 1px solid rgba(230, 72, 51, 0.3);
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
}

.landing-container .squid-info h3 {
    color: #f0ac54;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.landing-container .squid-info p {
    margin: 0;
    font-size: 1.1em;
}

/* Overlay for menu */
.landing-container .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.landing-container .menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Landing page responsive design */
@media (max-width: 768px) {
    .landing-container .content-card {
        padding: 30px 20px;
    }

    .landing-container .content-card h1 {
        font-size: 2.2em;
    }

    .landing-container .content-card h2 {
        font-size: 1.5em;
    }

    .landing-container .content-card p {
        font-size: 1.1em;
    }

    .landing-container .nav-menu {
        width: 250px;
    }

    .landing-container .logo-text {
        font-size: 1.2em;
    }

    .landing-container .menu-container {
        gap: 8px;
    }

    .logo-bg {
        width: 350px;
    }
    
    .background-logo::before {
        width: 400px;
        height: 400px;
    }
    
    .background-logo::after {
        width: 500px;
        height: 500px;
    }
}

@media (max-width: 480px) {
    .landing-container .content-card h1 {
        font-size: 1.8em;
    }

    .landing-container .content-card h2 {
        font-size: 1.3em;
    }

    .landing-container .content-card p {
        font-size: 1em;
    }

    .landing-container .wikipedia-link {
        padding: 12px 25px;
        font-size: 1em;
    }

    .landing-container .menu-container {
        gap: 6px;
    }

    .landing-container .home-icon {
        width: 22px;
        height: 22px;
    }

    .landing-container .burger-line {
        width: 22px;
        height: 2px;
    }

    .logo-bg {
        width: 280px;
    }
    
    .background-logo::before {
        width: 320px;
        height: 320px;
    }
    
    .background-logo::after {
        width: 400px;
        height: 400px;
    }
}
