* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.text-right { text-align: right !important; }

:root {
    --bg: #0d0d0d;
    --card: #1a1a1a;
    --border: #2a2a2a;
    --accent: #c8a84e;
    --accent-dim: #a08030;
    --text: #d4d4d4;
    --text-secondary: #888;
    --mono: "Consolas", "Monaco", "Courier New", monospace;
}

html {
    font-size: 20px;
}
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Tooltips */
.tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 300;
    max-width: 220px;
    padding: 0.25rem 0.5rem;
    background: #252525;
    color: var(--text);
    font-size: 0.6rem;
    line-height: 1.4;
    border-radius: 6px;
    border: 1px solid var(--border);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.12s, transform 0.12s;
    white-space: normal;
    word-wrap: break-word;
}
.tooltip.visible {
    opacity: 1;
    transform: scale(1);
}
.tooltip-arrow {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #252525;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    transform: rotate(45deg);
}

/* Header */
.site-header {
    background: #141414;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.site-logo {
    height: 2.5rem;
    width: auto;
    flex-shrink: 0;
    opacity: 0.75;
}
.header-title-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.15;
}
.header-pack-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.site-header h1 {
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Pack selector */
.pack-selector {
    flex-shrink: 0;
}
.pack-selector select {
    padding: 0.2rem 0.45rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.6rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.pack-selector select:hover {
    color: var(--text);
    border-color: var(--accent-dim);
}
.pack-selector select:focus {
    border-color: var(--accent);
}
.pack-selector select option {
    background: var(--card);
    color: var(--text);
}

.locale-select {
    height: 2rem;
    padding: 0 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}
.locale-select:hover {
    color: var(--text);
    border-color: var(--accent-dim);
    background: rgba(255, 255, 255, 0.05);
}
.locale-select:focus {
    border-color: var(--accent);
}
.locale-select option {
    background: var(--card);
    color: var(--text);
}
.header-divider {
    width: 1px;
    height: 1.4rem;
    background: var(--border);
    margin: 0 0.35rem;
    flex-shrink: 0;
}

/* Header links */
.header-links {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}
.header-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.header-link:hover {
    color: var(--text);
    border-color: var(--accent-dim);
    background: rgba(255, 255, 255, 0.05);
}
.header-link:active {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

/* Global search */
.global-search {
    position: relative;
    flex: 1;
    max-width: 28rem;
    margin-left: auto;
}
.global-search input {
    width: 100%;
    padding: 0.375rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}
.global-search input:focus {
    border-color: var(--accent);
}
.global-search input::placeholder {
    color: var(--text-secondary);
}
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    max-height: 20rem;
    overflow-y: auto;
    z-index: 50;
}
.search-dropdown a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--accent);
    text-decoration: none;
    transition: background 0.15s;
}
.search-dropdown a:hover {
    background: rgba(42, 42, 42, 0.5);
    text-decoration: none;
}
.search-dropdown .no-results {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.75rem;
}
.search-cat-badge {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--border);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

/* Layout */
.layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    border-right: 1px solid var(--border);
    padding: 0.5rem 0;
    overflow-y: auto;
}
.sidebar-group {
    margin-bottom: 0.25rem;
}
.sidebar-group-label {
    color: var(--accent-dim);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.75rem 0.15rem;
}
.sidebar button {
    display: flex;
    align-items: center;
    width: 100%;
    white-space: nowrap;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.sidebar button:hover {
    color: var(--text);
    background: var(--border);
}
.sidebar button.active {
    color: var(--accent);
    background: rgba(200, 168, 78, 0.08);
    border-left: 2px solid var(--accent);
    padding-left: calc(0.75rem - 2px);
}
.cat-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cat-count {
    flex-shrink: 0;
    margin-left: 0.35rem;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.05rem 0.4rem;
    border-radius: 9999px;
    min-width: 1.6em;
    text-align: center;
}
.sidebar button.active .cat-count {
    color: var(--accent);
    background: rgba(200, 168, 78, 0.12);
}

/* Content */
.content {
    padding: 1rem 0 0 1.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.content-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Category filter bar */
.filter-bar {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-right: calc(1rem + 8px);
}
.filter-input-group {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 14rem;
    height: 1.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: border-color 0.15s;
    position: relative;
}
.filter-input-group:focus-within {
    border-color: var(--accent);
}
.filter-input-icon {
    flex-shrink: 0;
    margin-left: 0.5rem;
    color: var(--text-secondary);
    opacity: 0.5;
}
.filter-input-group input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 0.5rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.75rem;
    outline: none;
}
.filter-input-group input::placeholder {
    color: var(--text-secondary);
}
.filter-input-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0 0.35rem;
    flex-shrink: 0;
}
.filter-input-clear:hover {
    color: var(--text);
}
.filter-bar .item-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* View toggle */
.view-toggle {
    display: flex;
    margin-left: auto;
    flex-shrink: 0;
}
.view-toggle button {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}
.view-toggle button:first-child {
    border-radius: 4px 0 0 4px;
}
.view-toggle button + button {
    margin-left: -1px;
}
.view-toggle button:last-child {
    border-radius: 0 4px 4px 0;
}
.view-toggle button:hover {
    color: var(--text);
    border-color: var(--accent-dim);
    z-index: 1;
}
.view-toggle button.active {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: rgba(200, 168, 78, 0.08);
    z-index: 2;
}

