:root {
    --bg: #06111f;
    --bg-deep: #020712;
    --glass: rgba(11, 22, 38, 0.62);
    --glass-light: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(173, 224, 255, 0.24);
    --text: #f7fbff;
    --muted: #adc1cf;
    --sky: #38bdf8;
    --sky-deep: #0284c7;
    --gold: #f4c86a;
    --danger: #ff8a9a;
    --shadow: rgba(0, 0, 0, 0.38);
    --radius-card: 30px;
    --ease: 0.3s ease-in-out;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    color-scheme: dark;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    font-family: "Poppins", "Cairo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 18% 12%, rgba(56, 189, 248, 0.18), transparent 28rem),
        radial-gradient(circle at 85% 20%, rgba(244, 200, 106, 0.12), transparent 24rem),
        linear-gradient(145deg, var(--bg-deep), var(--bg) 52%, #081827);
}

button,
input,
a {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.eid-background {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.eid-background::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background-image:
        linear-gradient(30deg, rgba(255, 255, 255, 0.18) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.18) 87.5%, rgba(255, 255, 255, 0.18)),
        linear-gradient(150deg, rgba(255, 255, 255, 0.18) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.18) 87.5%, rgba(255, 255, 255, 0.18)),
        linear-gradient(30deg, rgba(255, 255, 255, 0.18) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.18) 87.5%, rgba(255, 255, 255, 0.18)),
        linear-gradient(150deg, rgba(255, 255, 255, 0.18) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.18) 87.5%, rgba(255, 255, 255, 0.18));
    background-position: 0 0, 0 0, 24px 42px, 24px 42px;
    background-size: 48px 84px;
    mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.crescent {
    position: absolute;
    top: clamp(36px, 7vw, 82px);
    right: clamp(24px, 9vw, 118px);
    width: clamp(78px, 12vw, 138px);
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: -18px 12px 0 0 rgba(244, 200, 106, 0.86);
    filter: drop-shadow(0 0 26px rgba(244, 200, 106, 0.24));
    opacity: 0.7;
}

.star,
.pattern {
    position: absolute;
    display: block;
}

.star {
    width: 7px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(185, 232, 255, 0.96);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.85);
    animation: twinkle 3.6s ease-in-out infinite;
}

.star::before,
.star::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 20px;
    height: 1px;
    border-radius: 99px;
    background: currentColor;
    color: rgba(185, 232, 255, 0.62);
    transform: translate(-50%, -50%);
}

.star::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.star-one {
    top: 18%;
    left: 15%;
}

.star-two {
    top: 68%;
    right: 14%;
    animation-delay: 0.8s;
}

.star-three {
    bottom: 16%;
    left: 23%;
    animation-delay: 1.5s;
}

.pattern {
    width: clamp(150px, 25vw, 360px);
    aspect-ratio: 1;
    border: 1px solid rgba(56, 189, 248, 0.16);
    transform: rotate(45deg);
    opacity: 0.42;
}

.pattern::before,
.pattern::after {
    content: "";
    position: absolute;
    inset: 18%;
    border: 1px solid rgba(244, 200, 106, 0.18);
}

.pattern::after {
    inset: 34%;
    border-color: rgba(255, 255, 255, 0.14);
}

.pattern-left {
    left: -110px;
    bottom: 8%;
}

.pattern-right {
    right: -120px;
    top: 42%;
}

.page-shell {
    width: min(100%, 1180px);
    min-height: 100vh;
    margin: 0 auto;
    padding: clamp(22px, 5vw, 54px);
    display: grid;
    place-items: center;
}

.greeting-card {
    width: min(100%, 780px);
    position: relative;
    padding: clamp(22px, 4vw, 44px);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.03)),
        var(--glass);
    box-shadow:
        0 28px 90px var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(26px) saturate(135%);
    -webkit-backdrop-filter: blur(26px) saturate(135%);
    text-align: center;
}

.greeting-card::before {
    content: "";
    position: absolute;
    inset: -40% 10% auto;
    height: 300px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.2);
    filter: blur(75px);
    pointer-events: none;
}

.model-stage {
    position: relative;
    width: min(100%, 430px);
    margin: 0 auto clamp(12px, 2vw, 18px);
    aspect-ratio: 1.18;
}

.model-stage::after {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: 6%;
    height: 16%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.22), transparent 72%);
    filter: blur(10px);
    z-index: -1;
}

