html, body {
    scrollbar-width: thin;
    scrollbar-color: #555 #222;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #222;
}

::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 3px;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: black;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

button {
    margin-right: 8px;
    background-color: #222;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s ease;
}

button.active {
    background-color: #555;
    border-color: #aaa;
    font-weight: bold;
}

#measure-start.active {
    background-color: #10384a;
    border-color: #78dcff;
    color: #c9f3ff;
}

#measure-end.active {
    background-color: #4a3810;
    border-color: #ffd166;
    color: #fff0bf;
}

button:hover {
    background-color: #444;
}

#tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    display: none;
    z-index: 10;
}

#poi-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

#marker-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    max-width: 100vh;
    aspect-ratio: 1 / 1;
    pointer-events: none;
    z-index: 4;
}

.poi-img {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    -webkit-user-drag: none;
    user-select: none;
    cursor: pointer;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px 20px rgba(255, 255, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 40px 20px rgba(255, 255, 255, 1);
    }
}

.poi-img.selected {
    border-radius: 50%;
    z-index: 5;
    animation: pulseGlow 4s infinite ease-in-out;
}

.poi-img.measure-start-selected {
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 0 2px rgba(120, 220, 255, 0.95), 0 0 14px rgba(120, 220, 255, 0.9);
}

.poi-img.measure-end-selected {
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.95), 0 0 14px rgba(255, 209, 102, 0.9);
}

#canvas-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    max-width: 100vh;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    z-index: 2;
}

#poi-info-box {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 220px;
    max-height: 50vh;

    background: rgba(20, 20, 20, 0.9);
    color: white;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 14px;
    z-index: 15;
    padding: 10px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

#poi-info-box.show {
    opacity: 1;
    pointer-events: auto;
}

#poi-info-box h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
}

#poi-info-box p {
    margin: 0;
    white-space: pre-wrap;
}

#poi-info-close {
    background: none;
    border: none;
    color: #ccc;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 100%;
    width: auto;
}

#poi-info-close:hover {
    color: #fff;
}

.poi-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #222;
    padding: 6px 10px;
    font-weight: bold;
    border-bottom: 1px solid #333;
    gap: 10px;
}

.poi-info-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.poi-icon {
    width: 50px;
    height: 30px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
    margin-right: 8px;
}

#poi-info-title {
    margin: 0;
    font-size: 14px;
    line-height: normal;
    display: inline-block;
    position: relative;
    top: 2px;
}

.poi-info-content {
    padding: 10px;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: #555 #222;
}

.poi-description {
    max-height: 38vh;
    overflow-y: auto;
    padding: 10px;
    text-align: justify;
}

.poi-label {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
}

.market-indicator {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    z-index: 1;
}

.market-ring {
    border: 2px solid #ffcc4d;
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(255, 204, 77, 0.7);
    background: radial-gradient(circle, rgba(255, 204, 77, 0.16) 0%, rgba(255, 204, 77, 0) 70%);
}

.market-arrow {
    width: 22px;
    height: 22px;
    background: #ffcc4d;
    clip-path: polygon(50% 0%, 100% 100%, 50% 74%, 0% 100%);
    filter: drop-shadow(0 0 8px rgba(255, 204, 77, 0.8));
}

.market-label {
    position: absolute;
    transform: translate(-50%, -100%);
    background: rgba(0, 0, 0, 0.78);
    color: #ffdf8c;
    padding: 3px 8px;
    border: 1px solid rgba(255, 204, 77, 0.45);
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.03em;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

.market-label-offscreen {
    transform: translate(-50%, 0);
}

.measurement-label {
    position: absolute;
    transform: translate(-50%, -100%);
    background: rgba(0, 0, 0, 0.78);
    color: #ffe082;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 209, 102, 0.35);
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
}

#parallax-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: black;
}

#parallax-background,
#parallax-foreground {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 0;
}

#parallax-background {
    filter: brightness(70%);
}

#parallax-foreground {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 3;
    object-fit: contain;
    object-position: center;
}

#mask-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at center, transparent 49.9%, black 50%);
}

#starmap-mask-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    max-width: 100vh;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    clip-path: circle(49% at center);
    z-index: 1;
}

#measure-tools {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

#measure-tools .measure-title {
    color: #fff;
    font-size: 14px;
    text-align: center;
    margin-bottom: 4px;
    font-weight: bold;
}

.tool-readout {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: #ddd;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.tool-readout-label {
    color: #9f9f9f;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
    text-align: center;
}

.tool-readout-value {
    color: #ffdf8c;
    font-weight: bold;
    margin-bottom: 8px;
    min-height: 1.4em;
    text-align: center;
}

.tool-readout-url {
    color: #fff;
    word-break: break-all;
}

@media screen and (min-width: 768px) {
    #poi-info-box {
        width: 500px;
    }
}
