
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

/* =========================================
   THE LAST LIGHT - CLEAN STYLESHEET
   ========================================= */

/* 1. Global settings */

:root {
    --bg: #07131d;
    --ocean: #0a202c;
    --light: #f4c987;
    --text: #e9edf0;
    --muted: #91a3ad;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    overflow-x: hidden;
}

/* 2. Main scene */

.scene {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(
        180deg,
        #07131d 0%,
        #0a1c29 48%,
        #102b38 100%
    );
}

/* 3. Background glow */

.sky-glow {
    position: absolute;
    width: 700px;
    height: 500px;
    left: 10%;
    top: -260px;
    background: #34536a;
    opacity: .13;
    filter: blur(110px);
    border-radius: 50%;
    pointer-events: none;
}

/* 4. Stars */

.stars {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #e7e8db;
    opacity: .55;
    animation: twinkle 3s ease-in-out infinite alternate;
}

@keyframes twinkle {
    from {
        opacity: .15;
        transform: scale(.7);
    }

    to {
        opacity: .8;
        transform: scale(1.3);
    }
}

/* 5. Moon */

.moon {
    position: absolute;
    width: 76px;
    height: 76px;
    top: 105px;
    left: 17%;
    z-index: 1;
    border-radius: 50%;
    background: #e4d9bd;
    box-shadow: 0 0 45px rgba(228, 217, 189, .16);
    opacity: .8;
}

.moon::after {
    content: "";
    position: absolute;
    width: 68px;
    height: 68px;
    top: -9px;
    left: -14px;
    background: #0a1b28;
    border-radius: 50%;
}

/* 6. Main content */

.content {
    position: relative;
    z-index: 5;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    padding: 30px 7%;
}

/* 7. Header */

.topbar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e8edf0;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.3px;
}

.brand-icon {
    color: var(--light);
    font-size: 22px;
}

.status {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #9babb4;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 30px;
    padding: 8px 14px;
    background: rgba(255,255,255,.025);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d28a68;
    box-shadow: 0 0 10px #d28a68;
}

/* 8. Error message */

.message {
    position: relative;
    z-index: 8;
    width: 480px;
    max-width: 48%;
    margin-top: clamp(65px, 11vh, 115px);
    animation: appear 1s ease both;
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--light);
    font-size: 11px;
    letter-spacing: 3px;
    direction: ltr;
    width: fit-content;
}

.eyebrow-line {
    width: 30px;
    height: 1px;
    background: var(--light);
}

.error-code {
    direction: ltr;
    text-align: right;
    font-size: clamp(82px, 11vw, 145px);
    line-height: 1.25;
    font-weight: 800;
    color: #f1d5a8;
    text-shadow: 0 0 50px rgba(241, 213, 168, .1);
    margin: 10px 0;
    letter-spacing: 5px;
}

.message h2 {
    font-size: clamp(22px, 2.5vw, 30px);
    font-weight: 600;
    margin-bottom: 18px;
    color: #e7edf0;
}

.message p {
    max-width: 440px;
    color: #a1b0b8;
    font-size: 14px;
    line-height: 2.5;
}

/* 9. Buttons */

.actions {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 24px;
}

.home-button {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: 13px 20px;
    background: #e5bd83;
    color: #17212a;
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 700;
    transition: .3s ease;
}

.home-button:hover {
    background: #f3d3a3;
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(229,189,131,.16);
}

.button-arrow {
    font-size: 19px;
    transition: transform .3s ease;
}

.home-button:hover .button-arrow {
    transform: translateX(-5px);
}

.back-button {
    border: none;
    background: transparent;
    color: #a9b6bc;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color .3s ease;
}

.back-button:hover {
    color: var(--light);
}

/* 10. Lighthouse scene */

.lighthouse-scene {
    position: absolute;
    z-index: 4;
    left: 11%;
    bottom: 155px;
    width: 300px;
    height: 440px;
    pointer-events: none;
}

.lighthouse {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 340px;
}

/* Lighthouse lamp room */

.light-room {
    position: absolute;
    top: 0;
    left: 36px;
    width: 58px;
    height: 53px;
    z-index: 4;
    border: 4px solid #d8c7a6;
    background: #263b43;
    border-radius: 5px 5px 0 0;
    overflow: hidden;
}

