/* ==========================================================================
   1. Global & Reset
   ========================================================================== */
body {
    caret-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    overflow-y: overlay;
}

input,
textarea {
    caret-color: auto;
    user-select: auto;
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.persona-img,
.card-background,
.cover-star {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ==========================================================================
   2. Layout & Containers
   ========================================================================== */
.main-content {
    background-color: transparent;
    width: 100%;
}

.header-container,
.navigation-path {
    padding-left: 0px;
    padding-right: 0px;
}

.separator-line {
    padding: 0 20px;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1) 10%, rgba(255, 255, 255, 0.1) 90%, transparent);
    margin: 0px 0 24px 0;
    box-sizing: border-box;
}

/* Split View Layout */
.split-view-container {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.persona-list-panel {
    flex: 0 0 390px;
    min-width: 0;
    max-height: 80vh;
    overflow-y: auto;
    padding: 0 20px;
    background: #222;
    border-radius: 8px;
    box-sizing: border-box;
}

.persona-detail-panel {
    flex: 1;
    min-width: 0;
    background: #222;
    border-radius: 8px;
    overflow-y: auto;
    box-sizing: border-box;
    width: 100%;
    user-select: text;
    -webkit-user-select: text;
}

/* Panel specific scrollbar override */
.persona-list-panel::-webkit-scrollbar,
.persona-detail-panel::-webkit-scrollbar {
    width: 6px;
}

.persona-list-panel::-webkit-scrollbar-track,
.persona-detail-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.persona-list-panel::-webkit-scrollbar-thumb,
.persona-detail-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.persona-list-panel::-webkit-scrollbar-thumb:hover,
.persona-detail-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sticky-content {
    top: 20px;
    padding: 0 20px 20px 20px;
}

.empty-state-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
    min-height: 400px;
}

/* ==========================================================================
   3. Filters, Search & Controls
   ========================================================================== */
.filter-section {
    margin-bottom: 40px;
    overflow: hidden;
}

.filter-header {
    display: none;
}

/* Filter Controls inside List Panel */
.persona-list-panel .filter-header-sticky {
    position: sticky;
    top: 0;
    background-color: #222;
    z-index: 100;
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
}

.filter-toggle-btn img {
    width: 20px;
    height: 20px;
}

.filter-reset-btn {
    margin-right: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0px;
}

.filter-reset-btn img {
    height: 28px;
    object-fit: contain;
}

.filter-content {
    padding: 0px;
}

.filter-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 4px;
    gap: 4px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group h3 {
    width: 60px;
    color: rgb(255, 255, 255, 0.8);
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 400;
    outline: none;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-right: 0px;
    padding-right: 0px;
}

.filter-options label {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    border-radius: 32px;
    padding: 0px 6px;
    transition: all 0s;
    background-color: var(--card-background);
    outline: none;
}

.filter-options label:hover {
    filter: brightness(1.1);
    background-color: rgb(255, 255, 255, 0.4);
}

.filter-options input[type="checkbox"]:checked+img,
.filter-options input[type="checkbox"]:checked+.star-container {
    filter: brightness(1.2);
}

.filter-options input[type="checkbox"]:checked~label,
.filter-options label:has(input[type="checkbox"]:checked) {
    background-color: rgba(0, 0, 0, 0.2);
    height: 32px;
    padding: 0px 6px;
    box-shadow: 0 0 0 1px #ff00007c inset;
}

.filter-options img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.filter-options img[src*="직업_지배.png"],
.filter-options img[src*="직업_반항.png"],
.filter-options img[src*="직업_우월.png"],
.filter-options img[src*="직업_굴복.png"],
.filter-options img[src*="직업_방위.png"],
.filter-options img[src*="직업_해명.png"],
.filter-options img[src*="persona-grade8.webp"] {
    width: 22px;
    height: 22px;
}

.filter-options input[type="checkbox"] {
    display: none;
    width: 16px;
    height: 16px;
}

.star-container {
    display: flex;
    gap: 2px;
    padding: 0px 8px;
}

.star-container img {
    width: 12px;
    height: 12px;
    object-fit: contain;
}

/* Search */
.search-section {
    position: relative;
    padding: 0;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    align-items: center;
    max-width: 260px;
    box-sizing: border-box;
}

.search-count {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    white-space: nowrap;
}

.search-icon {
    position: absolute;
    left: 0px;
    top: 50%;
    transform: translateY(-40%);
    pointer-events: none;
}

#personaSearch {
    width: 100%;
    padding: 10px 16px 10px 32px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

