/* /world — fullscreen globe (page-scoped; not loaded on Home) */

html:has(body.page-world),
body.page-world {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body.page-world {
    /* Cancel global navbar clearance (style.css body padding-top) — navbar is hidden here. */
    padding-top: 0;
    background: #020617 !important;
    background-image: none !important;
}

/* Hide site chrome on World only (markup stays in base.html) */
body.page-world .navbar,
body.page-world .site-footer {
    display: none !important;
}

body.page-world main.container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

.world-page {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #b7cfe0;
}

.world-home-btn {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(248, 250, 252, 0.35);
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    line-height: 1.2;
}

.world-home-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    color: #fff;
}

.world-mode-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 30;
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(248, 250, 252, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.world-mode-btn {
    appearance: none;
    margin: 0;
    min-height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.world-mode-btn.is-active {
    background: rgba(248, 250, 252, 0.14);
    color: #f8fafc;
}

.world-mode-btn:hover {
    color: #f8fafc;
}

.world-overlay-hint {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    margin: 0;
    max-width: min(90vw, 28rem);
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.45);
    color: #cbd5e1;
    font-size: 0.82rem;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
}

.world-overlay-hint[hidden] {
    display: none !important;
}

.world-stage {
    position: absolute;
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}

/* ---- 2D flat map (default, full-bleed + horizontal pan) ---- */
.world-map-2d {
    position: absolute;
    inset: 0;
    background: #b7cfe0;
}

.world-map-2d[hidden] {
    display: none !important;
}

.world-map-2d-scroll {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.4) transparent;
}

.world-map-2d-scroll::-webkit-scrollbar {
    height: 4px;
}

.world-map-2d-scroll::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4);
    border-radius: 999px;
}

.world-map-2d-inner {
    position: relative;
    flex: 0 0 auto;
    height: 100%;
    /* Strict equirectangular 2:1 from viewport height — pan when wider than screen */
    aspect-ratio: 2 / 1;
    width: auto;
    background: #98b8d0;
}

.world-map-2d-inner::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 85% 70% at 50% 45%, transparent 55%, rgba(15, 23, 42, 0.1) 100%),
        linear-gradient(to bottom, rgba(15, 23, 42, 0.08) 0%, transparent 12%, transparent 88%, rgba(15, 23, 42, 0.1) 100%);
}

.world-map-2d-basemap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    z-index: 0;
}

.world-map-2d-basemap.is-failed {
    display: none;
}

.world-map-2d-plane {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.world-map-2d-dot {
    position: absolute;
    transform: translate(-50%, -50%);
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: radial-gradient(circle at 35% 30%, #fff7cc 0%, #fbbf24 42%, #d97706 100%);
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.85),
        0 0 0 3px rgba(180, 83, 9, 0.35),
        0 2px 10px rgba(146, 64, 14, 0.35),
        0 0 18px rgba(251, 191, 36, 0.55);
    cursor: pointer;
    z-index: 2;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.world-map-2d-dot:hover,
.world-map-2d-dot:focus-visible {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 0 4px rgba(180, 83, 9, 0.45),
        0 3px 14px rgba(146, 64, 14, 0.4),
        0 0 24px rgba(251, 191, 36, 0.7);
    outline: none;
}

.world-map-2d-tag {
    position: absolute;
    transform: translate(-50%, calc(-100% - 14px));
    z-index: 5;
    appearance: none;
    margin: 0;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, 0.55);
    background: rgba(15, 23, 42, 0.92);
    color: #fde68a;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    max-width: min(70vw, 14rem);
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(2, 6, 23, 0.35);
}

.world-map-2d-tag:hover {
    background: rgba(30, 41, 59, 0.95);
    color: #fffbeb;
}

.world-globe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
    background: #020617;
    touch-action: none;
}

.world-globe[hidden] {
    display: none !important;
}

/* Do NOT force canvas CSS size — globe.gl owns width/height pixels (avoids aspect skew / low framing). */
.world-globe canvas {
    display: block;
    margin: 0;
    cursor: grab;
    touch-action: none;
    vertical-align: top;
}

.world-globe canvas:active {
    cursor: grabbing;
}

/* Origin assist tag — one at a time, leader line down to the yellow dot */
.world-origin-tag-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(-50%, -100%);
    pointer-events: auto;
    z-index: 5;
    user-select: none;
    -webkit-user-select: none;
}

.world-origin-tag {
    appearance: none;
    margin: 0;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, 0.55);
    background: rgba(15, 23, 42, 0.88);
    color: #fde68a;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    max-width: min(70vw, 14rem);
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(2, 6, 23, 0.35);
}

.world-origin-tag:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(251, 191, 36, 0.8);
    color: #fffbeb;
}

.world-origin-tag-line {
    width: 1.5px;
    height: 26px;
    margin-top: 2px;
    border-radius: 1px;
    background: linear-gradient(
        to bottom,
        rgba(251, 191, 36, 0.85),
        rgba(251, 191, 36, 0.15)
    );
    pointer-events: none;
}

.world-fallback {
    position: fixed;
    left: 50%;
    bottom: 56px;
    transform: translateX(-50%);
    z-index: 25;
    width: min(92vw, 40rem);
    max-height: 40vh;
    overflow: auto;
    margin: 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.world-fallback-title {
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
}

.world-fallback-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.world-fallback-btn {
    appearance: none;
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    line-height: 1.3;
}

.world-fallback-btn:hover {
    background: rgba(251, 191, 36, 0.22);
}

@media (max-width: 720px) {
    .world-overlay-hint {
        top: auto;
        bottom: 52px;
        font-size: 0.75rem;
        max-width: 84vw;
    }

    .world-home-btn {
        top: 10px;
        left: 10px;
        padding: 7px 12px;
        font-size: 0.82rem;
    }

    .world-mode-toggle {
        top: 10px;
        right: 10px;
    }

    .world-mode-btn {
        min-height: 30px;
        padding: 0 10px;
        font-size: 0.75rem;
    }
}