/* Tile grid */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
    padding-bottom: 1rem;
    align-content: start;
}
.tile-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}
.tile-card:hover {
    border-color: var(--accent-dim);
    background: #1f1f1f;
}
.recipe-card, .exchange-card, .crafting-tree-card {
    cursor: default;
}
.tile-card-header {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}
.tile-card.tile-card-compact .tile-card-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.tile-card-header .pin-icon {
    font-size: 0.6rem;
}
.tile-card-header .badge-flag {
    font-size: 0.55rem;
    padding: 0.05rem 0.3rem;
}
.tile-card-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
a.tile-card-name:hover {
    text-decoration: underline;
}
.tile-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.1rem 0.75rem;
}
.tile-stat-row:has(.tile-ammo-list) {
    grid-column: 1 / -1;
}
.tile-ammo-list {
    display: flex;
    gap: 0.2rem;
    overflow: hidden;
    min-width: 0;
}
.tile-ammo-list .badge-ammo {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}
.tile-stat-row .badge,
.tile-stat-row .badge-ammo,
.tile-stat-row .badge-flag {
    font-size: 0.6rem;
    padding: 0 0.35rem;
    line-height: 1.3;
}
.tile-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem;
}
.tile-stat-row .stat-label {
    color: var(--text-secondary);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-width: 0;
    word-break: break-word;
}
.tile-stat-row .stat-value {
    font-family: var(--mono);
    font-size: 0.7rem;
    text-align: right;
}
.stat-positive {
    color: #6ec87a;
}
.stat-negative {
    color: #d07a6e;
}
.stat-warning {
    color: #c8a84e;
}
.stat-radiation-restore {
    color: #6ea8d0;
}

/* Heal dots */
.modal-heal-row .stat-label {
    min-width: 5.5rem;
}
.modal-heal-grid .modal-heal-row {
    gap: 0.75rem;
}
.heal-cell .heal-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.heal-cell .heal-row + .heal-row {
    margin-top: 0.15rem;
}
.heal-row-label {
    font-size: 0.55rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-width: 5.5rem;
}
.heal-parts {
    display: flex;
    gap: 0.5rem;
}
.heal-part {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.heal-part.heal-active {
    color: var(--text);
}
.heal-dots {
    font-size: 1rem;
    line-height: 1;
    letter-spacing: -0.05em;
    vertical-align: -0.05em;
}
.dot.filled {
    color: #6ec87a;
}
.dot.empty {
    color: var(--border);
}

/* Item table */
.table-wrap {
    flex: 1;
    overflow: auto;
}
.item-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.item-table th,
.item-table td {
    text-align: left;
    padding: 0.375rem 0.625rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.item-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    border-bottom: none;
    box-shadow: inset 0 -2px 0 var(--border);
    user-select: none;
    cursor: pointer;
}
.item-table thead th:hover {
    color: var(--accent);
}
.sort-icon {
    font-size: 0.65rem;
    margin-left: 0.125rem;
    color: var(--accent);
}
.item-table td {
    font-family: var(--mono);
    font-size: 0.8rem;
}
.item-table td a {
    font-family: var(--mono);
    color: var(--accent);
    text-decoration: none;
}
.item-table td a:hover {
    text-decoration: underline;
}
.clickable-row {
    cursor: pointer;
    transition: background 0.1s;
}
.clickable-row:hover {
    background: var(--card);
}

/* Badges */
.badge {
    display: inline-block;
    font-family: sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--border);
    color: var(--text);
}
.badge-faction {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    white-space: nowrap;
    background: color-mix(in srgb, var(--faction-color) 12%, transparent);
}
.badge-ammo {
    display: inline-block;
    font-family: sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    background: rgba(120, 160, 180, 0.12);
    color: #7eaab8;
}
.badge-ammo-alt {
    background: rgba(180, 160, 120, 0.12);
    color: #b8a878;
}
/* Settings menu */
.settings-wrap {
    position: relative;
}
.settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.settings-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}
.settings-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 13rem;
    background: #1e1e1e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.settings-header {
    padding: 0.35rem 0.75rem 0.25rem;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.settings-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.7rem;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
    user-select: none;
}
.settings-item:hover {
    background: rgba(255, 255, 255, 0.06);
}
/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 1.75rem;
    height: 1rem;
    background: #3a3a3a;
    border-radius: 0.5rem;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-switch.on {
    background: var(--accent);
}
.toggle-knob {
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 0.75rem;
    height: 0.75rem;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch.on .toggle-knob {
    transform: translateX(0.75rem);
}
/* Filter button & panel */
.filter-wrap {
    position: relative; /* positioning context for mobile; desktop uses Floating UI */
}
.filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.6rem;
    height: calc(100% - 4px);
    margin: 2px;
    border-radius: 3px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}
