/* ═══════════════════════════════════════════════════════════════
   main.css  —  Endless Sky Data Viewer
   Design tokens → shared utilities → component styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Design tokens ────────────────────────────────────────────── */
:root {
    --c-bg:          #0f172a;
    --c-bg-mid:      #1e3a8a;
    --c-surface:     rgba(15, 23, 42, 0.60);
    --c-surface-2:   rgba(30, 41, 59, 0.80);
    --c-surface-3:   rgba(30, 41, 59, 0.50);
    --c-border:      rgba(59, 130, 246, 0.30);
    --c-border-hi:   rgba(59, 130, 246, 0.45);
    --c-border-2:    rgba(100, 116, 139, 0.25);

    --c-accent:      #3b82f6;
    --c-accent-dark: #2563eb;
    --c-accent-text: #93c5fd;
    --c-text:        #e2e8f0;
    --c-text-mid:    #cbd5e1;
    --c-text-muted:  #94a3b8;
    --c-text-dim:    #64748b;

    --c-danger:      rgba(239, 68, 68, 0.20);
    --c-danger-hi:   #ef4444;
    --c-danger-text: #fca5a5;
    --c-success:     rgba(34, 197, 94, 0.20);
    --c-success-text:#86efac;
    --c-warn:        rgba(120, 90, 20, 0.20);
    --c-warn-text:   #fde68a;

    --r-sm:  6px;
    --r-md:  8px;
    --r-lg:  12px;
    --r-xl:  16px;

    --shadow-sm:  0 4px 16px rgba(0,0,0,.20);
    --shadow-md:  0 8px 32px rgba(0,0,0,.30);
    --shadow-lg:  0 16px 48px rgba(0,0,0,.50);

    --t-fast:  0.15s ease;
    --t-base:  0.30s ease;
}

/* ── Base ─────────────────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--c-bg) 0%, var(--c-bg-mid) 50%, var(--c-bg) 100%);
    min-height: 100vh;
    color: var(--c-text);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--c-text-mid);
    font-weight: 500;
}

/* ── Utility: visibility ──────────────────────────────────────── */
.hidden { display: none !important; }
.shown  { display: block; }

/* ── Utility: panel ──────────────────────────────────────────── */
.panel {
    background: var(--c-surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
}

/* ── Utility: section title ───────────────────────────────────── */
.section-title {
    color: var(--c-accent-text);
    font-size: 1.5rem;
    margin-bottom: 15px;
}

/* ── Utility: text-input ──────────────────────────────────────── */
.text-input {
    width: 100%;
    padding: 12px;
    background: var(--c-surface-2);
    border: 1px solid rgba(59, 130, 246, 0.40);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 1rem;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.text-input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.20);
}

/* ── Utility: buttons ─────────────────────────────────────────── */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--r-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-base), transform var(--t-base), box-shadow var(--t-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-dark));
    color: #fff;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--c-accent-dark), #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.40);
}

.btn-secondary {
    background: rgba(71, 85, 105, 0.80);
    color: #fff;
}
.btn-secondary:hover { background: rgba(71, 85, 105, 1); }

.btn-action {
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-dark));
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-base), transform var(--t-base), box-shadow var(--t-base);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-action:hover {
    background: linear-gradient(135deg, var(--c-accent-dark), #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.40);
}

.btn-close {
    background: none;
    border: none;
    color: var(--c-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    transition: background var(--t-fast), color var(--t-fast);
    line-height: 1;
}
.btn-close:hover {
    background: rgba(239, 68, 68, 0.20);
    color: var(--c-danger-hi);
}
.btn-close--lg { font-size: 2rem;   width: 40px; height: 40px; padding: 0; }
.btn-close--sm { font-size: 1.6rem; width: 32px; height: 32px; padding: 0; }

.btn-remove {
    background: var(--c-danger);
    color: var(--c-danger-text);
    border: 1px solid rgba(239, 68, 68, 0.30);
    border-radius: var(--r-sm);
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn-remove:hover {
    background: rgba(239, 68, 68, 0.30);
    border-color: var(--c-danger-hi);
    color: var(--c-danger-hi);
}

/* ── Utility: list row ────────────────────────────────────────── */
.list-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.40);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    flex-wrap: wrap;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.list-row:hover {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.40);
}
.list-row__label {
    flex: 1;
    font-size: 0.95rem;
    color: var(--c-text-mid);
    min-width: 120px;
}

/* ── Utility: overlay backdrop ────────────────────────────────── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.80);
    backdrop-filter: blur(5px);
    z-index: 1000;
    will-change: opacity;
}

.overlay.active{
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ── Utility: modal box ───────────────────────────────────────── */
.modal-box {
    background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.95));
    border: 2px solid rgba(59, 130, 246, 0.50);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    contain: layout style;
    will-change: transform;
}
.modal-box--detail {
    padding: 30px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.modal-box--picker {
    width: min(460px, 92vw);
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

/* ── Utility: picker ──────────────────────────────────────────── */
.picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
    background: rgba(15, 23, 42, 0.30);
}
.picker-row:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--c-border);
}
.picker-row input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--c-accent);
    width: 16px; height: 16px;
    flex-shrink: 0;
}
.picker-row label {
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--c-text-mid);
    flex: 1;
    margin-bottom: 0;
    user-select: none;
}

.picker-list {
    overflow-y: auto;
    flex: 1;
    padding: 0 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.picker-list::-webkit-scrollbar { width: 6px; }
.picker-list::-webkit-scrollbar-track  { background: rgba(15,23,42,0.40); border-radius: 3px; }
.picker-list::-webkit-scrollbar-thumb  { background: rgba(59,130,246,0.40); border-radius: 3px; }
.picker-list::-webkit-scrollbar-thumb:hover { background: rgba(59,130,246,0.70); }

.picker-footer {
    padding: 14px 20px;
    border-top: 2px solid var(--c-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 15px;
    border-bottom: 2px solid var(--c-border);
}
.picker-header__title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--c-accent-text);
}
.picker-search {
    margin: 12px 16px;
    width: calc(100% - 32px);
    box-sizing: border-box;   /* padding inside the width, so it doesn't poke past the panel */
}
.modal-box .picker-search.text-input { width: calc(100% - 32px); }

/* ── Layout ───────────────────────────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    padding: 30px;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    color: var(--c-accent-text);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--c-text-muted);
    font-size: 1.1rem;
}

/* ── Config section ───────────────────────────────────────────── */
.config-section { padding: 25px; margin-bottom: 30px; }
.config-section h2 { margin-bottom: 20px; }
.input-group { margin-bottom: 15px; }
.button-group { display: flex; gap: 10px; margin-top: 20px; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--c-border);
    padding-bottom: 10px;
}
.tab {
    padding: 10px 20px;
    background: rgba(30, 41, 59, 0.60);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md) var(--r-md) 0 0;
    cursor: pointer;
    transition: background var(--t-base), color var(--t-base);
    color: var(--c-text-muted);
}
.tab.active {
    background: rgba(59, 130, 246, 0.30);
    color: var(--c-accent-text);
    border-bottom-color: transparent;
}
.tab:hover { background: rgba(59, 130, 246, 0.20); }

/* ── Search / filter panel ────────────────────────────────────── */
.search-section { margin-bottom: 20px; }

.search-input {
    width: 100%;
    padding: 12px;
    background: var(--c-surface-2);
    border: 1px solid rgba(59, 130, 246, 0.40);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 1rem;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.20);
}

.internal-name {
    color: var(--c-text-muted);
    font-size: 0.9rem;
    font-style: italic;
    margin-top: -15px;
    padding-bottom: 5px;
}

/* ── Filter sub-sections ──────────────────────────────────────── */
.filter-section {
    background: var(--c-surface-3);
    padding: 20px;
    border-radius: var(--r-md);
    margin: 15px;
    border: 1px solid var(--c-border);
}
.filter-title,
.filter-title-no-margin {
    font-weight: 600;
    color: var(--c-accent-text);
    font-size: 1.1rem;
    cursor: pointer;
    user-select: none;
}
.filter-title        { margin-bottom: 20px; }
.filter-title-no-margin { margin-bottom: 0; }

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.40);
    padding: 8px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--c-border);
    transition: background var(--t-base), border-color var(--t-base);
}
.filter-option:hover {
    background: rgba(59, 130, 246, 0.20);
    border-color: var(--c-accent);
}
.filter-option input[type="checkbox"] {
    cursor: pointer;
    width: 18px; height: 18px;
    accent-color: var(--c-accent);
}
.filter-option label {
    cursor: pointer;
    user-select: none;
    text-transform: capitalize;
    color: var(--c-text-mid);
    font-size: 0.95rem;
    margin-bottom: 0;
}
.filter-clear {
    margin-top: 15px;
    background: rgba(71, 85, 105, 0.80);
    color: #fff;
}
.filter-clear:hover {
    background: rgba(71, 85, 105, 1);
    border-color: var(--c-accent);
    transform: translateY(-1px);
}

/* ── Sorter section ───────────────────────────────────────────── */
.sorter-section {
    background: var(--c-surface-3);
    padding: 20px;
    border-radius: var(--r-md);
    margin: 15px;
    border: 1px solid var(--c-border);
}
.sorter-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
#sorterActiveList,
#activePluginList {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sorter-empty {
    color: var(--c-text-muted);
    font-size: 0.9rem;
    font-style: italic;
}
.sorter-avg {
    font-size: 0.78rem;
    color: var(--c-text-muted);
    background: rgba(15, 23, 42, 0.60);
    border: 1px solid var(--c-border);
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ── Sorter picker overlay ────────────────────────────────────── */
#sorterPickerOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.80);
    backdrop-filter: blur(5px);
    z-index: 1000;
}
#sorterPickerOverlay.sorter-overlay-visible {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#sorterPickerSearch {
    margin: 12px 16px;
    width: calc(100% - 32px);
}
#sorterPickerList { padding: 0 16px 10px; }

/* ── Plugin picker overlay ────────────────────────────────────── */
#pluginPickerOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.80);
    backdrop-filter: blur(5px);
    z-index: 1000;
}
#pluginPickerOverlay.plugin-overlay-visible {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.plugin-picker-group-header {
    color: #63b3ed;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 10px 10px 4px;
    margin-top: 4px;
    border-top: 1px solid var(--c-border);
    user-select: none;
}
.plugin-picker-group-header:first-child { border-top: none; margin-top: 0; }

.plugin-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
    background: rgba(15, 23, 42, 0.30);
    margin: 0 2px;
}
.plugin-picker-row:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--c-border);
}
.plugin-picker-row.active {
    background: rgba(59, 130, 246, 0.20);
    border-color: var(--c-border-hi);
}
.plugin-picker-row-label {
    font-size: 0.95rem;
    color: var(--c-text-mid);
    flex: 1;
    user-select: none;
    pointer-events: none;
}
.plugin-picker-row input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--c-accent);
    width: 16px; height: 16px;
    flex-shrink: 0;
    pointer-events: none;
}
.plugin-picker-row.active .plugin-picker-row-label {
    color: var(--c-accent-text);
    font-weight: 600;
}
.plugin-picker-active-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--c-accent);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--t-fast);
}
.plugin-picker-row.active .plugin-picker-active-dot { opacity: 1; }

