/* Base & Theme */
body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    background-color: #1a1a24; color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; user-select: none;
}

/* Top Bar */
header {
    position: absolute; top: 0; left: 0; width: 100%; height: 60px;
    background: #20202b; border-bottom: 2px solid #3a3a45;
    display: flex; justify-content: center; align-items: center;
    padding: 0 20px; box-sizing: border-box; z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
header .menu-btn { position: absolute; right: 20px; }

.logo { font-size: 20px; font-weight: bold; letter-spacing: 1px; color: #c7c7c7; }

.mode-tabs {
    display: flex; gap: 4px; background: #2a2a35; border-radius: 8px; padding: 3px; border: 1px solid #4a4a5a;
}
.mode-tab {
    padding: 5px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: bold;
    color: #888; transition: 0.2s; white-space: nowrap;
}
.mode-tab:hover { color: #c7c7c7; }
.mode-tab.active { background: #3a3a45; color: #e0e0e0; }

/* Workspace & Zooming */
#workspace-wrapper {
    position: absolute; top: 60px; left: 0; right: 0; bottom: 320px;
    overflow: hidden;
    background-color: #1a1a24;
    cursor: grab;
}
#workspace-wrapper:active { cursor: grabbing; }

#workspace-plane {
    width: 0; height: 0; position: absolute;
    left: 50%; top: 50%;
    transition: transform 0.1s ease-out;
}

/* Infinite Grid Background */
#grid-bg {
    position: absolute; left: -5000px; top: -5000px; width: 10000px; height: 10000px;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Vertical Zoom Slider */
.zoom-container {
    position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
    height: 150px; display: flex; flex-direction: column; align-items: center; gap: 10px;
    background: rgba(32, 32, 43, 0.8); padding: 15px 5px; border-radius: 20px;
    border: 1px solid #3a3a45; z-index: 50;
}
input[type=range][orient=vertical] {
    appearance: slider-vertical; width: 8px; height: 100px; cursor: pointer;
}

/* Resizable Roster Panel */
#roster-panel {
    position: absolute; bottom: 0; left: 0; right: 0; height: 320px;
    background-color: #121218; z-index: 100;
    display: flex; flex-direction: column;
}

#resizer {
    height: 6px; width: 100%; background: #3a3a45; cursor: ns-resize;
    border-top: 1px solid #4a4a5a; border-bottom: 1px solid #1a1a24;
    transition: background 0.2s;
}
#resizer:hover { background: #5a5a6a; }

#categories-wrapper { display: flex; flex-direction: column; flex: 0 1 auto; overflow: hidden; min-height: 100px; }
#categories { display: flex; flex: 1; overflow: hidden; }
.roster-section {
    flex: 1; border-right: 2px solid #2a2a35;
    display: flex; flex-direction: column; overflow: hidden;
}
.roster-section:last-child { border-right: none; }
.roster-title {
    background: #1a1a24; padding: 5px; text-align: center;
    font-size: 12px; font-weight: bold; color: #888; border-bottom: 1px solid #2a2a35;
    flex-shrink: 0;
}

.drop-zone { flex: 1; padding: 10px; gap: 15px; }
.grid-zone { display: flex; flex-wrap: wrap; align-content: flex-start; overflow-y: auto; }

