
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
    --night: #090b16;
    --dark-blue: #111629;
    --stone: #343342;
    --stone-light: #555064;
    --gold: #d5ae70;
    --gold-light: #f0d39b;
    --mist: rgba(171, 176, 194, 0.13);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    font-family: 'Vazirmatn', sans-serif;
    background: var(--night);
    overflow: hidden;
}

.haunted-world {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(ellipse at 50% 42%, #25263a 0%, transparent 48%),
        linear-gradient(180deg, #090d1c 0%, #17182a 48%, #0b0c16 100%);
}

/* SKY */

.sky {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: -4;
}

.moon {
    position: absolute;
    width: 112px;
    height: 112px;
    top: 9%;
    left: 19%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 32%, #fff6d8, #d9c8a4 60%, #a99a83);
    box-shadow:
        0 0 25px rgba(238, 215, 172, 0.28),
        0 0 80px rgba(207, 193, 164, 0.18),
        0 0 150px rgba(207, 193, 164, 0.08);
    animation: moonGlow 5s ease-in-out infinite alternate;
}

.moon::before,
.moon::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(111, 103, 91, 0.12);
}

.moon::before {
    width: 23px;
    height: 17px;
    top: 25px;
    left: 22px;
}

.moon::after {
    width: 15px;
    height: 15px;
    bottom: 25px;
    right: 25px;
}

.moon-glow {
    position: absolute;
    top: 3%;
    left: 12%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 204, 171, 0.1), transparent 70%);
    pointer-events: none;
}

@keyframes moonGlow {
    from { opacity: 0.78; }
    to { opacity: 1; }
}

/* STARS */

