/*
   estrelas.css
   Estrelas (web)

   The interface styles (Estrela, a holographic HUD; macOS) as colour roles and type, the styled panels and controls, and the app's chrome: menu bar, side panel, time strip and sheets.
*/

:root {
    color-scheme: dark;
    --sheet-background: #1d1f24;
    --sheet-text: #e8e9ec;
    --sheet-secondary: #9a9ea8;
    --sheet-border: #3a3d45;
    --sheet-accent: #3b82f6;
    --sheet-field: #2a2d34;
    --system-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

body[data-style="estrela"] {
    --primary: rgb(115 209 255);
    --accent: rgb(77 230 199);
    --highlight: rgb(255 199 77);
    --label: rgb(158 184 219);
    --control: rgb(107 153 255);
    --info: rgb(102 242 242);
    --muted: rgb(128 153 179);
    --alert: rgb(255 92 51);
    --background: rgb(10 18 31 / 0.85);
    --glass: rgb(23 36 56 / 0.85);
    --font: var(--system-font);
    --font-stretch: expanded;
    --letter-spacing: 0.08em;
    --font-scale: 0.86;
    --numeric-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --numeric-scale: 0.9;
}
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: #000;
    color: var(--label);
    font-family: var(--system-font);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
}

#scene:active {
    cursor: grabbing;
}

.hidden {
    display: none !important;
}

svg.defs {
    position: absolute;
    width: 0;
    height: 0;
}

/* MARK: themed type */

.themed {
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    text-transform: uppercase;
}

.numeric {
    font-family: var(--numeric-font);
    font-variant-numeric: tabular-nums;
    font-stretch: var(--font-stretch);
}

/* MARK: decorations */

.decoration {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    overflow: visible;
}

.decoration.behind {
    z-index: -1;
}

/* MARK: panels */

.panel {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.estrela-panel {
    padding: 14px;
    gap: 8px;
    margin: 4px;
}

.estrela-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
}

.estrela-title {
    font-family: var(--font);
    font-stretch: expanded;
    letter-spacing: 0.08em;
    font-size: calc(16px * 0.86);
    font-weight: 500;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 4px var(--glow);
    flex: 1;
}

.estrela-indicators {
    display: flex;
    gap: 3px;
}

.estrela-indicators i {
    width: 10px;
    height: 3px;
}

.estrela-rule {
    height: 1px;
}

.estrela-ticks {
    display: flex;
    gap: 3px;
}

.estrela-ticks i {
    width: 5px;
    height: 5px;
}
/* MARK: buttons */

.styled-button {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--height);
    padding: 0 calc(var(--height) * 0.45);
    border: none;
    background: none;
    color: var(--color);
    cursor: pointer;
    font: inherit;
    white-space: nowrap;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.styled-button.grow {
    display: flex;
    width: 100%;
}

.styled-button .label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    justify-content: inherit;
}

.styled-button:disabled {
    cursor: default;
}

.styled-button:focus-visible {
    outline: 2px solid var(--color);
    outline-offset: 2px;
}

.icon {
    width: 1.1em;
    height: 1.1em;
    flex: none;
}

body[data-style="estrela"] .styled-button {
    font-family: var(--font);
    font-stretch: expanded;
    letter-spacing: 0.08em;
    font-size: calc(var(--height) * 0.5 * 0.86);
    font-weight: 500;
    text-transform: uppercase;
    text-shadow: 0 0 3px color-mix(in srgb, var(--color) 60%, transparent);
}

body[data-style="estrela"] .styled-button .button-fill {
    fill-opacity: 0.12;
}

body[data-style="estrela"] .styled-button:active:not(:disabled) .button-fill {
    fill-opacity: 0.4;
}

body[data-style="estrela"] .styled-button:disabled {
    opacity: 0.35;
}
/* Toggles */

.toggle .lamp {
    width: 8px;
    height: 8px;
    flex: none;
}

.toggle .toggle-title {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

body[data-style="estrela"] .toggle .lamp {
    border: 1px solid var(--color);
}

body[data-style="estrela"] .toggle.on .lamp {
    background: var(--color);
    box-shadow: 0 0 4px var(--color);
}
/* MARK: section headers and data rows */

.section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color);
    min-width: 0;
}

.section-header span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: none;
    max-width: 80%;
    font-family: var(--font);
    text-transform: uppercase;
}

.section-header.estrela {
    padding-top: 6px;
}

.section-header.estrela .diamond {
    width: 5px;
    height: 5px;
    background: var(--color);
    transform: rotate(45deg);
    flex: none;
}

.section-header.estrela span {
    font-stretch: expanded;
    letter-spacing: 0.08em;
    font-size: calc(13px * 0.86);
    font-weight: 500;
}

.section-header.estrela .rule {
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--color) 50%, transparent);
}
.data-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.data-label {
    color: var(--label);
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    text-transform: uppercase;
    flex: none;
}

.data-value {
    margin-left: auto;
    text-align: right;
    font-family: var(--numeric-font);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

body[data-style="estrela"] .data-row {
    padding-bottom: 2px;
    border-bottom: 1px solid rgb(158 184 219 / 0.15);
}

body[data-style="estrela"] .data-label {
    font-size: calc(12px * 0.86);
}

body[data-style="estrela"] .data-value {
    font-size: calc(13px * 0.9);
}
.muted-text {
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    text-transform: uppercase;
    color: color-mix(in srgb, var(--label) 70%, transparent);
    font-size: 13px;
}

/* MARK: strips */

.strip {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: 6px;
}

.strip > * {
    flex: none;
}

.estrela-strip {
    padding: 8px 16px;
}
/* MARK: app chrome */

#menubar {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 20;
    display: flex;
    gap: 2px;
    align-items: center;
    padding: 4px;
    border-radius: 10px;
    background: rgb(20 22 28 / 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgb(255 255 255 / 0.08);
    font-family: var(--system-font);
    font-size: 13px;
    color: var(--sheet-text);
    max-width: calc(100vw - 20px);
}

#menubar .app-name {
    font-weight: 700;
    padding: 0 8px 0 6px;
    display: flex;
    gap: 6px;
    align-items: center;
}

