/* ========================================
   Aniimax - Minimalist Production Optimizer
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0e1013;
    --surface: #16191e;
    --surface-2: #1e2229;
    --text: #e9eaec;
    --text-muted: #9aa0a8;
    --border: #2a2f37;
    --accent: #6cc5a4;
    --on-accent: #0e1013;
    --success: #6cc5a4;
    --error: #ef6b68;
    --warning: #f0b35a;
    --radius: 12px;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Courier New", Courier, monospace;
}

.light {
    --bg: #f5f4ef;
    --surface: #ffffff;
    --surface-2: #f0eee8;
    --text: #1d1f22;
    --text-muted: #666a70;
    --border: #e2dfd7;
    --accent: #2e7d65;
    --on-accent: #ffffff;
    --success: #2e7d65;
    --error: #c62828;
    --warning: #b8660b;
}

body {
    accent-color: var(--accent);
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.55;
    max-width: 880px;
    margin: 2.5rem auto;
    padding: 0 1rem;
    transition: background-color 0.3s, color 0.3s;
    font-variant-numeric: tabular-nums;
}

a {
    color: inherit;
    text-decoration: underline;
}

a:hover {
    color: inherit;
}

/* Header */
header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

header h1 {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: normal;
    letter-spacing: -0.02em;
}

.header-buttons {
    display: flex;
    gap: 1rem;
}

.toggle-button {
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: normal;
    text-decoration: underline;
}