.sheep-model {
    width: 100%;
    height: 100%;
    --poster-color: transparent;
}

.model-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background:
        radial-gradient(circle at 50% 38%, rgba(56, 189, 248, 0.18), transparent 42%),
        rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-weight: 700;
}

.intro-copy {
    position: relative;
    z-index: 1;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    max-width: 680px;
    margin: 0 auto;
    font-size: clamp(2rem, 6vw, 4.2rem);
    line-height: 1.02;
    letter-spacing: 0;
    text-wrap: balance;
}

.subtitle {
    width: min(100%, 590px);
    margin: 18px auto 0;
    color: var(--muted);
    font-size: clamp(0.98rem, 2vw, 1.08rem);
    line-height: 1.7;
}

.generator-form {
    width: min(100%, 540px);
    margin: 30px auto 0;
    display: grid;
    gap: 14px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--ease), transform var(--ease), max-height var(--ease), margin var(--ease);
}

.generator-form.is-hidden {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    overflow: hidden;
}

.name-input {
    width: 100%;
    min-height: 58px;
    padding: 0 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50px;
    outline: none;
    background: rgba(2, 9, 18, 0.52);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.name-input::placeholder {
    color: rgba(222, 238, 247, 0.58);
}

.name-input:focus {
    border-color: var(--sky);
    background: rgba(2, 9, 18, 0.72);
    box-shadow:
        0 0 0 4px rgba(56, 189, 248, 0.12),
        0 0 24px rgba(56, 189, 248, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.form-message {
    min-height: 1.3em;
    margin: 0;
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 600;
}

.primary-button,
.secondary-button {
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 26px;
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 800;
    line-height: 1;
    transition:
        transform var(--ease),
        box-shadow var(--ease),
        background var(--ease),
        border-color var(--ease),
        color var(--ease),
        opacity var(--ease);
}

.primary-button {
    border: 1px solid rgba(125, 211, 252, 0.95);
    background: linear-gradient(135deg, var(--sky), #7dd3fc);
    color: #02101d;
    box-shadow: 0 16px 34px rgba(56, 189, 248, 0.18);
}

.primary-button:hover,
.primary-button:focus-visible {
    transform: scale(1.05);
    box-shadow: 0 0 28px rgba(56, 189, 248, 0.58), 0 18px 42px rgba(56, 189, 248, 0.28);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.78;
    transform: none;
}

.primary-button.compact {
    min-height: 48px;
    padding-inline: 22px;
}

.button-spinner {
    width: 18px;
    aspect-ratio: 1;
    display: none;
    border: 2px solid rgba(2, 16, 29, 0.22);
    border-top-color: #02101d;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.primary-button.is-loading .button-spinner {
    display: inline-block;
}

.result-panel {
    margin: 28px auto 0;
}

.result-panel[hidden] {
    display: none;
}

.result-panel.is-visible {
    animation: slideFadeUp 0.62s ease both;
}

.greeting-text {
    margin: 0;
    font-size: clamp(1.55rem, 4.2vw, 3.25rem);
    line-height: 1.16;
    font-weight: 800;
    letter-spacing: 0;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18),
        0 16px 34px rgba(0, 0, 0, 0.36);
}

.greeting-text .name-highlight {
    color: var(--sky);
    text-shadow: 0 0 22px rgba(56, 189, 248, 0.72);
}

.wish-line {
    display: block;
    margin-top: 12px;
    color: var(--muted);
    font-size: clamp(1rem, 2.2vw, 1.24rem);
    font-weight: 600;
    line-height: 1.6;
    text-shadow: none;
}

.share-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.secondary-button {
    min-height: 48px;
    border: 1px solid rgba(56, 189, 248, 0.86);
    background: rgba(56, 189, 248, 0.02);
    color: #7dd3fc;
}

.secondary-button:hover,
.secondary-button:focus-visible {
    transform: translateY(-2px);
    background: var(--sky);
    color: #02101d;
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.42);
}

@keyframes slideFadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes twinkle {
    0%,
    100% {
        opacity: 0.42;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.18);
    }
}

@media (max-width: 680px) {
    .page-shell {
        padding: 16px;
        align-items: start;
    }

    .greeting-card {
        margin-top: 10px;
        border-radius: 24px;
    }

    .model-stage {
        width: min(100%, 340px);
    }

    .share-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .secondary-button,
    .primary-button.compact {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
