:root {
    --rarity-common: rgb(178, 178, 178);
    --rarity-rare: rgb(160, 217, 72);
    --rarity-epic: rgb(201, 134, 255);
    --rarity-legendary: rgb(247, 148, 32);
    --generals-panel: #60412c;
    --generals-panel-soft: #714c31;
    --generals-panel-dark: #4f3625;
    --generals-line: rgba(215, 155, 66, 0.52);
    --generals-line-soft: rgba(215, 155, 66, 0.22);
    --generals-text: #f7ead5;
    --generals-muted: rgba(247, 234, 213, 0.74);
}

.container {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.container > .row {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    flex-wrap: nowrap;
}

.container > .row > .col-12.mb-2 {
    flex: 0 0 auto;
    margin-bottom: 0 !important;
}

#content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    --generals-scrollbar-width: 10px;
}

.view-section {
    color: var(--generals-text);
}

#viewCosts:not(.d-none) {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.general-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), rgba(43, 30, 20, 0.94) 62%);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 4px 10px rgba(0, 0, 0, 0.34);
}

.general-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.general-icon.rarity-common {
    border: 2px solid var(--rarity-common);
    background-color: rgb(93, 93, 93);
}

.general-icon.rarity-rare {
    border: 2px solid var(--rarity-rare);
    background-color: rgb(71, 94, 19);
}

.general-icon.rarity-epic {
    border: 2px solid var(--rarity-epic);
    background-color: rgb(111, 40, 173);
}

.general-icon.rarity-legendary {
    border: 2px solid var(--rarity-legendary);
    background-color: rgb(165, 85, 27);
}

.skill-tree-grouped {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--generals-line);
}

.skill-tier-row {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    background: rgba(79, 54, 37, 0.86);
    border: 0;
    border-bottom: 1px solid var(--generals-line);
    border-radius: 0;
    padding: 0;
    overflow: visible;
    box-shadow: none;
}

.skill-tier-label {
    color: var(--gf-gold-strong);
    font-size: 34px;
    font-weight: 850;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.38);
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.skill-tier-content {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    padding: 9px 10px 16px;
    border-left: 1px solid rgba(215, 155, 66, 0.32);
}

.skill-group {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #4c5263;
    border: 2px solid #f4b551;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateZ(0);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.skill-group.selected {
    border-color: var(--gf-gold-strong);
    background: #4c5263;
    box-shadow: 0 0 0 2px rgba(243, 194, 74, 0.24), 0 0 14px rgba(243, 194, 74, 0.32);
    transform: scale(1.04);
    z-index: 2;
}

.skill-group.maxed {
    border-color: #f4b551;
}

.skill-group.attack,
.skill-group.defense,
.skill-group.both {
    background: #4c5263;
    border-color: #f4b551;
}

.skill-group.attack.selected,
.skill-group.defense.selected,
.skill-group.both.selected {
    background: #4c5263;
    border-color: var(--gf-gold-strong);
}

.skill-group img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.skill-group-level {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(35, 25, 18, 0.92);
    border: 1px solid rgba(243, 194, 74, 0.78);
    border-radius: 4px;
    padding: 1px 5px;
    color: #f3c24a;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.32);
}

.skill-group:not(.maxed) .skill-group-level {
    border-color: rgba(247, 234, 213, 0.42);
    color: rgba(247, 234, 213, 0.86);
}

.skill-group.attack img {
    filter: none;
}

.skill-group.defense img {
    filter: none;
}

.skill-group.both img {
    filter: none;
}

.skill-overview {
    min-height: 92px;
    margin-bottom: 8px;
    padding: 0;
    display: flex;
    align-items: center;
    background: rgba(79, 54, 37, 0.86);
    border: 0;
    border-top: 1px solid var(--generals-line);
    border-bottom: 1px solid var(--generals-line);
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}

.skill-overview.empty {
    opacity: 0.88;
}

.skill-overview-content {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
    padding: 10px;
}

.skill-overview-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    color: var(--generals-muted);
    font-size: 13px;
    line-height: 1.18;
}

.skill-overview-info > div:first-child {
    color: var(--gf-gold-strong);
    font-size: 16px;
    font-weight: 850;
}

.skill-overview-type {
    margin-top: 3px;
    color: var(--generals-muted);
    font-weight: 700;
}

.skill-overview .skill-group {
    width: 70px;
    height: 70px;
    cursor: default;
    flex: 0 0 auto;
}

.skill-overview .skill-group-level {
    display: none;
}

.skill-overview .general-icon {
    margin: 10px 0 10px 10px;
    flex: 0 0 auto;
}

.skill-details-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-top: 8px;
    border-top: 1px solid var(--generals-line);
    border-bottom: 1px solid var(--generals-line);
}

.skill-detail-panel {
    background: rgba(73, 49, 34, 0.84);
    border: 0;
    border-radius: 0;
    padding: 0;
    min-height: 96px;
    color: var(--generals-text);
    font-size: 13px;
    line-height: 1.28;
    overflow: hidden;
    box-shadow: none;
}

