:root {
    /* Theme matching index.html (GitHub Dark Dimmed style) */
    --bg-color: #0d1117;
    --panel-bg: #161b22;
    --border-color: #30363d;
    --text-color: #c9d1d9;
    --text-muted: #8b949e;
    --accent-color: #58a6ff;
    --input-bg: #0d1117;
    
    --grid-cell-size: 60px;
    --stash-cell-size: var(--grid-cell-size);
    --slot-bg: #21262d;
    --slot-blocked: #010409;
}

html {
    background-color: var(--bg-color);
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    line-height: 1.5;
    font-size: 18px; /* Increased base size to compensate for downscaling */
}

/* Virtual Resolution Wrapper */
#app-scale-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    transform-origin: top left;
    overflow: hidden;
    backface-visibility: hidden;
    transform: translateZ(0); /* Forces hardware acceleration to fix pixelation */
}

/* Layout */
.header {
    padding: 15px 20px;
    background-color: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 20px;
    align-items: center;
}

.header h3 {
    margin: 0;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

.stash-panel {
    width: fit-content;
    min-width: 260px;
    flex: 0 0 auto;
    background-color: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    
    /* Layout Fixes */
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 5;
    height: 100%;           /* Force full height */
    overflow: hidden;       /* Stop the panel itself from scrolling */
    box-sizing: border-box; /* Ensure padding doesn't add to height */
}

.stash-grid {
    display: grid;
    grid-template-columns: repeat(4, var(--stash-cell-size));
    grid-auto-rows: var(--stash-cell-size);
    gap: 4px;
    background-color: var(--bg-color);
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    
    /* Layout Fixes */
    flex: 1;              /* Grow to fill available space */
    min-height: 0;        /* Allow shrinking if needed */
    overflow: auto;       /* Enable internal scrolling */
    align-content: start;
    position: relative;
}

.sidebar {
    width: 240px;
    background-color: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.sidebar-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

kbd {
    background-color: #21262d;
    border: 1px solid #6e7681;
    border-bottom-color: #484f58;
    border-radius: 4px;
    box-shadow: inset 0 -1px 0 #484f58;
    color: var(--text-color);
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    font-size: 0.75em;
    line-height: 1;
    padding: 3px 6px;
    vertical-align: middle;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: var(--text-muted);
    padding: 4px 0;
}

.editor-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #010409; /* Darker background for canvas */
    position: relative;
    overflow: auto;
    background-image: radial-gradient(#21262d 1px, transparent 1px);
    background-size: 20px 20px;
}

.properties-panel {
    width: 420px;
    background-color: var(--panel-bg);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
}

h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

/* Inputs & Status */
input[type="file"] {
    display: none;
}

.file-upload-btn {
    background-color: #1f6feb; /* Primary Blue */
    color: white;
    border: 1px solid rgba(240,246,252,0.1);
    font-weight: 500;
    padding: 8px 12px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.file-upload-btn:hover {
    background-color: #388bfd;
    border-color: transparent;
}

.file-upload-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted);
}

.status-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.status-pending { color: #d29922; } /* GitHub Warning Color */
.status-ok { color: #3fb950; }     /* GitHub Success Color */
.status-error { color: #f85149; }  /* GitHub Error Color */

/* Grid Visualization */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(7, var(--grid-cell-size));
    grid-template-rows: repeat(6, var(--grid-cell-size));
    gap: 4px;
    position: relative;
    background-color: var(--bg-color);
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.grid-slot {
    width: var(--grid-cell-size);
    height: var(--grid-cell-size);
    background-color: var(--slot-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

.grid-slot.blocked {
    background-color: var(--slot-blocked);
    border-color: #111;
    background-image: repeating-linear-gradient(45deg, var(--slot-blocked) 0, var(--slot-blocked) 10px, #161b22 10px, #161b22 20px);
}

.relic-item {
    position: absolute;
    background-color: rgba(22, 27, 34, 1);
    border: 2px solid var(--text-muted);
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75em;
    text-align: center;
    transition: all 0.2s;
    overflow: hidden;
    z-index: 10;
    padding: 2px;
    word-break: break-word;
    border-radius: 4px;
    color: var(--text-color);
    backface-visibility: hidden;
    will-change: transform;
}

.relic-item:hover {
    border-color: var(--text-color);
    z-index: 20;
    transform: translateY(-5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.relic-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 1);
    z-index: 30;
}

.relic-level-indicator {
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: var(--dot-gap, 2px);
    pointer-events: none;
    z-index: 15;
    align-items: center;
}

.level-dot {
    width: var(--dot-size, 4px);
    height: var(--dot-size, 4px);
    min-width: var(--dot-size, 4px);
    min-height: var(--dot-size, 4px);
    border-radius: 50%;
    background-color: #2ae943;
    box-shadow: 0 0 2px rgba(0,0,0,0.8);
    flex-shrink: 0;
    aspect-ratio: 1;
}

/* Rarity Colors */
.rarity-0 { border-color: #8b949e; background: #353d47; } 
.rarity-1 { border-color: #58a6ff; background: #142244; } 
.rarity-2 { border-color: #d29922; background: #46390f; } 
.rarity-3 { border-color: #f85149; background: #4d1111; } 
.rarity-3.tier-4 { border-color: #58a6ff; } 

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85em;
    color: var(--text-muted);
}

input[type="text"], input[type="number"], select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 10px;
    box-sizing: border-box;
    border-radius: 6px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

/* Remove spinner arrows from number inputs */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    appearance: none;
    margin: 0; 
}

input[type=number] {
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield;
}


button:disabled { background-color: #21262d; color: #8b949e; cursor: not-allowed; border-color: var(--border-color); }

/* --- Affix Card Styling (GitHub Dark Style) --- */
.affix-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.affix-item {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.2s;
}

/* Header: Name Group (Left) -- Value Group (Right) */
.affix-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

/* Left Side */
.affix-name-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.affix-name-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.3;
}

.affix-name-btn:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.affix-name-btn:disabled {
    background-color: transparent;
    border: none;
    color: var(--text-color);
    cursor: default;
}

/* Container for Range + Tags on the left */
.affix-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px; /* Space between Range and Tags */
}

.range-info-card {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    background: rgba(110, 118, 129, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.affix-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-mini {
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid;
    font-weight: 600;
    line-height: 1;
}

/* Right Side: Value & Lock */
.affix-right-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.calculated-value-card {
    font-family: ui-monospace, SFMono-Regular, SF Mono, monospace;
    font-size: 0.95rem;
    color: #3fb950;
    font-weight: 600;
}

.lock-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.lock-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Controls Row: Slider, Input, Remove Button */
.affix-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.affix-controls input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    cursor: pointer;
}

.input-standard {
    width: 60px !important;
    height: 28px;
    padding: 0 8px !important;
    font-size: 0.9rem;
    font-family: monospace;
    text-align: right;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
}

.input-standard:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
    outline: none;
}

.btn-remove-danger {
    background: transparent;
    border: 1px solid var(--border-color);
    color: #f85149;
    font-size: 0.8rem;
    padding: 0 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    height: 28px; /* Match input height */
    line-height: 26px; /* Center text vertically */
    font-weight: 500;
}

.btn-remove-danger:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: #f85149;
}

/* Implicit Select Styling */
.implicit-select-card {
    background: #21262d;
    border: 1px solid var(--border-color);
    color: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    max-width: 100px;
}

.range-info-card {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.btn-download {
    background-color: #238636;
    color: white;
    border: 1px solid rgba(240,246,252,0.1);
    padding: 6px 16px;
    cursor: pointer;
    font-weight: 500;
    border-radius: 6px;
    transition: 0.2s;
    font-family: inherit;
}

.btn-download:hover { 
    background-color: #2ea043; 
}

.btn-download:disabled { 
    background-color: #21262d; 
    color: #8b949e; 
    cursor: not-allowed; 
    border-color: var(--border-color); 
}

.btn-add {
    background-color: #1f6feb;
    color: white;
    border: 1px solid rgba(240,246,252,0.1);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    width: 100%; /* Default to full width, overridden by inline styles in JS where needed */
    padding: 8px;
    font-size: 0.9em;
    transition: 0.2s;
}

.btn-add:hover { 
    background-color: #388bfd; 
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border-radius: 8px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-search {
    width: 100%;
    padding: 8px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 1rem;
}

.affix-search-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 6px;
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.1s;
}

.search-item:last-child { border-bottom: none; }

.search-item:hover {
    background: #21262d;
}

.search-item strong {
    display: block;
    color: var(--text-color);
}

.search-item small {
    color: var(--text-muted);
}

.search-item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.search-item-right {
    text-align: right;
    font-family: monospace;
    color: var(--text-muted);
    font-size: 0.85em;
    white-space: nowrap; 
    margin-left: 15px;
}

.btn-close {
    background-color: transparent !important; /* Force override of global green */
    border: none !important;                  /* Remove global button border */
    color: var(--text-muted);
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

.btn-close:hover {
    background-color: rgba(255, 255, 255, 0.1) !important; /* Slight tint instead of green */
    color: var(--text-color);
    box-shadow: none !important; /* Remove any global button shadows */
    border-color: transparent !important;
}

.btn-select-affix {
    background: var(--bg-color);
    color: var(--text-color);
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.btn-select-affix:hover {
    border-color: var(--accent-color);
}

.relic-item.dragging {
    opacity: 0.9;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 100 !important;
    cursor: grabbing;
    transition: width 0.2s ease, height 0.2s ease; /* Smooth resize, instant position */
    pointer-events: none; /* Important for mouse tracking */
}

/* Ensure the container catches mouse events when item has pointer-events: none */
.inventory-grid {
    user-select: none; /* Prevent text selection while dragging */
}

.trash-zone {
    flex-shrink: 0;       /* Prevent being squashed */
    border: 2px solid #f85149;
    color: #f85149;
    border-radius: 6px;
    padding: 20px;       
    text-align: center;
    font-weight: bold;
    cursor: default;
    transition: all 0.2s;
    background-color: rgba(40, 13, 13, 0.70);
    z-index: 20;          /* Ensure it stays above any weird overlaps */
}

.trash-zone.drag-over {
    background-color: rgba(248, 81, 73, 0.2);
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(248, 81, 73, 0.3);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-color); border-left: 1px solid var(--border-color); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 5px; border: 2px solid var(--bg-color); }
::-webkit-scrollbar-thumb:hover { background: #565e68; }

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.1s;
}

.search-item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-item-right {
    text-align: right;
    font-family: monospace;
    color: var(--text-muted);
    font-size: 0.85em;

    white-space: nowrap; /* Forces text to stay on one line */
    flex-shrink: 0;      /* Prevents the ID box from getting squished by long names */
    margin-left: 15px;   /* Adds a safety buffer between the name and the ID */
}

.tag-container {
    display: flex;
    gap: 6px;
}

.tag-badge {
    font-size: 0.7em;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid;
    font-weight: 600;
    text-transform: uppercase;
}

/* Badge Colors */
.tag-unique { color: #f85149; border-color: rgba(248, 81, 73, 0.4); background: rgba(248, 81, 73, 0.1); }
.tag-rare { color: #d29922; border-color: rgba(210, 153, 34, 0.4); background: rgba(210, 153, 34, 0.1); }
.tag-corrupted { color: #a371f7; border-color: rgba(163, 113, 247, 0.4); background: rgba(163, 113, 247, 0.1); }
.tag-fury { color: #e5534b; border-color: rgba(229, 83, 75, 0.4); background: rgba(229, 83, 75, 0.1); }
.tag-faith { color: #58a6ff; border-color: rgba(88, 166, 255, 0.4); background: rgba(88, 166, 255, 0.1); }
.tag-discipline { color: #3fb950; border-color: rgba(63, 185, 80, 0.4); background: rgba(63, 185, 80, 0.1); }
.tag-primary { color: #a5d6ff; border-color: rgba(56, 139, 253, 0.4); background: rgba(56, 139, 253, 0.1); }
.tag-secondary { color: #c9d1d9; border-color: rgba(139, 148, 158, 0.4); background: rgba(139, 148, 158, 0.1); }
.tag-unavailable { color: #8b949e; border-color: rgba(139, 148, 158, 0.4); background: rgba(110, 118, 129, 0.1); font-style: italic; }

/* --- Splash Overlay Styling --- */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.85); /* Dark dim */
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.upload-prompt-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.upload-prompt-card h2 {
    margin: 0;
    color: var(--text-color);
    font-weight: 600;
}

.upload-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

.path-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--accent-color); /* Blue label */
    margin-bottom: 8px;
}

.path-code {
    display: block;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--text-color);
    background: rgba(110, 118, 129, 0.1);
    padding: 10px;
    border-radius: 4px;
    word-break: break-all; /* Wrap long paths */
    user-select: all;      /* Select text on single click */
    border: 1px solid rgba(255,255,255,0.05);
}

.btn-large {
    background-color: #238636;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 6px;
    border: 1px solid rgba(240,246,252,0.1);
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.btn-large:hover {
    background-color: #2ea043;
}

/* --- Custom Checkbox Styling (GitHub Dark) --- */
input[type="checkbox"] {
    /* Reset default browser appearance */
    -webkit-appearance: none;
    appearance: none;
    
    /* Box Styling */
    background-color: var(--input-bg);
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px; /* Matches your input border-radius */
    
    /* Layout for the checkmark */
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    flex-shrink: 0; /* Prevents squishing in flex containers */
    transition: background-color 0.2s, border-color 0.2s;
}

/* The Checkmark (Hidden by default) */
input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    /* Create a white checkmark using box-shadow and clip-path */
    box-shadow: inset 1em 1em white;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

/* Checked State */
input[type="checkbox"]:checked {
    background-color: #1f6feb; /* Primary GitHub Blue */
    border-color: #1f6feb;
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

/* Hover State */
input[type="checkbox"]:hover {
    border-color: var(--text-muted);
}

/* Focus State (Accessibility) */
input[type="checkbox"]:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

/* --- Tooltip Styling --- */
#relicTooltip {
    position: fixed;
    background: rgba(13, 17, 23, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    pointer-events: none;
    z-index: 10000;
    display: none;
    color: var(--text-color);
    font-size: 0.85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.8);
    
    /* Layout constraints */
    min-width: 150px;
    max-width: 300px; /* wrapping point */
    white-space: normal; /* Allow text to wrap */
    transform: scale(var(--app-scale, 1));
    transform-origin: top left;
}

.tooltip-header {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--accent-color); 
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tooltip-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.tooltip-row {
    display: flex;
    align-items: flex-start; /* Align icon to top of wrapped text */
    gap: 8px;
    line-height: 1.4;
    padding: 2px 0;
}

.tooltip-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 3px; /* visual alignment with text */
}

.tooltip-icon.large {
    width: 48px;
    height: 48px;
    margin-left: -5px;
    margin-right: 5px;
    margin-top: 0;
}

.tooltip-icon.colored {
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    background-color: currentColor;
}

/* Flex container for Name + Range */
.tooltip-text {
    flex: 1;
    display: flex;
    justify-content: space-between; /* Pushes Range to right */
    align-items: flex-start; /* Top align allows wrapping without weird spacing */
    gap: 15px; /* Minimum space between text and range */
    width: 100%;
}

/* The Name / Description */
.tooltip-val, .tooltip-desc {
    color: #c9d1d9;
    flex: 1; /* Takes available space */
    word-wrap: break-word;
}

/* The Range [x - y] */
.tooltip-range {
    color: #8b949e;
    font-family: monospace;
    font-size: 0.8em;
    white-space: nowrap; /* Keep [10 - 20] on one line */
    flex-shrink: 0;      /* Never shrink or wrap the range itself */
    text-align: right;
}

.hidden { display: none !important; }

/* Activity Bar (Vertical Sidebar) */
.activity-bar {
    width: 50px;
    background-color: var(--panel-bg);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    flex-shrink: 0;
    z-index: 10;
}

.activity-tab {
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.5rem;
    opacity: 0.5;
    transition: 0.2s;
    border-left: 2px solid transparent;
}

.activity-tab img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.activity-tab:hover { opacity: 1; background-color: rgba(255,255,255,0.05); }
.activity-tab.active { opacity: 1; border-left-color: var(--accent-color); color: var(--accent-color); }

.tooltip-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0 8px 0;
}

/* Description Mode override */
.tooltip-text.column-mode {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.tooltip-text.column-mode .tooltip-range {
    align-self: flex-end;
}

/* --- Changelog Visuals --- */
.changelog-entry {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-color);
    gap: 12px;
    transition: background-color 0.2s;
}

.changelog-entry:hover {
    background-color: var(--panel-bg);
}

.changelog-badge {
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.action-add { background-color: rgba(63, 185, 80, 0.15); color: #3fb950; border: 1px solid rgba(63, 185, 80, 0.4); }
.action-remove { background-color: rgba(248, 81, 73, 0.15); color: #f85149; border: 1px solid rgba(248, 81, 73, 0.4); }
.action-modify { background-color: rgba(88, 166, 255, 0.15); color: #58a6ff; border: 1px solid rgba(88, 166, 255, 0.4); }
.action-default { background-color: rgba(139, 148, 158, 0.15); color: #8b949e; border: 1px solid rgba(139, 148, 158, 0.4); }

.changelog-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--slot-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    flex-shrink: 0;
}

.changelog-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.changelog-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.changelog-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.changelog-sub {
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 2px;
}

.changelog-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.75em;
    color: var(--text-muted);
    font-family: monospace;
    flex-shrink: 0;
}

.changelog-loc {
    color: var(--accent-color);
    font-weight: 600;
}

.changelog-group-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.1s;
}

.changelog-group-header:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.comparison-view {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border-color);
    justify-content: center;
}

.comparison-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    flex: 1;
    max-width: 300px;
    font-size: 0.85rem;
    color: var(--text-color);
}

.comparison-title {
    text-align: center;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}