.toggle-button:hover {
    opacity: 0.7;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.disclaimer {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    margin-bottom: 2rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
}

/* Typography */
h2 {
    font-size: 1.2rem;
    font-weight: normal;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1rem;
    font-weight: normal;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.hint.small {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Sections */
.config-section,
.results-section {
    margin-bottom: 2rem;
}

/* Input Fields */
.config-group {
    margin-bottom: 1.5rem;
}

.input-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.input-field {
    flex: 1;
}

.input-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.input-field input,
.input-field select {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.input-field input:focus,
.input-field select:focus {
    outline: none;
    border-color: var(--text);
}

.input-field input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.input-field input[type="number"]::-webkit-outer-spin-button,
.input-field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-field select {
    cursor: pointer;
}

/* Checkbox Field */
.checkbox-field {
    display: flex;
    align-items: center;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-field input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Radio Group (currency selector) */
.radio-group {
    display: flex;
    gap: 1.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.radio-group input[type="radio"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Facilities Grid */
.facilities-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.facility-category-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.facilities-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.facility-card {
    border: 1px solid var(--border);
    padding: 1rem;
}

.facility-card h4 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

/* Info icon and tooltip styles */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: 0.65rem;
    font-weight: bold;
    border: 1px solid var(--text-muted);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: help;
    margin-left: 0.25rem;
    vertical-align: middle;
    position: relative;
}

.info-icon:hover {
    border-color: var(--text);
    color: var(--text);
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: normal;
    white-space: pre-line;
    border: 1px solid var(--border);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    margin-bottom: 0.5rem;
    min-width: 180px;
    max-width: 280px;
    text-align: left;
    line-height: 1.4;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

.facility-tiers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.facility-inputs {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.facility-inputs .input-field {
    flex: 1;
}

.facility-inputs .input-field label {
    font-size: 0.7rem;
}

.facility-inputs input {
    padding: 0.4rem;
    font-size: 0.85rem;
}

/* Simple / advanced input mode switch. */
.mode-switch {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
}

.mode-switch label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* One owned tier's remove button, sitting inline at the end of its Count/Level row. */
.tier-remove-btn {
    cursor: pointer;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.4rem 0.6rem;
}

.tier-remove-btn:hover {
    color: var(--text);
    border-color: var(--text);
}

/* Adds one more owned tier (e.g. "+ Add level") below a facility's tier rows. */
.add-tier-btn {
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: 0.75rem;
    text-decoration: underline;
    padding: 0;
    margin-top: 0.5rem;
    align-self: flex-start;
}

.add-tier-btn:hover {
    opacity: 0.7;
}

/* Modules Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.module-card {
    border: 1px solid var(--border);
    padding: 1rem;
}

.module-card h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.module-card .input-field {
    max-width: 100px;
}

.module-card .input-field label {
    font-size: 0.7rem;
}

.module-card input {
    padding: 0.4rem;
    font-size: 0.85rem;
}

/* Optimize Button */
.optimize-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.optimize-btn:hover {
    opacity: 0.8;
}

.optimize-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Progress bar shown while find_plan runs in the worker (see worker.js); fill width is driven by
   the solver's own real trial-solve count (see `trialCountToPercent` in app.js), not a decorative
   animation, so it actually reflects work happening. */
.progress-bar-container {
    width: 100%;
    height: 4px;
    margin-top: 0.6rem;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: width 0.15s ease-out;
}

/* Error Message */
.error-message {
    border: 1px solid var(--error);
    color: var(--error);
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Results Summary */
.result-summary {
    margin-bottom: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.summary-item {
    border: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--success);
}

.rate-unit-select {
    margin-top: 0.5rem;
    padding: 0.2rem 0.4rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.rate-unit-select:focus {
    outline: none;
    border-color: var(--text);
}

/* Byproduct bonus rows, appended to the bottom of the Product Breakdown table */
#product-breakdown-table tbody tr.byproduct-row {
    color: var(--warning);
    font-style: italic;
}

#product-breakdown-table tbody tr.byproduct-row td {
    border-top: 1px dashed var(--warning);
}

/* Production Steps */
.production-steps {
    margin-bottom: 1.5rem;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.energy-info {
    border: 1px solid var(--success);
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--success);
    font-size: 0.85rem;
}

.energy-info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.parallel-info {
    border: 1px solid #9f7aea;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #9f7aea;
    font-size: 0.85rem;
}

.parallel-info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.step-item {
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.step-number {
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.step-number.energy-step {
    border-color: var(--warning);
    color: var(--warning);
}

.step-number.profit-step {
    border-color: var(--success);
    color: var(--success);
}

.step-number.parallel-step {
    border-color: #9f7aea;
    color: #9f7aea;
    font-weight: bold;
}

/* Chain Groups for Parallel Mode */
.chain-group {
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    background: var(--bg-lighter);
}

.chain-header {
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chain-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chain-number {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    color: white;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.chain-path {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.chain-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chain-step {
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-lighter);
}

.chain-step:last-child {
    border-bottom: none;
}

.step-indicator {
    width: 1.5rem;
    color: #9f7aea;
    font-weight: bold;
    flex-shrink: 0;
    text-align: center;
}

.step-details {
    flex: 1;
}

.step-name {
    font-size: 0.9rem;
}

.step-facility {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.step-allocation {
    font-size: 0.75rem;
    color: #9f7aea;
    margin-top: 0.25rem;
    font-style: italic;
}

.step-meta {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Options Table */
.all-options {
    margin-bottom: 1rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th,
td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr:first-child {
    background: transparent;
}

tbody tr:first-child td {
    color: var(--success);
    font-weight: bold;
}

/* Facility plan tables (one per category, see renderFacilityPlan in app.js): status reflects
   role (producing/idle/not needed), not row position, overriding the generic "highlight first
   row" rule above so it doesn't imply the first facility listed is special. */
.facility-plan-table tbody tr:first-child td {
    color: inherit;
    font-weight: normal;
}

.facility-plan-table tbody tr.status-not_needed td,
.facility-plan-table tbody tr.status-nothing_available td,
.facility-plan-table tbody tr.status-idle td {
    color: var(--text-muted);
}

/* Environment building layout diagram (see renderEnvironmentDiagram in app.js): a simple SVG
   showing the solver's own chosen facility placements around one building instance, next to that
   instance's table. */
.env-unit {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.env-unit-table {
    flex: 1 1 320px;
    min-width: 0;
}

.env-diagram {
    flex: 0 0 auto;
    color: var(--text-muted);
}

/* The diagram's frame only: its icons are <svg> elements too, and Firefox sizes a nested <svg>
   by these rules (blurred or missing icons). */
.env-diagram > svg {
    display: block;
    width: 280px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* Whole-tile lines, a heavier major line every other tile, and faint quarter-tile lines. */
.env-grid line {
    stroke: currentColor;
    stroke-opacity: 0.2;
    stroke-width: 0.035;
}

.env-grid line.major {
    stroke-opacity: 0.38;
    stroke-width: 0.08;
}

.env-grid line.quarter {
    stroke-opacity: 0.05;
    stroke-width: 0.02;
}

.env-plot text {
    fill: #111;
    font-family: var(--font-body);
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.environment-map-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem 1.2rem;
    margin: 0.75rem 0 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.environment-map-toggle,
.environment-map-parcels {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.environment-map-toggle {
    font-weight: 650;
}

.environment-map-toggle input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--accent, #5b8def);
}

.environment-map-parcels[hidden],
.whole-environment-map[hidden] {
    display: none;
}

.environment-map-parcels input {
    width: 5rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

.environment-map-parcels span,
.environment-map-caption {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.environment-map-caption {
    margin: 0.3rem 0 0.6rem;
}

.environment-map-warning {
    margin: 0.5rem 0;
    padding: 0.65rem 0.8rem;
    border: 1px solid #d97706;
    border-radius: 8px;
    background: color-mix(in srgb, #d97706 12%, var(--surface));
    color: var(--text);
}

.environment-map-scroll {
    max-width: 100%;
    max-height: 75vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.environment-map {
    display: block;
    width: 100%;
    height: auto;
    min-width: min(100%, 620px);
}

/* Lines a fixed width on screen, sharp at any zoom; the half and quarter tiles only once zoomed in
   enough (`grid-halves`, `grid-quarters`, see app.js's `updateMapGrid`). */
.world-grid path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
    shape-rendering: crispEdges;
}

.world-grid .grid-tile { stroke-opacity: 0.2; }
.world-grid .grid-half { stroke-opacity: 0.1; display: none; }
.world-grid .grid-quarter { stroke-opacity: 0.06; display: none; }
.map-frame.grid-halves .world-grid .grid-half,
.map-frame.grid-quarters .world-grid .grid-quarter { display: inline; }

.world-parcel {
    /* Drawn over the buildings: let the pointer through to them (names on hover). */
    pointer-events: none;
    fill: transparent;
    stroke: currentColor;
    stroke-opacity: 0.72;
    /* As thick at any zoom, like the grid. */
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
}

.world-parcel-label,
.world-module-label {
    fill: currentColor;
    font-family: var(--font-body);
    font-size: 0.62px;
    paint-order: stroke;
    stroke: var(--surface-2);
    stroke-width: 0.1px;
    stroke-linejoin: round;
    pointer-events: none;
}

.world-facility-icon {
    pointer-events: none;
}

.world-facility-icon:not(svg) {
    filter: drop-shadow(0 0 0.08px #111);
}

.environment-map-legend {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.environment-map-legend summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 600;
}

.environment-map-legend ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.4rem 1rem;
    padding: 0.65rem 0 0;
    margin: 0;
    list-style: none;
}

.environment-map-legend li {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.map-legend-visual .game-entity {
    display: block;
}

.map-legend-visual .game-entity > span:not(.game-icon) {
    display: none;
}

.map-legend-visual .game-icon {
    display: block;
    width: 1.8rem;
    height: 1.8rem;
}

.map-legend-visual > img {
    display: block;
    width: 1.8rem;
    height: 1.8rem;
    object-fit: contain;
}

.environment-map-legend li small {
    white-space: nowrap;
}

.whole-map-active .env-diagram {
    display: none;
}

.env-plot-icon,
.env-building-icon,
.env-icon-badge {
    pointer-events: none;
}

.env-plot-icon {
    opacity: 1;
}

.env-building-icon {
    opacity: 1;
}

.env-icon-badge {
    stroke: #fff;
    stroke-opacity: 0.82;
    stroke-width: 0.055;
}

.env-plot:hover rect {
    fill-opacity: 1;
    stroke: currentColor;
}

.env-legend {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.5rem;
    max-width: 280px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.env-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.env-legend-swatch {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 3px;
}

.env-legend-swatch.coverage {
    border: 1px dashed;
}

.env-note {
    max-width: 280px;
    margin: 0.4rem 0 0;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Recipe reference tables (facility recipe modal): one table per facility, listed row order
   reflects level/name sort, not importance, same override as the facility-plan table above. */
.recipe-table tbody tr:first-child td {
    color: inherit;
    font-weight: normal;
}

.facility-recipe-table {
    margin-bottom: 1.5rem;
}

.facility-recipe-table h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Loading State */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        margin: 2rem auto;
        padding: 0 1rem;
    }

    header {
        flex-direction: column;
        gap: 0.5rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .toggle-button {
        align-self: flex-end;
    }

    .input-row {
        flex-direction: column;
        gap: 1rem;
    }

    .facilities-grid {
        grid-template-columns: 1fr;
    }

    .modules-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .step-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .step-meta {
        text-align: left;
    }

    th,
    td {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.modal-content {
    background-color: var(--bg);
    border: 1px solid var(--border);
    max-width: 600px;
    width: 100%;
    margin: 2rem auto;
}

.modal-content.wide {
    max-width: 1100px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

.close-button {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-button:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.modal-body ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.modal-body li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.modal-body li strong {
    color: var(--text);
}

.modal-wide {
    max-width: 750px;
}

.math-block {
    background: rgba(128, 128, 128, 0.1);
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    border-left: 2px solid var(--border);
}

.modal-body h4 {
    font-size: 0.9rem;
    font-weight: bold;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.modal-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.modal-body ol li {
    margin-bottom: 0.75rem;
}

.modal-body ol li ul {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.math-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.85rem;
}

.math-table th,
.math-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}

.math-table th {
    background: rgba(128, 128, 128, 0.1);
    font-weight: bold;
}

/* ========================================
   Cards, tabs and badges
   ======================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 1.5rem;
    margin-bottom: 1.25rem;
}

.card h2 {
    margin: 0 0 0.75rem;
    padding: 0;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
}

.card h3 {
    font-weight: 600;
    margin-top: 1.25rem;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.card-head h2 {
    margin: 0;
}

.card-lead {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.toggle-button.small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.subtitle {
    margin-top: -1.5rem;
}

.disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-style: normal;
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 45%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--warning) 9%, var(--surface));
    margin-bottom: 1.5rem;
}

.disclaimer-icon {
    font-size: 0.95rem;
    line-height: 1.2;
}

/* Segmented tabs built from radio labels. */
.tabs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: 1.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.tabs label {
    position: relative;
    padding: 0.4rem 1.1rem;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s, color 0.15s;
}

.tabs label:hover {
    color: var(--text);
}

.tabs input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tabs label:has(input:checked) {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.tabs label:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.tabs.compact {
    margin-bottom: 0;
}

.tabs.compact label {
    padding: 0.3rem 0.85rem;
    font-size: 0.85rem;
}

/* Inputs */
.input-field input,
.input-field select {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
}

.input-field input:focus,
.input-field select:focus {
    border-color: var(--accent);
}

#simple-config .input-field {
    max-width: 16rem;
}

/* Simple mode: what the RV level assumes, as a grid of chips. */
.assume-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1rem 0 0.5rem;
}

.chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.4rem;
}

.chip {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0.65rem;
    background: var(--surface-2);
    border-radius: 8px;
    font-size: 0.82rem;
}

.chip-count {
    font-weight: 600;
}

.chip-level {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Options and the main button */
.option-row {
    gap: 0.4rem;
    margin: 1.5rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.optimize-btn {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.progress-bar-container {
    position: relative;
}

/* The exact planner doesn't report progress, so the bar just shows it's working. */
.progress-bar-fill.indeterminate {
    position: absolute;
    width: 35%;
    background: var(--accent);
    animation: progress-slide 1.1s ease-in-out infinite;
}

@keyframes progress-slide {
    from { left: -35%; }
    to { left: 100%; }
}

/* Results: the rate */
#rate-block .summary-label {
    margin-bottom: 0.1rem;
}

.rate-line {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.rate-line .summary-value {
    display: inline;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.rate-unit-select {
    margin-top: 0;
    border-radius: 6px;
    background: var(--surface-2);
}

.plan-proof {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.plan-unverified {
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
    color: var(--warning);
}

.tag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: 1px;
}

.tag.unverified {
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* Collapsible explanations */
details.explain {
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

details.explain summary {
    cursor: pointer;
    width: fit-content;
    user-select: none;
}

details.explain summary:hover {
    color: var(--text);
}

details.explain p {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
}

/* Tables */
.card table {
    font-size: 0.85rem;
}

.card th,
.card td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.55rem 0.6rem;
}

.card th {
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.7rem;
}

.card tbody tr:last-child td {
    border-bottom: none;
}

.card tbody tr:first-child td {
    color: inherit;
    font-weight: normal;
}

.facility-category-title {
    font-weight: 600;
    border-bottom: none;
    padding-bottom: 0;
}

.facility-card,
.module-card {
    background: var(--surface-2);
    border: none;
    border-radius: 10px;
}

.summary-item {
    border-radius: 10px;
    background: var(--surface-2);
    border: none;
}

#goal-section .summary-value {
    color: var(--text);
}

.error-message {
    border-color: var(--error);
}

/* Inputs inside the Advanced tab's facility and module cards. */
.facility-card .input-field input,
.module-card .input-field input {
    background: var(--surface);
}

@media (max-width: 600px) {
    .card {
        padding: 1rem;
    }

    /* Plan tables become one labelled block per row on narrow screens. */
    .facility-plan-table thead {
        display: none;
    }

    .facility-plan-table tr {
        display: block;
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--border);
    }

    .facility-plan-table tbody tr:last-child {
        border-bottom: none;
    }

    .card .facility-plan-table td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.15rem 0;
        border: none;
        text-align: right;
    }

    .facility-plan-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.75rem;
        text-align: left;
        white-space: nowrap;
    }

    .rate-line .summary-value,
    .level-up-card .summary-value {
        font-size: 1.6rem;
    }

    .chip-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Aniimo team card: collapsed to a one-line summary until opened. */
.collapse-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.collapse-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.collapse-toggle .chevron {
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.15s;
}

.collapse-toggle[aria-expanded="true"] .chevron {
    transform: rotate(45deg);
}

.collapse-toggle:hover h2 {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.aniimo-card .card-head {
    margin-bottom: 0.35rem;
}

.collapsed-summary {
    margin: 0 0 0 1.05rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#aniimo-body {
    margin-top: 1rem;
}

/* Aniimo abilities in their in-game colors. */
.ability {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--ability);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.ability.dark {
    color: #1d1f22;
}

/* How many of each ability a plan needs, like the game's Abilities screen. */
.ability-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 1rem 0.35rem;
    margin: 0.85rem 0 0;
}

@media (min-width: 720px) {
    .ability-strip {
        grid-template-columns: repeat(13, minmax(0, 1fr));
        gap: 0.3rem;
    }
}

.ability-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.4rem 0.2rem 0.35rem;
    border-radius: 8px;
    background: var(--surface-2);
    border-top: 3px solid var(--ability);
}

.ability-count {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ability);
}

.ability-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.ability-cell.zero {
    opacity: 0.35;
    border-top-color: var(--border);
}

.ability-cell.zero .ability-count {
    color: var(--text-muted);
}

/* The facility plan's Aniimo column: one colored circle per ability, level inside. */
.ability-dots {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    vertical-align: middle;
}

.ability-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--ability);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: help;
}

.ability-dot.dark {
    color: #1d1f22;
}

/* A ring marks an Aniimo that has the facility's personality bonus. */
.ability-dot.bonus {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ability);
}

/* The Aniimo behind each ability count, one circle each. */
/* One column per ability: its box, then its Aniimo circles below it. */
.ability-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.ability-col .ability-cell {
    width: 100%;
}

.ability-stack {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.ability-kind {
    position: relative;
    display: inline-flex;
}

/* Beside the circle without shifting it, so circles line up in their column. */
.ability-times {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.15rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.ability-dot.small {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.65rem;
}

.ability-dot.small.bonus {
    box-shadow: 0 0 0 1.5px var(--surface-2), 0 0 0 2.75px var(--ability);
}

/* Strategy: level up or most coins. */
.strategy {
    margin: 1.5rem 0 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.strategy h3 {
    margin-bottom: 0.6rem;
}

#level-up-config .input-field {
    max-width: 16rem;
}

#level-up-cost .chip-grid {
    margin-bottom: 0.75rem;
}

.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem 1rem;
    margin-top: 0.6rem;
}

#level-up-config .stock-grid .input-field {
    max-width: none;
}

.level-up-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0;
}

/* Results: how soon the level-up is covered. */
.level-up-card .summary-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.level-up-lines {
    width: 100%;
    margin-top: 0.75rem;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.level-up-lines th {
    text-align: left;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem 0.3rem 0;
}

.level-up-lines td {
    padding: 0.35rem 0.5rem 0.35rem 0;
    border-top: 1px solid var(--border);
}

/* The unit select, as the rate column's header. */
.level-up-lines th .rate-unit-select {
    font-size: 0.75rem;
    padding: 0.15rem 0.3rem;
}

/* A level-up that couldn't be planned: the coin rate follows its note. */
.level-up-card .level-up-note {
    margin-bottom: 1rem;
}

.level-up-lines .slowest td,
.rate-table .top td {
    font-weight: 600;
}

.level-up-coins {
    margin: 0.85rem 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.level-up-coins strong {
    color: var(--text);
}

/* Popups use more of a phone's width. */
@media (max-width: 600px) {
    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        margin: 0.5rem auto;
    }

    .modal-body {
        padding: 1rem;
    }

    .math-block {
        padding: 0.75rem 0.4rem;
    }
}

/* Crop and tree jobs in the recipe list: "Sowing [Grass]". */
.job-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.job {
    white-space: nowrap;
}

.job-step {
    display: inline-block;
    min-width: 5.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.recipe-best {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Recipe tables become one labelled block per recipe on phones. */
@media (max-width: 600px) {
    .recipe-table thead {
        display: none;
    }

    .recipe-table tr {
        display: block;
        padding: 0.6rem 0.75rem;
        border-bottom: 1px solid var(--border);
    }

    .recipe-table td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: 0.12rem 0;
        border: none;
        text-align: right;
    }

    .recipe-table td.recipe-name {
        justify-content: flex-start;
        gap: 0;
        font-weight: 600;
        text-align: left;
        padding-bottom: 0.3rem;
    }

    /* The "not checked" tooltip hangs from the name cell, not the icon, so a long name can't
       push it past the edge. */
    .recipe-table td.recipe-name {
        position: relative;
    }

    .recipe-table td.recipe-name .info-icon {
        position: static;
    }

    .recipe-table td.recipe-name [data-tooltip]::after {
        left: 0;
        transform: none;
    }

    .recipe-table td.empty {
        display: none;
    }

    .recipe-table td[data-label]::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.75rem;
        text-align: left;
        white-space: nowrap;
    }

    .recipe-table .job-list {
        align-items: flex-end;
    }

    .recipe-table .recipe-best {
        text-align: right;
    }
}

/* Table header tooltips open downward (a scrolling table would clip them above), and the last
   column's stays inside the table's right edge. */
.table-wrapper th [data-tooltip]::after {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 0.5rem;
    text-transform: none;
    letter-spacing: normal;
}

.table-wrapper th:last-child [data-tooltip]::after {
    left: auto;
    right: 0;
    transform: none;
}

/* Time and Sell stay on one line; Inputs wraps instead. */
.recipe-table td:nth-child(5),
.recipe-table td:nth-child(6) {
    white-space: nowrap;
}

/* Recipes: special recipes and recipes to skip */
.recipes-section {
    margin: 0 0 1.25rem;
}

.recipes-section .assume-title:first-of-type {
    margin-top: 0.75rem;
}

.skip-count {
    color: var(--text-muted);
}

.skip-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
    max-width: 28rem;
}

.skip-add input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

.skip-add input:focus {
    outline: none;
    border-color: var(--accent);
}

.skip-add-btn {
    padding: 0.5rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.skip-add-btn:hover {
    border-color: var(--accent);
}

.skip-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.skip-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.3rem 0.25rem 0.65rem;
    background: var(--surface-2);
    border-radius: 999px;
    font-size: 0.82rem;
}

.skip-chip-facility {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.skip-chip button,
.skip-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
}

.skip-chip button:hover,
.skip-row:hover {
    background: var(--border);
    color: var(--text);
}

.skip-row {
    margin-left: 0.3rem;
    vertical-align: middle;
    opacity: 0.55;
}

tr:hover .skip-row,
.skip-row:focus-visible {
    opacity: 1;
}

.plan-skipped {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Special recipes: one checkbox each. */
.special-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.4rem 1rem;
    margin-top: 0.6rem;
}

.special-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.tag.special {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    margin-left: 0.35rem;
}

/* "Fill from RV level" in advanced mode. */
.fill-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 1.25rem;
}

.fill-row label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.fill-row select {
    padding: 0.4rem 0.6rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
}

.fill-row .hint {
    flex-basis: 100%;
    margin: 0;
}

/* Seeds a plan plants, in their own card. */
.seed-table {
    margin-top: 0.5rem;
}

.seed-table table {
    width: 100%;
    max-width: 32rem;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.seed-table th {
    text-align: left;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem 0.2rem 0;
}

.seed-table td {
    padding: 0.25rem 0.5rem 0.25rem 0;
    border-top: 1px solid var(--border);
}

.seed-table tfoot td {
    font-weight: 600;
}

/* Priorities: a ranked, draggable list. */
.priority-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    max-width: 26rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.priority {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: grab;
}

.priority.off .priority-name,
.priority.off .drag-handle {
    opacity: 0.55;
}

.priority.dragging {
    opacity: 0.4;
}

.priority.drop-target {
    border-color: var(--accent);
}

.priority-name {
    flex: 1;
}

/* On/off switch: a real checkbox, drawn as a sliding switch. */
.priority-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.priority-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.switch-track {
    position: relative;
    width: 2.1rem;
    height: 1.2rem;
    border-radius: 999px;
    background: var(--border);
    transition: background 0.15s;
}

.switch-track::after {
    content: '';
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.15s, background 0.15s;
}

.priority-switch input:checked + .switch-track {
    background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.priority-switch input:checked + .switch-track::after {
    transform: translateX(0.9rem);
    background: var(--accent);
}

.priority-switch input:focus-visible + .switch-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.switch-text {
    min-width: 1.5rem;
}

.drag-handle {
    color: var(--text-muted);
    letter-spacing: -0.15em;
    user-select: none;
}

.priority-rank {
    min-width: 1rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
}

.priority-move {
    display: flex;
    gap: 0.2rem;
}

.priority-move button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
}

.priority-move button:disabled {
    opacity: 0.3;
    cursor: default;
}

.priority-move button:not(:disabled):hover {
    border-color: var(--accent);
}

/* The coverage tint drawn over the plots, so it shows which part of each is covered; it lets
   hovers through to the plots underneath. */
.env-coverage-top {
    pointer-events: none;
}

/* Simple mode's facility list, collapsed by default. */
.simple-details {
    margin-top: 0.75rem;
}
