/*
 * 이동 경로(/map/route). 세계 지도 한 장의 모양은 world-map.css · game-map.css, 붙은 단추(진영)는 client.css 「버튼형 라디오」 다.
 * 색은 tokens.css 의 이름만 쓴다. 선의 색은 지도 그림 위라 테마와 관계없이 같은 --map-* 이다.
 */

/* ── 찾는 칸 ─────────────────────────────────────── */

.map-route__form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.map-route__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
}

.map-route__field {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    max-width: 100%;
}

.map-route__label {
    font-weight: 600;
}

/* 고르는 칸은 든 것만큼 — 가장 긴 곳 이름에 맞춘다 */
.map-route__select {
    max-width: 100%;
    height: 2.375rem;
    padding: 0 0.5rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.map-route__select {
    min-width: 0;
}

.map-route__select:focus {
    outline: none;
    border-color: var(--color-focus);
}

.map-route__fields .radio-buttons__text {
    min-height: 2.375rem;
}

@media (pointer: coarse) {
    .map-route__fields .radio-buttons__text {
        min-height: 2.75rem;
    }
}

.map-route__submit {
    min-height: 2.375rem;
    padding: 0 1.125rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

/* 열어 둔 비행 조련사 — 단계 목록 아래. 길이 지나는 지역을 먼저, 나머지는 접어 둔다. 체크를 풀면 바로 다시 찾는다(map-route.js) */
.map-route__side {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    min-width: 0;
}

.map-route__taxis-title {
    margin: 0;
    font-size: 1rem;
}

.map-route__taxis-note {
    margin: var(--space-xs) 0 var(--space-sm);
    font-size: 0.8125rem;
}

.map-route__more {
    margin-top: var(--space-sm);
}

.map-route__more summary {
    cursor: pointer;
    color: var(--color-accent);
    font-size: 0.875rem;
}

.map-route__more-title {
    margin: var(--space-sm) 0 var(--space-xs);
    font-size: 0.875rem;
}

.map-route__zones {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
    margin: 0;
    padding: 0;
    list-style: none;
}

.map-route__zone {
    display: inline-flex;
    align-items: baseline;
    gap: 0.375rem;
    cursor: pointer;
}

.map-route__zone input {
    accent-color: var(--color-accent);
}

/* 열지 않은 지역 — 이름을 흐리게 */
.map-route__zone.is-closed > span {
    color: var(--color-muted);
    text-decoration: line-through;
}

.map-route__zone-taxis {
    font-size: 0.8125rem;
}

/* ── 결과 ─────────────────────────────────────── */

.map-route__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-xs) var(--space-md);
}

.map-route__summary strong {
    font-size: 1.25rem;
}

.map-route__stat + .map-route__stat,
.map-route__summary strong + .map-route__stat {
    padding-left: var(--space-md);
    border-left: 1px solid var(--color-border-strong);
}

/* 넓은 화면에서는 왼쪽에 지도, 오른쪽에 단계. 지도는 단계를 내려 읽는 동안 머리글 아래에 붙어 있다.
   지도는 누른 곳 곁에 뜨는 메뉴(.map-route__pick)의 기준 위치다 — 붙어 있을 때(sticky)도 기준이 된다 */
.map-route__layout {
    display: grid;
    gap: var(--space-lg);
}

.map-route__map {
    position: relative;
    min-width: 0;
}

@media (min-width: 75em) {
    .map-route__layout {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        align-items: start;
    }

    /* 길이 없을 때(고르기 전)는 지도만 — 지도 그림의 크기(1002px)까지 */
    .map-route__layout--map {
        grid-template-columns: minmax(0, 62.625rem);
    }

    .map-route__map {
        position: sticky;
        top: calc(var(--header-height) + var(--space-md));
    }
}

/* 지도를 눌러 자리를 고른다 — 지역 모양은 링크가 아니고, 들어 올리지 않고 밝게만 한다(선 · 번호와 어긋나지 않게) */
.map-route .world-map__layer {
    cursor: crosshair;
}

.map-route .world-map__zone:hover .world-map__lift,
.map-route .world-map__zone.is-active .world-map__lift {
    transform: none;
    filter: brightness(1.12);
}