#bottom-rosters { display: flex; flex-direction: row; flex: 1; min-height: 0; border-top: 2px solid #3a3a45; }
#zone-unsorted-wrapper, #zone-unowned-wrapper {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column; background-color: #0f0f14;
    transition: flex 0.2s;
}
#zone-unowned-wrapper { border-left: 1px solid #3a3a45; }
.unsorted-zone { display: flex; flex-wrap: wrap; align-content: flex-start; overflow-y: auto; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #121218; }
::-webkit-scrollbar-thumb { background: #4a4a5a; border-radius: 4px; }

/* Unit Styles */
div.unit {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    cursor: grab; width: 76px; flex-shrink: 0; position: relative;
}
div.unit:active { cursor: grabbing; }
.unit-icon {
    width: 70px; height: 70px; border-radius: 50%;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    border: 3px solid #c7c7c7; box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    background-color: #2a2a35; box-sizing: border-box;
}

.unit-name {
    font-size: 11px; color: #aaa; text-align: center;
    width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.unit-delete {
    position: absolute; top: -4px; right: -4px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #e74c3c; color: #fff;
    font-size: 13px; line-height: 18px; text-align: center;
    cursor: pointer; z-index: 5; display: none;
}
.drop-zone .unit:hover .unit-delete { display: block; }

/* Toggle for hiding names */
body.hide-names .unit-name { display: none; }

.charge-badge {
    position: absolute; top: 0; right: 0; background: #c7c7c7; color: #000;
    font-size: 11px; font-weight: bold; padding: 2px 5px; border-radius: 10px;
    display: none; pointer-events: none; border: 1px solid #1a1a24; z-index: 5;
}

.dragging {
    position: absolute; z-index: 9999; pointer-events: none;
    transform: scale(1.1); transition: transform 0.1s;
}

.drag-placeholder {
    visibility: hidden; pointer-events: none; flex-shrink: 0;
}

/* Team Container */
.team {
    position: absolute; width: 270px; min-height: 90px;
    border-radius: 12px; background: rgba(255, 255, 255, 0.05);
    border: 2px dashed #4a4a5a; cursor: grab; z-index: 10;
    display: flex; flex-direction: row; align-items: center; justify-content: center;
    gap: 10px; padding: 32px 5px 6px 5px;
}
.team:hover { background: rgba(255, 255, 255, 0.1); border-color: #c7c7c7; }
.team.dragging-team { z-index: 1000; opacity: 0.6; transform: scale(1.05); box-shadow: 0 8px 30px rgba(0,0,0,0.5); }

/* Locked Team State */
.team.locked { border: 2px solid #5a5a6a; background: rgba(255, 255, 255, 0.02); }
.team.locked .unit { cursor: grab; }

/* Team Top Bar */
.team-topbar {
    position: absolute; top: 0; left: 0; right: 0; height: 26px;
    border-radius: 10px 10px 0 0; overflow: hidden;
    display: flex; align-items: center; padding: 0 3px; gap: 2px; z-index: 5;
    background: rgba(255, 255, 255, 0.03);
}
.team.has-element .team-topbar {
    background: var(--elem-grad);
}

.lock-indicator, .delete-btn {
    width: 18px; height: 18px; background: #5a5a6a; color: #fff;
    font-size: 11px; border-radius: 4px; display: flex;
    justify-content: center; align-items: center; flex-shrink: 0;
    cursor: pointer; line-height: 1;
}
.lock-indicator:hover, .delete-btn:hover { background: #7a7a8a; }
.team.locked .lock-indicator { background: #c7c7c7; color: #1a1a24; }
.team .delete-btn { display: flex; }

.element-badge {
    width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
    background-color: rgba(0,0,0,0.4);
    background-size: contain; background-position: center; background-repeat: no-repeat;
    border: 1px solid #4a4a5a;
    transition: 0.2s; box-sizing: border-box; flex-shrink: 0;
}
.element-badge:hover { background-color: rgba(0,0,0,0.7); }
.element-badge.has-element { border-color: transparent; }

.team-name-label {
    position: absolute; left: 50%; transform: translateX(-50%);
    max-width: calc(100% - 80px);
    font-size: 12px; font-weight: 900;
    color: #fff; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; cursor: text;
    text-transform: uppercase; letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.team-name-label:empty::before {
    content: 'NAME';
    opacity: 0.35;
}

.team div.unit { pointer-events: auto; margin: 0; }

/* Element Selector Popup */
#element-selector-popup {
    position: fixed; z-index: 10001;
    background: #20202b; border: 1px solid #4a4a5a; border-radius: 8px;
    padding: 5px; display: none; flex-wrap: wrap; gap: 3px;
    width: 124px; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.element-option {
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: 0.2s; box-sizing: border-box;
    background-size: contain; background-position: center; background-repeat: no-repeat;
}
.element-option:hover { border-color: #fff; transform: scale(1.15); }

/* Overlays (Search & Settings) */
.overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 10000;
    justify-content: center; align-items: center; flex-direction: column;
}
#search-input {
    width: 400px; padding: 15px; font-size: 20px;
    background: #2a2a35; border: 2px solid #c7c7c7;
    color: white; border-radius: 8px; outline: none; text-align: center;
}
.hint-text { margin-top: 10px; color: #888; font-size: 14px; }

.modal {
    background: #20202b; padding: 25px; border-radius: 8px; border: 1px solid #4a4a5a;
    width: 300px; display: flex; flex-direction: column; gap: 15px;
}
.modal h2 { margin: 0 0 10px 0; font-size: 18px; color: #c7c7c7; text-align: center; border-bottom: 1px solid #3a3a45; padding-bottom: 10px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; }

/* Rows Layout */
.rows-container {
    display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    overflow-y: auto; padding: 10px; flex-direction: column; gap: 8px;
}
body.layout-rows .rows-container { display: flex; }
body.layout-rows #workspace-plane,
body.layout-rows #grid-bg,
body.layout-rows .zoom-container { display: none; }
body.layout-rows #workspace-wrapper { cursor: default; overflow: auto; }
body.layout-rows #workspace-wrapper:active { cursor: default; }

.row {
    border-radius: 8px; background: rgba(255,255,255,0.03);
    border: 1px solid #3a3a45; min-height: 100px;
    display: flex; flex-direction: column; flex-shrink: 0;
}
.row-topbar {
    height: 28px; border-radius: 8px 8px 0 0; position: relative;
    display: flex; align-items: center; padding: 0 6px; gap: 6px;
    background: rgba(255,255,255,0.04); overflow: hidden; cursor: grab;
}
.row.has-element .row-topbar { background: var(--row-grad); }
.row-body {
    flex: 1; display: flex; flex-wrap: wrap; gap: 10px; padding: 8px; align-content: flex-start;
}
.row .team { position: relative; }
.row-element-label {
    position: absolute; left: 50%; transform: translateX(-50%);
    max-width: calc(100% - 60px);
    font-size: 12px; color: #fff; text-transform: uppercase;
    font-weight: bold; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}

/* Row Alignment - Horizontal rows (default) */
body.layout-rows.row-align-center .row-body { justify-content: center; }
body.layout-rows.row-align-right .row-body { justify-content: flex-end; }

/* Row Alignment - Vertical rows (row-body uses column flex) */
body.layout-rows.row-direction-vertical.row-align-center .row-body { justify-content: flex-start; align-items: center; }
body.layout-rows.row-direction-vertical.row-align-right .row-body { justify-content: flex-start; align-items: flex-end; }
body.layout-rows.row-direction-vertical.row-align-center .rows-container { justify-content: center; }
body.layout-rows.row-direction-vertical.row-align-right .rows-container { justify-content: flex-end; }

/* Vertical Row Direction */
body.layout-rows.row-direction-vertical .rows-container {
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
}
body.layout-rows.row-direction-vertical .row {
    min-height: auto; min-width: 200px; flex-direction: column;
}
body.layout-rows.row-direction-vertical .row-body {
    flex-direction: column; flex: 1;
}
body.layout-rows.row-direction-vertical .row-topbar {
    border-radius: 8px 8px 0 0; flex-shrink: 0;
}

/* Hamburger Menu Button */
.menu-btn {
    width: 36px; height: 36px; border-radius: 6px;
    background: #2a2a35; border: 1px solid #4a4a5a;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: 0.2s; color: #aaa;
}
.menu-btn:hover { background: #3a3a45; color: white; border-color: #c7c7c7; }
.menu-btn svg { width: 22px; height: 22px; fill: currentColor; }

/* Sidebar */
.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 9998;
}
.sidebar-overlay.open { display: block; }

.sidebar {
    position: fixed; top: 0; right: -280px; width: 260px; height: 100%;
    background: #1a1a24; border-left: 2px solid #3a3a45;
    z-index: 9999; transition: right 0.3s ease; display: flex; flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}
.sidebar.open { right: 0; }

.sidebar-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 18px; border-bottom: 1px solid #3a3a45;
    font-size: 16px; font-weight: bold; color: #c7c7c7;
}
.sidebar-close {
    font-size: 22px; cursor: pointer; color: #888; line-height: 1;
}
.sidebar-close:hover { color: #fff; }

.sidebar-items {
    padding: 10px 0; overflow-y: auto; flex: 1;
}

.sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px; cursor: pointer; color: #aaa;
    transition: 0.2s; position: relative;
}
.sidebar-item:hover { background: #2a2a35; color: #fff; }
.sidebar-item svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.sidebar-item span { font-size: 14px; }
.sidebar-item input[type="file"] {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}

.sidebar-divider {
    height: 1px; background: #3a3a45; margin: 8px 18px;
}

/* Auth Tabs & Forms */
.auth-tabs {
    display: flex; border-bottom: 1px solid #3a3a45; margin-bottom: 10px;
}
.auth-tab {
    flex: 1; text-align: center; padding: 8px 0; cursor: pointer;
    color: #888; font-size: 14px; font-weight: bold; transition: 0.2s;
    border-bottom: 2px solid transparent;
}
.auth-tab.active { color: #c7c7c7; border-bottom-color: #c7c7c7; }
.auth-tab:hover { color: #e0e0e0; }

.auth-field {
    display: flex; flex-direction: column; gap: 6px;
}
#auth-login-form, #auth-register-form {
    display: flex; flex-direction: column; gap: 14px;
}
.auth-field label {
    font-size: 12px; color: #888; font-weight: bold;
}
.auth-field input {
    background: #2a2a35; color: #e0e0e0;
    border: 1px solid #4a4a5a; border-radius: 4px;
    padding: 8px 10px; outline: none; font-size: 14px;
    box-sizing: border-box;
}
.auth-field input:focus { border-color: #c7c7c7; }

.auth-submit-btn {
    width: 100%; padding: 10px; margin-top: 4px;
    background: #3a3a45; color: #e0e0e0;
    border: 1px solid #4a4a5a; border-radius: 4px;
    cursor: pointer; font-size: 14px; font-weight: bold;
    transition: 0.2s;
}
.auth-submit-btn:hover { background: #4a4a5a; border-color: #c7c7c7; }

/* Unowned Unit */
.unit.unowned .unit-icon {
    filter: grayscale(1) opacity(0.35);
    border-color: #555;
}
.unit.unowned .unit-name {
    color: #555;
}

/* Unowned Toggle Button */
.unit-unowned-btn {
    position: absolute; bottom: -4px; right: -4px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #5a5a6a; color: #fff;
    font-size: 11px; display: flex;
    justify-content: center; align-items: center;
    cursor: pointer; z-index: 5; line-height: 1;
    opacity: 0; transition: opacity 0.15s;
}
.drop-zone .unit:hover .unit-unowned-btn { opacity: 1; }
.team .unit-unowned-btn { display: none; }
.unit.unowned .unit-unowned-btn { opacity: 1; background: #e74c3c; }
.unit-unowned-btn:hover { background: #7a7a8a; }
.unit.unowned .unit-unowned-btn:hover { background: #c0392b; }

/* Endstate Matrix Mode */
body.mode-matrix #workspace-wrapper,
body.mode-matrix #roster-panel,
body.mode-matrix #fab-add,
body.mode-matrix #element-selector-popup {
    display: none !important;
}
body.mode-matrix {
    background: #1a1a24;
}

.matrix-container {
    display: none; position: absolute; top: 60px; left: 0; right: 0; bottom: 0;
    flex-direction: column;
}
body.mode-matrix .matrix-container { display: flex; }

.matrix-main {
    flex: 1; overflow: hidden; position: relative;
    display: flex; flex-direction: column;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Round groups for Endstate Matrix */
.round-group {
    display: flex; flex-direction: column; flex: none;
    border-left: 1px solid rgba(255,255,255,0.12);
    padding-left: 8px;
}
.round-group:first-child { border-left: none; padding-left: 0; }
.round-label {
    height: 22px; display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 1.5px;
    text-transform: uppercase; font-weight: 600; flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.12); margin-bottom: 6px;
}
.round-bosses {
    display: flex; flex: 1; gap: 8px;
}
body.matrix-row-direction-horizontal .round-group {
    flex-direction: column;
}
body.matrix-row-direction-horizontal .round-bosses {
    flex-direction: row;
}
body:not(.matrix-row-direction-horizontal) .round-group {
    flex-direction: column;
}
body:not(.matrix-row-direction-horizontal) .round-bosses {
    flex-direction: row; flex-wrap: wrap; align-content: flex-start;
}

#matrix-rows {
    flex: 1; min-height: 0; padding: 10px; padding-bottom: 70px; gap: 8px;
    display: flex; flex-direction: column; overflow-y: auto;
}
body.matrix-row-direction-horizontal #matrix-rows {
    flex-direction: row; flex-wrap: nowrap; align-content: flex-start;
    overflow-x: auto; overflow-y: hidden; min-height: 200px; padding-bottom: 10px;
}
body.matrix-row-direction-horizontal #matrix-rows::-webkit-scrollbar {
    height: 6px;
}
body.matrix-row-direction-horizontal #matrix-rows::-webkit-scrollbar-thumb {
    background: #3a3a45; border-radius: 3px;
}
body.matrix-row-direction-horizontal #matrix-rows::-webkit-scrollbar-track {
    background: transparent;
}

/* Individual Boss Row (in Matrix view) — mimics team/element row design */
.matrix-boss-row {
    border-radius: 8px; border: 1px solid #3a3a45;
    display: flex; flex-direction: column; flex: none; height: 200px;
    position: relative; min-width: 290px;
}
body.matrix-row-direction-horizontal .matrix-boss-row {
    width: 300px; flex: none; min-height: 200px; height: auto;
}
body:not(.matrix-row-direction-horizontal) .matrix-boss-row .boss-body {
    overflow-y: auto;
}

.matrix-boss-row .boss-body {
    flex: 1; min-height: 0; padding: 8px; border-radius: 0 0 8px 8px;
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-content: center; align-items: center;
    border-top: 1px dashed #3a3a45;
}
.matrix-boss-row .boss-topbar {
    height: 28px; border-radius: 8px 8px 0 0; position: relative;
    display: flex; justify-content: center; align-items: center;
    background: rgba(255,255,255,0.04); flex-shrink: 0;
}
.matrix-boss-row .boss-topbar .topbar-center {
    display: inline-flex; align-items: center; gap: 8px;
}
.matrix-boss-row .boss-topbar .element-badge {
    width: 22px; height: 22px; border-radius: 50%;
    background-size: contain; background-repeat: no-repeat; background-position: center;
    flex-shrink: 0;
}
.matrix-boss-row .boss-topbar .boss-name-label {
    color: #fff; font-size: 14px; font-weight: 900; text-transform: uppercase;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer; pointer-events: auto; max-width: 200px;
}
.matrix-boss-row .boss-topbar .boss-delete-btn {
    width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(90,30,30,0.7); color: #f88; font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: 0.2s; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
}
.matrix-boss-row .boss-topbar .boss-delete-btn:hover { background: rgba(120,30,30,0.9); color: #faa; }

.matrix-boss-row .boss-body {
    flex: 1; min-height: 0; padding: 8px; border-radius: 0 0 8px 8px;
    display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start;
    border-top: 1px dashed #3a3a45; overflow-y: auto;
}
.matrix-boss-row .boss-body .team {
    position: relative; flex-shrink: 0; cursor: grab;
}
.matrix-boss-row .boss-body .team:active { cursor: grabbing; }
body.matrix-row-direction-horizontal .matrix-boss-row .boss-body {
    flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: center;
}

/* Search mode (before boss is selected) */
.matrix-boss-row .boss-search-wrap {
    position: relative; min-height: 28px; max-width: 280px;
    display: flex; align-items: center; margin: 0 auto;
}
.matrix-boss-row .boss-search-input {
    width: 100%; padding: 6px 10px; border-radius: 8px;
    border: 1px solid #4a4a5a; background: #1a1a24; color: #eee;
    font-size: 13px; outline: none; box-sizing: border-box;
}
.matrix-boss-row .boss-search-input:focus { border-color: #6a6a7a; }

/* Matrix FAB — anchored near resizer bar */
body.mode-matrix #matrix-fab-add {
    display: flex; position: absolute; bottom: 14px; right: 24px;
    width: 52px; height: 52px; border-radius: 50%;
    background: #c7c7c7; color: #1a1a24;
    border: 2px solid #4a4a5a; cursor: pointer; outline: none;
    font-size: 30px; font-weight: bold; line-height: 1; padding: 0;
    justify-content: center; align-items: center;
    z-index: 60; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: 0.2s;
}
body.mode-matrix #matrix-fab-add:hover { background: #fff; transform: scale(1.1); }

/* Boss Search Dropdown */
.boss-dropdown {
    display: none; position: fixed; z-index: 10002;
    background: #20202b; border: 1px solid #4a4a5a; border-radius: 8px;
    max-height: 280px; overflow-y: auto; min-width: 220px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.boss-dropdown.open { display: block; }
.boss-dropdown .boss-option {
    padding: 6px 10px; cursor: pointer; color: #ddd; font-size: 13px;
    display: flex; align-items: center; gap: 8px; transition: 0.15s;
}
.boss-dropdown .boss-option:hover { background: #3a3a45; }
.boss-dropdown .boss-option .option-boss-icon {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background-size: cover; background-position: center;
    border: 1px solid #4a4a5a;
}
.boss-dropdown .boss-option .option-resist {
    margin-left: auto; display: flex; gap: 4px; align-items: center;
}
.boss-dropdown .boss-option .option-resist .mini-resist {
    width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
    background-size: contain; background-repeat: no-repeat; background-position: center;
}

.matrix-resizer {
    height: 6px; width: 100%; background: #3a3a45; cursor: ns-resize;
    border-top: 1px solid #4a4a5a; border-bottom: 1px solid #1a1a24;
    transition: background 0.2s; flex-shrink: 0;
}
.matrix-resizer:hover { background: #5a5a6a; }

.matrix-grid {
    height: 320px; flex-shrink: 0;
    padding: 16px; overflow-y: auto;
    display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px;
    background: #121218;
}

.matrix-grid .team {
    position: relative; cursor: grab; flex-shrink: 0;
}
.matrix-grid .team:active { cursor: grabbing; }

/* Floating Add Button */
.fab-add {
    position: fixed; bottom: 340px; right: 24px;
    width: 52px; height: 52px; border-radius: 50%;
    background: #c7c7c7; color: #1a1a24;
    border: 2px solid #4a4a5a; cursor: pointer; outline: none;
    font-size: 30px; font-weight: bold; line-height: 1; padding: 0;
    display: flex; justify-content: center; align-items: center;
    z-index: 9997; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: 0.2s;
}
.fab-add:hover { background: #fff; transform: scale(1.1); }

/* Hide Matrix FAB outside matrix mode */
body:not(.mode-matrix) #matrix-fab-add { display: none !important; }
/* Hide lock icon in matrix mode */
body.mode-matrix .team .lock-indicator { display: none !important; }

/* Roster Basic/Advanced Modes */
body.roster-basic .roster-advanced { display: none !important; }
#roster-panel { overflow-y: auto; }
