@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;700;900&display=swap");

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --red: #d62828;
    --green: #1b998b;
    --gold: #f4d35e;
    --white: #fffbfc;
    --dark: #2d3436;
}

body {
    font-family: "Rubik", sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3f 50%, #1a472a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    direction: rtl;
    overflow: hidden;
    position: relative;
}

/* Snowflakes */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    animation: fall linear infinite;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

@keyframes fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* Container */
.container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 40px rgba(244, 211, 94, 0.3);
    text-align: center;
    border: 3px solid var(--gold);
}

/* Decorations */
.decorations {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    display: flex;
    gap: 10px;
}

/* Header */
.header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--red);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px var(--gold);
}

.header .subtitle {
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Input Section */
.input-section {
    transition: all 0.5s ease;
}

.input-section.hidden {
    display: none;
}

.code-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.3rem;
    font-family: "Rubik", sans-serif;
    border: 3px solid var(--green);
    border-radius: 12px;
    text-align: center;
    direction: ltr;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    background: var(--white);
}

.code-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(244, 211, 94, 0.5);
}

.code-input::placeholder {
    color: #aaa;
    direction: rtl;
}

.btn {
    padding: 14px 40px;
    font-size: 1.2rem;
    font-family: "Rubik", sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--red) 0%, #b71c1c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(214, 40, 40, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(214, 40, 40, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--green) 0%, #147a6e 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(27, 153, 139, 0.4);
    margin-top: 20px;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(27, 153, 139, 0.5);
}

/* Error Message */
.error-message {
    background: #ffebee;
    border: 2px solid var(--red);
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
    color: var(--red);
    font-weight: 500;
    animation: shake 0.5s ease;
    display: none;
}

.error-message.show {
    display: block;
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* Reveal Section */
.reveal-section {
    display: none;
    text-align: center;
}

.reveal-section.show {
    display: block;
    animation: fadeInUp 0.6s ease;
}

.reveal-content {
    position: relative;
    padding: 40px 20px;
}

.reveal-icon {
    font-size: 3rem;
    animation: bounce 1s ease infinite;
    margin-bottom: 20px;
}

.reveal-text-container {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.reveal-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--red);
    animation: fadeTextPulse 0.8s ease-in-out infinite;
    margin: 0;
}

@keyframes fadeTextPulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.reveal-sparkles {
    font-size: 2rem;
    animation: sparkle 1s ease-in-out infinite;
    margin-top: 15px;
}

@keyframes sparkle {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.3);
    }
}

/* Result Section */
.result-section {
    display: none;
    animation: fadeInUp 0.8s ease;
}

.result-section.show {
    display: block;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
    border: 3px solid var(--gold);
    border-radius: 20px;
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: "✨";
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    animation: sparkle 1.5s ease infinite;
}

.result-card::after {
    content: "✨";
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 1.5rem;
    animation: sparkle 1.5s ease 0.5s infinite;
}

@keyframes sparkle {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.gift-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    animation: bounce 2s ease infinite;
}

.receiver-avatar {
    width: 100%;
    /* height: 96px; */
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 8px auto 6px auto;
    border: 4px solid var(--gold);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.result-text {
    font-size: 1.3rem;
    color: var(--dark);
    margin-bottom: 10px;
}

.receiver-name {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--red);
    text-shadow: 3px 3px 0px var(--gold), 0 0 30px rgba(214, 40, 40, 0.3);
    animation: glow 2s ease infinite alternate;
    margin: 15px 0;
}

@keyframes glow {
    0% {
        text-shadow: 3px 3px 0px var(--gold), 0 0 20px rgba(214, 40, 40, 0.3);
    }
    100% {
        text-shadow: 3px 3px 0px var(--gold), 0 0 40px rgba(214, 40, 40, 0.5);
    }
}

.result-decoration {
    font-size: 1.5rem;
    margin-top: 10px;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Lights decoration */
.lights {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: space-around;
    z-index: 5;
}

.light {
    width: 15px;
    height: 25px;
    border-radius: 50%;
    animation: blink 1s ease infinite;
}

.light:nth-child(odd) {
    background: var(--red);
    animation-delay: 0s;
}

.light:nth-child(even) {
    background: var(--green);
    animation-delay: 0.5s;
}

.light:nth-child(3n) {
    background: var(--gold);
    animation-delay: 0.25s;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 10px currentColor;
    }
    50% {
        opacity: 0.5;
        box-shadow: 0 0 5px currentColor;
    }
}

/* Footer */
.footer {
    margin-top: 25px;
    font-size: 0.85rem;
    color: #888;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .receiver-name {
        font-size: 2.2rem;
    }

    .code-input {
        font-size: 1.1rem;
    }
}