.filter-badge {
    position: absolute;
    top: -0.3rem;
    right: -0.3rem;
    background: var(--accent);
    color: #000;
    font-size: 0.5rem;
    font-weight: 700;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.filter-panel {
    position: absolute;
    left: 0;
    top: 0;
    width: max-content;
    min-width: 20rem;
    max-width: min(27rem, calc(100vw - 1rem));
    max-height: 28rem;
    overflow-y: auto;
    background: #1e1e1e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    font-size: 0.75rem;
}
.filter-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
}
.filter-clear {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--accent);
    text-decoration: none;
    text-transform: none;
    font-weight: 500;
    letter-spacing: normal;
}
.filter-clear:hover {
    text-decoration: underline;
}
.filter-group {
    padding: 0.4rem 0.75rem;
}
.filter-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    background: rgba(200, 168, 78, 0.06);
    border: 1px solid var(--accent-dim);
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.filter-chip:hover {
    background: rgba(200, 168, 78, 0.14);
    border-color: var(--accent);
}
.filter-chip.active {
    color: #000;
    border-color: var(--accent);
    background: var(--accent);
    font-weight: 600;
}
/* Range filter inputs */
.range-filters-grid {
    display: flex;
    padding: 0.4rem 0;
}
.range-filters-col {
    flex: 1;
    min-width: 0;
}
.range-filters-divider {
    width: 1px;
    background: var(--border);
    flex-shrink: 0;
}
.range-filter-cell {
    min-width: 0;
    padding: 0 0.75rem;
}
.range-filter-cell .filter-group-label {
    padding: 0.35rem 0 0.15rem;
}
.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
input.range-input {
    flex: 1;
    min-width: 0;
    height: 1.2rem;
    padding: 0 0.3rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.6rem;
    line-height: 1.2;
    font-family: var(--mono);
    outline: none;
    transition: border-color 0.15s;
}
.range-input:focus {
    border-color: var(--accent);
}
.range-input::-webkit-inner-spin-button,
.range-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.range-input[type="number"] {
    -moz-appearance: textfield;
}
.range-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    position: relative;
}
.range-input-wrap .range-input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}
.range-spinners {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.range-spin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0.9rem;
    flex: 1;
    padding: 0;
    background: var(--border);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.range-spin-btn:first-child {
    border-top-right-radius: 4px;
    border-bottom: none;
}
.range-spin-btn:last-child {
    border-bottom-right-radius: 4px;
}
.range-spin-btn:hover {
    background: var(--accent-dim);
    color: var(--text);
}
.range-spin-btn:active {
    background: var(--accent);
    color: #000;
}
.range-sep {
    color: var(--text-secondary);
    font-size: 0.65rem;
    text-align: center;
}
.range-unit {
    display: inline-block;
    width: 1.6rem;
    color: var(--text-secondary);
    font-size: 0.6rem;
    text-align: left;
    flex-shrink: 0;
}

/* Sort controls */
.sort-wrap {
    position: relative;
    flex-shrink: 0;
}
.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 1.75rem;
    padding: 0 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.sort-btn:hover {
    color: var(--text);
    border-color: var(--accent-dim);
}
.sort-btn-label {
    color: var(--text);
}
.sort-btn-dir {
    font-size: 0.5rem;
    color: var(--accent);
}
.sort-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 10rem;
    background: #1e1e1e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.sort-menu-header {
    padding: 0.35rem 0.75rem 0.25rem;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.sort-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.7rem;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
    text-align: left;
}
.sort-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
}
.sort-menu-item.active {
    color: var(--accent);
}
.sort-menu-check {
    width: 0.85rem;
    text-align: center;
    font-size: 0.6rem;
    flex-shrink: 0;
    color: var(--accent);
}
.sort-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0.5rem;
}

/* Active filter chips row */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
    padding-right: 1rem;
}
.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.15rem 0.1rem 0.45rem;
    background: rgba(200, 168, 78, 0.08);
    border: 1px solid var(--accent-dim);
    border-radius: 999px;
    font-size: 0.6rem;
    color: var(--accent);
}
.active-filter-label {
    white-space: nowrap;
}
.active-filter-remove {
    background: none;
    border: none;
    color: var(--accent-dim);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}
