@font-face {
    font-family: "VazirmatnGalaxy";
    src: url("/fonts/Vazirmatn-Light.ttf") format("truetype");
    font-display: swap;
}

:root {
    color-scheme: dark;
    --cyan: #80dcff;
    --glass: rgba(4, 15, 35, 0.82);
    --border-glow: rgba(112, 201, 255, 0.55);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 320px;
    min-height: 100%;
    margin: 0;
    font-family: "VazirmatnGalaxy", Tahoma, sans-serif;
    background: #020510;
    color: #f5f8ff;
}

button,
a {
    font: inherit;
}

.galaxy-page {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.galaxy-topbar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    min-width: 320px;
    min-height: 72px;
    padding: 10px clamp(14px, 3vw, 42px);
    border-bottom: 1px solid rgba(113, 190, 255, 0.2);
    background: rgba(2, 7, 20, 0.86);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    flex: 0 0 42px;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(140deg, #1d7aff, #7c43ff 58%, #ffb54b);
    box-shadow: 0 0 24px rgba(58, 156, 255, 0.33);
    font-size: 24px;
}

.brand-text strong,
.brand-text small {
    display: block;
}

.brand-text strong {
    font-size: 16px;
    white-space: nowrap;
}

.brand-text small {
    margin-top: 2px;
    color: #82b9ed;
    font-size: 9px;
    letter-spacing: 2px;
}

.topbar-center {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a9c5e6;
    font-size: 12px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #66ffbd;
    box-shadow: 0 0 12px #66ffbd;
}

.classic-mode-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid var(--border-glow);
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(25, 83, 145, 0.45), rgba(20, 30, 70, 0.6));
    color: #fff;
    white-space: nowrap;
    cursor: pointer;
}

.classic-mode-button:hover {
    border-color: #a7e9ff;
    box-shadow: 0 0 18px rgba(57, 157, 255, 0.28);
}

.galaxy-main {
    position: relative;
    isolation: isolate;
    width: 100%;
    min-width: 320px;
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    min-height: 500px;
    overflow: hidden;
    background-color: #030814;
    background-image:
        linear-gradient(rgba(4, 10, 28, 0.18), rgba(4, 10, 28, 0.28)),
        url("/galaxy/images/galaxy.jpg");
    background-position: center center;
    background-repeat: no-repeat;
    background-size: max(120vw, 120vh) auto;
    background-size: max(120vw, 120vh, 2200px) auto;
}

#galaxyCanvas {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

#galaxyCanvas.dragging {
    cursor: grabbing;
}

.galaxy-heading {
    position: absolute;
    z-index: 3;
    top: clamp(18px, 4vh, 44px);
    left: 50%;
    width: min(700px, calc(100% - 36px));
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    text-shadow: 0 2px 18px #020510;
}

.galaxy-heading .eyebrow {
    color: #8adfff;
    font-size: 11px;
}

.galaxy-heading h1 {
    margin: 5px 0 7px;
    color: #fff0b5;
    font-size: clamp(24px, 3.4vw, 40px);
    line-height: 1.3;
    text-shadow: 0 0 10px #ffbd4c, 0 0 26px #ff9f2f, 0 0 48px #ff8b27;
}

.galaxy-heading p {
    margin: 0;
    color: #d5e7ff;
    font-size: clamp(10px, 1.3vw, 13px);
}

.galaxy-controls {
    position: absolute;
    z-index: 5;
    top: 50%;
    left: clamp(10px, 2vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 8px;
    transform: translateY(-50%);
    border: 1px solid rgba(112, 191, 255, 0.25);
    border-radius: 20px;
    background: rgba(3, 14, 34, 0.76);
    backdrop-filter: blur(12px);
}

.galaxy-controls button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #d7edff;
    font-size: 24px;
    cursor: pointer;
}

.galaxy-controls button:hover,
.galaxy-controls button:focus-visible {
    outline: 1px solid rgba(117, 202, 255, 0.6);
    background: rgba(37, 138, 255, 0.2);
}

.galaxy-controls small {
    font-size: 9px;
    white-space: nowrap;
}

.galaxy-hint {
    position: absolute;
    z-index: 4;
    bottom: 16px;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 11px 18px;
    transform: translateX(-50%);
    border: 1px solid rgba(125, 191, 255, 0.3);
    border-radius: 999px;
    background: rgba(3, 12, 30, 0.78);
    color: #d6e8ff;
    font-size: 10px;
    white-space: nowrap;
    backdrop-filter: blur(12px);
}

.star-info {
    position: fixed;
    z-index: 20;
    top: 50%;
    right: clamp(12px, 3vw, 42px);
    width: min(370px, calc(100% - 24px));
    padding: 24px;
    transform: translateY(-50%);
    border: 1px solid rgba(114, 207, 255, 0.72);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(7, 28, 58, 0.95), rgba(7, 12, 36, 0.92));
    box-shadow: 0 18px 70px rgba(0, 0, 0, 0.6), 0 0 38px rgba(22, 138, 255, 0.17);
    backdrop-filter: blur(22px);
}