/* ── Cards grid ───────────────────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(350px, 100%), 1fr));
    gap: 20px;
    margin-top: 20px;
}
.card {
    background: rgba(15, 23, 42, 0.70);
    backdrop-filter: blur(10px);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 20px;
    cursor: pointer;
    transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;  /* ← changed from row to column */
    gap: 0;                  /* ← remove gap, badges use margin-top: auto */
}
.card-inner {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.30);
    border-color: var(--c-accent);
}
.card-image {
    width: 90px; height: 90px;
    border-radius: 10px;
    border: 1px solid var(--c-border);
    background: var(--c-surface-3);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    contain: strict;
}
.card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.card-title {
    font-size: 1.3rem;
    color: var(--c-accent-text);
    margin-bottom: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.detail-item { display: flex; flex-direction: column; }
.detail-label { font-size: 0.85rem; color: var(--c-text-muted); margin-bottom: 4px; }
.detail-value { font-size: 1rem; color: var(--c-text); font-weight: 500; }

/* ── Stats ────────────────────────────────────────────────────── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--c-surface-3);
    padding: 15px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-border);
    text-align: center;
}
.stat-value { font-size: 2rem; color: var(--c-accent-text); font-weight: 700; }
.stat-label { font-size: 0.9rem; color: var(--c-text-muted); margin-top: 5px; }

/* ── Loading / error ──────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--c-text-muted);
    font-size: 1.2rem;
}
.error {
    background: rgba(239, 68, 68, 0.20);
    border: 1px solid rgba(239, 68, 68, 0.50);
    color: var(--c-danger-text);
    padding: 15px;
    border-radius: var(--r-md);
    margin-bottom: 20px;
}

/* ── Detail modal ─────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.80);
    backdrop-filter: blur(5px);
    z-index: 1000;
    overflow-y: auto;
    overscroll-behavior: contain;
    will-change: opacity;
}
.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}
.modal-content {
    background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.95));
    border: 2px solid rgba(59, 130, 246, 0.50);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    padding: 30px;
    max-width: 800px;
    width: 100%;
    margin: auto;
    contain: layout style;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--c-border);
}
.modal-title { font-size: 2rem; color: var(--c-accent-text); }
.modal-body  { color: var(--c-text-mid); }

/* ── Modal tabs ───────────────────────────────────────────────── */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--c-border);
    padding-bottom: 10px;
    flex-wrap: wrap;
}
.modal-tab {
    padding: 10px 20px;
    background: rgba(30, 41, 59, 0.60);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md) var(--r-md) 0 0;
    cursor: pointer;
    transition: background var(--t-base), color var(--t-base);
    color: var(--c-text-muted);
    font-size: 1rem;
    font-weight: normal;
}
.modal-tab:hover { background: rgba(59, 130, 246, 0.20); }
.modal-tab.active {
    background: rgba(59, 130, 246, 0.30);
    color: var(--c-accent-text);
    border-bottom-color: transparent;
}
.modal-tab-contents { position: relative; min-height: 200px; }
.modal-tab-content {
    display: none;
    animation: fadeIn 0.20s ease;
    contain: content;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-tab-content img {
    border-radius: var(--r-md);
    box-shadow: 0 4px 6px rgba(0,0,0,.30);
}

/* ── Attribute display ────────────────────────────────────────── */
.attribute-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 15px;
    margin-top: 20px;
}
.attribute {
    background: var(--c-surface-3);
    padding: 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-border);
}
.attribute-name  { font-size: 0.9rem;  color: var(--c-text-muted); margin-bottom: 6px; }
.attribute-value { font-size: 1.1rem;  color: var(--c-text); font-weight: 600; }

.ad-section-title {
    color: #63b3ed;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 20px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(99,179,237,.20);
}
.ad-grid {
    display: grid;
    /* minmax(0,…): a long value (e.g. an internal id) wraps instead of
       widening the column past its panel and hiding every other value */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px 12px;
    margin-bottom: 4px;
}
.ad-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 8px;
    border-radius: 5px;
    background: var(--c-surface-3);
    cursor: default;
    transition: background var(--t-fast);
}
.ad-row:hover { background: rgba(51, 65, 85, .70); }
.ad-row[data-tooltip] { cursor: help; }
.ad-row[data-tooltip]:hover {
    background: rgba(59, 100, 150, .35);
    outline: 1px solid rgba(99, 179, 237, .25);
}
.ad-row--derived {
    background: rgba(30, 58, 90, .45);
    border-left: 2px solid rgba(99, 179, 237, .50);
}
.ad-row--derived:hover { background: rgba(30, 80, 120, .50); }
.ad-label {
    font-size: 12px;
    color: var(--c-text-muted);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}
.ad-value {
    font-size: 12px;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 0;
    text-align: right;
}
.ad-unit { font-size: 10px; color: var(--c-text-dim); margin-left: 3px; }
.ad-base-ship { color: var(--c-accent-text); font-size: 13px; margin-bottom: 16px; }
.ad-base-ship strong { color: #bfdbfe; }
.ad-description {
    color: var(--c-text-mid);
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 12px;
    grid-column: 1 / -1;
}
.ad-stacking-section { margin-top: 12px; }
.ad-stacking-note {
    display: flex;
    gap: 8px;
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 4px;
    background: var(--c-warn);
    border-left: 2px solid rgba(250,200,50,.40);
    margin-bottom: 4px;
}
.ad-stacking-key  { color: var(--c-warn-text); font-weight: 600; white-space: nowrap; }
.ad-stacking-rule { color: #a3a3a3; }

/* ── Location Display ─────────────────────────────────────────── */
.ld-plugin-block {
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    margin-bottom: 10px;
    overflow: hidden;
}
.ld-plugin-block.ld-plugin-active   { border-color: var(--c-border-hi); }
.ld-plugin-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    background: var(--c-surface);
    user-select: none;
    transition: background var(--t-fast);
}
.ld-plugin-header:hover          { background: rgba(30,41,59,0.90); }
.ld-plugin-header:focus-visible  { outline: 2px solid var(--c-accent); outline-offset: -2px; }
.ld-plugin-name {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    color: var(--c-accent-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ld-plugin-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.ld-plugin-active .ld-plugin-badge {
    background: var(--c-success);
    color: var(--c-success-text);
    border: 1px solid rgba(34,197,94,0.35);
}
.ld-arrow { font-size: 13px; color: var(--c-text-dim); flex-shrink: 0; transition: transform var(--t-fast); }
.ld-plugin-content-wrapper {
    padding: 12px 14px;
    background: rgba(15,23,42,0.35);
}
.ld-plugin-content { display: flex; flex-direction: column; gap: 12px; }
.ld-unused { font-size: 12px; color: var(--c-text-muted); font-style: italic; padding: 6px 0; }
.ld-category { display: flex; flex-direction: column; gap: 6px; }
.ld-category-header { display: flex; align-items: center; gap: 6px; }
.ld-category-icon  { font-size: 14px; line-height: 1; }
.ld-category-label {
    font-size: 12px;
    font-weight: 600;
    color: #7dd3fc;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ld-category-count {
    font-size: 11px;
    color: var(--c-text-dim);
    background: rgba(100,116,139,0.15);
    border-radius: 8px;
    padding: 1px 6px;
}
.ld-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.ld-pill {
    font-size: 11px;
    padding: 3px 9px;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    color: var(--c-text-mid);
    white-space: nowrap;
    transition: border-color var(--t-fast), color var(--t-fast);
}
.ld-pill:hover { border-color: rgba(147,197,253,0.50); color: var(--c-text); }
.ld-empty {
    color: var(--c-text-dim);
    font-style: italic;
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

/* ── Tooltip ──────────────────────────────────────────────────── */
#ad-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 320px;
    padding: 10px 14px;
    background: rgba(15,23,42,0.97);
    border: 1px solid rgba(99,179,237,0.35);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 12px;
    line-height: 1.55;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.60);
    white-space: pre-wrap;
}

/* ── Sorter buttons (exact names used by JS) ──────────────────── */
.sorter-remove-btn {
    background: var(--c-danger);
    color: var(--c-danger-text);
    border: 1px solid rgba(239, 68, 68, 0.30);
    border-radius: var(--r-sm);
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.sorter-remove-btn:hover {
    background: rgba(239, 68, 68, 0.30);
    border-color: var(--c-danger-hi);
    color: var(--c-danger-hi);
}

.sorter-move-btn {
    background: rgba(71, 85, 105, 0.50);
    color: var(--c-text-muted);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 4px 9px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.sorter-move-btn:hover:not(:disabled) {
    background: rgba(71, 85, 105, 0.90);
    color: var(--c-text);
    transform: translateY(-1px);
}
.sorter-move-btn:disabled { opacity: 0.30; cursor: default; transform: none; }

.sorter-dir-btn {
    background: var(--c-surface-3);
    color: var(--c-accent-text);
    border: 1px solid var(--c-border-hi);
    border-radius: var(--r-sm);
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast);
    white-space: nowrap;
}
.sorter-dir-btn:hover {
    background: rgba(59, 130, 246, 0.30);
    border-color: var(--c-accent);
    transform: translateY(-1px);
}

.sorter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.40);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    flex-wrap: wrap;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.sorter-row:hover {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.40);
}
.sorter-label {
    flex: 1;
    font-size: 0.95rem;
    color: var(--c-text-mid);
    min-width: 120px;
}

.sorter-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
    background: rgba(15, 23, 42, 0.30);
}
.sorter-picker-row:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--c-border);
}
.sorter-picker-row input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--c-accent);
    width: 16px; height: 16px;
    flex-shrink: 0;
    pointer-events: none;
}
.sorter-picker-row label {
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--c-text-mid);
    flex: 1;
    margin-bottom: 0;
    user-select: none;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   Navbar
   ═══════════════════════════════════════════════════════════════ */
.es-nav {
    --nav-h:          56px;
    --nav-bg:         rgba(10, 18, 38, 0.88);
    --nav-border:     rgba(59, 130, 246, 0.25);
    --nav-accent:     #3b82f6;
    --nav-accent-text:#93c5fd;
    --nav-text:       #cbd5e1;
    --nav-text-muted: #64748b;
    --nav-hover-bg:   rgba(59, 130, 246, 0.12);
    --nav-active-bg:  rgba(59, 130, 246, 0.22);
    --nav-radius:     8px;
    --nav-t:          0.18s ease;

    position: sticky;
    top: 0;
    z-index: 900;
    width: 100%;
    height: var(--nav-h);
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
    overflow: visible;
}

.es-nav__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--nav-accent-text);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    margin-right: 12px;
    flex-shrink: 0;
    transition: color var(--nav-t);
}
.es-nav__brand:hover   { color: #bfdbfe; }
.es-nav__brand-icon    { font-size: 1.3rem; line-height: 1; }

.es-nav__divider {
    width: 1px;
    height: 28px;
    background: var(--nav-border);
    flex-shrink: 0;
    margin: 0 4px;
}

.es-nav__links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow: visible;
}
.es-nav__links li { flex-shrink: 0; }

.es-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--nav-radius);
    color: var(--nav-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--nav-t), color var(--nav-t);
    border: 1px solid transparent;
    cursor: pointer;
    background: none;
    font-family: inherit;
}
.es-nav__icon { font-size: 1rem; line-height: 1; }
.es-nav__link:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-accent-text);
    border-color: rgba(59,130,246,0.20);
}
.es-nav__link.active {
    background: var(--nav-active-bg);
    color: var(--nav-accent-text);
    border-color: rgba(59,130,246,0.35);
}

.es-nav__dropdown { position: relative; }
.es-nav__dropdown-toggle::after {
    content: '▾';
    font-size: 0.7rem;
    margin-left: 2px;
    opacity: 0.6;
    transition: transform var(--nav-t);
}
.es-nav__dropdown.open .es-nav__dropdown-toggle::after { transform: rotate(180deg); }
.es-nav__dropdown-menu {
    display: none;
    position: fixed;
    min-width: 200px;
    background: rgba(10, 18, 38, 0.97);
    border: 1px solid rgba(59,130,246,0.30);
    border-radius: var(--nav-radius);
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
    padding: 6px;
    z-index: 9999;
    animation: navDropIn 0.15s ease;
}
.es-nav__dropdown.open .es-nav__dropdown-menu { display: block; }

@keyframes navDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.es-nav__dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 0.88rem;
    transition: background var(--nav-t), color var(--nav-t);
    cursor: pointer;
}
.es-nav__dropdown-item:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-accent-text);
}
.es-nav__dropdown-item .es-nav__icon { font-size: 0.95rem; opacity: 0.8; }
.es-nav__dropdown-sep {
    height: 1px;
    background: rgba(59,130,246,0.15);
    margin: 4px 6px;
}

.es-nav__spacer { flex: 1; }

.es-nav__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--nav-border);
    border-radius: var(--nav-radius);
    background: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background var(--nav-t), border-color var(--nav-t);
    margin-left: auto;
}
.es-nav__hamburger:hover {
    background: var(--nav-hover-bg);
    border-color: rgba(59,130,246,0.40);
}
.es-nav__hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--nav-text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.es-nav.nav-open .es-nav__hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.es-nav.nav-open .es-nav__hamburger span:nth-child(2) { opacity: 0; }
.es-nav.nav-open .es-nav__hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.es-nav__drawer {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(10, 18, 38, 0.98);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.25);
    padding: 12px 16px 20px;
    z-index: 899;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.60);
    animation: drawerSlide 0.2s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --nav-accent-text: #93c5fd;
    --nav-text:        #cbd5e1;
    --nav-text-muted:  #64748b;
    --nav-hover-bg:    rgba(59, 130, 246, 0.12);
    --nav-active-bg:   rgba(59, 130, 246, 0.22);
    --nav-border:      rgba(59, 130, 246, 0.25);
    --nav-t:           0.18s ease;
    --nav-radius:      8px;
}
@keyframes drawerSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.es-nav__drawer.nav-drawer-open { display: flex; }
.es-nav__drawer .es-nav__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--nav-radius);
    color: var(--nav-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background var(--nav-t), color var(--nav-t);
    border: 1px solid transparent;
    cursor: pointer;
    background: none;
    font-family: inherit;
}
.es-nav__drawer .es-nav__link:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-accent-text);
    border-color: rgba(59,130,246,0.20);
}
.es-nav__drawer .es-nav__link.active {
    background: var(--nav-active-bg);
    color: var(--nav-accent-text);
    border-color: rgba(59,130,246,0.35);
}
.es-nav__drawer .nav-drawer-sep {
    height: 1px;
    background: rgba(59,130,246,0.15);
    margin: 6px 0;
}
.es-nav__drawer .nav-drawer-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--nav-text-muted);
    padding: 8px 14px 2px;
    user-select: none;
}
.es-nav__drawer .es-nav__icon { font-size: 1rem; line-height: 1; }