.light-room::before,
.light-room::after {
    content: "";
    position: absolute;
    top: 0;
    width: 4px;
    height: 100%;
    background: #d8c7a6;
}

.light-room::before {
    left: 16px;
}

.light-room::after {
    right: 16px;
}

.lamp {
    position: absolute;
    width: 13px;
    height: 23px;
    background: #ffe5a7;
    left: 19px;
    top: 11px;
    border-radius: 50%;
    box-shadow: 0 0 18px 8px rgba(255, 213, 137, .55);
    animation: lampPulse 3s ease-in-out infinite alternate;
    z-index: 2;
}

@keyframes lampPulse {
    from {
        opacity: .7;
    }

    to {
        opacity: 1;
    }
}

.lamp-glow {
    position: absolute;
    inset: 0;
    background: rgba(255, 217, 153, .12);
}

/* Lighthouse roof */

.roof {
    position: absolute;
    top: -13px;
    left: 29px;
    width: 72px;
    height: 17px;
    background: #9a7660;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    z-index: 5;
}

/* Lighthouse tower */

.tower {
    position: absolute;
    top: 52px;
    left: 22px;
    width: 86px;
    height: 250px;
    background: repeating-linear-gradient(
        to bottom,
        #e5d5b9 0px,
        #e5d5b9 42px,
        #a85e50 42px,
        #a85e50 84px
    );
    clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
    box-shadow: inset -15px 0 20px rgba(0,0,0,.22);
}

.tower-window {
    position: absolute;
    left: 36px;
    width: 13px;
    height: 23px;
    background: #172d38;
    border-radius: 8px 8px 2px 2px;
}

.window-one {
    top: 70px;
}

.window-two {
    top: 150px;
}

.tower-door {
    position: absolute;
    bottom: 0;
    left: 32px;
    width: 23px;
    height: 35px;
    background: #263b43;
    border-radius: 12px 12px 0 0;
}

/* Balcony and base */

.balcony {
    position: absolute;
    top: 46px;
    left: 14px;
    width: 102px;
    height: 10px;
    border: 3px solid #bca98c;
    border-top: 0;
    z-index: 6;
}