#menubar .app-name .icon {
    color: var(--highlight);
}

.menu {
    position: relative;
}

.menu > button,
#universe-title {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    padding: 4px 9px;
    border-radius: 6px;
    cursor: pointer;
}

.menu > button:hover,
.menu.open > button {
    background: rgb(255 255 255 / 0.1);
}

#universe-title {
    cursor: default;
    color: var(--sheet-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30vw;
}

.menu-items {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    padding: 5px;
    border-radius: 9px;
    background: rgb(36 38 44 / 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgb(255 255 255 / 0.1);
    box-shadow: 0 12px 30px rgb(0 0 0 / 0.5);
    display: none;
    flex-direction: column;
}

.menu.open .menu-items {
    display: flex;
}

.menu-items button {
    display: flex;
    align-items: center;
    gap: 16px;
    border: none;
    background: none;
    color: var(--sheet-text);
    font: inherit;
    text-align: left;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.menu-items button:hover:not(:disabled) {
    background: var(--sheet-accent);
}

.menu-items button:disabled {
    color: var(--sheet-secondary);
    cursor: default;
}

.menu-items .shortcut {
    margin-left: auto;
    color: var(--sheet-secondary);
    font-size: 12px;
}

.menu-items button:hover:not(:disabled) .shortcut {
    color: inherit;
}

.menu-items .check {
    width: 14px;
    flex: none;
}

.menu-items hr {
    border: none;
    border-top: 1px solid rgb(255 255 255 / 0.1);
    margin: 4px 6px;
}

.menu-items .heading {
    color: var(--sheet-secondary);
    font-size: 11px;
    padding: 4px 10px 2px;
}

#side {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 330px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    z-index: 10;
    display: flex;
    flex-direction: column;
}

#side > .panel {
    max-height: calc(100vh - 20px);
}

/* The side panel scrolls when it's taller than the screen (a phone held sideways), with the planet list keeping
   enough room to scroll on its own */
#side .panel-content {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

#side .panel-content > * {
    flex-shrink: 0;
}

#side .panel-content > .planet-list {
    flex-shrink: 1;
    min-height: 140px;
}

@supports (height: 100dvh) {
    #side,
    #side > .panel {
        max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
}

#side {
    top: calc(10px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
}

.planet-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
    min-height: 0;
    flex: 1;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* Buttons keep their whole label, in any language: one that doesn't fit goes to the next line instead */
.button-row > .styled-button:not(.grow) {
    flex-shrink: 0;
}

.button-row > .grow {
    flex: 1;
}

.world-button .label {
    justify-content: space-between !important;
}

.world-button .sah {
    font-family: var(--numeric-font);
    font-variant-numeric: tabular-nums;
}

.camera-readout {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    font-family: var(--numeric-font);
    font-size: 11px;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--label) 80%, transparent);
}

#time {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 10;
    max-width: calc(100vw - 20px);
}

#time .readout {
    min-width: 200px;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
}

#time .date.stacked {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

#time .date.stacked .time-text {
    font-size: 0.8em;
    opacity: 0.85;
}

#time .date {
    white-space: nowrap;
    color: var(--primary);
    font-family: var(--numeric-font);
    font-variant-numeric: tabular-nums;
    font-size: calc(20px * var(--numeric-scale));
}

#time .caption {
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    text-transform: uppercase;
    font-size: 11px;
}

#time .rate {
    min-width: 120px;
    text-align: center;
    color: var(--highlight);
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    text-transform: uppercase;
    font-size: 16px;
    font-weight: 700;
}

#status {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    text-transform: uppercase;
    color: var(--primary);
    text-align: center;
    pointer-events: none;
}

#status .icon {
    width: 48px;
    height: 48px;
    display: block;
    margin: 0 auto 10px;
    color: var(--muted);
}

#toast {
    position: fixed;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    z-index: 40;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgb(36 38 44 / 0.95);
    color: var(--sheet-text);
    font-size: 13px;
    max-width: min(520px, calc(100vw - 32px));
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}

/* MARK: sheets */

dialog {
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
}

dialog:focus {
    outline: none;
}

dialog::backdrop {
    background: rgb(0 0 0 / 0.55);
}

dialog.themed-sheet {
    width: 720px;
    height: min(620px, calc(100vh - 24px));
    background: #000;
    border-radius: 12px;
}

dialog.themed-sheet.wide {
    width: 1100px;
    height: min(660px, calc(100vh - 24px));
}

dialog.themed-sheet > .panel {
    height: 100%;
}

.sheet-columns {
    display: flex;
    gap: 18px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-right: 4px;
    flex-wrap: wrap;
}

.sheet-columns > div {
    flex: 1 1 280px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sheet-footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding-top: 6px;
}

.world-row {
    padding: 1px 0;
    font-family: var(--numeric-font);
    font-variant-numeric: tabular-nums;
}

.world-row .main {
    display: flex;
    gap: 8px;
    font-size: 14px;
}

.world-row .main .orbit {
    margin-left: auto;
    color: var(--label);
}

.world-row .main .sah {
    color: var(--accent);
    min-width: 34px;
    text-align: right;
}

.world-row .extra {
    font-size: 12px;
    color: color-mix(in srgb, var(--label) 80%, transparent);
}

/* Plain sheets: new universe, universes, settings, alerts */

dialog.plain-sheet {
    background: var(--sheet-background);
    color: var(--sheet-text);
    border-radius: 12px;
    border: 1px solid var(--sheet-border);
    box-shadow: 0 20px 50px rgb(0 0 0 / 0.6);
    font-family: var(--system-font);
    font-size: 13px;
}