/* ═══════════════════════════════════════════════════════════════
   Battle Simulator
   ═══════════════════════════════════════════════════════════════ */


/* ── Ship slot ────────────────────────────────────────────────── */


.ship-search-wrap { position: relative; }
.ship-search-wrap input {
    width: 100%;
    padding: 10px 14px;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 0.9rem;
}
.ship-search-wrap input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.ship-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: rgba(10,18,38,0.98);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.ship-dropdown.open { display: block; }
.ship-dropdown-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--c-text-mid);
    border-bottom: 1px solid rgba(59,130,246,0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    transition: background var(--t-fast);
}
.ship-dropdown-item:hover { background: rgba(59,130,246,0.15); color: var(--c-text); }
.ship-dropdown-item .sdi-plugin { font-size: 0.75rem; color: var(--c-text-dim); white-space: nowrap; }
.ship-dropdown-empty {
    padding: 12px 14px;
    color: var(--c-text-muted);
    font-style: italic;
    font-size: 0.88rem;
}

/* ── Selected ship card ───────────────────────────────────────── */


/* ── Slot stats strip ─────────────────────────────────────────── */


/* ── Fight button ─────────────────────────────────────────────── */
.fight-btn-wrap {
    text-align: center;
    margin: 18px 0 10px;
}
.fight-btn {
    width: 100%;
    padding: 14px 32px;
    background: linear-gradient(135deg, #1e40af, #7c3aed);
    border: none;
    border-radius: var(--r-lg);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}
.fight-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fight-btn:not(:disabled):hover { opacity: 0.88; transform: translateY(-1px); }

/* ── Sim loading ──────────────────────────────────────────────── */
.sim-loading {
    display: none;
    text-align: center;
    padding: 24px;
    color: var(--c-accent-text);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    animation: simPulse 1.2s ease-in-out infinite;
}
.sim-loading.visible { display: block; }

@keyframes simPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Result header ────────────────────────────────────────────── */
.result-header {
    text-align: center;
    padding: 18px 0 10px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 18px;
}
.result-winner-label {
    font-size: 0.82rem;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}
.result-winner-name {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.result-subtitle { font-size: 0.9rem; color: var(--c-text-muted); }

/* ── Timeline bar ─────────────────────────────────────────────── */
.timeline-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-text-dim);
    margin-bottom: 10px;
}
.timeline-track {
    position: relative;
    height: 48px;
    background: rgba(15,23,42,0.6);
    border: 1px solid var(--c-border);
    border-radius: 24px;
    overflow: hidden;
}
.timeline-bar-a {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-radius: 24px 0 0 24px;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    padding-left: 12px;
}
.timeline-bar-b {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    border-radius: 0 24px 24px 0;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
}
.timeline-bar-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
}
.timeline-midline {
    position: absolute;
    left: 50%; top: 0; bottom: 0;
    width: 1px;
    background: rgba(255,255,255,0.15);
    pointer-events: none;
}

/* ── HP chart ─────────────────────────────────────────────────── */
.hp-chart-wrap {
    background: rgba(15,23,42,0.4);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    overflow: hidden;
    padding: 4px;
    margin-bottom: 20px;
}
.hp-chart-wrap svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 220px;
}

/* ── Stats comparison grid ────────────────────────────────────── */
.res-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: #63b3ed;
    padding: 18px 0 8px;
    border-bottom: 1px solid rgba(99,179,237,0.18);
    margin-bottom: 6px;
}
.results-compare {
    display: grid;
    grid-template-columns: 1fr minmax(18px, 0.6fr) 1fr;
    gap: 0 8px;
    margin-bottom: 4px;
}
.res-col { display: flex; flex-direction: column; gap: 3px; }
.res-col-a .res-row { justify-content: flex-end; text-align: right; }
.res-col-b .res-row { justify-content: flex-start; text-align: left; }
.res-row {
    display: flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 10px;
    border-radius: var(--r-sm);
    background: rgba(15,23,42,0.35);
    transition: background var(--t-fast);
}
.res-row:hover { background: rgba(30,58,138,0.25); }
.res-row-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.res-col-a .res-row-value { color: #93c5fd; }
.res-col-b .res-row-value { color: #fca5a5; }
.res-divider { display: flex; flex-direction: column; gap: 3px; }
.res-divider-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 3px 8px;
    font-size: 0.73rem;
    color: var(--c-text-muted);
    text-align: center;
    line-height: 1.3;
    border-radius: var(--r-sm);
    background: rgba(15,23,42,0.20);
}

/* Mobile rows (hidden on desktop, shown on narrow screens) */
.res-row-mobile { display: none; }

/* ── Weapons grid ─────────────────────────────────────────────── */
.weapons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.weapons-col-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--c-border);
}

