body {
    font-family: Arial, sans-serif;
    background: #f4efe5;
    color: #332d26;
    margin: 0;
}

main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 30px;
}

h1 {
    font-size: 2.5rem;
}

input[type="file"],
input[type="search"] {
    margin: 15px 0;
    padding: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin-top: 20px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}

th {
    background: #e8dfcf;
}

tbody tr:hover {
    background: #faf7f1;
}

.character-link,
.profile-character-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: #6f4c2d;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.character-link:hover,
.profile-character-link:hover {
    color: #a06431;
}


/* MODAL */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.character-profile {
    position: relative;
    width: min(850px, 100%);
    max-height: 90vh;
    overflow-y: auto;

    background: #f7f1e7;
    border-radius: 12px;
    padding: 35px;

    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.35);
}

.close-profile {
    position: absolute;
    top: 15px;
    right: 20px;

    border: 0;
    background: transparent;

    font-size: 2rem;
    cursor: pointer;
}


/* PROFILE HEADER */

.profile-header {
    text-align: center;
    padding-bottom: 25px;
    border-bottom: 1px solid #d6c8b5;
}

.profile-header h2 {
    margin: 0;
    font-size: 2.4rem;
}

.profile-subtitle {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.profile-id {
    font-size: 0.8rem;
    opacity: 0.6;
}


/* PROFILE SECTIONS */

.profile-section {
    margin-top: 30px;
}

.profile-section h3 {
    border-bottom: 1px solid #d6c8b5;
    padding-bottom: 8px;
}


/* SHARED PROFILE ROW LAYOUT */

.information-grid {
    display: grid;
    gap: 5px;
}

.information-row,
.relationship-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 18px;
    align-items: start;

    padding: 7px 0;
}

.information-label {
    font-weight: bold;
}

.relationship-row > div {
    min-width: 0;
}


/* EXPANDABLE DETAILS */

.profile-details {
    margin-top: 25px;
    border-top: 1px solid #d6c8b5;
    padding-top: 15px;
}

.profile-details summary {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
}

.details-content {
    margin-top: 15px;
}


/* ADVANCED DATA */

.advanced pre {
    background: #272522;
    color: #eee;

    padding: 15px;
    border-radius: 6px;

    overflow-x: auto;

    white-space: pre-wrap;
    word-break: break-word;
}

.advanced-warning {
    opacity: 0.7;
    font-size: 0.9rem;
}


/* TRAITS */

.tag-group {
    margin-top: 15px;
}

.tag-group h4 {
    margin-bottom: 10px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    display: inline-block;

    padding: 6px 10px;

    border-radius: 999px;
    font-size: 0.9rem;

    border: 1px solid #bbb;
    background: white;
}

.tag-positive {
    border-color: #73956f;
    background: #edf5eb;
}

.tag-neutral {
    border-color: #999;
    background: #f1f1f1;
}

.tag-negative {
    border-color: #a46c6c;
    background: #f8ecec;
}

.tag-unknown {
    border-color: #aaa;
    background: #eee;
    opacity: 0.7;
}

.hidden-tags {
    margin-top: 15px;
    opacity: 0.75;
}


/* CHARACTER FILTERS */

.character-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 8px;
}

.character-filters select,
.character-filters button {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #999;
    font: inherit;
}

.character-filters button {
    cursor: pointer;
}

#filterCount {
    margin-top: 8px;
    opacity: 0.7;
    font-size: 0.9rem;
}

.sort-header {
    border: 0;
    background: transparent;
    padding: 0;

    font: inherit;
    font-weight: bold;
    color: inherit;

    cursor: pointer;

    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sort-header:hover {
    color: #6f4c2d;
}

.sort-arrow {
    font-size: 0.7em;
    min-width: 10px;
}

.save-location-help {
    margin-top: 15px;
    padding: 15px 18px;
    max-width: 650px;

    background: #eee5d6;
    border: 1px solid #d6c8b5;
    border-radius: 8px;
}

.save-location-help p {
    margin: 8px 0;
}

.save-path-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.save-path-row code {
    padding: 8px 10px;
    background: #f7f1e7;
    border: 1px solid #d6c8b5;
    border-radius: 5px;
}

.save-path-row button {
    padding: 8px 12px;
    cursor: pointer;
}

.save-file-hint {
    font-size: 0.9rem;
    opacity: 0.75;
}

kbd {
    padding: 2px 6px;
    border: 1px solid #aaa;
    border-radius: 4px;
    background: #fafafa;
    font-family: inherit;
}

.third-party-notice {
    max-width: 750px;
    margin: 18px 0;
    padding: 16px 18px;

    background: #f8f3e9;
    border: 1px solid #c9b99f;
    border-left: 4px solid #8b6f47;
    border-radius: 8px;

    line-height: 1.5;
}

.third-party-notice > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.third-party-notice p {
    margin: 8px 0;
}

.third-party-small {
    font-size: 0.88rem;
    opacity: 0.75;
}

.site-footer {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px 30px;

    text-align: center;
    font-size: 0.85rem;
    opacity: 0.65;
}