:root {
    --bg-main: #ffffff;
    --text-main: #333333;
    --header-bg: #333333;
    --header-text: #ffffff;
    --panel-left: #f4f4f4;
    --panel-center: #ffffff;
    --panel-right: #f9f9f9;
    --border-color: #cccccc;
    
    --card-bg: #353641;
    --card-border: #555555;
    
    --route-card-bg: #ffffff;
    --route-card-border: #dddddd;
    
    --filter-bg: #e8e8e8;
    --btn-bg: #ffffff;
    --btn-border: #cccccc;
    --btn-text: #333333;
    
    --empty-msg: #666666;
    --substat-bg: #ffffff;
    --text-muted: #7f8c8d;
}

body.dark-mode {
    --bg-main: #121212;
    --text-main: #e0e0e0;
    --header-bg: #1f1f1f;
    --header-text: #ffffff;
    --panel-left: #1e1e1e;
    --panel-center: #121212;
    --panel-right: #1a1a1a;
    --border-color: #333333;
    
    --card-bg: #2c2d35;
    --card-border: #444444;
    
    --route-card-bg: #2c2d35;
    --route-card-border: #444444;
    
    --filter-bg: #2a2a2a;
    --btn-bg: #2c2c2c;
    --btn-border: #444444;
    --btn-text: #e0e0e0;
    
    --empty-msg: #aaaaaa;
    --substat-bg: #2c2c2c;
    --text-muted: #aaaaaa;
}

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

body {
    font-family: Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    color: var(--text-main);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--header-bg);
    color: var(--header-text);
    height: 60px;
}

.header-center {
    flex-grow: 1;
    text-align: center;
}

.header-right {
    display: flex;
    gap: 10px;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.panel {
    padding: 1rem;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    min-height: 0;
}

.left-panel {
    width: 20%;
    background-color: var(--panel-left);
    overflow-y: visible;
}

.center-panel {
    width: 50%;
    background-color: var(--panel-center);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.right-panel {
    width: 30%;
    background-color: var(--panel-right);
    border-right: none;
}

.mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.mode-tab {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--filter-bg);
    color: var(--text-main);
    cursor: pointer;
    font-weight: bold;
    padding: 8px 10px;
}

.mode-tab.active {
    background: #3498db;
    border-color: #2980b9;
    color: white;
}

.mode-view {
    display: none;
    min-height: 0;
}

.mode-view.active {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.recommendation-controls {
    background: var(--filter-bg);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.recommendation-toolbar {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.recommendation-stat-picker {
    flex: 1;
    min-width: 0;
}

.recommend-primary-btn {
    border: 0;
    border-radius: 6px;
    background: #27ae60;
    color: white;
    cursor: pointer;
    font-weight: bold;
    padding: 8px 14px;
    white-space: nowrap;
}

.recommend-primary-btn:hover {
    background: #2ecc71;
}

.recommendation-passive-block {
    margin-top: 8px;
}

.recommendation-block-label {
    color: var(--text-muted);
    font-size: 0.82em;
    font-weight: bold;
    margin-top: 5px;
}

.recommendation-route-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.86em;
    line-height: 1.2;
}

.recommendation-route-filter input {
    accent-color: #27ae60;
    flex-shrink: 0;
}

.recommendation-priority-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.recommendation-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.recommendation-priority-row {
    display: grid;
    grid-template-columns: 28px minmax(120px, 1fr) 80px 80px 30px 30px 30px;
    gap: 6px;
    align-items: center;
}

.priority-rank {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
}

.priority-name {
    font-weight: bold;
    font-size: 0.88em;
}

.priority-bound-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-main);
    color: var(--text-main);
    padding: 5px 6px;
}

.priority-order-btn,
.priority-remove-btn {
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-main);
    color: var(--text-main);
    cursor: pointer;
}

.priority-order-btn:disabled {
    cursor: default;
    opacity: 0.35;
}

.priority-remove-btn {
    color: #e74c3c;
    font-weight: bold;
}

.recommendation-empty-option {
    color: var(--text-muted);
    font-size: 0.85em;
    padding: 8px;
}

.recommendation-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.recommendation-card {
    width: 100%;
    border: 1px solid var(--border-color);
    border-left: 5px solid #3498db;
    border-radius: 6px;
    background: var(--bg-main);
    color: var(--text-main);
    cursor: pointer;
    padding: 10px;
    text-align: left;
}

.recommendation-card:hover,
.recommendation-card.selected {
    border-color: #f1c40f;
    box-shadow: 0 0 8px rgba(241, 196, 15, 0.25);
}

.recommendation-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.recommendation-item-row {
    display: grid;
    grid-template-columns: repeat(5, 42px);
    gap: 6px;
    margin-bottom: 8px;
}

.recommendation-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 5px;
    border: 1px solid var(--card-border);
    background: linear-gradient(to bottom, #302A40, #511D8C);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.55em;
    overflow: hidden;
}

.recommendation-item-icon img {
    max-width: 96%;
    max-height: 96%;
    object-fit: contain;
}

.recommendation-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.recommendation-stat-chip {
    border-radius: 999px;
    background: var(--filter-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 3px 7px;
    font-size: 0.78em;
}

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    align-content: start;
    gap: 10px;
    padding: 10px;
}

#epic-item-grid {
    flex: 1;
    overflow-y: auto;
}