/* ── Weapon items ─────────────────────────────────────────────── */
.weapon-item {
    background: rgba(15,23,42,0.45);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 10px 12px;
    margin-bottom: 6px;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.weapon-item:hover {
    border-color: rgba(59,130,246,0.45);
    background: rgba(15,23,42,0.65);
}
.weapon-item:last-child { margin-bottom: 0; }
.weapon-item-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--c-accent-text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.weapon-item-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}
.weapon-stat {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    background: rgba(30,41,59,0.60);
    border: 1px solid var(--c-border-2);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.weapon-stat span {
    color: var(--c-text);
    font-weight: 600;
    margin-left: 2px;
}

/* ── Ship accordion ───────────────────────────────────────────── */
.ship-accordion {
    border: 1px solid rgba(148,163,184,0.13);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    background: rgba(15,23,42,0.28);
}
.ship-accordion--open { border-color: rgba(148,163,184,0.22); }
.ship-accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    background: rgba(30,41,59,0.45);
    user-select: none;
    transition: background 0.15s;
}
.ship-accordion-header:hover { background: rgba(51,65,85,0.55); }
.ship-accordion-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ship-accordion-header-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
}
.ship-accordion-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ship-accordion-quick-stats {
    font-size: 0.71rem;
    color: var(--c-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ship-accordion-count-badge {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    background: rgba(59,130,246,0.18);
    color: var(--c-accent-text);
    border: 1px solid rgba(59,130,246,0.25);
    vertical-align: middle;
}
.ship-accordion-chevron {
    color: #64748b;
    font-size: 0.65rem;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.ship-accordion-body {
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(148,163,184,0.08);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ship-accordion-subsection-title {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #63b3ed;
    padding: 10px 0 5px;
    border-bottom: 1px solid rgba(99,179,237,0.15);
    margin-bottom: 4px;
}
.ship-accordion-subsection-title:first-child { padding-top: 0; }
.ship-accordion-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(15,23,42,0.3);
    margin-bottom: 2px;
}
.ship-accordion-stat-row:hover { background: rgba(30,58,138,0.2); }
.ship-accordion-stat-label {
    font-size: 0.76rem;
    color: var(--c-text-muted);
}
.ship-accordion-stat-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ship-accordion-no-weapons {
    color: var(--c-text-muted);
    font-style: italic;
    font-size: 0.82rem;
    padding: 6px 0;
}

/* ── Combat phases ────────────────────────────────────────────── */
.phase-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
}
.phase-item {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 9px 14px;
    border-radius: var(--r-md);
    border-left: 3px solid transparent;
    font-size: 0.86rem;
    line-height: 1.45;
    transition: background var(--t-fast);
    background: rgba(15,23,42,0.35);
}
.phase-item:hover { background: rgba(15,23,42,0.60); }
.phase-icon { flex-shrink: 0; line-height: 1; }
.phase-time {
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--c-text-dim);
    background: rgba(15,23,42,0.60);
    border: 1px solid var(--c-border-2);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 46px;
    text-align: center;
}
.phase-text { flex: 1; min-width: 120px; color: var(--c-text-mid); }
.phase-text strong { color: var(--c-text); font-weight: 700; }
.phase-A { border-left-color: #3b82f6; background: rgba(59,130,246,0.07); }
.phase-A:hover { background: rgba(59,130,246,0.13); }
.phase-A .phase-time { color: #93c5fd; border-color: rgba(59,130,246,0.30); }
.phase-B { border-left-color: #ef4444; background: rgba(239,68,68,0.07); }
.phase-B:hover { background: rgba(239,68,68,0.13); }
.phase-B .phase-time { color: #fca5a5; border-color: rgba(239,68,68,0.30); }
.phase-neutral {
    border-left-color: var(--c-text-dim);
    background: rgba(100,116,139,0.07);
    font-style: italic;
    color: var(--c-text-muted);
}

/* ── Matchup block (N-team) ───────────────────────────────────── */
.matchup-block {
    border: 1px solid rgba(148,163,184,0.13);
    border-radius: 10px;
    margin-bottom: 14px;
    overflow: hidden;
    background: rgba(15,23,42,0.35);
}
.matchup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    background: rgba(30,41,59,0.55);
    transition: background 0.15s;
    user-select: none;
}
.matchup-header:hover { background: rgba(51,65,85,0.65); }
.matchup-header--collapsed { opacity: 0.85; }
.matchup-header-teams {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    flex-wrap: wrap;
}
.matchup-team-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.matchup-team-name { font-weight: 600; font-size: 0.9rem; }
.matchup-vs { color: #64748b; font-size: 0.78rem; font-style: italic; }
.matchup-header-winner { font-size: 0.82rem; white-space: nowrap; }
.matchup-header-chevron { color: #64748b; font-size: 0.7rem; flex-shrink: 0; }
.matchup-body {
    padding: 14px 16px 18px;
    border-top: 1px solid rgba(148,163,184,0.1);
}

/* ── Team cards ───────────────────────────────────────────────── */
#teamsContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}
.team-card {
    background: var(--c-surface);
    border: 2px solid color-mix(in srgb, var(--team-color) 40%, transparent);
    border-radius: 10px;
    padding: 14px;
    min-width: 280px;
    max-width: 340px;
    flex: 1 1 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.team-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.team-color-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.team-name-input {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--c-border);
    color: var(--team-color);
    font-size: 1rem;
    font-weight: 600;
    padding: 2px 4px;
    outline: none;
}
.team-name-input:focus { border-bottom-color: var(--team-color); }
.team-ship-count {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.team-remove-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--c-text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 5px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.team-remove-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }
.team-ship-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}
.team-no-ships {
    color: var(--c-text-muted);
    font-style: italic;
    font-size: 0.82rem;
    padding: 6px 0;
}
.team-ship-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
    padding: 6px 8px;
}
.team-ship-info { flex: 1; min-width: 0; }
.team-ship-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.team-ship-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.team-ship-stats span { font-size: 0.72rem; color: var(--c-text-muted); }
.team-ship-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.team-count-input {
    width: 52px;
    padding: 3px 5px;
    border-radius: 5px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 0.85rem;
    text-align: center;
}
.team-add-section { margin-top: 4px; }
.team-add-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.team-search-input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 0.85rem;
}

#addTeamBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
    height: 52px;
    background: rgba(59,130,246,0.08);
    border: 2px dashed rgba(59,130,246,0.35);
    border-radius: 10px;
    color: #60a5fa;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    align-self: flex-start;
    padding: 0 16px;
    white-space: nowrap;
}
#addTeamBtn:hover {
    background: rgba(59,130,246,0.14);
    border-color: rgba(59,130,246,0.55);
}

/* ── Ammo summary ─────────────────────────────────────────────── */


/* ── Matrix ───────────────────────────────────────────────────── */
.matrix-scroll { overflow-x: auto; }
.battle-matrix {
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 10px 0;
}
.battle-matrix th, .battle-matrix td {
    border: 1px solid var(--c-border);
    padding: 6px 10px;
    text-align: center;
}
.battle-matrix th { font-weight: 600; background: rgba(0,0,0,0.3); }
.matrix-row-label { font-weight: 600; text-align: left !important; white-space: nowrap; }
.matrix-self { background: rgba(0,0,0,0.3); color: #475569; }
.matrix-win  { background: rgba(34,197,94,0.08); }
.matrix-loss { background: rgba(239,68,68,0.08); }
.matrix-draw { background: rgba(234,179,8,0.08); }
.matrix-result { display: block; font-size: 1rem; }
.matrix-ttk { display: block; font-size: 0.72rem; color: #64748b; margin-top: 1px; }

/* ── Rankings ─────────────────────────────────────────────────── */
.ranking-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.ranking-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 0.84rem;
    flex-wrap: wrap;
}
.ranking-pos { color: #94a3b8; font-weight: 700; min-width: 22px; }
.ranking-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ranking-name { font-weight: 600; min-width: 80px; }
.ranking-wins { color: #94a3b8; white-space: nowrap; }
.ranking-dps, .ranking-ehp { color: #64748b; font-size: 0.78rem; white-space: nowrap; }

/* ── Misc ─────────────────────────────────────────────────────── */
#simResults:empty { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* Navbar: collapse to hamburger on small screens */
/* Navbar collapse — driven by JS overflow detection (see navBar.js's
   checkNavOverflow), not a fixed pixel breakpoint. .es-nav--collapsed
   gets added the moment the bar's content actually doesn't fit,
   regardless of what's causing that (long nav list, account button,
   whatever) — more robust than guessing a pixel value that may not
   match reality once things like login state change what's showing. */
.es-nav--collapsed .es-nav__links    { display: none; }
.es-nav--collapsed .es-nav__divider  { display: none; }
.es-nav--collapsed .es-nav__spacer   { display: none; }
.es-nav--collapsed .es-nav__account  { display: none; }
.es-nav--collapsed .es-nav__hamburger { display: flex; }

/* Modal tabs: compact on tablet */
@media (max-width: 768px) {
    .modal-tab { padding: 10px 16px; font-size: 0.9rem; }
    .modal-tab-content .attribute-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
        gap: 12px;
    }
}

/* Sim layout: collapse VS column on narrow */


/* ── 691–750px: single column weapons, wrap pills and stats ── */
@media (min-width: 690px) and (max-width: 800px) {
    .weapons-grid { grid-template-columns: 1fr; }
    .weapon-stat { white-space: normal; }
    .ship-accordion-quick-stats {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        line-height: 1.4;
    }
    .ship-accordion-name {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
}

/* ── ≤690px: mobile stats layout ────────────────────────────── */
@media (max-width: 690px) {
    /* Hide desktop three-column compare, show labelled rows */
    .results-compare .res-col     { display: none !important; }
    .results-compare .res-divider { display: none !important; }

    .res-row-mobile {
        display: grid;
        grid-template-columns: 1fr auto auto;
        align-items: center;
        gap: 0 8px;
        min-height: 28px;
        padding: 5px 10px;
        border-radius: var(--r-sm);
        background: rgba(15,23,42,0.35);
        transition: background 0.15s ease;
    }
    .res-row-mobile:hover { background: rgba(30,58,138,0.25); }
    .res-row-mobile__label {
        font-size: 0.74rem;
        color: var(--c-text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .res-row-mobile__val-a {
        font-size: 0.8rem;
        font-weight: 700;
        color: #93c5fd;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
        text-align: right;
        min-width: 44px;
    }
    .res-row-mobile__val-b {
        font-size: 0.8rem;
        font-weight: 700;
        color: #fca5a5;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
        text-align: right;
        min-width: 44px;
    }
    .res-section-title { grid-column: 1 / -1; }

    .weapons-grid { grid-template-columns: 1fr; }
    .phase-item { flex-wrap: wrap; }
    .phase-text { min-width: 0; flex: 1 1 160px; }
}

/* ── Shared: text-input & select ─────────────────────────────── */
.text-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--c-surface-2);
    border: 1px solid rgba(59,130,246,0.40);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 0.95rem;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    font-family: inherit;
}
.text-input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.20);
}
textarea.text-input { resize: vertical; min-height: 80px; }
 
/* ── Shared: extra button variants ───────────────────────────── */
.btn-success {
    background: var(--c-success);
    color: var(--c-success-text);
    border: 1px solid rgba(34,197,94,0.30);
}
.btn-success:hover { background: rgba(34,197,94,0.35); }
/* Was referenced (shipBuilder.html's delete-confirm button, and now the
   navbar's logout-confirm button) but never actually defined — those
   buttons were silently rendering with no danger styling at all. */
.btn-danger {
    background: var(--c-danger);
    color: var(--c-danger-text);
    border: 1px solid var(--c-danger-hi);
}
.btn-danger:hover { background: rgba(239,68,68,0.35); }
.btn-xs { padding: 3px 8px; font-size: 0.78rem; }
 
/* ── Shared: button groups ────────────────────────────────────── */
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-group-right { justify-content: flex-end; }
 
/* ── Shared: divider ──────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--c-border); margin: 16px 0; }
 
/* ── Shared: modal overlay ────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.80); backdrop-filter: blur(5px);
    z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: linear-gradient(135deg, rgba(15,23,42,0.97), rgba(30,41,59,0.97));
    border: 2px solid rgba(59,130,246,0.50);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    width: min(520px, 96vw);
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--c-border);
}
.modal-title { font-size: 1.3rem; color: var(--c-accent-text); font-weight: 600; }
.modal-close {
    background: none; border: none; color: var(--c-text-muted);
    font-size: 1.5rem; cursor: pointer; line-height: 1;
    padding: 2px 6px; border-radius: var(--r-sm);
    transition: color var(--t-fast), background var(--t-fast);
}
.modal-close:hover { color: var(--c-danger-hi); background: rgba(239,68,68,0.20); }
.confirm-text { color: var(--c-text-mid); margin-bottom: 20px; line-height: 1.6; }
.import-area { min-height: 200px; font-family: monospace; font-size: 0.82rem; }
 
/* ── Toast ────────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 2000;
    background: rgba(30,41,59,0.98); border: 1px solid var(--c-border-hi);
    border-radius: var(--r-md); padding: 12px 20px;
    color: var(--c-text); font-size: 0.9rem;
    box-shadow: var(--shadow-md);
    transform: translateY(80px); opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(34,197,94,0.50); color: var(--c-success-text); }
.toast.danger  { border-color: rgba(239,68,68,0.50);  color: var(--c-danger-text); }
/* a message with a button in it (e.g. "↶ Undo") — same look, but clickable */
.toast.toast--action { pointer-events: auto; display: flex; gap: 12px; align-items: center; }
 
/* ── Autocomplete ─────────────────────────────────────────────── */
.autocomplete-wrap { position: relative; flex: 1; }
.autocomplete-dropdown {
    position: absolute; top: calc(100% + 2px); left: 0; right: 0;
    background: rgba(10,18,38,0.98); border: 1px solid var(--c-border);
    border-radius: var(--r-md); max-height: 200px; overflow-y: auto;
    z-index: 500; display: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.autocomplete-dropdown.open { display: block; }
.ac-item {
    padding: 7px 12px; font-size: 0.85rem; color: var(--c-text-mid);
    cursor: pointer; border-bottom: 1px solid rgba(59,130,246,0.07);
    transition: background var(--t-fast);
}
.ac-item:hover, .ac-item.selected { background: rgba(59,130,246,0.15); color: var(--c-text); }
 
/* ── Fleet grid & cards ───────────────────────────────────────── */
.fleet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: 16px; margin-top: 16px;
}
.fleet-card {
    background: rgba(15,23,42,0.70);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 18px;
    cursor: pointer;
    transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.fleet-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(59,130,246,0.25);
    border-color: var(--c-accent);
}
.fleet-card__name  { font-size: 1.2rem; color: var(--c-accent-text); font-weight: 700; margin-bottom: 4px; }
.fleet-card__variant { font-size: 0.82rem; color: var(--c-text-muted); margin-bottom: 12px; }
.fleet-card__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fleet-card__stat  { background: var(--c-surface-3); border-radius: var(--r-sm); padding: 6px 10px; }
.fleet-card__stat-label { font-size: 0.72rem; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.fleet-card__stat-value { font-size: 0.95rem; color: var(--c-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.fleet-card__actions { display: flex; gap: 8px; margin-top: 14px; }
.fleet-empty {
    text-align: center; padding: 60px 20px;
    color: var(--c-text-muted); font-size: 1rem;
    border: 2px dashed var(--c-border); border-radius: var(--r-lg);
    margin-top: 16px;
}
.fleet-empty__icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
 
/* ── Builder layout ───────────────────────────────────────────── */
.builder-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) { .builder-layout { grid-template-columns: minmax(0, 1fr); } }
/* grid/flex children may shrink below their content's width (otherwise one
   long outfit row widens the whole editor past the screen) */
.builder-layout > *, .builder-sidebar > * { min-width: 0; }
.builder-sidebar { display: flex; flex-direction: column; gap: 16px; }
 
.input-group { margin-bottom: 14px; }
.input-group label { margin-bottom: 6px; font-size: 0.88rem; }
 
/* ── Attributes panel ─────────────────────────────────────────── */
.attr-section { margin-bottom: 20px; }
.attr-section-title {
    color: #63b3ed; font-size: 11px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    margin-bottom: 8px; padding-bottom: 5px;
    border-bottom: 1px solid rgba(99,179,237,.20);
    display: flex; align-items: center; justify-content: space-between;
}
.attr-row {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; border-radius: var(--r-sm);
    background: var(--c-surface-3);
    margin-bottom: 4px;
    transition: background var(--t-fast);
}
.attr-row:hover { background: rgba(51,65,85,.70); }
.attr-key {
    font-size: 12px; color: var(--c-text-muted); flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attr-val-input {
    width: 90px; padding: 2px 6px;
    background: rgba(15,23,42,0.60);
    border: 1px solid rgba(59,130,246,0.35);
    border-radius: 4px; color: var(--c-text);
    font-size: 12px; font-family: inherit;
    font-variant-numeric: tabular-nums; text-align: right;
}
.attr-val-input:focus { outline: none; border-color: var(--c-accent); }
 
/* ── Outfits list ─────────────────────────────────────────────── */
.outfit-section { margin-bottom: 14px; }
.outfit-section-title {
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--c-text-muted);
    margin-bottom: 8px; padding-bottom: 4px;
    border-bottom: 1px solid var(--c-border-2);
    display: flex; align-items: center; justify-content: space-between;
}
.outfit-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: var(--r-sm);
    background: rgba(15,23,42,0.40); border: 1px solid var(--c-border);
    margin-bottom: 4px;
    transition: background var(--t-fast);
}
.outfit-item:hover { background: rgba(59,130,246,0.10); }
.outfit-item__name {
    flex: 1; font-size: 0.88rem; color: var(--c-text-mid);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.outfit-item__count {
    width: 52px; padding: 2px 6px; text-align: center;
    background: rgba(15,23,42,0.60); border: 1px solid var(--c-border);
    border-radius: 4px; color: var(--c-text); font-size: 0.85rem; font-family: inherit;
}
.outfit-item__count:focus { outline: none; border-color: var(--c-accent); }
 
/* ── Builder tabs ─────────────────────────────────────────────── */
.builder-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.builder-tab {
    padding: 8px 16px; background: rgba(30,41,59,0.60);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md) var(--r-md) 0 0;
    cursor: pointer; color: var(--c-text-muted);
    font-size: 0.88rem; font-family: inherit;
    transition: background var(--t-base), color var(--t-base);
}
.builder-tab.active { background: rgba(59,130,246,0.30); color: var(--c-accent-text); border-bottom-color: transparent; }
.builder-tab:hover  { background: rgba(59,130,246,0.20); }
.builder-tab-content { display: none; }
.builder-tab-content.active { display: block; }
 
/* ── Output / raw code box ────────────────────────────────────── */
.output-box {
    background: rgba(10,18,38,0.95);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 16px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
    color: #93c5fd;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    max-height: 520px;
    overflow-y: auto;
    tab-size: 4;
}
.output-box::-webkit-scrollbar { width: 6px; height: 6px; }
.output-box::-webkit-scrollbar-track { background: rgba(15,23,42,0.40); }
.output-box::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.40); border-radius: 3px; }
 
/* ── Quick stats strip ────────────────────────────────────────── */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
    gap: 10px; margin-bottom: 16px;
}
.qs-card { background: var(--c-surface-3); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 10px 14px; }
.qs-label { font-size: 0.72rem; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.qs-value { font-size: 1.3rem; color: var(--c-accent-text); font-weight: 700; font-variant-numeric: tabular-nums; }
 
/* ── Page header (builder pages) ─────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 2.5rem; color: var(--c-accent-text); margin-bottom: 10px; }   /* same as every page */
.page-header p  { color: var(--c-text-muted); font-size: 1.1rem; }
 
/* ── Ship / Outfit picker rows ────────────────────────────── */
.sb-picker-group { margin-bottom: 4px; }
.sb-picker-group-label {
    color: #63b3ed;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 10px 10px 4px;
    border-top: 1px solid var(--c-border);
    user-select: none;
}
.sb-picker-group-label:first-child { border-top: none; padding-top: 4px; }
.sb-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--t-fast);
    background: rgba(15,23,42,0.30);
    margin: 1px 4px;
}
.sb-picker-row:hover { background: rgba(59,130,246,0.15); }
.sb-picker-name { font-size: 0.88rem; color: var(--c-text-mid); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-picker-meta { font-size: 0.76rem; color: var(--c-text-dim); white-space: nowrap; flex-shrink: 0; }
 
/* ── Mode badge ───────────────────────────────────────────── */
.badge-purple {
    background: rgba(139, 92, 246, 0.20);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.35);
}
 
/* ── Outfit space bar ─────────────────────────────────────── */
.sb-space-bar-track {
    height: 8px;
    background: rgba(15,23,42,0.60);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--c-border);
}
.sb-space-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    min-width: 2px;
}
 