.active-filter-remove:hover {
    color: #c44;
}
.filter-clear-inline {
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}
.filter-clear-inline:hover {
    color: var(--accent);
}

.badge-no-drop {
    display: inline-block;
    font-family: sans-serif;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(200, 80, 80, 0.18);
    color: #d47070;
    margin-left: 0.35rem;
    vertical-align: middle;
}
.badge-no-drop s {
    text-decoration: line-through;
}
.badge-unused {
    display: inline-block;
    font-family: sans-serif;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(180, 160, 60, 0.18);
    color: #b0a040;
    margin-left: 0.35rem;
    vertical-align: middle;
}
.ammo-variants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.badge-hands {
    display: inline-block;
    font-family: sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    text-transform: uppercase;
}
.badge-hands[data-hands="1"] {
    background: rgba(78, 168, 100, 0.15);
    color: #6ec87a;
}
.badge-hands[data-hands="2"] {
    background: rgba(78, 130, 200, 0.15);
    color: #6ea8d0;
}
.modal-badges {
    margin: 0.5rem 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.name-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.2rem;
}
.name-tags .badge-flag {
    margin-left: 0;
}
.badge-flag {
    display: inline-block;
    font-family: sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-left: 0.35rem;
    vertical-align: middle;
}
.badge-perk { background: rgba(220, 160, 50, 0.18); color: #dca032; }
.badge-junk { background: rgba(140, 140, 140, 0.18); color: #999; }
.badge-craftable { background: rgba(78, 168, 100, 0.15); color: #6ec87a; }
.badge-powered { background: rgba(78, 130, 200, 0.15); color: #6ea8d0; }
.badge-cookable { background: rgba(200, 130, 60, 0.18); color: #c8843c; }
.badge-ingredient { background: rgba(180, 160, 120, 0.18); color: #b8a078; }
.badge-craft-mat { background: rgba(160, 120, 180, 0.18); color: #a880b8; }
.badge-thick-skin { background: rgba(200, 100, 78, 0.15); color: #d07a6e; }
.badge-type { background: rgba(100, 160, 210, 0.18); color: #78b8e0; }

/* Preloader (pre-Vue) */
#app-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.preloader-card {
    animation: fadeIn 0.3s ease 500ms both;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 2rem 2.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.preloader-logo {
    height: 40px;
    opacity: 0.8;
}

.preloader-title {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    margin: 0 0 0.75rem 0;
}

.preloader-text {
    color: var(--text-secondary);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.preloader-footer {
    animation: fadeIn 0.3s ease 500ms both;
    position: absolute;
    bottom: 2rem;
    color: var(--text-secondary);
    font-size: 0.7rem;
    opacity: 0.5;
}

/* Loading (in-page, Vue-managed) */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 0;
    gap: 1.25rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.error-msg {
    color: #c44;
    padding: 2rem 0;
}

/* Item detail page */
.item-detail {
    max-width: 48rem;
}
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.item-detail h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.item-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.item-meta .cat-badge {
    font-size: 0.75rem;
    color: var(--accent);
    background: rgba(200, 168, 78, 0.1);
    border: 1px solid var(--accent-dim);
    padding: 0.125rem 0.625rem;
    border-radius: 3px;
}
.item-meta .item-id {
    font-family: var(--mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.copy-id-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-family: var(--mono);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.copy-id-btn:hover {
    color: var(--text);
    border-color: var(--accent-dim);
}
.copy-id-btn.copied {
    color: #5cb85c;
    border-color: rgba(92, 184, 92, 0.3);
}
.copy-id-btn .copy-id-text {
    font-family: var(--mono);
}

/* Copy Link button — matches view-toggle buttons */
/* Utility button group */
.utility-group {
    display: flex;
    flex-shrink: 0;
}
.utility-group > *:first-child > button,
.utility-group > button:first-child {
    border-radius: 4px 0 0 4px;
}
.utility-group > *:last-child > button,
.utility-group > button:last-child {
    border-radius: 0 4px 4px 0;
}
.utility-group > * + * > button,
.utility-group > * + button,
.utility-group > button + * > button {
    margin-left: -1px;
}
.utility-group > button:hover,
.utility-group > *:has(> button:hover) {
    z-index: 1;
}
.copy-link-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.copy-link-btn:hover {
    color: var(--text);
    border-color: var(--accent-dim);
}
.copy-link-btn.copied {
    color: #5cb85c;
    border-color: rgba(92, 184, 92, 0.3);
    z-index: 2;
}

/* Download button & menu */
.download-wrap {
    position: relative;
}
.download-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.download-btn:hover {
    color: var(--text);
    border-color: var(--accent-dim);
}
.download-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 10rem;
    background: #1e1e1e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.download-menu-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0.45rem 0.75rem;
    font-size: 0.7rem;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 0.12s;
}
.download-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Stat grid (detail page / modal) */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
}
.stat-grid .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}
.stat-grid .stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.info-hint {
    width: 1.1em;
    height: 1.1em;
    margin-left: 0.3em;
    vertical-align: middle;
    margin-top: -0.2em;
    margin-bottom: -0.2em;
    opacity: 0.55;
    cursor: help;
    color: #5b9bd5;
}
.stat-grid .stat-value {
    font-family: var(--mono);
    font-size: 0.8rem;
    text-align: right;
}
.stat-grid .stat-section {
    grid-column: 1 / -1;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--accent-dim);
}

/* Legacy stat table (item.html standalone) */
.stat-table {
    width: 100%;
    border-collapse: collapse;
}
.stat-table th,
.stat-table td {
    text-align: left;
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.stat-table th {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.875rem;
    width: 40%;
}
.stat-table td {
    font-family: var(--mono);
    font-size: 0.875rem;
}
.stat-table .section-header td {
    color: var(--accent);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 1rem;
    border-bottom: 1px solid var(--accent-dim);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    overflow: hidden;
}
.modal {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 100%;
    max-width: 60rem;
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}
.modal-close:hover {
    color: var(--text);
}
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
    font-size: 2rem;
    line-height: 1;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    z-index: 101;
    transition: background 0.15s, color 0.15s;
}
.modal-nav:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}
.modal-nav-prev { left: 0.5rem; }
.modal-nav-next { right: 0.5rem; }
.modal-faction-icon {
    position: absolute;
    top: 2.25rem;
    right: 3.25rem;
    width: 3rem;
    height: 3rem;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}
.modal-faction-icon:hover {
    opacity: 1;
}
.modal-body {
    padding: 1.5rem 2rem 2rem;
    overflow-y: auto;
    flex: 1;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
}
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: var(--bg);
}
.modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
.modal-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.modal-pin-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.modal-pin-icon:hover {
    opacity: 0.8 !important;
}
.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* Drop sources */
.drop-sources {
    margin-top: 2rem;
}
.drop-sources h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--accent-dim);
}
.drop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
}
.drop-faction {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}
.drop-faction-icon {
    width: 1.75rem;
    height: 1.75rem;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 0.1rem;
    opacity: 0.85;
}
.drop-faction-body {
    flex: 1;
    min-width: 0;
}
.drop-faction-name {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}
.drop-ranks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.drop-rank {
    font-size: 0.6rem;
    font-weight: 500;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(200, 168, 78, 0.1);
    color: var(--accent);
}

/* Stash drop locations */
.stash-drop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}
.stash-drop-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    text-align: center;
}
.stash-drop-map {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stash-drop-chances {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.75rem;
}
.stash-chance-common {
    color: #fff;
}
.stash-chance-rare {
    color: #c8a84e;
}
.stash-drop-ecos {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.2rem;
    font-size: 0.6rem;
    color: var(--text-secondary);
}

/* Pin column */
.pin-col-header {
    width: 1.2rem;
    min-width: 1.2rem;
    max-width: 1.2rem;
    cursor: default !important;
}
.pin-col-header:hover {
    color: var(--text-secondary) !important;
}
.pin-col {
    width: 1.2rem;
    min-width: 1.2rem;
    max-width: 1.2rem;
    text-align: center;
    padding: 0.1rem !important;
    cursor: pointer;
}
.pin-icon {
    font-size: 0.75rem;
    opacity: 0.25;
    filter: grayscale(1);
    transition: opacity 0.15s, filter 0.15s;
    cursor: pointer;
}
.pin-icon.pinned {
    opacity: 1;
    filter: none;
}
.clickable-row:hover .pin-icon {
    opacity: 0.55;
}
.clickable-row:hover .pin-icon.pinned {
    opacity: 1;
}
.pin-icon.pin-disabled {
    opacity: 0.1;
    cursor: not-allowed;
}

/* Favorite icon */
.fav-col-header {
    width: 1.2rem;
    min-width: 1.2rem;
    max-width: 1.2rem;
    cursor: default !important;
}
.fav-col {
    width: 1.2rem;
    min-width: 1.2rem;
    max-width: 1.2rem;
    text-align: center;
    padding: 0.1rem !important;
    cursor: pointer;
}
.fav-icon {
    font-size: 0.85rem;
    opacity: 0.25;
    color: var(--text-secondary);
    transition: opacity 0.15s, color 0.15s;
    cursor: pointer;
}
.fav-icon.favorited {
    opacity: 1;
    color: var(--accent);
}
.fav-icon:hover {
    opacity: 0.7;
}
.fav-icon.favorited:hover {
    opacity: 0.85;
}
.clickable-row:hover .fav-icon {
    opacity: 0.55;
}
.clickable-row:hover .fav-icon.favorited {
    opacity: 1;
}
.tile-card-header .fav-icon {
    font-size: 0.7rem;
}
.modal-fav-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.modal-fav-icon:hover {
    opacity: 0.8 !important;
}

.badge-category {
    margin-left: auto;
    background: rgba(200, 168, 78, 0.15);
    color: var(--accent);
}

/* Favorites toolbar toggle */
.fav-filter-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    font-size: 0.75rem;
    line-height: 1;
    transition: all 0.15s;
}
.fav-filter-btn:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
}
.fav-filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}
.fav-filter-star {
    font-size: 0.8rem;
}