.placeholder-item {
    background: var(--border-color);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.item-card {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(to bottom, #302A40, #511D8C);
    border: 2px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.item-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 95%;
    max-height: 95%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.item-card.selected {
    border-color: #2ecc71;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.5) inset;
}

.item-card:hover {
    border-color: #f1c40f;
    transform: scale(1.05);
}

.filter-row {
    display: flex;
    justify-content: space-around;
    gap: 5px;
    margin-top: 10px;
    flex-wrap: wrap;
    background: var(--filter-bg);
    padding: 5px;
    border-radius: 5px;
}

.weapon-filter-row {
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    margin-top: 10px;
    flex-wrap: wrap;
    background: var(--filter-bg);
    padding: 5px;
    border-radius: 5px;
}

.filter-btn {
    width: 45px;
    height: 45px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    background: var(--card-bg);
    color: white;
    padding: 0;
    overflow: hidden;
    transition: all 0.2s;
}

.filter-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0px 0px 1px rgba(0,0,0,0.5));
}

.filter-btn:hover {
    border-color: #f1c40f;
}

.filter-btn.active {
    border-color: #f1c40f;
    background-color: #e74c3c;
    color: white;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
}

.weapon-btn {
    width: 35px;
    height: 35px;
}

.compact-select {
    position: relative;
    width: 100%;
}

.compact-select-toggle {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-main);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 9px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.compact-select-toggle:hover {
    border-color: #f1c40f;
}

.compact-select-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8em;
}

.compact-select-menu {
    position: absolute;
    z-index: 50;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.18);
    padding: 6px;
    display: none;
}

.compact-select.open .compact-select-menu {
    display: block;
}

.compact-select-search {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-main);
    color: var(--text-main);
    margin-bottom: 6px;
}

.search-clear-wrap {
    position: relative;
    width: 100%;
}

.search-clear-wrap input {
    padding-right: 28px !important;
}

.search-clear-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 15px;
    font-weight: bold;
}

.compact-search-clear-wrap .search-clear-btn {
    top: calc(50% - 3px);
}

.search-clear-wrap.has-value .search-clear-btn {
    display: flex;
}

.search-clear-btn:hover {
    background: var(--filter-bg);
    color: var(--text-main);
}

.compact-options {
    max-height: 230px;
    overflow-y: auto;
}

.compact-option {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
}

.compact-option:hover,
.compact-option.active {
    background: var(--filter-bg);
}

.compact-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: var(--btn-bg);
    flex-shrink: 0;
}

.compact-avatar.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72em;
    font-weight: bold;
}

.stat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 0;
    margin-bottom: 6px;
}

.stat-picker-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.stat-picker-row .compact-select {
    min-width: 0;
    flex: 1;
}

.stat-reset-btn {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--filter-bg);
    color: var(--text-main);
    cursor: pointer;
    font: inherit;
    font-size: 0.82em;
    padding: 0 10px;
    white-space: nowrap;
}

.stat-reset-btn:hover {
    border-color: #e67e22;
    color: #e67e22;
}

.stat-reset-btn:disabled {
    cursor: default;
    opacity: 0.45;
}

.stat-reset-btn:disabled:hover {
    border-color: var(--border-color);
    color: var(--text-main);
}

.stat-pill {
    border: 1px solid #2980b9;
    background: #3498db;
    color: white;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 0.78em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    cursor: pointer;
}

.stat-pill:hover {
    background: #2980b9;
}

.stat-pill button {
    border: 0;
    background: transparent;
    color: white;
    cursor: pointer;
    padding: 0;
    font: inherit;
    line-height: 1;
}

.stat-option-check {
    width: 16px;
    color: #3498db;
    flex-shrink: 0;
}

.substat-btn {
    padding: 5px 2px;
    background: var(--substat-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    text-align: center;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.substat-btn:nth-child(odd):last-child {
    grid-column: span 2;
}
.substat-btn.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

body.lang-ko .substat-btn {
    font-size: 0.75em;
    padding: 4px 1px;
    letter-spacing: -0.5px;
    word-break: keep-all;
}

body.lang-ko .left-panel > div[data-i18n] {
    margin-top: 5px !important;
    margin-bottom: 5px !important;
    line-height: 1 !important;
}

.char-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    transition: all 0.2s;
    background: var(--btn-bg);
    color: var(--btn-text);
}
.char-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.char-btn.active {
    border-color: #e74c3c;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
}
.weapon-btn.disabled {
    opacity: 0.3;
    filter: grayscale(100%);
    pointer-events: none;
}

.selection-header {
    background: var(--filter-bg);
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.empty-msg {
    grid-column: 1 / -1;
    color: var(--empty-msg);
    font-style: italic;
    font-size: 0.9rem;
}

/* Tooltip Styles */
/* Tooltip Styles */
.item-tooltip {
    display: none;
    position: fixed;
    background: linear-gradient(to right, rgba(30, 25, 40, 0.9), rgba(81, 29, 140, 0.9));
    color: white;
    padding: 0;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    border: 1px solid rgba(155, 89, 182, 0.5);
    min-width: 250px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

.tooltip-header {
    display: flex;
    position: relative;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
}

.tooltip-highlight {
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
}

.tooltip-header-info {
    flex: 1;
    padding-left: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.4;
}

.tooltip-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: white;
}

.tooltip-type {
    font-size: 0.85rem;
    font-weight: bold;
}

.tooltip-part {
    font-size: 0.85rem;
    color: #aaa;
}

.tooltip-image-container {
    width: 70px;
    height: 70px;
    margin-left: 15px;
    flex-shrink: 0;
}

.tooltip-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tooltip-stats {
    padding: 10px;
}

.tooltip-stat {
    color: #2ecc71;
    margin-bottom: 3px;
}