/* ── Outfit size badge in list ────────────────────────────── */
.sb-outfit-size {
    font-size: 0.72rem;
    color: var(--c-text-dim);
    background: rgba(15,23,42,0.60);
    border: 1px solid var(--c-border-2);
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
 
/* ── Picker outfit size badge ─────────────────────────────── */
.sb-picker-size {
    display: inline-block;
    font-size: 0.72rem;
    padding: 1px 5px;
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.30);
    border-radius: 4px;
    color: var(--c-accent-text);
    margin-left: 6px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.sb-picker-size--over {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.30);
    color: var(--c-danger-text);
}
.sb-picker-row--over { opacity: 0.55; }
.sb-picker-row--over:hover { opacity: 1; }
 
/* ── Hardpoint index badge ────────────────────────────────── */
.sb-hp-idx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c-surface-3);
    border: 1px solid var(--c-border-2);
    font-size: 0.68rem;
    color: var(--c-text-dim);
    flex-shrink: 0;
}
.sb-hp-count-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--c-accent-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--c-border-2);
    margin-bottom: 8px;
}
 
/* ── Plugin picker rows ───────────────────────────────────── */

 
/* ── Active plugin strip ──────────────────────────────────── */


/* ═══════════════════════════════════════════════════════════════════
   Outfit Expander  —  append to main.css
   (shipBuilderOutfitExpander.js companion styles)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Wrapper: keeps row + panel together as one block ─────────────── */
.oe-wrapper,
.oe-picker-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
}

/* Cancel the bottom margin the row normally provides itself */
.oe-wrapper .outfit-item,
.oe-picker-wrapper .sb-picker-row {
    margin-bottom: 0;
}

/* ── Toggle button ────────────────────────────────────────────────── */
.oe-toggle {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    color: var(--c-text-dim);
    font-size: 0.6rem;
    line-height: 1;
    padding: 3px 5px;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}
.oe-toggle:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--c-border-hi);
    color: var(--c-accent-text);
}
.oe-toggle[aria-expanded="true"] {
    background: rgba(59, 130, 246, 0.20);
    border-color: var(--c-border-hi);
    color: var(--c-accent-text);
}

/* Picker toggle sits at the end of the row */
.oe-toggle--picker {
    margin-left: 8px;
}

/* ── Detail panel ─────────────────────────────────────────────────── */
.oe-panel {
    background: rgba(15, 23, 42, 0.70);
    border: 1px solid var(--c-border-hi);
    border-top: none;
    border-radius: 0 0 var(--r-sm) var(--r-sm);
    padding: 0 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.28s ease, opacity 0.22s ease, padding 0.22s ease;
}
.oe-panel--open {
    max-height: 600px;
    opacity: 1;
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.oe-stats-body {
    flex: 1;
    min-width: 0;
}
.oe-panel::-webkit-scrollbar       { width: 4px; }
.oe-panel::-webkit-scrollbar-track { background: transparent; }
.oe-panel::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.35); border-radius: 2px; }

/* ── Outfit image ─────────────────────────────────────────────────── */
.oe-img-wrap {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--c-border);
    background: rgba(15, 23, 42, 0.60);
    display: flex;
    align-items: center;
    justify-content: center;
}
.oe-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}
.oe-img-initials {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--c-text-dim);
    letter-spacing: -0.04em;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ── Description text ─────────────────────────────────────────────── */


/* ── Group title (Attributes / Computed) ──────────────────────────── */


/* ── Stat grid ────────────────────────────────────────────────────── */


/* ── Individual stat card ─────────────────────────────────────────── */


/* ── Empty state ──────────────────────────────────────────────────── */
.oe-no-stats {
    font-size: 0.82rem;
    color: var(--c-text-dim);
    font-style: italic;
    padding: 4px 0;
}

/* ── Narrow screens ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* picture above the stats so they get the panel's full width */
    .oe-panel--open { flex-direction: column; gap: 10px; }
    .oe-img-wrap  { width: 56px; height: 56px; }
    .oe-stats-body { width: 100%; }
    /* long values (ids, effect names) wrap under their label */
    .ad-row { flex-wrap: wrap; row-gap: 2px; }
    .ad-value { white-space: normal; overflow-wrap: anywhere; margin-left: auto; }
}

/* ── ≤640px: further compacting ─────────────────────────────── */
@media (max-width: 690px) {
    .results-compare {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    .res-divider { display: none; }
    .res-col { gap: 2px; }
    .res-col-a .res-row,
    .res-col-b .res-row { justify-content: flex-start; text-align: left; }
    .res-col-a .res-row-value { color: #93c5fd; }
    .res-col-b .res-row-value { color: #fca5a5; }

    .fight-btn { font-size: 0.95rem; padding: 12px 20px; }
}

/* Group header for Local Builds — slightly different colour to stand out */
.plugin-picker-group-header--local {
    background: linear-gradient(90deg, rgba(59,130,246,0.18) 0%, transparent 100%);
    color: #93c5fd;
    border-left: 3px solid #3b82f6;
    padding-left: 9px;
}
 
/* Row highlight for Local Builds entry */
.plugin-picker-row--local {
    border-left: 2px solid #3b82f6;
}
 
/* ── Local Builds — active plugin list ────────────────────────────────── */
 
/* Slightly tinted row so it's visually distinct from remote plugins */
.sorter-row--local {
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid #3b82f6;
    padding-left: 9px;
}
 
/* "📌 pinned first" badge */
.sorter-pin-badge {
    font-size: 0.72rem;
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 4px;
    padding: 2px 7px;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Ship Builder Stats */

#sbs-root {
    --sbs-bg:    #0d1826; --sbs-sur:  #162033; --sbs-sur2: #1d2d45;
    --sbs-bdr:   rgba(99,179,237,0.16); --sbs-acc: #63b3ed; --sbs-acc2: #38bdf8;
    --sbs-txt:   #e2e8f0; --sbs-mut:  #64748b; --sbs-dim:  #3d526b;
    --sbs-pos:   #4ade80; --sbs-neg:  #f87171; --sbs-r: 8px; --sbs-rsm: 5px;
    margin-top:28px; border:1px solid var(--sbs-bdr); border-radius:var(--sbs-r);
    background:var(--sbs-bg); overflow:hidden;
    box-shadow:0 6px 32px rgba(0,0,0,.45),inset 0 1px 0 rgba(99,179,237,.06);
}
#sbs-root .sbs-header {
    display:flex; align-items:center; gap:8px; padding:8px 12px;
    background:var(--sbs-sur); border-bottom:1px solid var(--sbs-bdr); flex-wrap:wrap;
}
#sbs-root .sbs-title {
    font-size:.72rem; font-weight:800; color:var(--sbs-acc);
    text-transform:uppercase; letter-spacing:.12em; white-space:nowrap; flex-shrink:0;
}
#sbs-root .sbs-tabs { display:flex; gap:4px; flex-wrap:wrap; flex:1; min-width:0; }
#sbs-root .sbs-tab {
    padding:3px 10px; border-radius:var(--sbs-rsm); border:1px solid var(--sbs-bdr);
    background:transparent; color:var(--sbs-mut); font-size:.72rem; font-weight:600;
    cursor:pointer; transition:background .12s,color .12s,border-color .12s; white-space:nowrap;
}
#sbs-root .sbs-tab:hover { background:var(--sbs-sur2); color:var(--sbs-txt); border-color:rgba(99,179,237,.5); }
#sbs-root .sbs-tab--active { background:#1d4ed8; color:#fff; border-color:#1d4ed8; }
#sbs-root .sbs-collapse-btn {
    margin-left:auto; padding:2px 8px; border-radius:var(--sbs-rsm);
    border:1px solid var(--sbs-bdr); background:transparent; color:var(--sbs-mut);
    font-size:.7rem; cursor:pointer; flex-shrink:0; transition:color .12s,border-color .12s;
}
#sbs-root .sbs-collapse-btn:hover { color:var(--sbs-txt); border-color:var(--sbs-acc); }
#sbs-root .sbs-body {
    padding:14px 14px 18px; max-height:420px; overflow-y:auto;
    scrollbar-width:thin; scrollbar-color:var(--sbs-dim) transparent;
}
#sbs-root .sbs-body::-webkit-scrollbar { width:5px; }
#sbs-root .sbs-body::-webkit-scrollbar-track { background:transparent; }
#sbs-root .sbs-body::-webkit-scrollbar-thumb { background:var(--sbs-dim); border-radius:3px; }
#sbs-root .sbs-content { display:flex; flex-direction:column; gap:16px; }
#sbs-root .sbs-empty {
    color:var(--sbs-mut); font-size:.82rem; font-style:italic;
    padding:14px 0; text-align:center; line-height:1.6;
}
#sbs-root .sbs-section { display:flex; flex-direction:column; gap:7px; }
#sbs-root .sbs-section-title {
    font-size:.63rem; font-weight:700; text-transform:uppercase;
    letter-spacing:.14em; color:var(--sbs-acc); border-bottom:1px solid var(--sbs-bdr); padding-bottom:3px;
}
#sbs-root .sbs-cards { display:flex; flex-wrap:wrap; gap:5px; }
#sbs-root .sbs-card {
    display:flex; flex-direction:column; background:var(--sbs-sur);
    border:1px solid var(--sbs-bdr); border-radius:var(--sbs-rsm);
    padding:5px 10px 6px; min-width:80px; transition:border-color .12s,background .12s;
}
#sbs-root .sbs-card:hover { border-color:rgba(99,179,237,.4); background:var(--sbs-sur2); }
#sbs-root .sbs-card--hi   { border-color:rgba(99,179,237,.35); background:var(--sbs-sur2); }
#sbs-root .sbs-label {
    font-size:.58rem; font-weight:700; text-transform:uppercase; letter-spacing:.07em;
    color:var(--sbs-mut); margin-bottom:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#sbs-root .sbs-value {
    font-size:.88rem; font-weight:700; color:var(--sbs-txt);
    font-variant-numeric:tabular-nums; white-space:nowrap;
}
#sbs-root .sbs-unit { font-size:.6rem; font-weight:400; color:var(--sbs-mut); margin-left:2px; }
#sbs-root .sbs-table-wrap { overflow-x:auto; }
#sbs-root .sbs-table { width:100%; border-collapse:collapse; font-size:.76rem; }
#sbs-root .sbs-table th {
    color:var(--sbs-mut); font-size:.62rem; text-transform:uppercase; letter-spacing:.08em;
    padding:4px 8px; border-bottom:1px solid var(--sbs-bdr); font-weight:700; white-space:nowrap;
}
#sbs-root .sbs-table td {
    padding:5px 8px; color:var(--sbs-txt);
    border-bottom:1px solid rgba(99,179,237,.06); vertical-align:middle;
}
#sbs-root .sbs-table tbody tr:hover td { background:var(--sbs-sur2); }
#sbs-root .sbs-wt-name  { font-weight:600; }
#sbs-root .sbs-wt-num   { text-align:right; font-variant-numeric:tabular-nums; color:var(--sbs-mut); }
#sbs-root .sbs-wt-count { font-size:.68rem; color:var(--sbs-mut); margin-left:2px; }
#sbs-root .sbs-badge {
    display:inline-block; font-size:.55rem; font-weight:800; letter-spacing:.05em;
    padding:1px 4px; border-radius:3px; vertical-align:middle; margin-left:3px; line-height:1.4;
}
#sbs-root .sbs-badge--blue  { background:rgba(59,130,246,.2);  color:#93c5fd; border:1px solid rgba(59,130,246,.35); }
#sbs-root .sbs-badge--amber { background:rgba(251,191,36,.15); color:#fcd34d; border:1px solid rgba(251,191,36,.35); }
#sbs-root .sbs-badge--red   { background:rgba(239,68,68,.15);  color:#fca5a5; border:1px solid rgba(239,68,68,.35); }

.sorter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px 8px;
    border-top: 1px solid rgba(59, 130, 246, 0.15);
    margin-top: auto;
}

.sorter-badge {
    display: flex;
    align-items: baseline;
    gap: 5px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11px;
}

.sorter-badge-label {
    color: #93c5fd;
    font-weight: 500;
}

.sorter-badge-value {
    color: #e2e8f0;
    font-weight: 600;
}

/* ─── compare.css ────────────────────────────────────────────────────────────
   Styles for the Compare feature:
     • .compare-bar        — sticky bottom bar
     • .compare-panel      — full-screen slide-up overlay
     • .compare-columns    — side-by-side column view
     • .compare-table      — attribute table view
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Bottom bar ─────────────────────────────────────────────────────────────── */

.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    height: 52px;
    background: rgba(15, 23, 42, 0.97);
    border-top: 1px solid rgba(59, 130, 246, 0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    transition: border-color 0.25s, box-shadow 0.25s;
}

.compare-bar--has-items {
    border-top-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 -4px 32px rgba(59, 130, 246, 0.15);
}

.compare-bar__left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden; /* clips scroll region against bar edge */
}

.compare-bar__icon {
    font-size: 1.15rem;
    flex-shrink: 0;
}

/* Scroll container — label and chips move together */
.compare-bar__scroll {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge */
}
.compare-bar__scroll::-webkit-scrollbar {
    display: none;              /* Chrome/Safari */
}