.plain-sheet form,
.plain-sheet .sheet-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.plain-sheet h2 {
    font-size: 15px;
    margin: 0;
}

.plain-sheet p {
    margin: 0;
}

.plain-sheet .footnote {
    font-size: 12px;
    color: var(--sheet-secondary);
}

.plain-sheet .error {
    color: #ff6b6b;
}

.plain-sheet label.field {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 10px;
}

.plain-sheet input[type="text"],
.plain-sheet select {
    background: var(--sheet-field);
    color: var(--sheet-text);
    border: 1px solid var(--sheet-border);
    border-radius: 6px;
    padding: 6px 8px;
    font: inherit;
    min-width: 0;
    width: 100%;
}

.plain-sheet input:focus,
.plain-sheet select:focus {
    outline: 2px solid var(--sheet-accent);
    outline-offset: -1px;
}

.plain-sheet .row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.plain-sheet .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.plain-sheet button {
    background: #3a3d45;
    color: var(--sheet-text);
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font: inherit;
    cursor: pointer;
}

.plain-sheet button:hover:not(:disabled) {
    background: #474b55;
}

.plain-sheet button.default {
    background: var(--sheet-accent);
    color: #fff;
}

.plain-sheet button.default:hover:not(:disabled) {
    background: #4c8ff7;
}

.plain-sheet button.destructive {
    color: #ff6b6b;
}

.plain-sheet button:disabled {
    opacity: 0.45;
    cursor: default;
}

.plain-sheet button.icon-button {
    padding: 5px 7px;
    display: inline-flex;
}

.plain-sheet hr {
    border: none;
    border-top: 1px solid var(--sheet-border);
    margin: 0;
}

dialog.universes {
    width: 640px;
}

.universe-list {
    display: flex;
    flex-direction: column;
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--sheet-border);
    border-radius: 8px;
}

.universe-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--sheet-border);
}

.universe-row:last-child {
    border-bottom: none;
}

.universe-row .status {
    color: var(--sheet-secondary);
    display: flex;
}

.universe-row .status.open {
    color: var(--sheet-accent);
}

.universe-row .details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.universe-row .details input {
    background: transparent;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    padding: 2px 4px;
    margin-left: -5px;
}

.universe-row .details input:hover {
    border-color: var(--sheet-border);
}

.universe-row .meta {
    font-size: 11px;
    color: var(--sheet-secondary);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.universe-row .meta .seed {
    font-variant-numeric: tabular-nums;
    user-select: text;
}

dialog.settings {
    width: 420px;
}

/* MARK: surface map */

.map-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.map-header .name {
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    text-transform: uppercase;
    font-size: 18px;
    font-weight: 700;
}

.map-header .sah {
    font-family: var(--numeric-font);
    font-size: 18px;
    color: var(--label);
    margin-right: auto;
}

.map-header .sah.summary {
    font-size: 14px;
}

.map-header .zoom {
    width: 48px;
    text-align: center;
    color: var(--highlight);
    font-family: var(--numeric-font);
    font-size: 16px;
}

.map-viewport {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #000;
    border-radius: 6px;
    position: relative;
    touch-action: pan-x pan-y;
}

.map-content {
    position: relative;
}

.map-surface {
    position: absolute;
}

.map-surface canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: auto;
}

.map-surface svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.map-label {
    position: absolute;
    padding: 1px 4px;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.6);
    color: #fff;
    font-family: var(--system-font);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

.map-progress {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--label);
    font-family: var(--system-font);
}

.map-progress progress {
    width: 220px;
}

.map-footer {
    min-height: 20px;
    font-size: 14px;
}

.map-footer .coordinates {
    color: var(--primary);
    font-family: var(--numeric-font);
}

@media (max-width: 700px) {
    #side {
        top: auto;
        bottom: 10px;
        max-height: 48vh;
    }

    #side > .panel {
        max-height: 48vh;
    }

    @supports (height: 100dvh) {
        #side,
        #side > .panel {
            max-height: 48dvh;
        }
    }

    #time {
        bottom: auto;
        top: 60px;
    }

    #universe-title {
        display: none;
    }
}

/* MARK: macOS style — Liquid Glass panels, the system font, native-looking switches */

body[data-style="macOS"] {
    --primary: rgb(235 235 245);
    --accent: rgb(10 132 255);
    --highlight: rgb(255 159 10);
    --label: rgb(235 235 245 / 0.6);
    --control: rgb(10 132 255);
    --info: rgb(100 210 255);
    --muted: rgb(142 142 147);
    --alert: rgb(255 69 58);
    --background: rgb(30 30 32 / 0.8);
    --glass: rgb(40 40 44 / 0.55);
    --font: var(--system-font);
    --font-stretch: normal;
    --letter-spacing: 0;
    --font-scale: 1;
    --numeric-font: var(--system-font);
    --numeric-scale: 1;
}

.macos-panel {
    padding: 16px;
    border-radius: 16px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid rgb(255 255 255 / 0.12);
    box-shadow: 0 10px 40px rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.12);
    color: var(--primary);
    margin: 4px;
}

.macos-title {
    margin: 0 0 10px;
    font: 600 15px var(--system-font);
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body[data-style="macOS"] .styled-button {
    height: var(--height);
    min-height: var(--height);
    padding: 0 calc(var(--height) * 0.45);
    border: 1px solid rgb(255 255 255 / 0.14);
    border-radius: calc(var(--height) * 0.3);
    background: color-mix(in srgb, var(--color) 35%, rgb(255 255 255 / 0.08));
    backdrop-filter: blur(12px);
    color: #fff;
    font: 400 max(calc(var(--height) * 0.5), 11px) var(--system-font);
    text-transform: none;
    letter-spacing: 0;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.15);
}

body[data-style="macOS"] .styled-button.pill {
    border-radius: 999px;
}

