/* Route library (2026-11-07). Loaded after shared.css and scripts.css, whose tokens, cards, pills and buttons it reuses.
   The minimap is a dark game image in both themes, so the map frame stays dark; everything around it follows the tokens. */

/* ── The map ── */
.route-map {
    position: relative;
    width: 100%;
    background: #0e0f16;
    border-radius: 10px;
    overflow: hidden;
}
.route-map svg { display: block; width: 100%; height: 100%; }
.route-map .rm-halo { fill: none; stroke: rgba(6, 6, 12, 0.78); stroke-linejoin: round; stroke-linecap: round; }
.route-map .rm-path { fill: none; stroke: #9a9bff; stroke-linejoin: round; stroke-linecap: round; }
.route-map .rm-start { fill: #4ade80; stroke: #0a0b10; }
.route-map .rm-end { fill: none; stroke: #f87171; }
.route-map .rm-end-halo { fill: none; stroke: rgba(6, 6, 12, 0.7); }
.route-map .rm-wp { fill: #fbbf24; }
.route-map-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
    color: #6b6b78; font-size: 0.75rem;
}
.route-map-empty i { font-size: 1.4rem; }

/* ── Listing rows: a wide map thumbnail in place of the square image ── */
.route-row-thumb {
    flex: 0 0 216px;
    width: 216px;
    margin: 0.6rem 0 0.6rem 0.6rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    align-self: center;
    display: block;
    transition: border-color 0.18s;
}
.script-row:hover .route-row-thumb { border-color: rgba(104,105,255, 0.3); }
.route-row-thumb .route-map { border-radius: 0; }

.route-chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.68rem; line-height: 1;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: var(--bg-base);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    font-variant-numeric: tabular-nums;
}
.route-chip i { opacity: 0.75; }
.route-chip-all { color: var(--accent); border-color: rgba(104,105,255,0.35); background: rgba(104,105,255,0.07); }
.route-heroes { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.8rem; }
.route-heroes .route-items-title { flex: 1 0 100%; }
.route-heroes-note { font-size: 0.72rem; color: var(--text-muted); }
.route-chip-count { color: var(--text-muted); font-variant-numeric: tabular-nums; margin-left: 0.15rem; }

.route-hero-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.85rem; }
.route-hero-filter .hero-pill { font-size: 0.74rem; padding-top: 0.2rem; padding-bottom: 0.2rem; }
.route-hero-filter .hero-pill:first-child { padding-left: 0.65rem; }
/* scripts.css's later .hero-pill rule ties with .hero-pill-active and wins, so the selected chip needs more weight. */
.route-hero-filter .hero-pill.hero-pill-active {
    color: var(--accent); background: rgba(104,105,255,0.2); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
[data-theme="light"] .route-hero-filter .hero-pill.hero-pill-active { background: rgba(74,76,222,0.12); }
.route-filter-notice {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 0.6rem 1rem; margin-bottom: 0.75rem; font-size: 0.82rem; color: var(--text-muted);
}
.route-filter-notice a { margin-left: auto; color: var(--text-muted); font-size: 0.75rem; text-decoration: none; }
.route-filter-notice a:hover { color: var(--text-primary); }
.route-mine-link { color: var(--text-secondary); text-decoration: none; }
.route-mine-link:hover { color: var(--accent); }

.route-status {
    font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em;
    padding: 0.18rem 0.55rem; border-radius: 999px; flex-shrink: 0;
    color: var(--text-secondary); background: var(--bg-base); border: 1px solid var(--border-subtle);
}
.route-status-on { color: #4ade80; border-color: rgba(74,222,128,0.3); background: rgba(74,222,128,0.07); }
.route-status-off { color: #fbbf24; border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.07); }

/* ── Detail ── */
.route-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.1rem;
}
.route-map-large { border: 1px solid var(--border-subtle); }
.route-map-legend {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem;
    margin-top: 0.5rem; font-size: 0.72rem; color: var(--text-muted);
}
.route-map-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.rm-key { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.rm-key-start { background: #4ade80; }
.rm-key-end { background: transparent; box-shadow: inset 0 0 0 2px #f87171; }
.rm-key-wp { background: #fbbf24; }
.route-map-name { margin-left: auto; }

.route-stats {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem; margin: 1rem 0 0;
}
.route-stats > div {
    background: var(--bg-base); border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 0.55rem 0.75rem;
}
.route-stats dt { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.03em; text-transform: uppercase; }
.route-stats dd { margin: 0.15rem 0 0; font-size: 1.05rem; font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }

.route-items { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.route-items-title { flex: 1 0 100%; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.route-item {
    font-size: 0.74rem; padding: 0.25rem 0.6rem; border-radius: 6px;
    background: var(--bg-base); border: 1px solid var(--border-subtle); color: var(--text-secondary);
}
.route-item-need { color: var(--accent); border-color: rgba(104,105,255,0.35); background: rgba(104,105,255,0.07); }
.route-items-hint { flex: 1 0 100%; font-size: 0.7rem; color: var(--text-muted); }

.route-desc { margin-top: 0.25rem; }
.route-notes {
    font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5;
    margin: 0 0 0.9rem; padding: 0.6rem 0.8rem;
    background: var(--bg-base); border: 1px solid var(--border-subtle); border-radius: 8px;
    white-space: pre-wrap; overflow-wrap: break-word;
}
.route-waypoints { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-bottom: 1rem; }
.route-waypoints .route-items-title { flex: 0 0 auto; margin-right: 0.35rem; }
.route-import-hint { font-size: 0.75rem; color: var(--text-muted); }

.route-banner {
    display: flex; gap: 0.6rem; align-items: flex-start;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 0.7rem 1rem; margin-bottom: 1.25rem; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.45;
}
.route-banner a { color: var(--accent); }
.route-banner-warn { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: #fbbf24; }
.route-banner-reason { margin-top: 0.35rem; color: #fde68a; font-size: 0.8rem; }

.route-staff {
    display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
    margin-top: 1rem; padding: 0.75rem; border: 1px dashed var(--border-active); border-radius: 8px;
}
.route-staff-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.route-staff input[type="text"] {
    flex: 1 1 220px; min-width: 0;
    background: var(--bg-base); border: 1px solid var(--border-subtle); border-radius: 8px;
    color: var(--text-primary); padding: 0.5rem 0.7rem; font-family: var(--font-sans); font-size: 0.8rem;
}

/* ── Forms ── */
.route-code-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.route-code-row input { flex: 1; font-family: 'Geist Mono', monospace; letter-spacing: 0.5px; }
.route-code-row button { white-space: nowrap; padding: 0.55rem 1rem; }
.route-code-status { margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
.route-code-status.good { color: #4ade80; }
.route-code-status.bad { color: #f87171; }
.route-code-mono { font-family: 'Geist Mono', monospace; color: var(--text-primary); }
.route-optional { color: var(--text-muted); font-weight: 400; }
.route-tag-checks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.scripts-form .route-tag-check {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; font-weight: 500; color: var(--text-secondary);
    padding: 0.35rem 0.7rem; border-radius: 999px; cursor: pointer;
    background: var(--bg-base); border: 1px solid var(--border-subtle);
    margin: 0;
}
.scripts-form .route-tag-check input { width: auto; margin: 0; accent-color: var(--accent); }
.scripts-form .route-tag-check:has(input:checked) { color: var(--accent); border-color: rgba(104,105,255,0.4); background: rgba(104,105,255,0.08); }
.scripts-form .route-listed-check { border-radius: 8px; }

.route-code-off { cursor: default; opacity: 0.75; font-family: 'Geist Mono', monospace; }
.route-detail-info .script-detail-title,
.route-waypoints .route-chip,
.route-row .script-row-title { overflow-wrap: anywhere; }

/* Light theme: the dark-theme amber/green/red text is unreadable on white. */
[data-theme="light"] .route-banner-warn { color: #92400e; background: rgba(245,158,11,0.1); border-color: rgba(180,83,9,0.35); }
[data-theme="light"] .route-banner-reason { color: #78350f; }
[data-theme="light"] .route-status-on { color: #15803d; border-color: rgba(21,128,61,0.35); background: rgba(21,128,61,0.08); }
[data-theme="light"] .route-status-off { color: #b45309; border-color: rgba(180,83,9,0.35); background: rgba(180,83,9,0.08); }
[data-theme="light"] .route-code-status.good { color: #15803d; }
[data-theme="light"] .route-code-status.bad { color: #b91c1c; }
[data-theme="light"] .scripts-form .errors { color: #b91c1c; background: rgba(220,38,38,0.06); border-color: rgba(185,28,28,0.35); }
[data-theme="light"] .btn-action-delete { color: #b91c1c !important; border-color: rgba(185,28,28,0.35) !important; }

@media (max-width: 760px) {
    .route-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
}
@media (max-width: 640px) {
    .route-row-thumb { flex: 0 0 104px; width: 104px; margin: 0.5rem; }
    .route-row .script-row-body { padding: 0.7rem 0.85rem 0.7rem 0.5rem; min-width: 0; }
    .route-row .script-row-bottom { flex-wrap: wrap; gap: 0.5rem; }
    .route-row .script-row-actions { flex-wrap: wrap; width: 100%; }
    .route-row .script-row-actions .btn-row { flex: 1 1 auto; }
    .route-code-row { flex-direction: column; align-items: stretch; }
    .route-map-name { margin-left: 0; }
    /* Many heroes would wrap into a wall above the routes: one scrolling row instead. */
    .route-hero-filter { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 0.3rem; scrollbar-width: thin; }
    .route-hero-filter .hero-pill { flex: 0 0 auto; }
}