/* Favorites empty state */
.favorites-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.fav-icon-inline {
    color: var(--accent);
    font-size: 0.9rem;
}

/* Compare bar */
.compare-bar {
    background: #151515;
    border-top: 1px solid var(--border);
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
}
.compare-bar-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--accent-dim);
}
.compare-bar-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}
.compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    color: var(--text);
    max-width: 200px;
}
.compare-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compare-chip-cat {
    font-size: 0.55rem;
    color: var(--text-secondary);
    background: var(--border);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    flex-shrink: 0;
}
.compare-chip-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 0.15rem;
    line-height: 1;
}
.compare-chip-remove:hover {
    color: #c44;
}
.compare-bar-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.compare-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.compare-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.compare-btn:not(:disabled):hover {
    opacity: 0.85;
}
.compare-clear-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.compare-clear-btn:hover {
    color: #c44;
    border-color: #c44;
}

/* Compare modal */
.compare-modal {
    max-width: calc(100vw - 4rem);
    width: auto;
}
.compare-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.compare-table-wrap {
    overflow-x: auto;
    max-width: 100%;
}
.compare-table {
    border-collapse: collapse;
    font-size: 0.8rem;
}
.compare-table th,
.compare-table td {
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.compare-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg);
    font-weight: 500;
    font-size: 0.75rem;
    border-bottom: 2px solid var(--border);
    vertical-align: bottom;
}
.compare-label-col {
    position: sticky;
    left: 0;
    background: var(--bg);
    z-index: 2;
    color: var(--text-secondary);
    width: 1%;
    border-right: 1px solid var(--border);
}
.compare-item-col {
    text-align: center;
}
.compare-item-name {
    display: block;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.8rem;
}
.compare-item-cat {
    display: block;
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.compare-label {
    position: sticky;
    left: 0;
    background: var(--bg);
    z-index: 1;
    color: var(--text-secondary);
    font-size: 0.75rem;
    width: 1%;
    border-right: 1px solid var(--border);
}
.compare-value {
    text-align: center;
    font-family: var(--mono);
}

/* Compare highlighting */
.compare-icon {
    font-size: 0.6rem;
    margin-right: 0.2rem;
}
.stat-best {
    color: #6ec87a;
}
.stat-best .compare-icon {
    color: #6ec87a;
}
.stat-worst {
    color: #d07a6e;
}
.stat-worst .compare-icon {
    color: #d07a6e;
}

/* Hamburger + backdrop (hidden on desktop) */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
}
.hamburger-btn span {
    display: block; width: 22px; height: 2px;
    background: var(--text-secondary); border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}