.compare-bar__label {
    font-size: 0.82rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.compare-bar__chips {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0; /* never compress — scroll instead */
}

/* ── Qty controls inside compare bar chips ────────────────────── */

/* Chip grows to accommodate the spinner */
.compare-bar__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 999px;
    padding: 2px 8px 2px 10px;
    font-size: 0.72rem;
    color: #93c5fd;
    white-space: nowrap;
    flex-shrink: 0; /* full name always visible, never truncated */
}

/* Inline qty control — compact version of .compare-qty */

.compare-qty__input {
    width: 2.5em;
    text-align: center;
    -moz-appearance: textfield;
    background: none;
}
.compare-qty__input::-webkit-inner-spin-button,
.compare-qty__input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.compare-bar__chip-remove {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0 1px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.compare-bar__chip-remove:hover { color: #ef4444; }

/* ── Group member list in column header ─────────────────────── */

.compare-col__member-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(59, 130, 246, 0.18);
    text-align: left;
}

.compare-col__member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    background: rgba(15, 23, 42, 0.40);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: var(--r-sm);
    transition: background var(--t-fast), border-color var(--t-fast);
}
.compare-col__member-row:hover {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.28);
}

.compare-col__member-name {
    font-size: 0.78rem;
    color: var(--c-text-mid);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Compact variant of .compare-qty for use inside the header */
.compare-qty--sm {
    margin-top: 0;
    flex-shrink: 0;
}
.compare-qty--sm .compare-qty__btn {
    width: 20px;
    height: 20px;
    font-size: 0.78rem;
}
.compare-qty--sm .compare-qty__val {
    font-size: 0.65rem;
    min-width: 26px;
    line-height: 20px;
    padding: 0 5px;
}

.compare-bar__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.compare-bar__clear {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 6px;
    color: #f87171;
    font-size: 0.78rem;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.compare-bar__clear:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.6);
}

.compare-bar__open {
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 6px;
    color: #93c5fd;
    font-size: 0.82rem;
    padding: 5px 16px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.compare-bar__open:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.7);
}

/* ── Panel ──────────────────────────────────────────────────────────────────── */

.compare-panel {
    position: fixed;
    bottom: 52px; /* sit above the bar */
    left: 0;
    right: 0;
    height: calc(100vh - 52px - 60px); /* 60px headroom for the page header */
    z-index: 890;
    background: rgba(10, 17, 32, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(59, 130, 246, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
}

.compare-panel--open {
    transform: translateY(0);
}

.compare-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.18);
    flex-shrink: 0;
}

.compare-panel__title {
    font-size: 1.05rem;
    color: #e2e8f0;
    font-weight: 600;
    margin: 0;
}

.compare-panel__controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compare-panel__close {
    background: none;
    border: 1px solid rgba(100, 116, 139, 0.35);
    border-radius: 6px;
    color: #94a3b8;
    font-size: 1rem;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}
.compare-panel__close:hover {
    color: #e2e8f0;
    border-color: rgba(100, 116, 139, 0.7);
}

.compare-panel__body {
    flex: 1;
    overflow: auto;
    padding: 20px 24px;
}

/* ── View mode toggle ───────────────────────────────────────────────────────── */

.compare-toggle {
    display: flex;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.compare-toggle__btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.78rem;
    padding: 5px 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.compare-toggle__btn--active {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.compare-toggle__btn:hover:not(.compare-toggle__btn--active) {
    background: rgba(59, 130, 246, 0.08);
    color: #cbd5e1;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */

.compare-empty {
    color: #475569;
    text-align: center;
    padding: 40px 0;
    font-size: 0.95rem;
}

/* ── Columns view ───────────────────────────────────────────────────────────── */

.compare-columns {
    display: grid;
    gap: 16px;
    align-items: start;
}

.compare-col {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 10px;
    overflow: hidden;
}

.compare-col__header {
    background: rgba(30, 41, 59, 0.7);
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
    padding: 14px;
    text-align: center;
    position: relative;
}

.compare-col__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    color: #f87171;
    font-size: 0.68rem;
    padding: 2px 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.compare-col__remove:hover {
    background: rgba(239, 68, 68, 0.15);
}

.compare-col__img {
    width: 80px;
    height: 80px;
    margin: 8px auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-col__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.3;
}

.compare-col__sub {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
}

.compare-col__row {
    display: flex;
    flex-direction: column;
    padding: 7px 14px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.6);
}
.compare-col__row:last-child { border-bottom: none; }

.compare-col__key {
    font-size: 0.68rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.compare-col__val {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-top: 1px;
}

/* ── Table view ─────────────────────────────────────────────────────────────── */

.compare-table-wrap {
    overflow: auto;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    min-width: 500px;
}

.compare-table__corner {
    background: rgba(15, 23, 42, 0.8);
    color: #475569;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 2;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    width: 160px;
    min-width: 140px;
}

.compare-table__item-header {
    background: rgba(20, 30, 50, 0.9);
    padding: 14px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    min-width: 180px;
    position: relative;
}

.compare-table__thumb {
    width: 56px;
    height: 56px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-table__item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
}

.compare-table__key {
    color: #64748b;
    padding: 7px 16px;
    white-space: nowrap;
    position: sticky;
    left: 0;
    z-index: 1;
    font-size: 0.78rem;
}

.compare-table__val {
    color: #cbd5e1;
    padding: 7px 16px;
    text-align: center;
}

.compare-table__row--even .compare-table__key,
.compare-table__row--even .compare-table__val {
    background: rgba(15, 23, 42, 0.55);
}

.compare-table__row--odd .compare-table__key,
.compare-table__row--odd .compare-table__val {
    background: rgba(20, 30, 50, 0.45);
}

.compare-table tr:hover .compare-table__key,
.compare-table tr:hover .compare-table__val {
    background: rgba(59, 130, 246, 0.07);
}

/* ── Thumbnail placeholder ──────────────────────────────────────────────────── */

.compare-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 4px;
}

/* ── "Add to Compare" button injected into cards & modal ────────────────────── */

.btn-compare {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 5px;
    color: #93c5fd;
    font-size: 0.72rem;
    padding: 3px 9px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn-compare:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
}

.btn-compare--active {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.7);
    color: #bfdbfe;
}

/* ── Push page content up so bar doesn't overlap it ────────────────────────── */

body {
    padding-bottom: 56px;
}

/* ── Column section headers ─────────────────────────────────────────────────── */

.compare-col__section {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #3b82f6;
    background: rgba(30, 41, 59, 0.85);
    padding: 6px 14px 4px;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    border-bottom: 1px solid rgba(59, 130, 246, 0.1);
    margin-top: 2px;
}

.compare-col__section:first-of-type {
    margin-top: 0;
    border-top: none;
}

/* ── Table section header rows ──────────────────────────────────────────────── */

.compare-table__section-row {
    /* no alternating colour */
}

.compare-table__section-header {
    background: rgba(30, 41, 59, 0.9) !important;
    color: #3b82f6;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 7px 16px 5px;
    border-top: 1px solid rgba(59, 130, 246, 0.25);
    border-bottom: 1px solid rgba(59, 130, 246, 0.12);
    position: sticky;
    left: 0;
}

/* ── Table item sub-label (internal name / category under main name) ────────── */

.compare-table__item-sub {
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 2px;
}

/* ── Weapon detail divider row (columns view) ───────────────────────────────── */

.compare-col__divider {
    font-size: 0.65rem;
    color: #3b82f6;
    opacity: 0.6;
    text-align: center;
    padding: 4px 14px 2px;
    border-top: 1px solid rgba(59, 130, 246, 0.15);
    letter-spacing: 0.05em;
}

/* ── Fleet summary banner ────────────────────────────────────────────────────── */


/* ── Quantity multiplier control ────────────────────────────────────────────
   Appears in each column/table header: [−] [×N] [+]
   Matches the existing compare panel design tokens.
   ─────────────────────────────────────────────────────────────────────────── */

.compare-qty {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-top: 10px;
    border: 1px solid rgba(59, 130, 246, 0.30);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.55);
}

/* − and + buttons */
.compare-qty__btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1rem;
    line-height: 1;
    width: 26px;
    height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    font-weight: 700;
    /* subtle separator lines between the three segments */
    border-right: 1px solid rgba(59, 130, 246, 0.18);
}
.compare-qty__btn:last-child {
    border-right: none;
    border-left: 1px solid rgba(59, 130, 246, 0.18);
}

.compare-qty__btn:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

/* ×N display */
.compare-qty__val {
    font-size: 0.72rem;
    font-weight: 700;
    color: #93c5fd;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    padding: 0 8px;
    min-width: 32px;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    line-height: 26px;
}

/* When qty > 1, highlight the whole control so it's visually obvious */
.compare-qty:has(.compare-qty__val:not([data-qty="1"])) {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.10);
}

/* Table header variant — same widget, just a bit more compact */
.compare-table__item-header .compare-qty {
    margin-top: 8px;
    margin-bottom: 8px;
}

.compare-val--best  { color: #4caf50; font-weight: 600; }
.compare-val--worst { color: #e05252; font-weight: 600; }

/* ── Group compare — modal & column additions ───────────────────
   These rules fix the .compare-modal-overlay / .compare-modal
   block at the bottom of main.css.  Replace the existing block
   (the one that references --bg, --border, --accent, --bg-input)
   with this one, which uses the established --c-* / --r-* tokens.
   ─────────────────────────────────────────────────────────────── */

/* ── Modal overlay (replaces the broken --bg / --border version) */
.compare-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.80);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-modal {
    background: linear-gradient(135deg, rgba(15,23,42,0.97), rgba(30,41,59,0.97));
    border: 2px solid rgba(59, 130, 246, 0.50);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    width: min(520px, 92vw);
    max-height: 82vh;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.compare-modal__title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--c-accent-text);
}

/* ── Name field ─────────────────────────────────────────────── */
.compare-modal__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.compare-modal__field label {
    font-size: 0.82rem;
    color: var(--c-text-muted);
    margin-bottom: 0;
}

.compare-modal__input {
    width: 100%;
    padding: 10px 12px;
    background: var(--c-surface-2);
    border: 1px solid rgba(59, 130, 246, 0.40);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.compare-modal__input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.20);
}

/* ── Member list ────────────────────────────────────────────── */
.compare-modal__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-border);
    background: rgba(15, 23, 42, 0.40);
    scrollbar-width: thin;
    scrollbar-color: rgba(59,130,246,0.40) transparent;
}
.compare-modal__list::-webkit-scrollbar { width: 6px; }
.compare-modal__list::-webkit-scrollbar-track { background: rgba(15,23,42,0.40); border-radius: 3px; }
.compare-modal__list::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.40); border-radius: 3px; }

.compare-modal__list-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--c-text-muted);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 4px;
    user-select: none;
}

.compare-modal__item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.30);
    transition: background var(--t-fast), border-color var(--t-fast);
}
.compare-modal__item-row:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--c-border);
}

.compare-modal__item-row input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--c-accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.compare-modal__item-label {
    flex: 1;
    font-size: 0.88rem;
    color: var(--c-text-mid);
    cursor: pointer;
    user-select: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compare-modal__item-qty {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid rgba(59, 130, 246, 0.30);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: rgba(15, 23, 42, 0.55);
    flex-shrink: 0;
}

.compare-modal__empty {
    color: var(--c-text-muted);
    font-style: italic;
    font-size: 0.85rem;
    padding: 10px 0;
    text-align: center;
}

/* ── Buttons row ────────────────────────────────────────────── */
.compare-modal__btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 4px;
}

.compare-modal__btn {
    padding: 8px 18px;
    border-radius: var(--r-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
    font-family: inherit;
}

.compare-modal__btn--cancel {
    background: rgba(71, 85, 105, 0.70);
    color: var(--c-text);
    border-color: var(--c-border);
}
.compare-modal__btn--cancel:hover {
    background: rgba(71, 85, 105, 1);
}

.compare-modal__btn--confirm {
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-dark));
    color: #fff;
}
.compare-modal__btn--confirm:hover {
    background: linear-gradient(135deg, var(--c-accent-dark), #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.40);
}

.compare-modal__btn--delete {
    background: var(--c-danger);
    color: var(--c-danger-text);
    border-color: rgba(239, 68, 68, 0.30);
    margin-right: auto;
}
.compare-modal__btn--delete:hover {
    background: rgba(239, 68, 68, 0.30);
    border-color: var(--c-danger-hi);
    color: var(--c-danger-hi);
}

/* ── Group column header ────────────────────────────────────── */
.compare-col--group .compare-col__header {
    background: rgba(30, 41, 59, 0.80);
    border-bottom-color: rgba(59, 130, 246, 0.25);
}

.compare-col__group-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
}

.compare-col__member-count {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.compare-col__edit-group {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.30);
    border-radius: var(--r-sm);
    color: var(--c-accent-text);
    font-size: 0.75rem;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.compare-col__edit-group:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.55);
}

