.characters-tool {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    color: #fff;
}

.characters-tool *,
.characters-tool *::before,
.characters-tool *::after {
    box-sizing: border-box;
}

.characters-hero {
    margin: 0 auto 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    background:
        radial-gradient(900px 240px at 20% 20%, rgba(212, 161, 104, 0.35), transparent 55%),
        linear-gradient(180deg, rgba(0,0,0,0.65), rgba(0,0,0,0.75)),
        url("/static/images/bg/1.jpg");
    background-size: cover;
    background-position: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.characters-hero-inner {
    padding: 1.25rem 1.25rem 1.5rem;
    backdrop-filter: blur(2px);
}

.characters-hero h1 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: 0.5px;
    color: #f3e6d7;
    text-shadow: 0 2px 8px rgba(0,0,0,0.65);
}

.characters-subtitle {
    margin: 0.5rem 0 0;
    color: rgba(255, 255, 255, 0.85);
    max-width: 70ch;
    line-height: 1.5;
}

.characters-error {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(0,0,0,0.55);
}

.characters-error-code {
    margin: 0.75rem 0 0;
    padding: 0.75rem;
    background: rgba(0,0,0,0.6);
    border: 1px dashed rgba(255,255,255,0.18);
    border-radius: 10px;
    overflow: auto;
}

.characters-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    justify-content: center;
    margin: 1rem auto 1.25rem;
}

.characters-controls input,
.characters-controls select {
    padding: 0.55rem 0.7rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    outline: none;
    min-width: 220px;
    min-height: 2.35rem;
    line-height: 1.1;
}

.characters-controls select {
    min-width: 180px;
}

.btn-secondary {
    padding: 0.55rem 0.7rem;
    min-height: 2.35rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.55);
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.2s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
}

.btn-secondary:hover {
    border-color: rgba(212, 161, 104, 0.7);
    background: rgba(0,0,0,0.65);
    transform: translateY(-1px);
}

.characters-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1rem;
    align-items: start;
}

.characters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}

.character-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.55);
    box-shadow: 0 8px 18px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
    overflow: hidden;
}

.character-card:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 161, 104, 0.7);
    background: rgba(0,0,0,0.65);
}

.character-card.is-active {
    border-color: rgba(212, 161, 104, 0.95);
    box-shadow: 0 10px 22px rgba(0,0,0,0.35);
}

.character-card-top {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 0.7rem;
    align-items: center;
}

.character-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.character-card-guide {
    padding: 0.45rem 0.6rem;
    min-height: 2rem;
    border-radius: 999px;
    font-size: 0.85rem;
    background: rgba(212, 161, 104, 0.12);
    border-color: rgba(212, 161, 104, 0.35);
}

.character-card-guide:hover {
    background: rgba(212, 161, 104, 0.18);
    border-color: rgba(212, 161, 104, 0.85);
}

.character-meta {
    min-width: 0;
}

.character-portrait {
    width: 74px;
    height: 74px;
    border-radius: 12px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.16);
    object-fit: contain;
}

.character-portrait.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: rgba(255,255,255,0.7);
}

.character-name {
    font-size: 1.05rem;
    line-height: 1.2;
    color: #f3e6d7;
    text-shadow: 0 2px 6px rgba(0,0,0,0.55);
    overflow-wrap: anywhere;
}

.character-title {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
    margin-top: 0.2rem;
}

.character-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.details-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.character-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 1.2;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.9);
}

.character-badge--variant {
    border-color: rgba(212, 161, 104, 0.45);
    background: rgba(212, 161, 104, 0.15);
    color: rgba(255, 245, 232, 0.95);
}

.character-mini-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    align-items: center;
    margin-top: 0.35rem;
}

.mini-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    min-width: 0;
}

.mini-stat img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.mini-stat span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compare-check {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.35rem;
    border-radius: 10px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.16);
}

.compare-check input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.characters-details {
    position: sticky;
    top: 1rem;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.55);
    box-shadow: 0 10px 22px rgba(0,0,0,0.25);
    overflow: hidden;
}

.characters-details-empty {
    padding: 1rem;
}

.characters-details-empty-title {
    font-size: 1.05rem;
    color: #f3e6d7;
}

.characters-details-empty-body {
    margin-top: 0.3rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
}

.details-header {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 0.9rem;
    padding: 1rem;
    background:
        radial-gradient(500px 160px at 20% 0%, rgba(212, 161, 104, 0.25), transparent 55%),
        rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.10);
}

.details-portrait {
    width: 92px;
    height: 92px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.55);
    object-fit: contain;
}

.details-name {
    font-size: 1.3rem;
    color: #f3e6d7;
    line-height: 1.2;
}

.details-title {
    margin-top: 0.2rem;
    color: rgba(255,255,255,0.8);
}

.details-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.details-body {
    padding: 1rem;
}

.details-quote {
    margin: 0;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.35);
    color: rgba(255,255,255,0.88);
    line-height: 1.5;
}

.details-section {
    margin-top: 1rem;
}

.details-section h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: rgba(212, 161, 104, 0.95);
    border-bottom: 1px solid rgba(255,255,255,0.10);
    padding-bottom: 0.35rem;
}

.details-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.details-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.35);
}

.details-stat img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.details-stat-label {
    display: block;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.72);
}

.details-stat-value {
    display: block;
    font-family: monospace;
    font-size: 1.05rem;
    color: rgba(255,255,255,0.92);
}

.details-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.item-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.35);
    font-size: 0.9rem;
}

.item-chip--link {
    color: inherit;
    text-decoration: none;
    transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
}

.item-chip--link:hover {
    border-color: rgba(212, 161, 104, 0.7);
    background: rgba(0, 0, 0, 0.45);
    transform: translateY(-1px);
}

.item-chip-icon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.35);
    object-fit: cover;
    flex: 0 0 auto;
}

.item-chip-label {
    display: inline-block;
}

.details-perks {
    margin: 0;
    padding-left: 1.2rem;
    color: rgba(255,255,255,0.88);
    line-height: 1.6;
}

.details-perks li::marker {
    color: rgba(212, 161, 104, 0.95);
}

.characters-compare {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.8);
    box-shadow: 0 14px 40px rgba(0,0,0,0.5);
    padding: 0.9rem;
    z-index: 1200;
}

.characters-compare-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.characters-compare-header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #f3e6d7;
}

.characters-compare-actions {
    display: flex;
    gap: 0.5rem;
}

.characters-compare-table {
    margin-top: 0.8rem;
    overflow: auto;
}

.compare-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 0.8rem;
}

.compare-card {
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.45);
    padding: 0.75rem;
}

.compare-card h3 {
    margin: 0;
    font-size: 1rem;
    color: rgba(212, 161, 104, 0.95);
}

.compare-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.compare-statline {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0;
    border-bottom: 1px dashed rgba(255,255,255,0.10);
    font-family: monospace;
}

.compare-statline:last-child {
    border-bottom: none;
}

@media (max-width: 1100px) {
    .characters-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .characters-layout {
        grid-template-columns: 1fr;
    }

    .characters-details {
        position: static;
    }
}

@media (max-width: 600px) {
    .characters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .characters-controls input,
    .characters-controls select {
        min-width: 0;
        width: 100%;
    }

    .characters-controls .btn-secondary {
        width: 100%;
    }

    .characters-controls {
        justify-content: stretch;
    }
}

#compareCount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.35rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-family: monospace;
    font-size: 0.95rem;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(212, 161, 104, 0.15);
}