#personaSearch:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-dropdown::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.search-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.dropdown-item {
    padding: 10px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Sort & Expand Controls */
.search-sort-container {
    width: 100%;
}

.sort-select {
    background: #222;
    color: #aaa;
    border: none;
    padding: 6px;
    border-radius: 4px;
    height: 28px;
    font-size: 11px;
}

.expand-all-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expand-all-toggle input {
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    appearance: auto;
}

.expand-all-toggle label {
    font-size: 12px;
    opacity: .9;
}

.skill-level-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.skill-level-label {
    opacity: 0.9;
}

.skill-level-separator {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   4. Card Component
   ========================================================================== */
.card {
    position: relative;
    width: 90px;
    aspect-ratio: 1/1.67;
    cursor: pointer;
    transition: filter 0.1s;
    overflow: hidden;
}

.card:hover {
    filter: brightness(1.1);
    z-index: 1;
}

/* Image Handling */
.image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
    z-index: 2;
    transform: translateZ(0);
    isolation: isolate;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.card-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: 10px;
    object-fit: cover;
}

.persona-img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Independent transform variables */
    --tx: 1%;
    --ty: 5%;
    --scale: 1;
    --hover-magnify: 1;
    transform: translate(var(--tx), var(--ty)) scale(calc(var(--scale) * var(--hover-magnify)));
    transition: transform 0.2s ease;
    z-index: 2;
    overflow: initial;
}

.card:hover .persona-img {
    --hover-magnify: 1.15;
}

.cover-star {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    object-fit: cover;
}

/* Icons & Badges */
.element-icon {
    width: 11% !important;
    height: auto !important;
    position: absolute;
    top: 0px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    object-fit: contain !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.position-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
}

.position-icon {
    width: 60% !important;
    height: auto !important;
    object-fit: contain !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.wild-emblem {
    position: absolute;
    bottom: 12px;
    left: 51%;
    transform: translateX(-50%);
    width: 18%;
    height: auto;
    z-index: 5;
    object-fit: contain;
    pointer-events: none;
}

.tier-label {
    position: absolute;
    top: 15px;
    right: 0;
    left: auto;
    z-index: 6;
    background: #333;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px 0 0 4px;
    box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1;
    font-family: sans-serif;
    letter-spacing: -0.5px;
    text-shadow: none;
    -webkit-text-stroke: 0;
    border: none;
}

.tier-label.tier-s {
    background: linear-gradient(45deg, #cbebea, #e0b1f2, #cbebea, #e8baf9);
    color: #111;
}

.tier-label.tier-a {
    background: linear-gradient(45deg, #efd16e, #fef0a2);
    color: #111;
}

.tier-label.tier-b {
    background: #8d6e63;
    color: #fff;
}

/* ==========================================================================
   5. List Item & Grid Container
   ========================================================================== */
.persona-cards {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    justify-content: space-between;
}

.persona-detail-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 20px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    justify-content: center;
    grid-column: span 1;
}

.persona-detail-container:hover {
    z-index: 10;
}

.persona-detail-container.selected .card {
    box-shadow: 0 0 0 2px #ff0000;
    filter: brightness(1.1);
    overflow: visible !important;
    z-index: 10;
}

/* Liquid Border Effect for Selected */
.persona-detail-container.selected .card::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: #ff0000d9;
    z-index: -1;
    border-radius: 0px;
    animation: subtle-liquid 2s infinite linear;
}

.persona-detail-container[style*="position: absolute"] {
    left: -9999px !important;
    top: -9999px !important;
    z-index: -1;
}

/* Thumbnail Mode (In list view) */
.persona-detail-container .persona-info-section {
    display: none;
}

.persona-card-section {
    flex-direction: column;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

.persona-card-section .position-container {
    transform: scale(0.6);
    transform-origin: top left;
    top: 2px !important;
    left: 2px !important;
}

.persona-detail-container .persona-name {
    margin-top: 4px;
    margin-bottom: 4px;
    text-align: center;
    font-weight: 500;
    font-size: 11px;
    color: EEEEEE;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persona-detail-container.active .persona-card-section .persona-name {
    display: none;
}

/* Expanded/Active Logic */
.persona-detail-container.expanded,
.expand-all .persona-detail-container {
    grid-column: 1 / -1;
}

.persona-detail-container.expanded .persona-info-section,
.expand-all .persona-detail-container .persona-info-section {
    display: flex;
}

/* ==========================================================================
   6. Detailed Information Sections
   ========================================================================== */
/* Sticky Header inside Detail Panel */
#personaDetailContent .persona-info-section {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
}

#personaDetailContent .persona-header-info {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    background-color: #222;
    z-index: 100;
    padding-top: 16px;
}

.persona-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.persona-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.persona-header-info h2 {
    margin: 0;
    font-size: 20px;
}

/* Info Boxes Common Styles */
.persona-instinct-info,
.persona-unique-skill-info,
.persona-highlight-info,
.persona-recommended-skills,
.persona-innate-skills,
.persona-comment {
    background: rgba(0, 0, 0, 0.15);
    padding: 16px;
    border-radius: 8px;
}

.persona-info-section h3 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: rgb(255, 255, 255, 0.9);
}