body[data-style="macOS"] .styled-button:hover:not(:disabled) {
    background: color-mix(in srgb, var(--color) 50%, rgb(255 255 255 / 0.1));
}

body[data-style="macOS"] .styled-button:active:not(:disabled) {
    opacity: 0.7;
}

body[data-style="macOS"] .styled-button:disabled {
    opacity: 0.4;
}

.macos-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font: 13px var(--system-font);
    color: var(--primary);
    cursor: pointer;
    min-height: 24px;
}

.macos-toggle span {
    flex: 1;
}

.macos-toggle input {
    appearance: none;
    width: 26px;
    height: 15px;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.2);
    position: relative;
    margin: 0;
    cursor: pointer;
    transition: background 0.15s;
}

.macos-toggle input::after {
    content: "";
    position: absolute;
    top: 1.5px;
    left: 1.5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    transition: transform 0.15s;
}

.macos-toggle input:checked {
    background: var(--color, var(--accent));
}

.macos-toggle input:checked::after {
    transform: translateX(11px);
}

.section-header.macos {
    font: 600 12px var(--system-font);
    color: var(--color);
    padding-top: 6px;
    margin: 2px 0;
}

body[data-style="macOS"] .data-row {
    font: 13px var(--system-font);
}

body[data-style="macOS"] .data-label {
    color: var(--label);
    text-transform: none;
    letter-spacing: 0;
    font: 13px var(--system-font);
}

body[data-style="macOS"] .data-value {
    font: 13px var(--system-font);
    font-variant-numeric: tabular-nums;
}

.macos-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid rgb(255 255 255 / 0.12);
}

body[data-style="macOS"] #time .date,
body[data-style="macOS"] #time .caption,
body[data-style="macOS"] #time .rate {
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--system-font);
}

/* MARK: side panel additions */

#side {
    flex-direction: row;
    align-items: flex-start;
    gap: 4px;
    width: auto;
}

#side > .panel {
    width: 330px;
    max-width: calc(100vw - 60px);
}

#side.collapsed {
    width: auto;
}

#side .fold-button {
    margin-top: 8px;
    flex: 0 0 auto;
}

.system-search {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 2px;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--control) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--control) 35%, transparent);
    color: var(--label);
}

.search-field:focus-within {
    border-color: color-mix(in srgb, var(--control) 80%, transparent);
}

.search-field input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--primary);
    font: 13px var(--font);
}

.search-field .icon {
    width: 14px;
    height: 14px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.search-result .label,
.styled-button.left .label {
    justify-content: flex-start !important;
}

.muted-text.small {
    font-size: 11px;
    padding-left: 4px;
}

.panel-switches {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.camera-readout {
    flex-direction: column;
    gap: 2px;
}

.camera-readout > div {
    display: flex;
    gap: 10px;
}

.camera-readout .hint {
    font-family: var(--font);
    font-size: 10px;
    opacity: 0.75;
    text-transform: none;
}

.zone-picker,
.choice-row,
.stepper-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.choice-row .data-label {
    width: 80px;
}

.stepper-row .data-label {
    width: 110px;
}

.stepper-row .value-stack {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding-left: 4px;
}

.stepper-row .value {
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    font-size: 13px;
}

.stepper-row .earth-symbol {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-stretch: normal;
}

.stepper-row .was {
    font-size: 11px;
    color: var(--label);
    opacity: 0.7;
}

/* The label sits beside the buttons when they all fit, and above them when they don't, so no title is cut short */
.zone-picker.wraps,
.choice-row.wraps {
    flex-wrap: wrap;
}

.zone-picker .choices,
.choice-row .choices {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.choice-row.wraps .data-label {
    width: auto;
    min-width: 80px;
}

.resolution-menu {
    font: inherit;
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    text-transform: uppercase;
    font-size: 12px;
    color: black;
    background: var(--info);
    border: none;
    border-radius: 13px;
    height: 26px;
    padding: 0 10px;
    cursor: pointer;
}

body[data-style="macOS"] .resolution-menu {
    color: white;
    text-transform: none;
    border-radius: 6px;
}

.spacer {
    flex: 1;
}

.button-row.end {
    justify-content: flex-end;
    margin-top: 4px;
}

.button-row > .data-row {
    flex: 1;
    min-width: 0;
}

.add-route {
    margin-top: 4px;
}

.styled-button .label .icon {
    width: 13px;
    height: 13px;
    margin-right: 4px;
    vertical-align: -2px;
}

.star-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.star-chips .chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.star-chips .chip-name {
    font-family: var(--numeric-font);
    font-size: 12px;
    color: var(--primary);
}

.moon-row {
    padding-left: 18px;
}

.note-button .icon {
    width: 13px;
    height: 13px;
}

/* MARK: jump route */

#route {
    position: fixed;
    top: 44px;
    left: 10px;
    width: 330px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 60px);
    z-index: 10;
    display: flex;
}

#route:empty {
    display: none;
}

/* The panel grows with the route, just tall enough for every hop; once that would run past the window, the hops scroll */
#route > .panel {
    max-height: 100%;
}

.route-panel .panel-content {
    overflow: hidden;
}

.route-jumps {
    flex: 0 1 auto;
    min-height: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--info) 30%, transparent);
    border-top-color: var(--info);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* MARK: time strip */

#time {
    left: 10px;
    right: 360px;
    transform: none;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

#time > * {
    pointer-events: auto;
}

#time .year {
    cursor: text;
}

#time .year-field {
    width: 64px;
    font: inherit;
    color: inherit;
    background: color-mix(in srgb, var(--control) 20%, transparent);
    border: none;
    border-radius: 4px;
    padding: 0 2px;
}

#time .compact .readout {
    min-width: 150px;
}

#time .compact .date {
    font-size: calc(15px * var(--numeric-scale));
}

/* MARK: popovers and menus */