.hamburger-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.active span:nth-child(2) { opacity: 0; }
.hamburger-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.sidebar-backdrop { display: none; }
.filter-panel-backdrop { display: none; }
.filter-panel-close { display: none; }

/* Full-screen overlay (added by JS when panel won't fit as dropdown) */
.filter-panel-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: auto;
    min-width: unset;
    max-width: none;
    max-height: none;
    border-radius: 0;
    z-index: 160;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* Remove overflow clipping from ancestors so fixed panel can cover full viewport */
.filter-fullscreen-active .content,
.filter-fullscreen-active .layout,
.filter-fullscreen-active #app {
    overflow: visible;
}
.filter-fullscreen-active .filter-panel-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 155;
    background: rgba(0, 0, 0, 0.5);
}
.filter-panel-fullscreen .filter-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.25rem;
    cursor: pointer;
}

/* Mobile */
@media (max-width: 768px) {
    /* Hamburger visible */
    .hamburger-btn { display: flex; }

    /* Header: compact + search wraps to own row */
    .site-header { padding: 0.5rem 0.75rem; gap: 0.5rem; flex-wrap: wrap; }
    .site-logo { height: 2rem; }
    .header-pack-label { font-size: 0.8rem; }
    .global-search { order: 10; flex: 1 1 100%; max-width: none; margin-left: 0; }

    /* Layout: single column, sidebar out of flow */
    .layout { grid-template-columns: 1fr; grid-template-rows: 1fr; }

    /* Sidebar: fixed drawer from left */
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 260px; max-width: 80vw; z-index: 150;
        background: var(--bg); border-right: 1px solid var(--border);
        transform: translateX(-100%); transition: transform 0.25s ease;
        overflow-y: auto; padding: 0.5rem 0;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: block; position: fixed; inset: 0;
        z-index: 140; background: rgba(0, 0, 0, 0.5);
    }
    .sidebar button { min-height: 44px; font-size: 0.85rem; }

    /* Content: reduce padding */
    .content { padding: 0.75rem 0 0 0.75rem; }

    /* Filter bar: wrap into rows */
    .filter-bar { flex-wrap: wrap; gap: 0.5rem; padding-right: 0.75rem; }
    .filter-input-group { flex: 1 1 auto; max-width: none; min-width: 0; order: 1; }
    .sort-wrap { order: 3; flex: 1 1 auto; }
    .filter-bar .item-count { order: 4; }
    .view-toggle { order: 5; margin-left: 0; }
    .utility-group { order: 6; }

    /* Tile grid: single-column on small screens */
    .tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
        padding-right: 0.75rem;
    }

    /* Active filters / exchange chips: reduce right padding */
    .active-filters { padding-right: 0.75rem; }
    .exchange-faction-chips { padding-right: 0.75rem; }
    .crafting-trees-toolbar { padding-right: 0.75rem; }

    /* Table */
    .item-table { font-size: 0.7rem; }

    /* Modals: near full-screen */
    .modal-backdrop { padding: 0.5rem; }
    .modal { max-width: none; max-height: calc(100vh - 1rem); border-radius: 6px; }
    .modal-nav { display: none; }
    .modal-body { padding: 1rem; }
    .modal-title { font-size: 1.15rem; }
    .stat-grid { grid-template-columns: 1fr; }

    /* Compare bar: wrap */
    .compare-bar { flex-wrap: wrap; padding: 0.5rem 0.75rem; }
    .compare-bar-icon { display: none; }
    .compare-bar-chips { flex: 1 1 100%; overflow-x: auto; }
    .compare-bar-actions { flex: 1 1 100%; justify-content: flex-end; }

    /* Footer: stack */
    .site-footer { flex-direction: column; gap: 0.25rem; text-align: center; padding: 0.5rem; }
    .footer-left, .footer-right { flex: none; text-align: center; }

    /* Touch targets: 44px minimum */
    .settings-btn, .sort-btn, .filter-input-group,
    .view-toggle button, .copy-link-btn, .download-btn, .header-link { min-width: 44px; min-height: 44px; }
    .compare-btn, .compare-clear-btn { min-height: 44px; padding-left: 1rem; padding-right: 1rem; }

    /* Filter panel: full-screen overlay at mobile */
    .filter-panel {
        position: fixed !important;
        inset: 0 !important;
        width: auto;
        min-width: unset;
        max-width: none;
        max-height: none;
        border-radius: 0;
        z-index: 160;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .filter-panel-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 155;
        background: rgba(0, 0, 0, 0.5);
    }
    .filter-panel-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-left: auto;
        background: none;
        border: none;
        color: var(--text);
        font-size: 1.25rem;
        cursor: pointer;
    }

    /* Range filters: single column */
    .range-filters-grid { flex-direction: column; }
    .range-filters-divider { width: auto; height: 1px; margin: 0.25rem 0.5rem; }

    /* Touch-friendly sizing */
    .filter-chip { min-height: 44px; padding: 0.4rem 0.85rem; font-size: 0.75rem; }
    .filter-chips { gap: 0.4rem; }
    .range-input { min-height: 36px; font-size: 0.75rem; padding: 0.2rem 0.5rem; }
    .range-spin-btn { width: 1.5rem; font-size: 0.45rem; }
    .filter-group { padding: 0.5rem 1rem; }
    .filter-group-label { font-size: 0.75rem; }
    .range-filter-cell .filter-group-label { font-size: 0.75rem; }
}