.persona-info-section p {
    white-space: pre-line;
    margin: 0;
    font-size: 13px;
    color: rgb(255, 255, 255, 0.8);
    line-height: 1.7;
}

/* Instinct & Variant */
.persona-instinct-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.persona-instinct-header h3 {
    margin-bottom: 0;
}

.persona-instinct-info ul {
    margin: 8px 0;
    padding-left: 20px;
}

.instinct-variant-buttons {
    display: inline-flex;
    margin: 0px 0px 10px 4px;
    gap: 4px;
}

.instinct-variant-btn {
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
}

.instinct-variant-btn.active {
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 0 1px #aaa inset;
}

/* Skills Layout & Styling */
.skill-highlight-container {
    display: grid;
    grid-template-columns: 1.617fr 1fr;
    gap: 10px;
}

.persona-unique-skill-info,
.persona-highlight-info {
    padding: 15px;
    border-radius: 8px;
}

.persona-unique-skill-info h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.persona-highlight-info h3 {
    height: 24px;
}

.skill-type-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.persona-unique-header,
.persona-highlight-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

.skill-level-buttons {
    display: inline-flex;
    gap: 6px;
    margin-left: 6px;
}

.skill-level-btn {
    background: rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
}

.skill-level-btn.active {
    box-shadow: 0 0 0 1px #aaa inset;
    background: rgba(0, 0, 0, 0.8);
}

.persona-grade-img {
    height: 16px;
    width: auto;
    object-fit: contain;
}

.persona-recommended-skills ul,
.persona-innate-skills ul {
    list-style: none;
    padding: 0;
    margin-bottom: 0px;
}

.persona-recommended-skills li,
.persona-innate-skills li {
    margin: 10px 0;
}

.skill-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.skill-info .skill-name-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 3px 8px 3px 0px;
    border-radius: 4px;
}

.innate-level {
    min-width: 24px;
    font-size: 10px !important;
    color: #888;
}