/* ── Group member qty row in column body ────────────────────── */
.compare-col__row--qty {
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: rgba(59, 130, 246, 0.06);
    border-top: 1px solid rgba(59, 130, 246, 0.12);
}
.compare-col__row--qty .compare-col__key {
    font-size: 0.82rem;
    color: var(--c-text-mid);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Create Group bar button ────────────────────────────────── */
.compare-bar__create-group {
    padding: 5px 12px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.10);
    color: var(--c-accent-text);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
    white-space: nowrap;
    flex-shrink: 0;
}
.compare-bar__create-group:hover {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(59, 130, 246, 0.60);
}

/* ── ≤600px: small phone ─────────────────────────────────────── */
@media (max-width: 600px) {
    .list-row__label { min-width: 90px; font-size: 0.85rem; }
    .sorter-avg      { display: none; }
    .weapons-grid    { grid-template-columns: 1fr; }

    .ranking-item {
        flex-wrap: wrap;
        gap: 6px;
    }
    .ranking-dps, .ranking-ehp { display: none; }
}

        /* ── Page-anchor quick nav ─────────────────────────────────────── */
        .toc-panel {
            padding: 18px 20px;
            margin-bottom: 30px;
        }
        .toc-list {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            list-style: none;
        }
        .toc-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 8px 16px;
            background: rgba(30, 41, 59, 0.60);
            border: 1px solid var(--c-border);
            border-radius: var(--r-md);
            color: var(--c-text-mid);
            text-decoration: none;
            font-size: 0.9rem;
            font-weight: 500;
            transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
        }
        .toc-link:hover {
            background: rgba(59, 130, 246, 0.20);
            color: var(--c-accent-text);
            border-color: var(--c-accent);
        }

        /* ── Section wrapper ──────────────────────────────────────────── */
        .about-section {
            padding: 25px 30px;
            margin-bottom: 30px;
            scroll-margin-top: 20px; /* offset for anchor jumps */
        }
        .about-section h2 {
            color: var(--c-accent-text);
            font-size: 1.7rem;
            margin-bottom: 8px;
        }
        .about-section .subtitle { margin-bottom: 20px; }

        /* ── Contributor cards ────────────────────────────────────────── */
        .contributor-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
            gap: 16px;
        }
        .contributor-card {
            background: rgba(15, 23, 42, 0.55);
            border: 1px solid var(--c-border);
            border-radius: var(--r-lg);
            padding: 16px 18px;
            transition: border-color var(--t-base), transform var(--t-base);
        }
        .contributor-card:hover {
            border-color: var(--c-accent);
            transform: translateY(-2px);
        }
        .contributor-name {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--c-accent-text);
            margin-bottom: 8px;
        }
        .contributor-role {
            display: inline-block;
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            padding: 2px 8px;
            border-radius: 10px;
            background: rgba(59, 130, 246, 0.15);
            border: 1px solid rgba(59, 130, 246, 0.35);
            color: var(--c-accent-text);
            margin-bottom: 10px;
        }
        .contributor-desc {
            font-size: 0.9rem;
            color: var(--c-text-mid);
            line-height: 1.5;
        }

        /* ── Per-page feature blocks ──────────────────────────────────── */
        .page-block {
            border: 1px solid var(--c-border);
            border-radius: var(--r-lg);
            margin-bottom: 20px;
            overflow: hidden;
        }
        .page-block-header {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 14px 18px;
            background: rgba(30, 41, 59, 0.55);
            border-bottom: 1px solid var(--c-border);
        }
        .page-block-title {
            font-size: 1.15rem;
            font-weight: 700;
            color: var(--c-accent-text);
        }
        .page-block-status {
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            padding: 2px 8px;
            border-radius: 10px;
            margin-left: auto;
        }
        .status-live      { background: var(--c-success); color: var(--c-success-text); border: 1px solid rgba(34,197,94,0.35); }
        .status-progress  { background: var(--c-warn);    color: var(--c-warn-text);    border: 1px solid rgba(250,200,50,0.35); }
        .status-planned   { background: rgba(100,116,139,0.20); color: var(--c-text-muted); border: 1px solid var(--c-border-2); }

        .page-block-body {
            padding: 16px 18px;
        }
        .feature-list {
            list-style: none;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .feature-list li {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            font-size: 0.92rem;
            color: var(--c-text-mid);
            padding: 8px 12px;
            background: rgba(15, 23, 42, 0.35);
            border-radius: var(--r-sm);
        }
        .feature-list li::before {
            content: "▸";
            color: var(--c-accent);
            flex-shrink: 0;
        }

        /* ── Bugs list ─────────────────────────────────────────────────── */
        .bug-item {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 12px 14px;
            border-radius: var(--r-md);
            background: rgba(239, 68, 68, 0.08);
            border: 1px solid rgba(239, 68, 68, 0.25);
            margin-bottom: 10px;
        }
        .bug-icon { flex-shrink: 0; font-size: 1.1rem; }
        .bug-text { color: var(--c-text-mid); font-size: 0.92rem; line-height: 1.5; }
        .bug-text strong { color: var(--c-danger-text); }

        /* ── Future plans ─────────────────────────────────────────────── */
        .plan-item {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 12px 14px;
            border-radius: var(--r-md);
            background: rgba(59, 130, 246, 0.08);
            border: 1px solid rgba(59, 130, 246, 0.25);
            margin-bottom: 10px;
        }
        .plan-icon { flex-shrink: 0; font-size: 1.1rem; }
        .plan-text { color: var(--c-text-mid); font-size: 0.92rem; line-height: 1.5; }
        .plan-text strong { color: var(--c-accent-text); }

        /* ── Back to top button ───────────────────────────────────────── */
        #backToTopBtn {
            position: fixed;
            right: 24px;
            bottom: 24px;
            z-index: 1500;
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--c-accent), var(--c-accent-dark));
            border: none;
            color: #fff;
            font-size: 1.3rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--shadow-md);
            opacity: 0;
            transform: translateY(16px);
            pointer-events: none;
            transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.2s ease;
        }
        #backToTopBtn.visible {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }
        #backToTopBtn:hover {
            box-shadow: 0 6px 20px rgba(59, 130, 246, 0.50);
            transform: translateY(-2px);
        }

/* ── ≤500px: attribute grid single col ──────────────────────── */
@media (max-width: 500px) {
    .ad-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── ≤420px: very small phones ──────────────────────────────── */
@media (max-width: 420px) {

    .ship-accordion-quick-stats { display: none; }

    .team-card { min-width: 0; max-width: 100%; }

    .phase-time { min-width: 38px; font-size: 0.68rem; }
    .phase-text { font-size: 0.82rem; }
}


/* ═══════════════════════════════════════════════════════════════
   Mission Data Viewer — page-specific styles
   (previously temp.css, merged in here — see UserManagerMissionDisplay.js
   header comment for the two optional elements these expect:
   #statusFilterSelect and #noSaveNotice)
   ═══════════════════════════════════════════════════════════════ */

/* Same page width as every other page; on wide screens the cards sit two
   (or three) to a row, on phones one — each card keeps its own height. */
#missionList {
    margin: 20px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr));
    align-items: start;
    gap: 14px;
}
#missionList > :not(.mission-card) { grid-column: 1 / -1; }

.mission-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.mission-head {
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    transition: background var(--t-fast);
}
.mission-head:hover { background: var(--c-surface-3); }

.mission-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--c-text);
}

.mission-plugin {
    color: var(--c-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Mission content now renders inside the shared .modal-box--detail
   overlay (see UserManagerMissionDisplay.js's MissionModal) rather than
   an inline card dropdown, so this no longer needs a hide/show toggle —
   it's just the content wrapper's own spacing now. */


.mission-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}
.mission-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--c-surface-3);
    border: 1px solid var(--c-border-2);
    color: var(--c-text-muted);
}
.mission-badge--repeatable { color: var(--c-success-text); border-color: var(--c-success-text); }
.mission-badge--illegal    { color: var(--c-danger-text);  border-color: var(--c-danger-hi); }
.mission-badge--flag       { color: var(--c-accent-text);  border-color: var(--c-accent); }

.mission-field-grid {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 6px 12px;
    margin: 10px 0;
    font-size: 0.88rem;
}
.mission-field-label { color: var(--c-text-muted); }
.mission-field-value { color: var(--c-text-mid); word-break: break-word; }

.mission-description {
    background: var(--c-surface-3);
    border: 1px solid var(--c-border-2);
    border-radius: var(--r-md);
    padding: 10px 12px;
    margin: 10px 0;
    font-size: 0.9rem;
    color: var(--c-text-mid);
    white-space: pre-wrap;
}

.mission-subhead {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--c-text-muted);
    margin: 16px 0 6px;
}

.mission-reward-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.88rem;
    color: var(--c-text-mid);
}
.mission-reward-list li { padding: 3px 0; }

.mission-tag {
    background: var(--c-surface-3);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    color: var(--c-accent-text);
}

.mission-raw-toggle {
    margin-top: 14px;
    font-size: 0.82rem;
    color: var(--c-accent-text);
    cursor: pointer;
    user-select: none;
    display: inline-block;
}
.mission-raw-tree {
    display: none;
    margin-top: 10px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--c-border-2);
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    overflow-x: auto;
}
.mission-raw-tree.open { display: block; }
.mission-raw-line { white-space: pre; color: var(--c-text-mid); }
.mission-raw-key   { color: var(--c-accent-text); }
.mission-raw-value { color: var(--c-warn-text); }
.mission-raw-text  { color: var(--c-text-muted); font-style: italic; }
.mission-raw-truncated {
    color: var(--c-warn-text);
    font-style: italic;
    margin-top: 6px;
}

.mission-empty { color: var(--c-text-muted); font-style: italic; }

/* Search bar + count label alongside the header's other controls */
#searchInput {
    flex: 1;
    min-width: 220px;
    padding: 12px;
    background: var(--c-surface-2);
    border: 1px solid rgba(59, 130, 246, 0.40);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 1rem;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
#searchInput:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.20);
}
#searchInput:disabled { opacity: 0.5; }
#countLabel {
    color: var(--c-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}
.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* ── Save-file status badges ─────────────────────────────────── */
.mission-head-right {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* ── Mission detail modal (reuses the app's shared .modal-overlay /
   .modal-box--detail / .modal-header / .modal-title / .modal-close —
   see main.css's "Shared: modal overlay" section — this is only the
   handful of things specific to mission content) ─────────────────── */
#missionModalPlugin {
    margin-top: 2px;
}

.mission-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--c-border);
}
.mission-modal-actions:empty { display: none; }
.mission-modal-actions .btn,
.mission-modal-actions button {
    font-size: 0.85rem;
}


.mission-status-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.mission-status-badge--active    { background: rgba(59,130,246,0.15);  color: var(--c-accent-text);  border-color: var(--c-accent); }
.mission-status-badge--available { background: var(--c-surface-3);     color: var(--c-text-muted);   border-color: var(--c-border-2); }
.mission-status-badge--done      { background: rgba(34,197,94,0.15);   color: var(--c-success-text); border-color: var(--c-success-text); }
.mission-status-badge--failed    { background: rgba(239,68,68,0.15);   color: var(--c-danger-text);  border-color: var(--c-danger-hi); }
.mission-status-badge--declined  { background: var(--c-surface-3);     color: var(--c-text-muted);   border-color: var(--c-border-2); }
.mission-status-badge--mixed     { background: rgba(234,179,8,0.15);   color: var(--c-warn-text);    border-color: var(--c-warn-text); }
.mission-status-badge--offered   { background: var(--c-surface-3);     color: var(--c-text-muted);   border-color: var(--c-border-2); }

.mission-status-warning {
    font-size: 0.85rem;
    cursor: help;
}

.mission-warning-banner {
    background: rgba(234,179,8,0.10);
    border: 1px solid var(--c-warn-text);
    color: var(--c-warn-text);
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 14px;
}
.mission-warning-banner .mission-tag {
    color: inherit;
}

/* #statusFilterSelect uses the site-wide drop-down style (see "select" above) */

#noSaveNotice {
    font-size: 0.82rem;
    color: var(--c-text-muted);
    font-style: italic;
    margin: 0 0 14px;
}
#noSaveNotice.hidden { display: none; }

/* ── Save cleanup panel ──────────────────────────────────────── */
.cleanup-section { margin-bottom: 18px; }
.cleanup-section:last-of-type { margin-bottom: 12px; }

.cleanup-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 8px;
}

.cleanup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--c-border-2);
    border-radius: var(--r-md);
}

.cleanup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 12px;
    font-size: 0.85rem;
    color: var(--c-text-mid);
    border-bottom: 1px solid var(--c-border-2);
}
.cleanup-row:last-child { border-bottom: none; }

.cleanup-empty {
    padding: 10px 12px;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    font-style: italic;
}

.btn-cleanup-remove {
    background: var(--c-surface-3);
    border: 1px solid var(--c-danger-hi);
    color: var(--c-danger-text);
    border-radius: var(--r-sm, 4px);
    padding: 3px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
}
.btn-cleanup-remove:hover { background: rgba(239,68,68,0.12); }