.star-info[hidden] {
    display: none;
}

.close-info {
    position: absolute;
    top: 8px;
    left: 13px;
    border: 0;
    background: transparent;
    color: #bcdfff;
    font-size: 27px;
    cursor: pointer;
}

.info-kicker {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #7ed8ff;
    font-size: 10px;
}

.info-kicker-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #80e4ff;
    box-shadow: 0 0 9px #80e4ff;
}

.star-info h2 {
    margin: 13px 0 8px;
    font-size: 25px;
}

.star-info p {
    margin: 0;
    color: #c1d3ea;
    font-size: 13px;
    line-height: 1.9;
}

.info-actions {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 20px;
}

.primary-info-action,
.secondary-info-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
}

.primary-info-action {
    border: 1px solid rgba(143, 216, 255, 0.44);
    background: linear-gradient(100deg, #087cf4, #4b6bff);
    color: #fff;
}

.secondary-info-action {
    border: 1px solid rgba(154, 203, 255, 0.3);
    background: rgba(255, 255, 255, 0.04);
    color: #d7eaff;
}

.galaxy-toast {
    position: fixed;
    z-index: 30;
    top: 88px;
    left: 50%;
    max-width: calc(100% - 24px);
    padding: 10px 15px;
    transform: translateX(-50%);
    border: 1px solid rgba(116, 202, 255, 0.4);
    border-radius: 12px;
    background: rgba(7, 26, 51, 0.96);
    color: #d9f3ff;
    font-size: 12px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.galaxy-toast.show {
    opacity: 1;
}

@media (max-width: 700px) {
    .galaxy-topbar {
        min-height: 60px;
        padding: 8px 10px;
        gap: 8px;
    }

    .brand-mark {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
        border-radius: 11px;
        font-size: 20px;
    }

    .brand-text strong {
        font-size: 12px;
    }

    .brand-text small {
        font-size: 7px;
        letter-spacing: 1.2px;
    }

    .topbar-center {
        display: none;
    }

    .classic-mode-button {
        min-height: 38px;
        padding: 7px 10px;
        font-size: 11px;
    }

    .galaxy-main {
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        min-height: 480px;
        background-position: center center;
    }

    .galaxy-heading {
        top: 12px;
        width: calc(100% - 24px);
    }

    .galaxy-heading .eyebrow {
        font-size: 9px;
    }

    .galaxy-heading h1 {
        margin: 3px 0 4px;
        font-size: 25px;
    }

    .galaxy-heading p {
        font-size: 10px;
    }

    .galaxy-controls {
        top: auto;
        bottom: 95px;
        left: 8px;
        gap: 3px;
        padding: 5px;
        transform: none;
        border-radius: 15px;
    }

    .galaxy-controls button {
        width: 42px;
        height: 42px;
        font-size: 21px;
    }

    .galaxy-controls small {
        font-size: 8px;
    }

    .galaxy-hint {
        bottom: 8px;
        left: auto;
        right: 8px;
        display: block;
        width: calc(100% - 112px);
        max-width: none;
        padding: 8px 10px;
        transform: none;
        border-radius: 14px;
        font-size: 9px;
        line-height: 1.8;
        white-space: normal;
        text-align: center;
    }

    .galaxy-hint span {
        display: block;
    }

    .star-info {
        top: auto;
        right: 12px;
        bottom: 12px;
        width: calc(100% - 24px);
        padding: 18px;
        transform: none;
    }

    .star-info h2 {
        font-size: 21px;
    }

    .star-info p {
        font-size: 12px;
    }

    .info-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 100px;
        margin-top: 12px;
    }
}

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


/* تلسکوپ مشاغل */
.galaxy-telescope {
    position: absolute;
    z-index: 5;
    top: clamp(150px, 23vh, 225px);
    left: 50%;
    transform: translateX(-50%);
    width: min(590px, calc(100% - 32px));
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px 7px 7px;
    border: 1px solid rgba(125, 195, 255, .48);
    border-radius: 16px;
    background: rgba(3, 14, 35, .82);
    box-shadow: 0 8px 32px rgba(0,0,0,.32), 0 0 24px rgba(50,145,255,.13);
    backdrop-filter: blur(14px);
}
.galaxy-telescope .telescope-icon { color:#9edcff; font-size:25px; line-height:1; }
.galaxy-telescope input {
    flex:1; min-width:0; height:40px; border:0; outline:0;
    background:transparent; color:#fff; font:inherit; font-size:13px;
}
.galaxy-telescope input::placeholder { color:#a9c1df; }
.galaxy-telescope button {
    border:1px solid rgba(143,216,255,.5); border-radius:10px;
    padding:9px 17px; background:linear-gradient(100deg,#087cf4,#4b6bff);
    color:#fff; font:inherit; cursor:pointer; white-space:nowrap;
}
.info-actions .primary-info-action {
    order:0; min-height:49px; font-size:15px; font-weight:700;
    box-shadow:0 0 22px rgba(38,137,255,.24);
}
.info-actions .secondary-info-action {
    order:1; align-self:flex-end; width:auto; min-height:23px;
    padding:2px 8px; border:0; background:transparent;
    color:rgba(196,218,242,.62); font-size:10px; opacity:.8;
}
.info-actions .secondary-info-action:hover { color:#d7eaff; opacity:1; }
@media(max-width:700px) {
    .galaxy-telescope { top:clamp(128px,20vh,178px); width:calc(100% - 24px); }
    .galaxy-telescope input { font-size:11px; }
    .galaxy-telescope button { padding:8px 11px; font-size:11px; }
}


/* چیدمان جدید: جست‌وجو در نوار بالای صفحه و کنار نام پرتال */
.galaxy-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(10px, 1.5vw, 22px);
}

.galaxy-topbar .brand {
    flex: 0 0 auto;
}

.galaxy-topbar .brand-text strong {
    font-size: clamp(13px, 1.15vw, 16px);
}

.galaxy-topbar .galaxy-telescope {
    position: relative;
    z-index: 11;
    top: auto;
    left: auto;
    transform: none;
    flex: 1 1 500px;
    width: min(520px, 42vw);
    max-width: 520px;
    min-width: 230px;
    margin: 0;
}

.galaxy-topbar .topbar-center {
    flex: 0 0 auto;
    white-space: nowrap;
}

.galaxy-topbar .classic-mode-button {
    flex: 0 0 auto;
}

.galaxy-topbar .galaxy-telescope input {
    min-width: 0;
}

@media (max-width: 1100px) {
    .galaxy-topbar .topbar-center {
        display: none;
    }

    .galaxy-topbar .galaxy-telescope {
        width: auto;
        max-width: none;
    }
}

@media (max-width: 700px) {
    .galaxy-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 8px 10px;
        min-height: 112px;
        padding: 8px 10px 10px;
    }

    .galaxy-topbar .brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .galaxy-topbar .brand-text strong {
        font-size: 12px;
        white-space: nowrap;
    }

    .galaxy-topbar .classic-mode-button {
        grid-column: 2;
        grid-row: 1;
    }

    .galaxy-topbar .galaxy-telescope {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        min-width: 0;
        max-width: none;
        padding: 5px 7px;
        gap: 7px;
    }

    .galaxy-topbar .galaxy-telescope input {
        height: 36px;
        font-size: 11px;
    }

    .galaxy-topbar .galaxy-telescope button {
        padding: 8px 10px;
        font-size: 11px;
    }

    .galaxy-main {
        height: calc(100vh - 112px);
        height: calc(100dvh - 112px);
        min-height: 440px;
    }
}

@media (max-width: 380px) {
    .galaxy-topbar .classic-mode-button {
        min-height: 34px;
        padding: 6px 8px;
        font-size: 10px;
    }

    .galaxy-topbar .brand-mark {
        flex-basis: 32px;
        width: 32px;
        height: 32px;
    }

    .galaxy-topbar .brand-text strong {
        font-size: 11px;
    }
}


/* گروه دکمه‌های نوار بالا: حالت کلاسیک و عضویت */
.galaxy-topbar .topbar-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.galaxy-topbar .membership-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid rgba(102, 235, 190, .52);
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(13, 112, 91, .48), rgba(11, 57, 68, .72));
    color: #eafff8;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 0 16px rgba(47, 210, 163, .10);
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.galaxy-topbar .membership-button:hover,
.galaxy-topbar .membership-button:focus-visible {
    border-color: #8bffda;
    background: linear-gradient(120deg, rgba(18, 145, 112, .68), rgba(13, 83, 92, .86));
    box-shadow: 0 0 20px rgba(47, 210, 163, .24);
    outline: none;
}

.galaxy-topbar .membership-button:active {
    transform: translateY(1px);
}

.galaxy-topbar .membership-icon {
    display: block;
    flex: 0 0 19px;
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 700px) {
    .galaxy-topbar .topbar-actions {
        grid-column: 2;
        grid-row: 1;
        gap: 6px;
    }

    .galaxy-topbar .topbar-actions .classic-mode-button,
    .galaxy-topbar .topbar-actions .membership-button {
        min-height: 36px;
        padding: 7px 9px;
        gap: 5px;
        font-size: 10px;
    }

    .galaxy-topbar .membership-icon {
        flex-basis: 17px;
        width: 17px;
        height: 17px;
    }
}

@media (max-width: 380px) {
    .galaxy-topbar .topbar-actions {
        gap: 4px;
    }

    .galaxy-topbar .topbar-actions .classic-mode-button,
    .galaxy-topbar .topbar-actions .membership-button {
        padding: 6px 7px;
        font-size: 9px;
    }

    .galaxy-topbar .membership-button {
        gap: 4px;
    }
}