.persona-recommended-skills .skill-name-container {
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.persona-recommended-skills .skill-name-container:hover {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.skill-icon {
    width: 20px;
    height: 20px;
}

.skill-name {
    min-width: 95px;
    font-size: 12px;
}

.skill-description {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    line-height: 1.6;
}

/* Priority & Colors */
.persona-instinct-info[data-priority="3"],
.persona-unique-skill-info[data-priority="3"],
.persona-highlight-info[data-priority="3"],
.priority-box.high {
    position: relative;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid transparent;
    background-clip: padding-box;
}

.persona-instinct-info[data-priority="3"]::before,
.persona-unique-skill-info[data-priority="3"]::before,
.persona-highlight-info[data-priority="3"]::before,
.priority-box.high::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(45deg, #b1c0ec, #efefef, #c4ffff, #efefef, #e4c2d3, #efefef, #c6a9f9, #ba7f96, #efefef, #c4ffff);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    background-size: 150% auto;
}

.persona-instinct-info[data-priority="2"],
.persona-unique-skill-info[data-priority="2"],
.persona-highlight-info[data-priority="2"],
.priority-box.medium {
    border: 1.5px solid rgba(212, 201, 189, 0.3);
}

.persona-instinct-info[data-priority="1"],
.persona-unique-skill-info[data-priority="1"],
.persona-highlight-info[data-priority="1"],
.priority-box.medium {
    border: 1.5px solid rgba(212, 201, 189, 0.3);
}

.persona-recommended-skills li[data-priority="3"] .skill-name,
.priority-text.high {
    color: #e99292;
}

.persona-recommended-skills li[data-priority="2"] .skill-name,
.priority-text.medium {
    color: rgba(114, 165, 224, 0.8);
}

.persona-recommended-skills li[data-priority="1"] .skill-name,
.persona-innate-skills li[data-priority="1"] .skill-name,
.priority-text.low {
    color: rgb(255, 255, 255, 0.8);
}

.persona-recommended-skills li[data-priority="0"] .skill-name,
.persona-innate-skills li[data-priority="0"] .skill-name,
.priority-text.extra-low {
    color: rgb(255, 255, 255, 0.4);
}

/* Comments */
.comment-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.comment-icon {
    font-size: 12px;
    line-height: 1.5;
    color: rgb(255, 255, 255, 0.6);
}

.persona-comment p {
    margin: 0;
    flex: 1;
    font-size: 12px;
    color: rgb(255, 255, 255, 0.6);
}

/* Acquisition Info */
.persona-acq-info {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.persona-acq-info .acq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.persona-acq-info .acq-header h3 {
    font-size: 13px;
    margin: 0;
}

.persona-acq-info .acq-detail {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ddd;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
}

.persona-acq-info .acq-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.persona-acq-info .acq-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.persona-acq-info .acq-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.persona-acq-info .acq-plus {
    opacity: .8;
    padding: 0 2px;
}

.persona-acq-info .acq-text {
    font-size: 12px;
    opacity: .9;
}

.persona-acq-info .acq-emblem {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.persona-acq-info .acq-emblem-num {
    font-size: 12px;
    color: #ffd54f;
}

.filter-text {
    font-size: 13px;
    opacity: 0.8;
}

.sub-text {
    margin-left: 2px;
    font-size: 12px;
    opacity: 0.4;
}

/* ==========================================================================
   7. Animations
   ========================================================================== */
@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes subtle-liquid {
    0% {
        clip-path: polygon(0% 2%, 99% 1%, 97% 99%, 2% 97%);
    }

    10% {
        clip-path: polygon(1% 1%, 98% 5%, 99% 100%, 1% 99%);
    }

    20% {
        clip-path: polygon(-1% 3%, 100% 5%, 101% 98%, 3% 98%);
    }

    30% {
        clip-path: polygon(0% 3%, 98% 2%, 99% 96%, 5% 96%);
    }

    40% {
        clip-path: polygon(1% 1%, 99% -1%, 97% 98%, 4% 98%);
    }

    50% {
        clip-path: polygon(0% 0%, 100% 2%, 96% 101%, 3% 95%);
    }

    60% {
        clip-path: polygon(-1% 3%, 98% 1%, 94% 98%, 1% 97%);
    }

    70% {
        clip-path: polygon(3% 2%, 99% -1%, 95% 96%, 4% 95%);
    }

    80% {
        clip-path: polygon(0% 4%, 101% 2%, 96% 98%, 3% 99%);
    }

    90% {
        clip-path: polygon(-1% 3%, 98% 4%, 97% 100%, 5% 100%);
    }

    100% {
        clip-path: polygon(0% 2%, 99% 1%, 98% 99%, 2% 98%);
    }
}

/* ==========================================================================
   8. Media Queries
   ========================================================================== */
/* PC Large / Expanded State Overrides */
@media(min-width:1440px) {
    .split-view-container {
        flex-direction: row-reverse;
    }

    .persona-detail-container {
        padding: 0px;
        background: var(--card-background)
    }

    .persona-detail-container.active {
        padding: 20px;
        background: var(--card-background);
        border-bottom: solid 3px rgb(115 0 0);
    }
}

/* Tablet / Laptop (Max 1440px) */
@media (max-width: 1440px) {
    .main-wrapper {
        padding-top: 60px;
    }

    .filter-header {
        display: none;
        padding-top: 0;
        margin-top: 0;
        overflow: hidden;
    }

    .filter-section {
        padding-top: 0;
        margin-top: 0;
        overflow: hidden;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-group h3 {
        margin-bottom: 4px;
    }

    .filter-content {
        margin-bottom: 10px;
    }

    .card {
        max-width: 80px;
        width: 40vw;
    }

    .persona-cards {
        justify-content: space-between;
        padding: 10px;
        gap: 2vh 2vw;
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .position-container {
        width: 32px;
        height: 32px;
    }

    .wild-emblem {
        width: 20%;
    }

    .filter-toggle-btn img {
        width: 20px;
        height: 20px;
    }

    .persona-info-section p {
        font-size: 12px;
    }

    .persona-detail-container {
        padding: 20px 0 0 0px;
        background: var(--card-background)
    }

    .persona-detail-container.active {
        padding: 20px 10px 10px 10px;
        background: var(--card-background);
        border-bottom: solid 3px rgb(115 0 0);
    }
}

/* Tablet Vertical (Max 1200px) */
@media (max-width: 1200px) {

    .navigation-path,
    .header-container,
    .filter-content,
    .persona-cards {
        padding-left: 0px;
        padding-right: 0px;
    }

    .header-container h1 {
        margin-bottom: 0px;
    }

    .persona-detail-container {
        padding: 20px 10px 10px 10px;
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 0px;
        gap: 1vh;
    }

    .search-section {
        padding: 0px;
        width: 100%;
    }

    .persona-card-section {
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .card {
        margin: 0 auto;
    }

    .persona-header-info {
        margin-left: 2px;
        gap: 4px;
    }

    .skill-highlight-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .persona-info-section {
        gap: 10px;
    }

    .skill-info {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        padding-bottom: 8px;
    }

    .skill-description {
        width: 100%;
        word-break: break-all;
    }

    .skill-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .persona-recommended-skills .skill-name-container,
    .persona-innate-skills .skill-name-container {
        padding: 4px 6px;
    }
}

/* Mobile (Max 768px) */
@media (max-width: 768px) {
    .split-view-container {
        flex-direction: column;
    }

    .persona-list-panel {
        width: 100%;
        padding: 0 16px;
    }

    .sticky-content {
        padding: 0 16px;
    }

    .persona-header-info h2 {
        font-size: 16px;
    }

    .persona-cards {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }

    .expand-all-toggle {
        display: none;
    }
}

/* Small Mobile (Max 660px) */
@media (max-width: 660px) {
    .persona-cards {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

/* Extra Small Mobile (Max 450px) */
@media (max-width: 450px) {
    .persona-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* ==========================================================================
   7. Filter Modal & Active Tags
   ========================================================================== */

/* Filter Button in Search Bar */
.filter-open-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.filter-open-btn:hover {
    color: #fff;
}

/* Active Filters Container */
.active-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 18px;
    /* Slightly increased margin since it's now in the header */
    min-height: 0;
    padding-bottom: 2px;
}

.filter-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px 3px 6px;
    /* Adjusted padding */
    border-radius: 4px;
    /* More rectangular like game UI if desirable, but sticking to rounded */
    font-size: 11px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-tag img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.filter-tag-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    padding: 0 2px;
    line-height: 1;
}

.filter-tag-close:hover {
    color: #fff;
}

/* Modal Styling */
.filter-modal.hidden {
    display: none;
}

.filter-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.filter-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.filter-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(400px, 90vw);
    max-height: 80vh;
    background: #1a1a1a;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #252525;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.filter-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.filter-close-btn:hover {
    color: #fff;
}

.filter-body {
    padding: 20px;
    overflow-y: auto;
}

.filter-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #252525;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: flex-end;
}

.filter-action-btn {
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    text-transform: capitalize;
    /* Ensure capitalization */
}

.filter-action-btn.reset {
    background: transparent;
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.filter-action-btn.save {
    background: #e60012;
    /* Persona Red */
    color: #fff;
}

.filter-action-btn.reset:hover {
    border-color: #fff;
    color: #fff;
}

.filter-action-btn.save:hover {
    background: #c2000f;
}

/* Ensure filter content looks good in modal */
/* Override previous .filter-group which was flex-row */
/* Assuming .filter-group is also defined earlier, but modal css comes last so it overrides. */
/* Wait, .filter-group is defined on line 527. It is row. */
.filter-body .filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-body .filter-group h3 {
    font-size: 14px;
    color: #ccc;
    margin: 0;
}

.filter-body .filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 0;
}

/* Ensure checkbox labels are correctly styled */
.filter-body .filter-options label {
    display: flex;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.2s;
    box-sizing: border-box;
}

.filter-body .filter-options label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-body .filter-options input[type="checkbox"]:checked+img+span,
.filter-body .filter-options input[type="checkbox"]:checked+div,
/* for stars */
.filter-body .filter-options input[type="checkbox"]:checked+img {
    /* This selector is tricky if structure varies */
}

/* Selected state styling for labels */
.filter-body .filter-options label:has(input:checked) {
    background: rgba(230, 0, 18, 0.2);
    border-color: #e60012;
    padding: 6px 10px;
    /* Force padding to match unchecked state */
}

.filter-body .filter-group:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Mobile Fixes
   ========================================================================== */
@media (max-width: 768px) {

    /* Stack skill level toggle */
    .skill-level-toggle {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .skill-level-buttons {
        margin-left: 0;
    }

    /* Remove left padding from skill name container */
    .persona-recommended-skills .skill-name-container,
    .persona-innate-skills .skill-name-container,
    .skill-info .skill-name-container {
        padding-left: 0 !important;
    }
}