:root {
    --primary-color: #ff3366;
    --secondary-color: #ff9933;
    --bg-color: #0d0d12;
    --text-color: #f0f0f0;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-hover: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 50px;
}

/* Particles background */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0d0d12 100%);
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: rgba(255, 51, 102, 0.5);
    border-radius: 50%;
    animation: float-up infinite linear;
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) translateX(20px);
        opacity: 0;
    }
}

.main-content {
    max-width: 900px;
    width: 90%;
    margin-top: 40px;
    z-index: 1;
    animation: fade-in 1s ease-out forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.main-title {
    font-size: 3rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 2px 2px 10px rgba(255, 51, 102, 0.2);
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #ccc;
}

.instructions {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #eee;
}

.highlight {
    color: var(--primary-color);
    font-size: 1.2em;
    padding: 0 5px;
}

.clues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.clue-card {
    background: transparent;
    border: none;
    perspective: 1000px;
    height: 250px;
    cursor: pointer;
}

.clue-card:hover .clue-card-inner {
    transform: translateY(-5px) scale(1.02) rotateY(0deg);
    box-shadow: 0 12px 40px 0 rgba(255, 51, 102, 0.2);
}

.clue-card.flipped:hover .clue-card-inner {
    transform: translateY(-5px) scale(1.02) rotateY(180deg);
}

.clue-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: var(--glass-shadow);
    border-radius: 15px;
}

.clue-card.flipped .clue-card-inner {
    transform: rotateY(180deg);
}

.clue-card-front,
.clue-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
}

.clue-card-front {
    background: rgba(20, 20, 30, 0.8);
    /* Solid fallback instead of backdrop-filter to prevent 3D breaking */
    color: var(--text-color);
}

.clue-card-front .question-mark {
    font-size: 5rem;
    font-weight: bold;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.clue-card-front .card-title {
    font-size: 1.2rem;
    margin-top: 10px;
    color: #ccc;
}

.clue-card-back {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    transform: rotateY(180deg);
    padding: 20px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
}

.clue-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 10px;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.vault-section {
    text-align: center;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.vault-section h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.vault-section p {
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.code-inputs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.code-digit {
    width: 50px;
    height: 60px;
    font-size: 2rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    transition: border-color 0.3s, box-shadow 0.3s;
    -moz-appearance: textfield;
    /* Remove arrows in Firefox */
}

/* Remove arrows in WebKit */
.code-digit::-webkit-outer-spin-button,
.code-digit::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.code-digit:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.5);
}

.verify-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
}

.verify-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 102, 0.5);
}

.verify-btn:active {
    transform: translateY(1px);
}

.error-message {
    color: #ff4d4d;
    margin-top: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: bold;
}

.error-message.show {
    opacity: 1;
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Final Reveal Overlay */
.final-reveal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.final-reveal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.final-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 50px 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 51, 102, 0.2);
}

.final-reveal-overlay.active .final-card {
    transform: scale(1);
}

.final-card h2 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.success-message {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.final-clue {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 15px;
    border: 1px dashed var(--secondary-color);
    margin-bottom: 30px;
}

.final-clue h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.final-clue p {
    font-size: 1.3rem;
    line-height: 1.5;
}

.close-reveal-btn {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 10px 30px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    font-weight: bold;
}

.close-reveal-btn:hover {
    background: white;
    color: var(--bg-color);
}

/* Confetti animation for success */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    animation: fall 3s linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}