/* Recipe cards */
.recipe-card {
    cursor: pointer;
}
.recipe-ingredients {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.recipe-ingredient {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
}
.recipe-ingredient a {
    color: var(--accent);
    text-decoration: none;
}
.recipe-ingredient a:hover {
    text-decoration: underline;
}
.recipe-base {
    color: var(--accent);
    font-weight: 600;
}
.recipe-plus {
    color: var(--text-secondary);
    font-size: 0.7rem;
    flex-shrink: 0;
}
.recipe-ing-amount {
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    background: rgba(120, 160, 180, 0.12);
    color: #7eaab8;
    flex-shrink: 0;
}
.recipe-ingredients-modal {
    gap: 0.35rem;
}
.recipe-ingredients-modal .recipe-ingredient {
    font-size: 0.85rem;
}
.recipe-ingredients-modal .recipe-ing-amount {
    font-size: 0.7rem;
}
.recipe-used-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.recipe-used-item {
    font-size: 0.85rem;
}
.recipe-used-item a {
    color: var(--accent);
}
.material-sources {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem 0.75rem;
}
.material-source {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    font-size: 0.75rem;
}
.material-source .recipe-ing-amount {
    flex-shrink: 0;
    font-size: 0.75rem;
}
.material-source .material-from {
    flex-shrink: 0;
}
.material-from {
    color: var(--text-secondary);
    font-size: 0.7rem;
}
.material-source a {
    color: var(--accent);
    text-decoration: none;
}
.material-source a:hover {
    text-decoration: underline;
}
.recipe-used-item a:hover {
    text-decoration: underline;
}

/* Crafting Trees */
.crafting-trees-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.crafting-trees-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0;
}
.crafting-tree-card .tile-card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
    margin-bottom: 0.25rem;
}
.crafting-tree-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.tree-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    line-height: 1.6;
    border-left: 1px solid var(--border);
}
.tree-toggle {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.55rem;
    user-select: none;
    width: 0.8rem;
    text-align: center;
    flex-shrink: 0;
}
.tree-toggle:hover {
    color: var(--accent);
}
.tree-leaf-dot {
    color: var(--text-secondary);
    font-size: 0.55rem;
    width: 0.8rem;
    text-align: center;
    flex-shrink: 0;
}
.tree-raw {
    color: var(--text-secondary);
}
.tree-row .recipe-ing-amount {
    margin-left: auto;
}