.popover {
    position: fixed;
    z-index: 1000;
    background: var(--sheet-background);
    color: var(--sheet-text);
    border: 1px solid var(--sheet-border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgb(0 0 0 / 0.5);
    padding: 12px;
    font: 13px var(--system-font);
    max-width: calc(100vw - 16px);
}

dialog .popover {
    position: fixed;
}

.popover .row,
.note-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.popover button:not(.styled-button),
.context-menu button {
    font: 13px var(--system-font);
}

.popover button:not(.styled-button) {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--sheet-border);
    background: var(--sheet-field);
    color: var(--sheet-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.popover button.destructive {
    color: #ff6b5e;
}

.popover .icon {
    width: 14px;
    height: 14px;
}

.note-editor {
    width: 440px;
    max-width: calc(100vw - 40px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-body {
    max-height: 360px;
    min-height: 160px;
    overflow-y: auto;
}

.note-body textarea {
    width: 100%;
    min-height: 200px;
    resize: vertical;
    font: 13px ui-monospace, Menlo, monospace;
    background: var(--sheet-field);
    color: var(--sheet-text);
    border: 1px solid var(--sheet-border);
    border-radius: 6px;
    padding: 6px;
}

.note-body .footnote,
.popover .footnote {
    color: var(--sheet-secondary);
    font-size: 11px;
    margin: 4px 0 0;
}

.segmented {
    display: inline-flex;
    border: 1px solid var(--sheet-border);
    border-radius: 6px;
    overflow: hidden;
}

.popover .segmented button {
    border: none;
    border-radius: 0;
    background: transparent;
}

.popover .segmented button.selected {
    background: var(--sheet-accent);
    color: #fff;
}

.context-menu {
    position: fixed;
    z-index: 1100;
    min-width: 180px;
    padding: 4px;
    background: var(--sheet-background);
    border: 1px solid var(--sheet-border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
    display: flex;
    flex-direction: column;
}

.context-menu button {
    text-align: left;
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--sheet-text);
    cursor: pointer;
}

.context-menu button:hover {
    background: var(--sheet-accent);
    color: #fff;
}

.export-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
}

.export-menu .heading {
    color: var(--sheet-secondary);
    font-size: 11px;
    text-transform: uppercase;
    margin-top: 4px;
}

.export-menu button {
    justify-content: flex-start;
}

/* MARK: markdown */

.markdown {
    display: flex;
    flex-direction: column;
    gap: 0.45em;
    line-height: 1.4;
}

.markdown p,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
    margin: 0;
}

.markdown .md-item {
    display: flex;
    gap: 6px;
}

.markdown .md-item .marker {
    min-width: 1em;
    text-align: right;
    opacity: 0.8;
}

.markdown blockquote {
    margin: 0;
    padding-left: 8px;
    border-left: 3px solid currentColor;
    font-style: italic;
    opacity: 0.85;
}

.markdown pre {
    margin: 0;
    padding: 6px;
    border-radius: 4px;
    background: rgb(127 127 127 / 0.12);
    white-space: pre-wrap;
}

.markdown code {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 0.95em;
}

.markdown a {
    color: var(--sheet-accent);
}

/* MARK: notes report */

dialog.notes-sheet {
    width: min(720px, calc(100vw - 20px));
    height: min(820px, calc(100vh - 20px));
    padding: 0;
}

.notes-report {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.notes-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #2a2b30;
}

.notes-page {
    background: #fff;
    color: #000;
    padding: 54px;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
    font: 11pt var(--system-font);
}

.notes-page header {
    border-bottom: 1.5px solid #000;
    padding-bottom: 6px;
    margin-bottom: 14px;
}

.notes-page h1 {
    margin: 0;
    font-size: 26px;
}

.notes-page .meta {
    color: rgb(0 0 0 / 0.6);
    font-size: 11px;
}

.notes-page section {
    margin-bottom: 12px;
    break-inside: avoid-page;
}

.notes-page .section-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.notes-page h2,
.notes-page h3 {
    margin: 0;
    font-size: 17px;
}

.notes-page h3 {
    font-size: 15px;
}

.notes-page .share {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgb(0 0 0 / 0.45);
}

.notes-page .share.shared {
    color: rgb(0 150 0 / 0.8);
}

.notes-report .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--sheet-border);
}

/* MARK: data sheets */

.sheet-holder {
    display: contents;
}

.sheet-scroll {
    overflow-y: auto;
    min-height: 0;
    flex: 1;
    padding-right: 4px;
}

.sheet-columns.social {
    margin-top: 12px;
}

.social-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editor {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.described-line,
.world-row .extra.described {
    text-align: right;
    font-family: var(--numeric-font);
    font-size: 12px;
    color: color-mix(in srgb, var(--label) 80%, transparent);
}

.sheet-footer {
    align-items: center;
    gap: 8px;
}

/* MARK: globe pin and map places */

.globe-pin-label {
    position: fixed;
    z-index: 5;
    transform: translate(-50%, calc(-100% - 6px));
    padding: 2px 6px;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.7);
    color: #fff;
    font: 600 12px var(--system-font);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    white-space: nowrap;
}

