/* Mission Map (mission-map.html, mission-map/*.js). The map itself is always deep space, in both themes,
   like the games; the panel beside it follows the site theme. On narrow screens the panel becomes a sheet
   over the bottom of the map. */

.mm-head {
    padding: 2.25rem 2rem 1.25rem;
}

.mm-head h1 {
    margin-bottom: 0.4rem;
}

.mm-back-link {
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}

.mm-back-link a {
    color: var(--accent);
    text-decoration: none;
}

.mm-back-link a:hover {
    text-decoration: underline;
}

.mm-intro {
    max-width: 820px;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.mm-disclaimer {
    max-width: 820px;
    margin-top: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.mm-section {
    padding: 0.5rem 1rem 3rem;
    border-top: none;
}

.mm {
    --space: #03050a;
    --hud-text: #d7e0ec;
    --hud-muted: #8796ab;
    --hud-line: rgba(160, 185, 220, 0.22);
    --hud-glass: rgba(10, 15, 26, 0.78);
    --hud-accent: #7cc4ff;
    --inset: 0px;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
    gap: 0.75rem;
    max-width: 1500px;
    height: clamp(560px, 80vh, 920px);
    margin: 0 auto;
}

/* ---------- Map stage ---------- */

.mm-stage {
    position: relative;
    overflow: hidden;
    border: 1px solid #1b2433;
    border-radius: 10px;
    background: var(--space);
    color: var(--hud-text);
    isolation: isolate;
}

.mm-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.mm-canvas:active {
    cursor: grabbing;
}

.mm-canvas:focus-visible {
    outline: 2px solid var(--hud-accent);
    outline-offset: -4px;
}

.mm-overlay {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.mm-overlay > * {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
}

.mm-overlay [hidden] {
    display: none;
}

/* Body labels: a name beside the body, with a dot when the body is too small to see */
.mm-label {
    display: flex;
    align-items: center;
    height: 18px;
    margin-top: -9px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--hud-text);
    font: 500 12px/1 system-ui, -apple-system, 'Segoe UI', sans-serif;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: auto;
}

.mm-label-dot {
    position: absolute;
    left: -3px;
    top: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
}

.mm-label.has-dot .mm-label-dot {
    opacity: 0.9;
}

.mm-label-name {
    margin-left: var(--off, 8px);
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(3, 5, 10, 0.55);
    text-shadow: 0 1px 2px #000;
    transition: background-color 0.15s, color 0.15s;
}

.mm-label.is-star {
    color: #ffe2a8;
}

.mm-label.is-moon {
    color: #b9c6d8;
    font-size: 11px;
}

.mm-label.is-region,
.mm-label.is-station {
    color: #8fc6ff;
    font-size: 11px;
}

.mm-label.is-station .mm-label-dot {
    border-radius: 1px;
    transform: rotate(45deg);
    opacity: 1;
}

.mm-label.is-hover .mm-label-name,
.mm-label:hover .mm-label-name {
    background: rgba(124, 196, 255, 0.22);
    color: #fff;
}

.mm-label.is-selected .mm-label-name {
    background: var(--hud-accent);
    color: #04121f;
    text-shadow: none;
}

/* Selection, hover and highlight rings */
.mm-ring {
    border: 1.5px solid var(--hud-accent);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(124, 196, 255, 0.12), 0 0 18px rgba(124, 196, 255, 0.35);
}

.mm-ring.is-hover {
    border-color: rgba(220, 235, 255, 0.55);
    border-style: dashed;
    box-shadow: none;
}

.mm-ring.is-focus {
    border-color: #ffd27a;
    border-style: dashed;
    box-shadow: 0 0 16px rgba(255, 210, 122, 0.35);
}

/* Event markers and the mission marker */
.mm-event {
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    padding: 0;
    border: 2px solid #e8eef7;
    border-radius: 50%;
    background: var(--space);
    cursor: pointer;
    pointer-events: auto;
}

.mm-event.is-past {
    background: #e8eef7;
}

.mm-event.is-current {
    border-color: #ffd27a;
    background: #ffd27a;
    box-shadow: 0 0 0 4px rgba(255, 210, 122, 0.25);
}

/* The marker is only translated (by script); the diamond is drawn on ::before so its rotation does not
   turn the translation too */
.mm-craft {
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
}

.mm-craft::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid #fff;
    background: var(--route, #ffb454);
    transform: rotate(45deg);
    box-shadow: 0 0 12px var(--route, #ffb454), 0 0 2px #000;
}

.mm-craft.is-ghost::before {
    background: transparent;
    border-style: dashed;
    box-shadow: none;
}

/* A planet is in front: the marker stays visible but dimmed */
.mm-event.is-behind,
.mm-craft.is-behind {
    opacity: 0.35;
}

.mm-tag {
    margin: 10px 0 0 10px;
    padding: 2px 6px;
    border: 1px dashed rgba(219, 230, 245, 0.6);
    border-radius: 4px;
    background: rgba(3, 5, 10, 0.7);
    color: #dbe6f5;
    font: 500 11px/1.3 system-ui, -apple-system, 'Segoe UI', sans-serif;
    white-space: nowrap;
}

/* ---------- Toolbar, legend and cards over the map ---------- */

.mm-toolbar {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    right: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    pointer-events: none;
}

.mm-toolbar > * {
    pointer-events: auto;
}

.mm-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0.3rem 0.6rem;
    list-style: none;
    border: 1px solid var(--hud-line);
    border-radius: 6px;
    background: var(--hud-glass);
    font-size: 0.82rem;
}

.mm-crumbs li + li::before {
    content: '›';
    margin: 0 0.4rem;
    color: var(--hud-muted);
}

.mm-crumbs button {
    padding: 0.1rem 0;
    border: 0;
    background: none;
    color: var(--hud-accent);
    font: inherit;
    cursor: pointer;
}

.mm-crumbs button:hover {
    text-decoration: underline;
}

.mm-crumbs [aria-current] {
    color: var(--hud-text);
    font-weight: 600;
}

.mm-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.mm-tool {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--hud-line);
    border-radius: 6px;
    background: var(--hud-glass);
    color: var(--hud-text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.mm-tool:hover {
    border-color: var(--hud-accent);
}

.mm-tool svg,
.mm-follow svg {
    display: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.mm-tool[aria-expanded="true"] {
    border-color: var(--hud-accent);
    background: rgba(124, 196, 255, 0.18);
}

.mm-tool:disabled {
    opacity: 0.45;
    cursor: default;
}

.mm-tool:focus-visible,
.mm-ctl:focus-visible,
.mm-crumbs button:focus-visible,
.mm-event:focus-visible,
.mm-speed:focus-visible,
.mm-scrub:focus-visible {
    outline: 2px solid var(--hud-accent);
    outline-offset: 2px;
}

.mm-legend {
    position: absolute;
    top: 3.2rem;
    right: 0.6rem;
    z-index: 2;
    width: min(340px, calc(100% - 1.2rem));
    max-height: calc(100% - 4rem - var(--inset));
    overflow: auto;
    padding: 0.85rem 1rem;
    border: 1px solid var(--hud-line);
    border-radius: 8px;
    background: rgba(8, 12, 21, 0.94);
    font-size: 0.82rem;
    line-height: 1.45;
}

.mm-legend-title {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.mm-legend ul {
    margin: 0 0 0.6rem;
    padding: 0;
    list-style: none;
}

.mm-legend li {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    margin-bottom: 0.4rem;
}

.mm-legend p {
    color: var(--hud-muted);
}

.mm-legend-controls {
    margin-top: 0.5rem;
}

.mm-key {
    flex: 0 0 28px;
    height: 0;
    transform: translateY(-3px);
    border-top: 3px dashed #ffb454;
}

.mm-key.is-documented {
    border-top-style: solid;
}

.mm-key.is-planned {
    border-top: 2px dotted #dbe6f5;
}

.mm-key.is-event,
.mm-key.is-craft {
    flex-basis: 12px;
    height: 12px;
    margin: 0 8px;
    transform: translateY(1px);
    border: 2px solid #e8eef7;
    border-radius: 50%;
}

.mm-key.is-craft {
    border-color: #fff;
    border-radius: 0;
    background: #ffb454;
    rotate: 45deg;
}

.mm-card {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(420px, calc(100% - 2rem));
    padding: 1.1rem 1.25rem;
    transform: translate(-50%, -50%);
    border: 1px solid var(--hud-line);
    border-radius: 10px;
    background: rgba(8, 12, 21, 0.95);
    text-align: center;
}

.mm-card-title {
    font-weight: 600;
}

.mm-card-text {
    margin-top: 0.4rem;
    color: var(--hud-muted);
    font-size: 0.9rem;
}

.mm-card-error {
    border-color: rgba(255, 140, 120, 0.5);
}

/* ---------- Replay controls (bottom of the map) ---------- */

.mm-transport {
    position: absolute;
    left: 0.6rem;
    right: 0.6rem;
    bottom: calc(0.6rem + var(--inset));
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) auto;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.5rem 0.75rem 0.45rem;
    border: 1px solid var(--hud-line);
    border-radius: 10px;
    background: var(--hud-glass);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.mm-transport[hidden] {
    display: none;
}

.mm-transport-buttons,
.mm-transport-side {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mm-ctl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    border: 1px solid var(--hud-line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--hud-text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
}

.mm-ctl:hover:not(:disabled) {
    border-color: var(--hud-accent);
}

.mm-ctl:disabled {
    opacity: 0.4;
    cursor: default;
}

.mm-ctl svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mm-play {
    min-width: 42px;
    border-color: var(--hud-accent);
    background: rgba(124, 196, 255, 0.16);
}

.mm-play svg {
    fill: currentColor;
}

.mm-play .mm-icon-pause {
    fill: none;
    stroke-width: 3;
}

.mm-play[data-state="playing"] .mm-icon-play,
.mm-play[data-state="paused"] .mm-icon-pause {
    display: none;
}

.mm-follow[aria-pressed="true"] {
    border-color: var(--hud-accent);
    background: rgba(124, 196, 255, 0.18);
    color: #fff;
}

.mm-scrub {
    width: 100%;
    accent-color: var(--hud-accent);
    cursor: pointer;
}

.mm-speed {
    height: 34px;
    padding: 0 0.3rem;
    border: 1px solid var(--hud-line);
    border-radius: 6px;
    background: #0b111c;
    color: var(--hud-text);
    font: inherit;
    font-size: 0.8rem;
}

.mm-progress {
    grid-column: 1 / -1;
    color: var(--hud-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.mm-progress #mm-progress {
    color: var(--hud-text);
}

/* ---------- Panel ---------- */

.mm-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.mm-view {
    padding: 1rem 1.1rem 1.25rem;
}

.mm-view[hidden] {
    display: none;
}

.mm-sheet-toggle {
    display: none;
}

.mm-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.85rem;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
}

.mm-tab {
    flex: 1;
    padding: 0.45rem 0.6rem;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
}

.mm-tab[aria-selected="true"] {
    background: var(--accent);
    color: #fff;
}

.mm-tab:focus-visible,
.mm-back:focus-visible,
.mm-mission:focus-visible,
.mm-step:focus-visible,
.mm-place-btn:focus-visible,
.mm-search:focus-visible,
.mm-select:focus-visible,
.mm-panel h2:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.mm-filters {
    display: grid;
    gap: 0.5rem;
}

.mm-search,
.mm-select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
}

.mm-count,
.mm-hint {
    margin: 0.6rem 0 0.5rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.mm-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mm-mission {
    display: grid;
    gap: 0.3rem;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--route);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.mm-mission:hover {
    border-color: var(--accent);
    border-left-color: var(--route);
}

.mm-mission-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mm-swatch {
    display: none;
}

.mm-mission-name {
    flex: 1;
    font-weight: 600;
    line-height: 1.3;
}

.mm-mission .status,
.mm-replay-meta .status {
    flex: none;
    margin: 0;
    font-size: 0.65rem;
}

.mm-mission-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.mm-mission-outcome {
    font-size: 0.85rem;
}

.mm-mission-summary {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mm-mission-open {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 500;
}

.mm-empty {
    padding: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mm-awaiting {
    margin-top: 1rem;
    padding: 0.65rem 0.8rem;
    border: 1px dashed var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.mm-awaiting summary {
    font-weight: 600;
    cursor: pointer;
}

.mm-awaiting p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.mm-awaiting ul {
    margin: 0;
    padding-left: 1.1rem;
}

.mm-awaiting li {
    margin-bottom: 0.45rem;
    color: var(--text-secondary);
}

.mm-awaiting strong {
    color: var(--text-primary);
}

.mm-awaiting a {
    color: var(--accent);
}

/* Locations tree */
.mm-tree ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mm-tree ul ul {
    margin-left: 0.9rem;
    padding-left: 0.6rem;
    border-left: 1px solid var(--border);
}

.mm-place-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.mm-place-btn:hover {
    background: var(--bg-primary);
}

.mm-place-count {
    margin-left: auto;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mm-opm {
    padding: 0 0.3rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
}

/* Place and replay views */
.mm-back {
    margin-bottom: 0.6rem;
    padding: 0.2rem 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.mm-back:hover {
    text-decoration: underline;
}

.mm-panel h2 {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    line-height: 1.25;
}

.mm-kind {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.mm-note {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.mm-actions {
    margin: 0.75rem 0 0.25rem;
}

.mm-tool.is-solid {
    border-color: var(--accent);
    background: transparent;
    color: var(--accent);
}

.mm-subhead {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin: 1.1rem 0 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.mm-subhead span {
    letter-spacing: 0;
    text-transform: none;
}

.mm-replay-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.mm-outcome {
    margin-top: 0.5rem;
    font-weight: 600;
}

.mm-summary {
    margin-top: 0.35rem;
    font-size: 0.92rem;
    line-height: 1.55;
}

.mm-route-kind {
    margin-top: 0.75rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.mm-route-kind strong {
    color: var(--text-primary);
}

.mm-route-swatch {
    display: inline-block;
    width: 22px;
    margin-right: 0.45rem;
    vertical-align: middle;
    border-top: 3px dashed var(--route);
}

.mm-route-swatch.is-planned {
    border-top: 2px dotted var(--text-secondary);
}

.mm-now {
    margin-top: 0.9rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-left: 3px solid #e0a940;
    border-radius: 6px;
    background: var(--bg-primary);
}

.mm-now.is-decision {
    border-left-color: var(--accent);
}

.mm-now-step {
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mm-now-title {
    margin-top: 0.15rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.mm-now-text {
    margin-top: 0.3rem;
    font-size: 0.92rem;
    line-height: 1.5;
}

.mm-now-place,
.mm-now-date {
    margin-top: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-style: italic;
}

.mm-now-place:empty {
    display: none;
}

.mm-now-foot {
    margin-top: 0.55rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.mm-now-source a {
    color: var(--accent);
}

.mm-basis {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.mm-basis:empty {
    display: none;
}

.mm-basis.is-site {
    color: var(--success);
}

.mm-basis.is-operator {
    color: var(--accent);
}

.mm-basis.is-planned {
    border-style: dashed;
    color: var(--text-secondary);
}

.mm-steps {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mm-step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.45rem 0.5rem;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}

.mm-step:hover {
    background: var(--bg-primary);
}

.mm-step-n {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mm-step-title {
    flex: 1;
}

.mm-step.is-past .mm-step-n {
    border-color: var(--text-secondary);
    background: var(--text-secondary);
    color: var(--bg-secondary);
}

.mm-step[aria-current] {
    background: var(--bg-primary);
    font-weight: 600;
}

.mm-step[aria-current] .mm-step-n {
    border-color: #e0a940;
    background: #e0a940;
    color: #1c1917;
}

.mm-step.is-planned .mm-step-n {
    border-style: dashed;
}

.mm-bullets {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.86rem;
    line-height: 1.5;
}

.mm-bullets li + li {
    margin-top: 0.35rem;
}

.mm-bullets.is-questions li::marker {
    content: '? ';
    color: var(--warning);
    font-weight: 700;
}

.mm-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.88rem;
}

.mm-links a {
    color: var(--accent);
}

.mm-noscript {
    max-width: 800px;
    margin: 1rem auto;
}

/* Without the 3D view the panel carries the page */
.mm.is-flat .mm-tools {
    display: none;
}

/* ---------- Narrow screens: the panel becomes a sheet over the map ---------- */

@media (max-width: 860px) {
    .mm-section {
        padding: 0 0.5rem 2rem;
    }

    .mm-head {
        padding: 1.5rem 1rem 1rem;
    }

    .mm {
        --peek: 4.4rem;
        display: block;
        height: 78vh;
        height: 78svh;
        min-height: 480px;
    }

    .mm-stage {
        position: absolute;
        inset: 0;
    }

    .mm-panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 3;
        max-height: 52%;
        border-radius: 14px 14px 10px 10px;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
        transform: translateY(calc(100% - var(--peek)));
        transition: transform 0.3s ease;
    }

    .mm.sheet-open .mm-panel {
        transform: none;
    }

    .mm:not(.sheet-open) .mm-panel {
        overflow: hidden;
    }

    .mm-sheet-toggle {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        justify-content: center;
        flex: none;
        width: 100%;
        height: 26px;
        padding: 0;
        border: 0;
        background: var(--bg-secondary);
        cursor: pointer;
    }

    .mm-sheet-toggle span {
        width: 42px;
        height: 5px;
        margin-top: 9px;
        border-radius: 3px;
        background: var(--text-secondary);
        opacity: 0.6;
    }

    .mm-view {
        padding-top: 0.15rem;
    }

    /* One row: where you are on the left, icon buttons on the right */
    .mm-toolbar {
        flex-wrap: nowrap;
        top: 0.45rem;
        left: 0.45rem;
        right: 0.45rem;
    }

    .mm-crumbs-wrap {
        flex: 1;
        min-width: 0;
    }

    .mm-crumbs {
        flex-wrap: nowrap;
        overflow: hidden;
        white-space: nowrap;
    }

    .mm-crumbs li {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mm-crumbs li:not(:last-child) {
        flex: none;
    }

    .mm-tools {
        flex: none;
        flex-wrap: nowrap;
        gap: 0.3rem;
    }

    .mm-tool {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
    }

    .mm-tool svg,
    .mm-follow svg {
        display: block;
    }

    .mm-tool span,
    .mm-follow span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .mm-legend {
        top: 3.4rem;
    }

    /* One row of controls and a line of progress */
    .mm-transport {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.2rem 0.4rem;
        left: 0.4rem;
        right: 0.4rem;
        bottom: calc(0.4rem + var(--inset));
        padding: 0.35rem 0.45rem 0.3rem;
    }

    .mm-transport-buttons,
    .mm-transport-side {
        gap: 0.2rem;
    }

    .mm-progress-note {
        display: none;
    }

    .mm-ctl {
        min-width: 40px;
        height: 40px;
        padding: 0;
    }

    .mm-speed {
        height: 40px;
    }
}

@media (max-width: 480px) {
    /* Play from the end starts again, so Restart can go where space is tight */
    #mm-restart {
        display: none;
    }
}

/* The site's floating menu button would sit on the panel while the map fills a phone screen */
body.mm-fills-screen .menu-fab {
    visibility: hidden;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .mm-panel,
    .mm-mission,
    .mm-label-name {
        transition: none;
    }
}