.map-route .world-map__label {
    cursor: crosshair;
}

/* 크게 키운 지도 — 이름표는 지도와 함께 커져 길을 가려 감춘다(지역 이름은 마우스를 올리면 지도 아래에) */
.map-route__map--zoomed .world-map__labels {
    display: none;
}

/* 선 — 달리기는 주황 실선, 비행은 파랑 끊은 선, 배 · 비행선은 청록 점선. 어두운 테두리로 그림의 어느 색 위에서도 보이게 */
.map-route__line {
    stroke-width: 3px;
    filter: drop-shadow(0 0 1px var(--map-halo));
}

.map-route__line--run {
    stroke: var(--map-route);
}

.map-route__line--flight {
    stroke: var(--map-vendor);
    stroke-dasharray: 8 5;
}

.map-route__line--boat,
.map-route__line--zeppelin {
    stroke: var(--map-fishing);
    stroke-dasharray: 2 6;
}

.game-map__pin--start {
    background: var(--map-object);
}

.game-map__pin--end {
    background: var(--map-npc);
}

/* 지역에 마우스가 가도 길은 흐리게 하지 않는다. 단계 줄 · 번호에 갈 때만 그 단계를 남기고 흐리게 */
.map-route .game-map.has-active .game-map__pin:not(.is-active) {
    opacity: 1;
}

.map-route .game-map:has(.game-map__pin.is-active) .game-map__pin:not(.is-active),
.map-route .game-map:has(.game-map__pin.is-active) .map-route__line:not(.is-active) {
    opacity: 0.3;
}

/* 지도를 누른 곳 곁에 뜨는 메뉴 */
.map-route__pick {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-width: 8.5rem;
    margin-top: 0.5rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-popup);
}

.map-route__pick[hidden] {
    display: none;
}

.map-route__pick button {
    padding: 0.625rem 0.875rem;
    border: 0;
    background: none;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.map-route__pick button + button {
    border-top: 1px solid var(--color-border);
}

.map-route__pick button:hover,
.map-route__pick button:focus-visible {
    background: var(--color-accent-soft);
    outline: none;
}

.map-route__legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs) var(--space-sm);
    margin: var(--space-xs) 0 0;
    font-size: 0.8125rem;
}

.map-route__key {
    display: inline-block;
    width: 1.5rem;
    margin-left: var(--space-xs);
    border-top: 3px solid var(--map-route);
}

.map-route__key:first-child {
    margin-left: 0;
}

.map-route__key--flight {
    border-top-style: dashed;
    border-top-color: var(--map-vendor);
}

.map-route__key--boat {
    border-top-style: dotted;
    border-top-color: var(--map-fishing);
}

/* 단계 — 번호는 지도의 번호와 같다. 줄에 마우스 · 초점이 가면 지도의 그 단계가 강조된다(game-map.js) */
.map-route__steps {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--color-border);
}

.map-route__step {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-xs);
    border-bottom: 1px solid var(--color-border);
}

.map-route__step:hover,
.map-route__step:focus-visible,
.map-route__step.is-active {
    background: var(--color-accent-soft);
    outline: none;
}

.map-route__number {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--radius-round);
    background: var(--map-route);
    color: var(--map-pin-text);
    font-size: 0.75rem;
    font-weight: 700;
}

.map-route__step:first-child .map-route__number {
    background: var(--map-object);
}

.map-route__number--end {
    background: var(--map-npc);
}

.map-route__step-body {
    min-width: 0;
}

.map-route__step-body p {
    margin: 0;
}

.map-route__step-meta {
    margin-top: 0.125rem;
    font-size: 0.8125rem;
}

.map-route__mode {
    display: inline-block;
    margin-right: 0.25rem;
    padding: 0 0.375rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    color: var(--color-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.map-route__how {
    font-size: 0.875rem;
}

.map-route__how summary {
    cursor: pointer;
    color: var(--color-accent);
}

.map-route__how ul {
    margin: var(--space-xs) 0 0;
    padding-left: 1.25rem;
}

.map-route__how li {
    margin: var(--space-xs) 0;
}