/* "Resolving world…": shown while a globe is still being drawn at its full resolution */
.resolving-status {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 8px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--info) 45%, transparent);
    background: rgb(4 10 20 / 0.78);
    color: var(--info);
    font-family: var(--font);
    font-stretch: var(--font-stretch);
    letter-spacing: var(--letter-spacing);
    font-size: 12px;
    text-transform: uppercase;
    pointer-events: none;
    white-space: nowrap;
    animation: resolving-in 0.3s ease-out;
}
body[data-style="macOS"] .resolving-status {
    text-transform: none;
    letter-spacing: normal;
    font-family: var(--system-font);
    font-size: 13px;
}
/* A small world turning, banded like a globe of cells, with a moon going round it on a tilted orbit */
.resolving-spinner {
    position: relative;
    width: 28px;
    height: 20px;
    flex: none;
}
.resolving-spinner .world {
    position: absolute;
    left: 7px;
    top: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.55), transparent 55%),
        repeating-linear-gradient(90deg, color-mix(in srgb, var(--info) 90%, white) 0 3px, color-mix(in srgb, var(--info) 35%, black) 3px 5px, var(--info) 5px 7px);
    background-size: 100% 100%, 14px 100%;
    box-shadow: inset -3px -2px 4px rgb(0 0 0 / 0.55), 0 0 6px color-mix(in srgb, var(--info) 60%, transparent);
    animation: resolving-turn 1.6s linear infinite, resolving-focus 2.4s ease-in-out infinite;
}
.resolving-spinner .orbit {
    position: absolute;
    inset: 0;
    transform: rotate(-18deg);
}
.resolving-spinner .orbit::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 6px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--info) 40%, transparent);
}
/* The moon: across and back, and up and down a quarter turn behind, makes the ellipse; it passes behind the world on
   the far side */
.resolving-spinner .orbit b {
    position: absolute;
    left: 50%;
    top: 50%;
    animation: resolving-across 1.4s ease-in-out infinite alternate;
}
.resolving-spinner .orbit em {
    position: absolute;
    width: 5px;
    height: 5px;
    margin: -2.5px 0 0 -2.5px;
    border-radius: 50%;
    background: var(--highlight);
    box-shadow: 0 0 4px var(--highlight);
    animation: resolving-depth 2.8s ease-in-out infinite -0.7s;
}
@keyframes resolving-across {
    from { transform: translateX(-13px); }
    to { transform: translateX(13px); }
}
@keyframes resolving-depth {
    0% { transform: translateY(-4px); opacity: 0.35; }
    50% { transform: translateY(4px); opacity: 1; }
    100% { transform: translateY(-4px); opacity: 0.35; }
}
@keyframes resolving-turn {
    from { background-position: 0 0, 0 0; }
    to { background-position: 0 0, 14px 0; }
}
@keyframes resolving-focus {
    0%, 100% { filter: blur(0.8px) saturate(0.6); }
    50% { filter: blur(0) saturate(1.2); }
}
@keyframes resolving-orbit {
    to { transform: rotate(360deg); }
}
@keyframes resolving-in {
    from { opacity: 0; transform: translate(-50%, -6px); }
}
@media (prefers-reduced-motion: reduce) {
    .resolving-spinner .world,
    .resolving-spinner .orbit b,
    .resolving-spinner .orbit em,
    .resolving-status {
        animation: none;
    }
}

.map-markers,
.map-pin-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.place-button {
    position: absolute;
    transform: translate(-50%, -8px);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    pointer-events: auto;
}

.place-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.place-marker .symbol {
    font: 700 13px var(--system-font);
    text-shadow: 0 0 2px #000, 0 0 3px #000;
    line-height: 16px;
}

.place-marker[data-kind="capital"] .symbol {
    font-size: 16px;
}

.place-marker .name {
    padding: 1px 4px;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.6);
    color: #fff;
    font: 600 10px var(--system-font);
    white-space: nowrap;
}

.dropped-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.dropped-pin .pill {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.7);
    color: #fff;
    font: 600 12px var(--system-font);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dropped-pin .pin .icon {
    width: 20px;
    height: 20px;
    color: #ff3b30;
    filter: drop-shadow(0 0 1.5px #000);
}

.place-editor {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.place-editor .field {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    align-items: center;
    gap: 6px;
}

.place-editor input,
.place-editor select {
    grid-column: span 2;
    background: var(--sheet-field);
    color: var(--sheet-text);
    border: 1px solid var(--sheet-border);
    border-radius: 6px;
    padding: 4px 6px;
    font: 13px var(--system-font);
}

.place-editor .field > .row {
    grid-column: span 2;
    display: flex;
    gap: 6px;
    min-width: 0;
}

.place-editor .field > .row input {
    flex: 1;
    min-width: 0;
}

.place-editor .icon-button {
    background: var(--sheet-field);
    color: var(--sheet-text);
    border: 1px solid var(--sheet-border);
    border-radius: 6px;
    padding: 2px 6px;
    cursor: pointer;
}

.place-editor .note-preview {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--sheet-secondary);
}

.add-place.on {
    --color: var(--highlight) !important;
}

.map-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-footer .hint {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--label);
}

.map-footer .hint.highlight {
    color: var(--highlight);
}

/* MARK: city map */

.city-scene {
    flex: 1;
    min-height: 0;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.city-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
}

.city-status {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 14px;
    border-radius: 8px;
    background: rgb(0 0 0 / 0.6);
    color: var(--label);
}

dialog.city-sheet > .panel {
    height: min(720px, calc(100vh - 40px));
}

.map-header .hint {
    color: var(--label);
    font-size: 14px;
    text-transform: uppercase;
}

/* MARK: printing */

#print-area {
    display: none;
}

@media print {
    body.printing,
    html {
        overflow: visible !important;
        height: auto !important;
        background: #fff !important;
    }

    body.printing > *:not(#print-area) {
        display: none !important;
    }

    body.printing #print-area {
        display: block;
        color: #000;
    }

    #print-area .notes-page {
        box-shadow: none;
        padding: 0;
    }

    .print-map img {
        width: 100%;
        display: block;
    }

    .printed-world {
        margin-top: 24px;
        font: 10pt var(--system-font);
        color: #000;
    }

    .printed-title {
        display: flex;
        align-items: baseline;
        gap: 16px;
        border-bottom: 1.5px solid #000;
        padding-bottom: 6px;
    }

    .printed-title h1 {
        margin: 0;
        font-size: 22pt;
    }

    .printed-title .system {
        font-size: 14pt;
        color: rgb(0 0 0 / 0.6);
    }

    .printed-title .uwp {
        font: 600 16pt ui-monospace, Menlo, monospace;
    }

    .printed-columns {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
        margin-top: 12px;
    }

    .printed-columns h2 {
        font-size: 12pt;
        text-transform: uppercase;
        border-bottom: 0.75px solid rgb(0 0 0 / 0.5);
        margin: 10px 0 4px;
    }

    .printed-row {
        display: flex;
        justify-content: space-between;
        gap: 8px;
    }

    .printed-row span {
        color: rgb(0 0 0 / 0.6);
    }
}