/* Ammo comparison table */
.ammo-table-wrap {
    overflow-x: auto;
}
.ammo-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}
.ammo-compare-table th,
.ammo-compare-table td {
    text-align: left;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.ammo-compare-table thead th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ammo-compare-table td {
    font-family: var(--mono);
    font-size: 0.75rem;
}
.ammo-compare-table td:first-child {
    font-family: inherit;
}
.ammo-variant-link {
    color: var(--accent);
    text-decoration: none;
}
.ammo-variant-link:hover {
    text-decoration: underline;
}
.ammo-alt-row {
    opacity: 1;
}
.ammo-alt-tag {
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 0.4rem;
    vertical-align: middle;
    padding: 0.15rem 0.4rem;
}
.ammo-compare-table .ammo-stat-cell {
    text-align: right;
}
.ammo-best {
    color: #5cb85c;
    font-weight: 600;
}
.ammo-arrow {
    font-size: 0.55rem;
    margin-left: 0.25rem;
}
.arrow-up { color: #5cb85c; }
.arrow-down { color: #d9534f; }
.arrow-neutral { color: var(--text-secondary); font-size: 0.35rem; }
.badge-ammo.clickable {
    cursor: pointer;
}
.badge-ammo.clickable:hover {
    filter: brightness(1.3);
}

/* Used By Weapons */
.used-by-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.used-by-item {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    font-size: 0.8rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}
.used-by-item a {
    color: var(--accent);
    text-decoration: none;
}
.used-by-item a:hover {
    text-decoration: underline;
}
.used-by-cat {
    color: var(--text-secondary);
    font-size: 0.65rem;
}

/* Outfit Exchange */
.exchange-view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.exchange-faction-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
    padding-right: 1rem;
}
.exchange-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.65rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.exchange-chip:hover {
    color: var(--text);
    border-color: var(--accent-dim);
}
.exchange-chip.active {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: rgba(200, 168, 78, 0.08);
}
.exchange-chip-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    opacity: 0.85;
}
.exchange-card .exchange-results {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.exchange-result-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
}
.exchange-result-faction {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 7.5rem;
    font-size: 0.65rem;
}
.exchange-result-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.85;
    flex-shrink: 0;
}
.exchange-result-name {
    font-family: var(--mono);
    font-size: 0.7rem;
}
.exchange-result-name a {
    color: var(--accent);
    text-decoration: none;
}
.exchange-result-name a:hover {
    text-decoration: underline;
}
.exchange-source-badge {
    font-size: 0.55rem;
    color: var(--text-secondary);
    background: var(--border);
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Vue transitions */

/* Fade (backdrops) */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.2s ease;
}
.fade-enter-from,
.fade-leave-to {
    opacity: 0;
}

/* Modal (scale + fade) */
.modal-enter-active,
.modal-leave-active {
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.modal-enter-from,
.modal-leave-to {
    opacity: 0;
    transform: scale(0.95);
}

/* Slide-up (compare bar) */
.slide-up-enter-active,
.slide-up-leave-active {
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.slide-up-enter-from,
.slide-up-leave-to {
    transform: translateY(100%);
    opacity: 0;
}

/* Footer */
.site-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 1rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.7rem;
}
.footer-left, .footer-right {
    flex: 1;
}
.footer-center {
    flex: none;
}
.footer-right {
    text-align: right;
}
.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}
.site-footer a:hover {
    color: var(--accent);
}
.footer-sep {
    color: var(--text-secondary);
}