.btn-cleanup-remove-all {
    background: transparent;
    border: 1px solid var(--c-border-2);
    color: var(--c-text-muted);
    border-radius: var(--r-sm, 4px);
    padding: 3px 10px;
    font-size: 0.78rem;
    cursor: pointer;
}
.btn-cleanup-remove-all:hover { color: var(--c-danger-text); border-color: var(--c-danger-hi); }

.btn-cleanup-reset {
    background: var(--c-surface-3);
    border: 1px solid var(--c-border-2);
    color: var(--c-text-muted);
    border-radius: var(--r-md);
    padding: 7px 12px;
    font-size: 0.82rem;
    cursor: pointer;
}
.btn-cleanup-reset:hover { color: var(--c-text); }

/* ── Account / auth widget ─────────────────────────────────────── */
/* Built from the existing .overlay / .modal-box / .modal-tabs /
   .text-input / .btn utilities above rather than a separate system —
   these are just the few extra pieces those didn't already cover. */

.modal-box--auth {
    width: min(400px, 92vw);
    padding: 28px;
}

.es-nav__account {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.auth-field {
    margin-bottom: 16px;
}
.auth-field label {
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.auth-field-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    min-height: 1.1em; /* reserves space so layout doesn't jump when a hint appears */
    transition: color var(--t-fast);
}
.auth-field-hint--checking { color: var(--c-text-dim); }
.auth-field-hint--ok       { color: var(--c-success-text); }
.auth-field-hint--bad      { color: var(--c-danger-text); }

.auth-form-error {
    background: var(--c-danger);
    border: 1px solid var(--c-danger-hi);
    color: var(--c-danger-text);
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-size: 0.88rem;
    margin-bottom: 16px;
}
.auth-form-success {
    background: var(--c-success);
    border: 1px solid var(--c-success-text);
    color: var(--c-success-text);
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
}
.auth-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.auth-switch {
    text-align: center;
    margin-top: 18px;
    font-size: 0.88rem;
    color: var(--c-text-muted);
}
.auth-switch button {
    background: none;
    border: none;
    color: var(--c-accent-text);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
    padding: 0;
}
.auth-switch button:hover { color: var(--c-text); }

/* ── Account controls inside the mobile drawer ─────────────────── */
/* Built entirely by navBar.js (appended after the flattened nav
   links), mirrors the top-bar widget's two states. */
.nav-drawer-account {
    border-top: 1px solid var(--nav-border, var(--c-border));
    margin-top: 8px;
    padding-top: 12px;
}
.nav-drawer-account-email {
    display: block;
    padding: 8px 14px;
    color: var(--c-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Small-screen collapses ────────────────────────────────────── */
@media (max-width: 600px) {
    /* My Account panel (UserManager.html): username/email side-by-side
       becomes stacked — 1fr 1fr at 320px width leaves each field an
       unusably narrow ~130px. */
    #account-logged-in .account-fields-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    .modal-box--auth { padding: 20px; }
}

/* ── Public build attribution ──────────────────────────────────── */
.card-owner-line {
    text-align: center;
    font-size: 0.8rem;
    color: var(--c-text-muted);
    font-style: italic;
    margin-top: 8px;
}
.modal-owner-line {
    font-size: 0.9rem;
    color: var(--c-text-muted);
    font-style: italic;
    margin-bottom: 16px;
}
/* ── Dropdowns (every <select> on the site) ──────────────────────
   One look for all selects: the site's dark input surface, a drawn
   chevron instead of the browser's own arrow, and the same focus ring
   as text inputs. Multi-line list boxes (multiple / size) keep their
   native layout and only get the colours. */
select {
    font: inherit;
    color: var(--c-text);
    background-color: var(--c-surface-2);
    border: 1px solid rgba(59, 130, 246, 0.40);
    border-radius: var(--r-md);
    transition: border-color var(--t-fast, 0.15s), box-shadow var(--t-fast, 0.15s), background-color var(--t-fast, 0.15s);
    color-scheme: dark;
}
select:not([multiple]):not([size]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 40px;
    padding: 8px 40px 8px 12px;
    line-height: 1.3;
    cursor: pointer;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2393c5fd' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
        linear-gradient(to right, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.25));
    background-repeat: no-repeat, no-repeat;
    background-position: right 14px center, right 36px center;
    background-size: 12px 8px, 1px 55%;
    text-overflow: ellipsis;
}
select:hover:not(:disabled) {
    border-color: var(--c-accent);
    background-color: rgba(30, 41, 59, 0.95);
}
select:focus,
select:focus-visible {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
select option,
select optgroup {
    background: #1e293b;
    color: var(--c-text);
}
select option:checked {
    background: #1e3a8a;
    color: #fff;
}
select optgroup { color: var(--c-accent-text); font-weight: 600; }
/* inline "width:auto" selects shouldn't shrink below their chevron */
select[style*="width:auto"], select[style*="width: auto"] { min-width: 140px; }
@media (prefers-reduced-motion: reduce) { select { transition: none; } }

/* ══════════════════════════════════════════════════════════════════
   Mobile & touch
   One layer for every page: nothing wider than the screen, controls big
   enough for a finger, and no zoom-jump when tapping a text box (iOS
   zooms into any input under 16px).
   ══════════════════════════════════════════════════════════════════ */
img, video, canvas { max-width: 100%; }
/* a panel holding an open type-ahead list sits above the panels after it */
.panel:focus-within { position: relative; z-index: 4; }
.sv-jump { display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.8rem; }
.button-group { flex-wrap: wrap; }
.fleet-card__actions { flex-wrap: wrap; }
.mission-raw-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.list-row__label, .ld-pill, .fleet-card__name { overflow-wrap: anywhere; }

@media (max-width: 640px) {
    /* tab strips scroll sideways instead of pushing the page wider */
    .tabs { overflow-x: auto; flex-wrap: nowrap; gap: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .tabs::-webkit-scrollbar { display: none; }
    .tabs .tab { flex: 0 0 auto; padding: 10px 14px; white-space: nowrap; }
    .button-group > .btn { flex: 1 1 calc(50% - 10px); }
    .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
    .toast.toast--action { justify-content: space-between; }
    .modal-box, .modal-box--detail { padding: 18px; border-radius: 14px; }
    .modal-box--detail { max-height: 92dvh; }
    .panel { padding-left: 14px; padding-right: 14px; }
    h1 { word-break: break-word; }
    /* ship builder outfit rows: name gets its own line, size tags + count +
       remove wrap underneath instead of squeezing the name to nothing */
    .outfit-item { flex-wrap: wrap; row-gap: 6px; }
    .outfit-item__name { flex: 1 1 calc(100% - 44px); white-space: normal; overflow-wrap: anywhere; }
    .outfit-item__count { margin-left: auto; }
    .outfit-item > .btn-danger { flex: 0 0 auto; }
    /* hardpoint rows: position + ⚙ + ✕ on one line, the mounted outfit below */
    .outfit-item .sb-hp-over { order: 5; flex: 1 1 100%; width: auto !important; }
    .outfit-item .sb-hp-over ~ :not(button) { order: 6; }
    /* add-outfit / pick-ship lists: name on its own line, details under it */
    .sb-picker-row { flex-wrap: wrap; row-gap: 4px; }
    .sb-picker-name { flex: 1 1 100%; white-space: normal; }
    .sb-picker-meta { flex-shrink: 1 !important; flex-wrap: wrap; white-space: normal; }
    /* save editor: jump links in one sideways-scrolling row, so the sticky bar stays short */
    .sv-jump { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; padding-bottom: 2px; }
    .sv-jump::-webkit-scrollbar { display: none; }
    .sv-jump .ld-pill { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 380px) {
    /* very narrow phones: card thumbnails above the text, details in one column */
    .card-inner { flex-wrap: wrap; }
    .card-details { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .detail-value, .detail-label { overflow-wrap: anywhere; }
}

@media (pointer: coarse) {
    .btn { min-height: 40px; }
    .btn.btn-sm, .btn-sm { min-height: 36px; }
    .btn-remove, .sorter-move-btn, .sorter-remove-btn, .modal-close { min-width: 36px; min-height: 36px; }
    .btn-compare, .mtl-more, .compare-toggle__btn, #sbs-root .sbs-tab, .sbs-collapse-btn,
    .btn-cleanup-remove, .btn-cleanup-remove-all { min-height: 36px; }
    input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; flex-shrink: 0; }
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px; }
    .uk-combo__item { padding: 11px 12px; }
    a.ld-pill, nav a.ld-pill { display: inline-flex; align-items: center; min-height: 32px; }
    .team-remove-btn { min-width: 36px; min-height: 36px; }
    .team-name-input, .team-count-input { min-height: 36px; }
    .map-trade-sys { padding: 6px 2px !important; }
    .map-layers input[type="checkbox"], .map-toggle-row input[type="checkbox"] { width: 20px; height: 20px; }
    .es-nav__brand { padding-top: 6px; padding-bottom: 6px; }
}

/* a ship's internal name next to its display name (ShipNames.html) */
.ship-realname { font-size: 0.78em; opacity: 0.55; font-weight: 400; margin-left: 4px; white-space: nowrap; }

/* A pill/chip with a remove button (licences, plugins …): small round ×, not a big red square */
.ld-pill > .btn-remove {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; min-width: 20px; min-height: 20px; padding: 0; margin-left: 4px;
    border: 0; border-radius: 50%; background: transparent; color: var(--c-text-dim, #94a3b8);
    font-size: 12px; line-height: 1; box-shadow: none;
}
.ld-pill > .btn-remove:hover, .ld-pill > .btn-remove:focus-visible { background: rgba(239,68,68,.18); color: var(--c-danger-text, #f87171); outline: none; }
@media (pointer: coarse) { .ld-pill > .btn-remove { width: 26px; height: 26px; min-width: 26px; min-height: 26px; } }
.ld-pill:has(> .btn-remove) { display: inline-flex; align-items: center; padding-right: 4px; }

/* ══════════════════════════════════════════════════════════════════
   Search boxes and drop-downs — one look on every page
   (Data Viewer, Missions, Battle Simulator team search, Systems map search,
   save editor, builder …), matching .text-input.
   ══════════════════════════════════════════════════════════════════ */
body .team-search-input,
body .map-search input,
body .controls input[type="text"],
body .controls input:not([type]),
body .search-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--c-surface-2);
    border: 1px solid rgba(59, 130, 246, 0.40);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 1rem;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
body .team-search-input:focus,
body .map-search input:focus,
body .controls input[type="text"]:focus,
body .controls input:not([type]):focus,
body .search-input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.20);
}
body .controls input[type="text"], body .controls input:not([type]) { flex: 1 1 240px; width: auto; }
/* every drop-down uses the same background (some pages had a lighter one) */
body select:not([multiple]):not([size]) { background-color: var(--c-surface-2); }

/* Ways to add a ship (empty fleet, and the "＋ Add ship" window) */
.sb-add-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 10px; margin-top: 14px; text-align: left; }
.sb-add-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text); cursor: pointer; font: inherit; text-decoration: none; text-align: left; }
.sb-add-opt:hover, .sb-add-opt:focus-visible { border-color: var(--c-accent); outline: none; }
.sb-add-opt__icon { font-size: 1.3rem; line-height: 1.2; }
.sb-add-opt__hint { display: block; font-size: 0.78rem; color: var(--c-text-dim); font-weight: 400; margin-top: 2px; }
.fleet-empty:has(.sb-add-opts) { grid-column: 1 / -1; padding: 28px 20px; }

/* Battle simulator: pilot skill per ship / per team */
.team-skill-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin: 6px 0 8px; font-size: 0.8rem; color: var(--c-text-dim); }
.team-skill-btn { border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text); border-radius: var(--r-md);
  padding: 4px 10px; font-size: 0.78rem; cursor: pointer; }
.team-skill-btn:hover { border-color: var(--c-accent); }
.team-skill { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--c-text-dim); white-space: nowrap; }
.team-skill-input { width: 52px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-text); }
@media (pointer: coarse) { .team-skill-input { min-height: 36px; } }

/* Home page */
.home-section { padding: 24px; margin-bottom: 20px; }
.home-section p { color: var(--c-text-mid); line-height: 1.6; }
.home-section details { margin: 8px 0; }
.home-section summary { cursor: pointer; font-weight: 600; color: var(--c-text); }
.home-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.home-tool { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.home-tool:hover, .home-tool:focus-visible { border-color: var(--c-accent); outline: none; }
.home-tool__icon { font-size: 1.6rem; line-height: 1.2; }
.home-tool__text { display: block; font-size: 0.86rem; color: var(--c-text-dim); margin-top: 3px; line-height: 1.45; }

/* "Built by GIVEMEFOOD5 …" line at the bottom of every page */
.site-credit { text-align: center; font-size: 0.8rem; color: var(--c-text-dim); padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
.home-credit { font-size: 0.9rem; margin-top: 6px; }