@media (max-width: 700px) {
    #route {
        top: 44px;
        max-height: 40vh;
    }

    #time {
        right: 10px;
    }
}

/* The side panel's filters, folded away under their heading */
.filters-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}
.filters-heading .section-header { flex: 1; }
.filters-heading .filters-on {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--highlight);
    white-space: nowrap;
}
.filters-heading .chevron {
    display: inline-flex;
    color: var(--label);
    transition: transform 0.2s ease;
}
.filters-heading.expanded .chevron { transform: rotate(90deg); }
.filters { display: flex; flex-direction: column; gap: 6px; }
.zone-picker.suggested .data-label { text-transform: uppercase; font-size: 12px; }

/* The weather map over the globe, when one is drawn */
.resolution-menu.globe-weather.on {
    background: var(--highlight);
}

/* A globe pin with the weather where it stands */
.globe-pin-label.weather {
    border-radius: 7px;
    padding: 4px 7px;
    text-align: left;
    line-height: 1.3;
}
.globe-pin-label.weather .coordinates { font-variant-numeric: tabular-nums; }
.globe-pin-label.weather .terrain { font-size: 11px; opacity: 0.8; }
.globe-pin-label.weather .conditions { font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; }

/* The weather sheet: the weather map over the world's surface, its legend and summary */
dialog.themed-sheet.weather-sheet {
    height: min(760px, calc(100vh - 24px));
}
.weather-map-holder {
    flex: 1;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.weather-map {
    position: relative;
    background: rgb(20 20 20);
    border-radius: 4px;
    overflow: hidden;
}
.weather-map canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.weather-ground {
    filter: saturate(0.45) brightness(0.88);
}
.weather-storms {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.weather-storm {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #fff;
    font: 600 10px var(--system-font);
    white-space: nowrap;
}
.weather-storm svg {
    width: 14px;
    height: 14px;
    filter: drop-shadow(0 0 1.5px #000);
}
.weather-storm span {
    padding: 0 4px;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.6);
}
.weather-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--label);
}
.weather-legend .swatch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.weather-legend .swatch i {
    width: 14px;
    height: 10px;
    border-radius: 2px;
}
.weather-legend .gradient {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.weather-legend .gradient i {
    width: 220px;
    height: 10px;
    border-radius: 2px;
}
.weather-legend .numeric,
.weather-summary .storm-line {
    font-variant-numeric: tabular-nums;
}
.weather-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-top: 8px;
}
.weather-summary .column {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 180px;
}
.weather-summary .storm-line {
    font-size: 12px;
    color: var(--primary);
}
.styled-button.dimmed {
    opacity: 0.5;
}

/* A suggested advisory: its button keeps its whole label, and goes under the suggestion if they don't fit */
.zone-picker.suggested {
    flex-wrap: wrap;
}
.zone-picker > .styled-button {
    flex-shrink: 0;
}

/* The Settle button's options: the world's city style, and placing its settlements */
.settle-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: max-content;
    min-width: 340px;
    max-width: min(460px, calc(100vw - 48px));
    padding: 4px;
}
/* Pickers keep their whole choice, in any language */
.settle-options .field select {
    flex-shrink: 0;
}
.settle-options .heading {
    font-weight: 600;
}
.settle-options .field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.settle-options .footnote {
    font-size: 11px;
    opacity: 0.7;
}
.settle-options .row.end {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* The city map's details each stay whole, in any language; when they and the buttons don't fit, the buttons wrap */
.city-sheet .map-header > .hint {
    white-space: nowrap;
}
.city-sheet .map-header > .styled-button,
.city-sheet .map-header > .name {
    flex-shrink: 0;
}

/* The map type chooser, shown at startup */
#chooser {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(3 4 10 / 0.92);
    color: #fff;
}
#chooser .chooser-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 40px 16px;
    text-align: center;
}
#chooser h1 {
    margin: 0;
    font: 600 32px var(--system-font);
}
#chooser .cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}
#chooser .kind-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 240px;
    min-height: 210px;
    padding: 18px 14px;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: 14px;
    background: rgb(255 255 255 / 0.06);
    color: inherit;
    font: 14px var(--system-font);
    cursor: pointer;
}
#chooser .kind-card.last {
    background: rgb(255 255 255 / 0.14);
    border-color: rgb(255 255 255 / 0.3);
}
#chooser .kind-card:hover {
    background: rgb(255 255 255 / 0.18);
}
#chooser .kind-card svg {
    width: 44px;
    height: 44px;
}
#chooser .kind-card strong {
    font-size: 18px;
}
#chooser .kind-card .summary,
#chooser .kind-card .count,
#chooser .footnote {
    color: rgb(255 255 255 / 0.65);
}
#chooser .kind-card .count {
    font-size: 12px;
}