.skill-detail-panel + .skill-detail-panel {
    border-left: 1px solid var(--generals-line);
}

.skill-detail-title {
    margin-bottom: 6px;
    padding: 3px 10px;
    border-bottom: 1px solid var(--generals-line);
    background: transparent;
    color: var(--gf-gold-strong);
    font-size: 14px;
    font-weight: 850;
}

.skill-detail-panel > div:not(.skill-detail-title) {
    padding: 0 10px 8px;
}

#viewCosts .box {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    background: transparent;
    border: 0;
    border-top: 1px solid rgba(215, 155, 66, 0.52);
    border-bottom: 1px solid rgba(215, 155, 66, 0.52);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

#viewCosts .box-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    background: transparent;
}

.cost-table-wrap {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    color: var(--generals-text);
}

.cost-table-header {
    flex: 0 0 auto;
    overflow: hidden;
    box-sizing: border-box;
    padding-inline-end: var(--generals-scrollbar-width);
    background: #4f3625;
}

.cost-table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.cost-table-scroll > .cost-table {
    min-height: 100%;
}

.cost-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
    color: var(--generals-text);
    font-size: clamp(12px, 1.15vw, 14px);
}

.cost-table th,
.cost-table td {
    height: 32px;
    padding: 5px 10px;
    border: 0;
    border-bottom: 1px solid rgba(215, 155, 66, 0.34);
    border-right: 1px solid rgba(215, 155, 66, 0.34);
    background: #4f3625;
    text-align: center;
    font-weight: 800;
    vertical-align: middle;
}

.cost-table th {
    background: #4f3625;
    border-bottom: 2px solid rgba(215, 155, 66, 0.52);
    color: var(--gf-gold-strong);
    font-size: clamp(13px, 1.2vw, 15px);
    font-weight: 850;
    text-shadow: none;
}

.cost-table th:last-child,
.cost-table td:last-child {
    border-right: 0;
}

.cost-table tbody tr:last-child td {
    border-bottom: 0;
}

.cost-table tbody tr:not(.cost-row-alt):not(.cost-total-row) td {
    background: linear-gradient(90deg, rgba(79, 54, 37, 0.96), rgba(79, 54, 37, 0.76));
}

.cost-table tbody tr.cost-row-alt td {
    background: linear-gradient(90deg, rgba(73, 49, 34, 0.96), rgba(73, 49, 34, 0.74));
}

.cost-table tbody tr:not(.cost-total-row):hover td {
    background: linear-gradient(90deg, rgba(86, 58, 39, 0.98), rgba(86, 58, 39, 0.82));
}

.cost-total-row td {
    background: linear-gradient(90deg, rgba(63, 43, 30, 0.97), rgba(63, 43, 30, 0.82));
    border-top: 2px solid rgba(215, 155, 66, 0.52);
    color: var(--gf-gold-strong);
    font-size: 14px;
    font-weight: 850;
}

.col-level {
    width: 28%;
}

.col-shards,
.col-xp {
    width: 36%;
}

.cost-table th:nth-child(1),
.cost-table td:nth-child(1) {
    width: 28%;
}

.cost-table th:nth-child(2),
.cost-table td:nth-child(2),
.cost-table th:nth-child(3),
.cost-table td:nth-child(3) {
    width: 36%;
}

@media (max-width: 768px) {
    #content {
        padding-left: 0;
        padding-right: 0;
    }

    .skill-tier-row {
        grid-template-columns: 38px minmax(0, 1fr);
        padding: 0;
    }

    .skill-tier-label {
        font-size: 28px;
    }

    .skill-tier-content {
        gap: 7px;
        padding: 6px 7px 11px;
    }

    .skill-group {
        width: 50px;
        height: 50px;
    }

    .skill-group-level {
        bottom: -5px;
        font-size: 10px;
        padding: 1px 4px;
    }

    .skill-overview {
        min-height: 62px;
        margin-bottom: 4px;
    }

    .skill-overview .general-icon {
        margin: 4px 0 4px 8px;
    }

    .skill-overview-content {
        gap: 8px;
        padding: 4px 8px;
    }

    .general-icon,
    .skill-overview .skill-group {
        width: 54px;
        height: 54px;
    }

    .skill-details-row {
        grid-template-columns: 1fr;
        margin-top: 4px;
    }

    .skill-detail-panel + .skill-detail-panel {
        border-left: 0;
        border-top: 1px solid var(--generals-line);
    }

    .skill-detail-panel {
        min-height: 90px;
    }
}

@media (max-width: 400px) {
    .general-icon,
    .skill-overview .skill-group {
        width: 46px;
        height: 46px;
    }

    .skill-group {
        width: 44px;
        height: 44px;
    }

    .skill-tier-content {
        gap: 7px;
    }

    .skill-overview-info > div:first-child {
        font-size: 14px;
    }

    .cost-table {
        font-size: 12px;
    }
}