.stars {
    position: absolute;
    inset: 0;
    opacity: 0.55;
    background-image:
        radial-gradient(2px 2px at 12% 17%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 35% 12%, #fff 50%, transparent 100%),
        radial-gradient(2px 2px at 65% 18%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 83% 11%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 74% 34%, #fff 50%, transparent 100%),
        radial-gradient(2px 2px at 27% 38%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 91% 43%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 8% 48%, #fff 50%, transparent 100%),
        radial-gradient(2px 2px at 47% 25%, #fff 50%, transparent 100%);
    animation: starsTwinkle 4s ease-in-out infinite alternate;
}

@keyframes starsTwinkle {
    from { opacity: 0.25; }
    to { opacity: 0.7; }
}

/* CLOUDS */

.cloud {
    position: absolute;
    width: 300px;
    height: 55px;
    border-radius: 50%;
    background: rgba(58, 61, 81, 0.32);
    filter: blur(22px);
    animation: cloudMove 35s linear infinite;
}

.cloud-one {
    top: 18%;
    left: -15%;
}

.cloud-two {
    top: 32%;
    left: 60%;
    animation-duration: 48s;
    animation-direction: reverse;
    opacity: 0.65;
}

.cloud-three {
    top: 55%;
    left: 5%;
    animation-duration: 55s;
    opacity: 0.45;
}

@keyframes cloudMove {
    from { transform: translateX(-10%); }
    to { transform: translateX(120vw); }
}

/* LIGHTNING */

.lightning {
    position: absolute;
    inset: 0;
    background: rgba(190, 197, 224, 0.08);
    opacity: 0;
    animation: lightningFlash 9s infinite;
}

@keyframes lightningFlash {
    0%, 91%, 94%, 97%, 100% { opacity: 0; }
    92% { opacity: 0.45; }
    93% { opacity: 0.05; }
    95% { opacity: 0.3; }
}

/* DISTANT HILLS */

.distant-hills {
    position: absolute;
    bottom: 15%;
    width: 100%;
    height: 35%;
    z-index: -3;
}

.hill {
    position: absolute;
    bottom: 0;
    width: 75%;
    height: 75%;
    border-radius: 50% 50% 0 0;
    background: #101321;
}

.hill-one {
    left: -20%;
    transform: rotate(-8deg);
}

.hill-two {
    right: -25%;
    height: 65%;
    background: #141526;
    transform: rotate(8deg);
}

/* CLOCK TOWER */

.clock-scene {
    position: absolute;
    width: 100%;
    height: 75%;
    bottom: 9%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: -1;
}

.tower-shadow {
    position: absolute;
    width: 450px;
    height: 80px;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    filter: blur(35px);
    border-radius: 50%;
}

.clock-tower {
    position: relative;
    width: 230px;
    height: 550px;
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.55));
    animation: towerAppear 1.8s ease-out both;
}

@keyframes towerAppear {
    from {
        opacity: 0;
        transform: translateY(35px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ROOF */

.tower-roof {
    position: relative;
    width: 100%;
    height: 135px;
    flex-shrink: 0;
}

.roof-spire {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 48px;
    background: linear-gradient(90deg, #494451, #9a8a7c, #393744);
}

.roof-spire::before {
    content: "";
    position: absolute;
    top: -8px;
    left: -4px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 14px rgba(213, 174, 112, 0.55);
}

.roof-top {
    position: absolute;
    top: 42px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 105px solid transparent;
    border-right: 105px solid transparent;
    border-bottom: 93px solid #393644;
    filter: drop-shadow(0 4px 2px #181824);
}

.roof-left,
.roof-right {
    position: absolute;
    bottom: 0;
    width: 12px;
    height: 12px;
    background: #716477;
}

.roof-left { left: 0; }
.roof-right { right: 0; }

/* TOWER BODY */

.tower-body {
    position: relative;
    width: 190px;
    height: 340px;
    margin-top: -1px;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 44px,
            rgba(0, 0, 0, 0.1) 45px,
            transparent 47px
        ),
        linear-gradient(90deg, #292936, #55505a 24%, #3c3948 72%, #222330);
    border-left: 7px solid #252431;
    border-right: 7px solid #242330;
    box-shadow:
        inset 10px 0 15px rgba(255, 255, 255, 0.035),
        inset -12px 0 18px rgba(0, 0, 0, 0.35);
}

.tower-body::before,
.tower-body::after {
    content: "";
    position: absolute;
    left: -12px;
    width: calc(100% + 24px);
    height: 10px;
    background: linear-gradient(180deg, #6c6470, #302e3a);
}

.tower-body::before { top: 0; }
.tower-body::after { bottom: 0; }

/* CLOCK FACE */

.clock-face {
    position: absolute;
    width: 148px;
    height: 148px;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    padding: 8px;
    background: linear-gradient(145deg, #8d7961, #332f37 65%, #8b765d);
    box-shadow:
        0 0 0 4px #272530,
        0 0 18px rgba(0, 0, 0, 0.7),
        0 0 35px rgba(219, 170, 94, 0.1);
}

.clock-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background:
        radial-gradient(circle, #e5d2a9 0%, #bda77f 75%, #7e705e 100%);
    border: 3px solid #5b4b3e;
    box-shadow: inset 0 0 15px rgba(45, 34, 25, 0.45);
}

.clock-inner::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(70, 53, 37, 0.5);
    border-radius: 50%;
}

.clock-number {
    position: absolute;
    z-index: 2;
    color: #44372d;
    font-family: Georgia, serif;
    font-size: 17px;
    font-weight: bold;
}

.number-12 {
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
}

.number-3 {
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
}

.number-6 {
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
}

.number-9 {
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
}

.clock-ticks {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: repeating-conic-gradient(
        from 0deg,
        #4c3b2d 0deg 1.4deg,
        transparent 1.4deg 30deg
    );
    mask: radial-gradient(circle, transparent 0 84%, black 85% 100%);
}

.clock-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 5px;
    z-index: 3;
}

.hour-hand {
    width: 5px;
    height: 37px;
    background: #40332b;
    transform: translateX(-50%) rotate(35deg);
    animation: hourMove 43200s linear infinite;
}

.minute-hand {
    width: 3px;
    height: 51px;
    background: #5a4230;
    transform: translateX(-50%) rotate(210deg);
    animation: minuteMove 3600s linear infinite;
}

.clock-center {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #6e4d32;
    border: 2px solid #c7a875;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
}

@keyframes hourMove {
    to { transform: translateX(-50%) rotate(395deg); }
}

@keyframes minuteMove {
    to { transform: translateX(-50%) rotate(570deg); }
}

/* WINDOWS */

.tower-window {
    position: absolute;
    width: 30px;
    height: 48px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid #24212c;
    border-radius: 50% 50% 3px 3px;
    overflow: hidden;
    background: #e6a85e;
}

.window-top { top: 13px; }
.window-bottom { top: 218px; }

.window-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #ffdb91, #b66e39);
    box-shadow: 0 0 20px #e7a04f;
    animation: windowFlicker 3s ease-in-out infinite alternate;
}

@keyframes windowFlicker {
    from { opacity: 0.55; }
    to { opacity: 1; }
}

/* ENTRANCE */

.tower-arch {
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 68px;
    height: 84px;
    border: 6px solid #24212d;
    border-bottom: 0;
    border-radius: 45px 45px 0 0;
    background: #171621;
    overflow: hidden;
}

.arch-door {
    position: absolute;
    inset: 8px 7px 0;
    border-radius: 35px 35px 0 0;
    background:
        repeating-linear-gradient(
            90deg,
            #292532 0,
            #292532 13px,
            #1c1a25 14px,
            #1c1a25 16px
        );
    border: 1px solid #554b4a;
}

/* TOWER BASE */

.tower-base {
    width: 225px;
    height: 22px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #625966, #252330);
    border-top: 4px solid #817080;
    box-shadow: 0 7px 10px rgba(0, 0, 0, 0.5);
}

/* BATS */

.bats {
    position: absolute;
    width: 100%;
    height: 50%;
    top: 5%;
    pointer-events: none;
}

.bat {
    position: absolute;
    font-size: 24px;
    filter: grayscale(1) brightness(0.55);
}

.bat-one {
    top: 25%;
    left: 18%;
    animation: batFlyOne 12s linear infinite;
}

.bat-two {
    top: 55%;
    right: 17%;
    font-size: 18px;
    animation: batFlyTwo 15s linear infinite;
}

.bat-three {
    top: 10%;
    right: 35%;
    font-size: 15px;
    animation: batFlyThree 18s linear infinite;
}

@keyframes batFlyOne {
    0% { transform: translate(0, 0) rotate(0); }
    25% { transform: translate(100px, -55px) rotate(12deg); }
    50% { transform: translate(210px, 5px) rotate(-8deg); }
    75% { transform: translate(100px, 55px) rotate(8deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

@keyframes batFlyTwo {
    0% { transform: translate(0, 0) scaleX(1); }
    50% { transform: translate(-180px, -65px) scaleX(-1); }
    100% { transform: translate(0, 0) scaleX(1); }
}

@keyframes batFlyThree {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-120px, 80px); }
    100% { transform: translate(0, 0); }
}

/* GROUND */

.ground {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 20%;
    background:
        linear-gradient(180deg, transparent, #080a11 55%),
        #11121a;
    z-index: -1;
}

.grass {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 45px;
    background:
        repeating-linear-gradient(
            78deg,
            transparent 0 14px,
            rgba(69, 75, 65, 0.5) 15px 16px,
            transparent 17px 27px
        );
    opacity: 0.4;
}

.grave {
    position: absolute;
    bottom: 20px;
    width: 42px;
    height: 58px;
    border-radius: 22px 22px 2px 2px;
    background: linear-gradient(90deg, #292a32, #494650, #24242d);
    opacity: 0.6;
}

.grave-one {
    left: 13%;
    transform: rotate(-7deg);
}

.grave-two {
    right: 15%;
    height: 42px;
    width: 34px;
    transform: rotate(5deg);
}

.fog {
    position: absolute;
    width: 65%;
    height: 65px;
    border-radius: 50%;
    background: var(--mist);
    filter: blur(25px);
}

.fog-one {
    left: -10%;
    top: 5%;
    animation: fogMove 25s linear infinite alternate;
}

.fog-two {
    right: -10%;
    top: 35%;
    animation: fogMove 32s linear infinite alternate-reverse;
}

@keyframes fogMove {
    from { transform: translateX(-8%); }
    to { transform: translateX(18%); }
}

/* VIGNETTE */

.vignette {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(4, 5, 12, 0.4), transparent 25%, transparent 75%, rgba(4, 5, 12, 0.4)),
        linear-gradient(0deg, rgba(4, 5, 12, 0.5), transparent 35%, transparent 75%, rgba(4, 5, 12, 0.2));
}

/* ERROR CONTENT */

.error-content {
    position: absolute;
    z-index: 5;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, 90%);
    text-align: center;
    color: #f1e9dd;
    padding: 25px;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.8);
    animation: contentAppear 1.5s ease-out both;
}

@keyframes contentAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -46%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.error-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #d5b982;
    font-size: 12px;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.label-line {
    width: 28px;
    height: 1px;
    background: rgba(213, 185, 130, 0.55);
}

.error-content h1 {
    font-family: Georgia, serif;
    direction: ltr;
    font-size: clamp(80px, 11vw, 122px);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: 8px;
    color: #e6d1a8;
    text-shadow:
        0 0 15px rgba(222, 190, 138, 0.22),
        0 5px 25px rgba(0, 0, 0, 0.7);
}

.error-content h2 {
    font-size: clamp(19px, 2.5vw, 24px);
    font-weight: 600;
    color: #f0e3ce;
    margin: 2px 0 12px;
}

.error-content p {
    max-width: 350px;
    margin: 0 auto;
    color: #c0b8b1;
    font-size: 13px;
    line-height: 2.2;
    font-weight: 300;
}

.home-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    margin-top: 25px;
    padding: 11px 23px;
    border: 1px solid rgba(215, 184, 130, 0.6);
    border-radius: 3px;
    background: rgba(35, 31, 36, 0.55);
    color: #ead8b9;
    font-size: 13px;
    text-decoration: none;
    transition: 0.3s ease;
    backdrop-filter: blur(8px);
}

.home-button:hover {
    background: rgba(173, 132, 78, 0.2);
    border-color: #e5c28d;
    box-shadow: 0 0 22px rgba(213, 174, 112, 0.16);
    transform: translateY(-3px);
}

.button-arrow {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.home-button:hover .button-arrow {
    transform: translateX(-5px);
}

/* BOTTOM NOTE */

.bottom-note {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: max-content;
    max-width: 95%;
    color: rgba(213, 199, 176, 0.55);
    font-size: 9px;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

.note-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #c49a61;
    box-shadow: 0 0 8px #c49a61;
}

.note-separator {
    color: rgba(213, 174, 112, 0.35);
}

/* RESPONSIVE */

@media (max-width: 768px) {
    .moon {
        width: 82px;
        height: 82px;
        top: 7%;
        left: 12%;
    }

    .moon-glow {
        width: 190px;
        height: 190px;
        left: 4%;
    }

    .clock-tower {
        transform: scale(0.82);
        transform-origin: bottom center;
    }

    .clock-scene {
        bottom: 5%;
    }

    .error-content {
        top: 49%;
        padding: 15px;
    }

    .error-content h1 {
        font-size: clamp(75px, 16vw, 105px);
    }

    .error-content p {
        font-size: 12px;
    }

    .bottom-note {
        bottom: 15px;
        font-size: 8px;
        gap: 7px;
    }
}

@media (max-width: 480px) {
    .clock-tower {
        transform: scale(0.65);
    }

    .clock-scene {
        bottom: 1%;
    }

    .error-content {
        top: 47%;
        width: 94%;
    }

    .error-label {
        font-size: 10px;
        gap: 8px;
    }

    .label-line {
        width: 18px;
    }

    .error-content h1 {
        font-size: 76px;
        letter-spacing: 5px;
    }

    .error-content h2 {
        font-size: 19px;
    }

    .error-content p {
        font-size: 11px;
        line-height: 2;
    }

    .home-button {
        margin-top: 18px;
        padding: 10px 18px;
        font-size: 12px;
    }

    .bottom-note {
        font-size: 7px;
        letter-spacing: 0.7px;
    }

    .bat-one {
        left: 5%;
    }

    .bat-two {
        right: 5%;
    }
}

@media (max-height: 650px) and (min-width: 769px) {
    .clock-tower {
        transform: scale(0.75);
        transform-origin: bottom center;
    }

    .clock-scene {
        bottom: 0;
    }

    .error-content {
        top: 48%;
    }

    .error-content h1 {
        font-size: 75px;
    }

    .error-content p {
        line-height: 1.8;
    }

    .home-button {
        margin-top: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
.error-content p {
    color: #f0e8dc;
    text-shadow:
        0 2px 5px rgba(0, 0, 0, 1),
        0 0 12px rgba(0, 0, 0, 0.9);
    font-weight: 400;
}