/* A hex universe's chart, over the star field */
.hex-chart {
    position: fixed;
    inset: 0;
    z-index: 2;
    background: rgb(5 5 13);
}
.hex-chart[hidden] {
    display: none;
}
.hex-chart-canvas {
    position: absolute;
    inset: 0;
    touch-action: none;
    cursor: grab;
}
.hex-chart-canvas:active {
    cursor: grabbing;
}
.hex-chart-controls {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-width: calc(100vw - 380px);
    padding: 8px;
    border-radius: 10px;
    background: rgb(20 22 32 / 0.85);
    backdrop-filter: blur(8px);
}
.hex-chart-controls .credit {
    margin-left: 6px;
    font-size: 11px;
    color: rgb(255 255 255 / 0.55);
}
.hex-chart-banner {
    position: absolute;
    top: 52px;
    left: 0;
    right: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.hex-chart-banner .notice {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 620px;
    width: calc(100% - 24px);
    padding: 10px;
    border-radius: 10px;
    background: rgb(30 32 44 / 0.95);
    color: #fff;
    font: 13px var(--system-font);
}
.hex-chart-banner .notice.small {
    width: auto;
}
.hex-chart-banner .notice svg {
    width: 18px;
    height: 18px;
    flex: none;
}
.hex-chart-banner .notice .text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hex-chart-banner .notice .text span {
    font-size: 11px;
    opacity: 0.7;
}
.hex-chart-banner .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgb(255 255 255 / 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* What TravellerMap lists for a world, in the side panel */
.traveller-world {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 4px;
}
.traveller-world .title-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.traveller-world .name {
    color: var(--highlight);
    font-weight: 600;
}
.traveller-world .uwp {
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, monospace;
}
.traveller-world .where {
    font-size: 11px;
    color: var(--label);
    opacity: 0.8;
}
.traveller-row {
    display: flex;
    gap: 8px;
    font-size: 11px;
}
.traveller-row .label {
    flex: none;
    width: 80px;
    color: var(--label);
    opacity: 0.7;
}
.traveller-row .value {
    color: var(--primary);
    user-select: text;
    overflow-wrap: anywhere;
}
.traveller-world .button-row {
    flex-wrap: wrap;
    margin-top: 4px;
}

/* The Traveller sheets: sectors to pick, versions and changes */
.traveller-sheet .sheet-body,
dialog.traveller-sheet > form {
    width: min(520px, calc(100vw - 32px));
}
.sector-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sector-list,
.traveller-list {
    height: min(300px, 40vh);
    overflow: auto;
    border: 1px solid rgb(128 128 128 / 0.3);
    border-radius: 6px;
}
.sector-list .sector {
    display: flex;
    gap: 8px;
    width: 100%;
    padding: 4px 8px;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.sector-list .sector.selected {
    background: Highlight;
    color: HighlightText;
}
.sector-list .coords {
    width: 60px;
    text-align: right;
}
.sector-list .loading,
.sector-list .load-error {
    padding: 16px;
    text-align: center;
}
.traveller-list .item {
    padding: 6px 8px;
    border-bottom: 1px solid rgb(128 128 128 / 0.15);
}
.traveller-list .item.row,
.traveller-list .item .row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.traveller-list .field-change {
    font: 11px ui-monospace, monospace;
    opacity: 0.7;
}
.traveller-list .kind.added { color: rgb(52 199 89); }
.traveller-list .kind.removed { color: rgb(255 69 58); }
.traveller-list .kind.changed { color: rgb(255 159 10); }
dialog.new-traveller progress {
    width: 100%;
}
dialog.world-map .world-map-image {
    display: block;
    max-width: min(1100px, calc(100vw - 80px));
    max-height: min(700px, calc(100vh - 200px));
    margin: 0 auto;
}
dialog.world-map .sheet-body {
    width: auto;
}

/* An export being drawn over the surface map */
.map-exporting {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: 10px;
    background: rgb(30 32 44 / 0.92);
    color: #fff;
    font: 13px var(--system-font);
}
.map-exporting[hidden] {
    display: none;
}
.map-exporting .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgb(255 255 255 / 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* A phone held sideways: the time controls and the resolving status keep clear of the side panel */
@media (min-width: 701px) and (max-height: 500px) {
    #time {
        bottom: calc(8px + env(safe-area-inset-bottom));
        left: calc(10px + env(safe-area-inset-left));
        justify-content: flex-start;
    }

    #time > * {
        zoom: 0.78;
    }

    .resolving-status {
        left: calc((100vw - 360px) / 2);
        top: 68px;
        zoom: 0.85;
    }
}

/* A phone held upright: the time controls fit its width, with the resolving status below them */
@media (max-width: 700px) {
    #time {
        left: 8px;
        right: 8px;
        justify-content: center;
    }

    #time > * {
        zoom: 0.8;
    }

    .resolving-status {
        top: 128px;
        zoom: 0.85;
    }
}

/* Ores, gemstones and crystals on the surface map */
.map-deposits {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.deposit-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgb(0 0 0 / 0.55);
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0 3px;
    min-width: 14px;
    font: 700 8px/12px var(--system-font);
    text-align: center;
    cursor: pointer;
    pointer-events: auto;
    white-space: nowrap;
}

.deposit-marker.gem,
.deposit-marker.crystal {
    border: none;
    background: none;
    font-size: 12px;
    text-shadow: 0 0 2px #000, 0 0 4px #000;
}

.deposit-marker.crystal {
    font-size: 14px;
    filter: drop-shadow(0 0 3px currentColor);
}

.deposit-marker.size-0 { opacity: 0.75; transform: translate(-50%, -50%) scale(0.85); }
.deposit-marker.size-2 { transform: translate(-50%, -50%) scale(1.2); }
.deposit-marker.size-3 { transform: translate(-50%, -50%) scale(1.45); box-shadow: 0 0 6px currentColor; }

.deposit-legend {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 240px;
    max-height: 60vh;
    overflow-y: auto;
}

.deposit-legend .heading {
    margin-top: 6px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.8;
}

.deposit-legend .row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.deposit-legend .spacer {
    flex: 1;
}

.deposit-symbol {
    display: inline-block;
    min-width: 30px;
    font-weight: 700;
    text-align: center;
}

.deposit-info {
    max-width: 280px;
}

.deposit-info .title-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.deposit-info p {
    margin: 6px 0;
}