.base {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 130px;
    height: 38px;
    background: #354b52;
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.rock {
    position: absolute;
    bottom: -9px;
    left: -28px;
    width: 185px;
    height: 45px;
    background: #1a303b;
    border-radius: 50% 50% 0 0;
    z-index: -1;
}

/* 11. Lighthouse light beam */

.light-beam {
    position: absolute;
    z-index: 3;

    /* Aligned with the center of the lamp */
    left: calc(11% + 146px);
    bottom: 382px;

    width: 700px;
    height: 180px;

    transform-origin: 0 50%;

    background: linear-gradient(
        90deg,
        rgba(255, 222, 164, .24),
        rgba(255, 222, 164, .08) 45%,
        transparent 100%
    );

    clip-path: polygon(0 48%, 100% 0, 100% 100%);
    filter: blur(4px);
    animation: rotateBeam 12s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes rotateBeam {
    from {
        transform: rotate(-15deg);
        opacity: .35;
    }

    to {
        transform: rotate(15deg);
        opacity: .8;
    }
}

.beam-halo {
    position: absolute;
    width: 180px;
    height: 180px;
    top: 0;
    left: 60px;
    background: rgba(255, 213, 145, .08);
    filter: blur(45px);
    border-radius: 50%;
}

/* 12. Fog */

.fog {
    position: absolute;
    z-index: 3;
    width: 900px;
    height: 180px;
    background: rgba(181, 198, 201, .07);
    filter: blur(45px);
    border-radius: 50%;
    pointer-events: none;
}

.fog-one {
    bottom: 210px;
    left: -250px;
    animation: fogMove 22s linear infinite alternate;
}

.fog-two {
    bottom: 340px;
    right: -400px;
    opacity: .6;
    animation: fogMove 28s linear infinite alternate-reverse;
}

@keyframes fogMove {
    from {
        transform: translateX(-80px);
    }

    to {
        transform: translateX(130px);
    }
}

/* 13. Ocean */

.ocean {
    position: absolute;
    z-index: 2;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 215px;
    background: linear-gradient(180deg, #102b38, #071923);
    overflow: hidden;
}

.wave {
    position: absolute;
    left: -10%;
    width: 120%;
    height: 100px;
    border-radius: 45% 48% 0 0;
    border-top: 1px solid rgba(180, 204, 207, .2);
}

.wave-back {
    top: -34px;
    background: rgba(34, 70, 82, .35);
    animation: waveMove 10s ease-in-out infinite alternate;
}

.wave-middle {
    top: -15px;
    background: rgba(15, 48, 62, .55);
    animation: waveMove 7s ease-in-out infinite alternate-reverse;
}

.wave-front {
    top: 12px;
    background: rgba(5, 26, 37, .75);
    animation: waveMove 9s ease-in-out infinite alternate;
}

@keyframes waveMove {
    from {
        transform: translateX(-2%) rotate(-1deg);
    }

    to {
        transform: translateX(2%) rotate(1deg);
    }
}

/* Water reflection */

.water-reflection {
    position: absolute;
    width: 90px;
    height: 180px;
    left: calc(11% + 100px);
    top: 25px;
    background: linear-gradient(
        180deg,
        rgba(255, 211, 147, .16),
        rgba(255, 211, 147, .02),
        transparent
    );
    filter: blur(14px);
    transform: perspective(100px) rotateX(-10deg);
    animation: reflection 4s ease-in-out infinite alternate;
}

@keyframes reflection {
    from {
        opacity: .3;
        transform: scaleX(.7);
    }

    to {
        opacity: .8;
        transform: scaleX(1.2);
    }
}

/* 14. Footer */

.footer {
    position: absolute;
    bottom: 22px;
    left: 7%;
    right: 7%;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #80939d;
    font-size: 11px;
}

.footer-mark {
    direction: ltr;
    letter-spacing: 2px;
    font-size: 9px;
    opacity: .7;
}

/* 15. Vignette */

.vignette {
    position: absolute;
    inset: 0;
    z-index: 9;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 45%,
        rgba(0, 8, 14, .25) 100%
    );
}

/* =========================================
   RESPONSIVE - TABLET
   ========================================= */

@media (max-width: 900px) and (min-width: 681px) {

    .content {
        padding: 25px 5%;
    }

    .message {
        width: 52%;
        max-width: 52%;
        margin-top: clamp(55px, 9vh, 90px);
    }

    .lighthouse-scene {
        left: 3%;
        bottom: 135px;
        transform: scale(.82);
        transform-origin: bottom left;
    }

    .light-beam {
        left: calc(3% + 120px);
        bottom: 305px;
        width: 62vw;
    }

    .ocean {
        height: 175px;
    }

    .footer {
        left: 5%;
        right: 5%;
    }
}

/* =========================================
   RESPONSIVE - MOBILE
   ========================================= */

@media (max-width: 680px) {

    .scene {
        min-height: 100vh;
        min-height: 100svh;
    }

    .content {
        min-height: 100vh;
        min-height: 100svh;
        padding: 18px 20px;
    }

    .brand {
        font-size: 13px;
    }

    .status {
        font-size: 10px;
        padding: 7px 10px;
    }

    .moon {
        width: 52px;
        height: 52px;
        top: 105px;
        left: 12%;
    }

    .moon::after {
        width: 48px;
        height: 48px;
    }

    .message {
        width: 100%;
        max-width: 100%;
        margin-top: clamp(28px, 6vh, 48px);
        text-align: center;
    }

    .eyebrow {
        margin: auto;
    }

    .error-code {
        text-align: center;
        font-size: clamp(72px, 18vw, 94px);
        line-height: 1.15;
        margin: 5px 0;
    }

    .message h2 {
        font-size: clamp(19px, 5vw, 23px);
        margin-bottom: 10px;
    }

    .message p {
        font-size: 12px;
        line-height: 2.05;
        margin: auto;
        max-width: 390px;
    }

    .actions {
        justify-content: center;
        gap: 15px;
        margin-top: 17px;
    }

    .home-button {
        padding: 12px 15px;
        gap: 12px;
        font-size: 12px;
    }

    .back-button {
        font-size: 12px;
    }

    .lighthouse-scene {
        left: 50%;
        bottom: 105px;
        transform: translateX(-50%) scale(.62);
        transform-origin: bottom center;
    }

    .light-beam {
        left: calc(50% - 3px);
        bottom: 229px;
        width: 480px;
        height: 145px;
    }

    .ocean {
        height: 160px;
    }

    .water-reflection {
        left: 50%;
    }

    .footer {
        left: 15px;
        right: 15px;
        bottom: 12px;
        flex-direction: column;
        gap: 5px;
        text-align: center;
        font-size: 9px;
    }

    .footer-mark {
        font-size: 8px;
    }
}

/* =========================================
   RESPONSIVE - SMALL MOBILE
   ========================================= */

@media (max-width: 380px) {

    .message h2 {
        font-size: 20px;
    }

    .message p {
        font-size: 12px;
    }

    .error-code {
        font-size: 82px;
    }

    .actions {
        gap: 12px;
    }

    .lighthouse-scene {
        transform: translateX(-50%) scale(.55);
    }
}

/* =========================================
   SHORT MOBILE SCREENS
   ========================================= */

@media (max-width: 680px) and (max-height: 700px) {

    .content {
        padding-top: 13px;
    }

    .message {
        margin-top: 20px;
    }

    .error-code {
        font-size: 68px;
    }

    .message h2 {
        font-size: 18px;
        margin-bottom: 7px;
    }

    .message p {
        font-size: 11px;
        line-height: 1.85;
    }

    .actions {
        margin-top: 12px;
    }

    .lighthouse-scene {
        bottom: 82px;
        transform: translateX(-50%) scale(.49);
    }

    .light-beam {
        bottom: 178px;
        height: 120px;
    }

    .ocean {
        height: 125px;
    }

    .footer {
        bottom: 7px;
    }
}

/* =========================================
   SHORT DESKTOP / LAPTOP SCREENS
   ========================================= */

@media (min-width: 681px) and (max-height: 760px) {

    .message {
        margin-top: 48px;
    }

    .lighthouse-scene {
        bottom: 125px;
        transform: scale(.88);
        transform-origin: bottom left;
    }

    .light-beam {
        bottom: 327px;
        height: 155px;
    }

    .ocean {
        height: 165px;
    }

    .footer {
        bottom: 18px;
    }
}

/* =========================================
   FULL WIDTH SAFETY
   ========================================= */

@media (min-width: 681px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
    }

    .scene {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

/* =========================================
   ACCESSIBILITY
   ========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
/* =========================================
   FINAL TEXT POSITION FIX
   ========================================= */

/* Move content closer to the right edge */
.content {
    padding-right: clamp(20px, 3vw, 45px) !important;
}

/* Align the main text block to the right */
.message {
    margin-right: 0 !important;
    margin-left: auto !important;
    text-align: right !important;
}

/* Align the small English label */
.eyebrow {
    margin-right: 0 !important;
    margin-left: auto !important;
}

/* Keep buttons aligned with the text */
.actions {
    justify-content: flex-start !important;
}

/* Tablet */
@media (max-width: 900px) and (min-width: 681px) {
    .content {
        padding-right: 25px !important;
    }
}

/* Mobile: preserve centered composition */
@media (max-width: 680px) {
    .content {
        padding-right: 20px !important;
        padding-left: 20px !important;
    }

    .message {
        text-align: center !important;
    }

    .eyebrow {
        margin-right: auto !important;
        margin-left: auto !important;
    }

    .actions {
        justify-content: center !important;
    }
}
/* Footer final alignment */
.footer {
    left: 7% !important;
    right: 7% !important;
    justify-content: space-between !important;
    text-align: right !important;
}

.footer > span:first-child {
    margin-right: 0 !important;
}

.footer .footer-mark {
    margin-right: auto !important;
    direction: ltr !important;
    text-align: left !important;
}

@media (max-width: 680px) {
    .footer {
        left: 15px !important;
        right: 15px !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 5px !important;
    }

    .footer .footer-mark {
        margin: 0 !important;
    }
}
