/* Official-style +0 -> +9 upgrade tables for item detail pages. */

/* One family block: maroon banner + cream card. */

.armor-upgrade {
    min-width: 0;
}

.armor-upgrade-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 10px 18px;
    border: 1px solid #2c0d07;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background:
        linear-gradient(180deg, rgba(255, 226, 170, 0.16), transparent 42%),
        linear-gradient(180deg, #6c271c, #3d130c);
    box-shadow: inset 0 1px 0 rgba(255, 221, 160, 0.18);
}

.armor-upgrade-banner-copy {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.armor-upgrade-banner-name {
    overflow: hidden;
    color: #ffe9bd;
    font-size: 1.06rem;
    font-weight: 900;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    text-decoration: none;
    white-space: nowrap;
}

.armor-upgrade-banner-name:hover {
    color: #fff4cf;
    text-decoration: underline;
}

.armor-upgrade-banner-name span {
    color: rgba(254, 206, 88, 0.78);
    font-size: 0.86em;
}

.armor-upgrade-banner-level {
    justify-self: start;
    padding: 2px 10px;
    border: 1px solid rgba(255, 223, 160, 0.36);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 244, 207, 0.86);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.armor-upgrade-card {
    min-width: 0;
    border: 1px solid var(--panel-border);
    border-radius: 0 0 4px 16px;
    background:
        linear-gradient(180deg, rgba(255, 252, 231, 0.82), rgba(238, 230, 197, 0.9)),
        var(--paper);
    box-shadow: var(--shadow), var(--inset-shadow);
}

.armor-upgrade-thumb {
    display: grid;
    grid-template-columns: 32px;
    align-self: center;
    flex: 0 0 32px;
    width: 32px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
}

.armor-upgrade-thumb-slot,
.refine-chain-evolution-slot {
    display: grid;
    place-items: center;
    width: 32px;
    border-radius: 3px;
    background: rgba(255, 248, 223, 0.92);
}

/* The table itself. */

.armor-upgrade-scroll {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scrollbar-color: #7d321d rgba(255, 248, 223, 0.78);
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.armor-upgrade-scroll::-webkit-scrollbar {
    height: 10px;
}

.armor-upgrade-scroll::-webkit-scrollbar-track {
    border: 1px solid rgba(143, 106, 71, 0.32);
    border-radius: 999px;
    background: rgba(255, 248, 223, 0.78);
}

.armor-upgrade-scroll::-webkit-scrollbar-thumb {
    border: 2px solid rgba(255, 248, 223, 0.78);
    border-radius: 999px;
    background: #7d321d;
}

.armor-upgrade-scroll::-webkit-scrollbar-thumb:hover {
    background: #5d140b;
}

.armor-upgrade-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

.armor-upgrade-table th,
.armor-upgrade-table td {
    padding: 5px 3px;
    border: 1px solid #b3925f;
    text-align: center;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: normal;
}

.armor-upgrade-table thead th:not(.armor-upgrade-emblem),
.armor-upgrade-table tbody td {
    min-width: 48px;
}

.armor-upgrade-table thead th {
    background:
        linear-gradient(180deg, rgba(255, 239, 196, 0.14), transparent 40%),
        linear-gradient(180deg, #8b6040, #3a1209);
    color: #fff4cf;
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
}

.armor-upgrade-table tbody th[scope="row"] {
    width: 100px;
    min-width: 100px;
    background:
        linear-gradient(180deg, rgba(255, 239, 196, 0.1), transparent 44%),
        linear-gradient(180deg, #8b6040, #3a1209);
    color: #fff4cf;
    font-size: 0.66rem;
    font-weight: 900;
    line-height: 1.18;
    text-align: left;
    padding-left: 7px;
}

.armor-upgrade-emblem,
.armor-upgrade-table tbody th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 2;
}

.armor-upgrade-emblem {
    z-index: 3;
}

.armor-upgrade-table tbody td {
    background: #efe4c6;
    color: #2f1809;
    font-size: 0.72rem;
    font-weight: 800;
}

.armor-upgrade-table tbody tr:nth-child(even) td {
    background: #e6d8b2;
}

/* Negative stat values (e.g. Movement Speed penalty) in red, like the original. */
.armor-upgrade-table td.armor-upgrade-negative {
    color: #97100d;
}

.armor-upgrade-yang-row td {
    color: #8a5a12;
    font-weight: 900;
}

.armor-upgrade-emblem {
    width: 100px;
    padding: 4px !important;
}

.armor-upgrade-item-row td {
    padding: 3px 2px;
}

/* Material tiles hug the icon and stay centred in the cell, so there is no
   oversized "uniform square" behind the icon (especially on hover). */

.armor-upgrade-table .refine-material.crafting-item-tile,
.armor-upgrade-table .refine-material.crafting-item-tile--proto-size-2,
.armor-upgrade-table .refine-material.crafting-item-tile--proto-size-3 {
    display: inline-grid;
    grid-template-columns: 32px;
    width: 32px;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.armor-upgrade-table .refine-material .crafting-item-icon,
.armor-upgrade-table .refine-material.crafting-item-tile--proto-size-2 .crafting-item-icon,
.armor-upgrade-table .refine-material.crafting-item-tile--proto-size-3 .crafting-item-icon {
    width: 32px;
    height: auto;
    border: 0;
    border-radius: 3px;
}

.armor-upgrade-table .refine-material .crafting-item-icon span {
    right: -5px;
    bottom: -4px;
    min-width: 15px;
    font-size: 0.5rem;
}

.armor-upgrade-table .refine-material .crafting-item-name {
    display: none;
}

.armor-upgrade-table .refine-material .shop-tooltip {
    display: none;
}

.armor-upgrade-table .refine-material:hover .shop-tooltip,
.armor-upgrade-table .refine-material:focus-visible .shop-tooltip,
.armor-upgrade-table .refine-material:focus-within .shop-tooltip {
    display: grid;
}

/* Item detail page: standalone upgrade table + detail-only rows. */

.armor-upgrade-standalone {
    margin-bottom: 22px;
}

.armor-upgrade-wearable-row td,
.armor-upgrade-next-row td {
    padding: 7px 10px;
    text-align: left;
}

.armor-upgrade-table .refine-wearable-list {
    gap: 6px;
}

.armor-upgrade-table .refine-chain-evolution {
    width: auto;
}

.refine-chain-evolution-icon {
    display: grid;
    grid-template-columns: 32px;
    align-self: center;
    flex: 0 0 32px;
    width: 32px;
}

/* Possible Bonuses panel: map/mob detail skin. */

.wiki-page-items .item-attribute-panel {
    border: 2px dashed #9e332d;
    border-radius: 0;
    background: rgba(255, 255, 232, 0.54);
    box-shadow: none;
}

.wiki-page-items .item-attribute-panel summary {
    align-items: flex-start;
    padding: 8px 9px;
    border-radius: 0;
    background: transparent;
}

.wiki-page-items .item-attribute-panel[open] summary {
    border-bottom: 2px dashed #9e332d;
}

.wiki-page-items .item-attribute-title {
    flex: 1 1 auto;
    justify-content: center;
}

.wiki-page-items .item-attribute-title > span {
    display: grid;
    justify-items: center;
    width: 100%;
    min-width: 0;
}

.wiki-page-items .item-attribute-panel summary .refine-chain-title strong {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(260px, 80%);
    min-height: 44px;
    margin: 0 auto 6px;
    padding: 6px 14px;
    border: 1px solid #f0d9a2;
    border-radius: 12px;
    background: #2f1d1f;
    color: #f0d9a2;
    font-family: Tahoma, Arial, sans-serif;
    font-size: clamp(1rem, 1.1vw, 1.18rem);
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-shadow: 1px 1px 2px #000;
    box-shadow: 2px 3px 7px rgba(20, 8, 2, 0.36);
}

.wiki-page-items .item-attribute-panel summary .refine-chain-title small {
    color: #21170e;
    text-align: center;
}

.wiki-page-items .item-attribute-body {
    padding: 0 9px 9px;
}

.wiki-page-items .item-attribute-panel[open] .item-attribute-body {
    padding-top: 9px;
}

/* +/- toggle instead of the diamond: + when collapsed, - when expanded. */

.item-attribute-panel summary .refine-chain-toggle,
.item-attribute-panel[open] summary .refine-chain-toggle {
    position: relative;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    transform: none;
}

.item-attribute-panel summary .refine-chain-toggle::before,
.item-attribute-panel summary .refine-chain-toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2.6px;
    border-radius: 2px;
    background: #fff4cf;
    transform: translate(-50%, -50%);
}

.wiki-page-items .item-attribute-panel summary .refine-chain-toggle,
.wiki-page-items .item-attribute-panel[open] summary .refine-chain-toggle {
    margin-top: 12px;
    border: 1px solid #f0d9a2;
    border-radius: 8px;
    background: #2f1d1f;
    box-shadow: 2px 3px 7px rgba(20, 8, 2, 0.24);
}

.item-attribute-panel summary .refine-chain-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.item-attribute-panel[open] summary .refine-chain-toggle::after {
    opacity: 0;
}

.wiki-page-items .item-attribute-panel .item-attribute-table {
    border-color: #2f1d1f;
    border-radius: 0;
    background: rgba(47, 29, 31, 0.78);
    box-shadow: none;
}

.wiki-page-items .item-attribute-panel .item-attribute-head {
    background: #2f1d1f;
    color: #f0d9a2;
}

.wiki-page-items .item-attribute-panel .item-attribute-row,
.wiki-page-items .item-attribute-panel .item-attribute-row:nth-child(odd) {
    background: rgba(255, 249, 223, 0.68);
}

.wiki-page-items .item-attribute-panel .item-attribute-value {
    color: var(--accent);
}

@media (max-width: 720px) {
    .armor-upgrade-banner {
        min-height: 70px;
        padding: 9px 12px;
    }

    .armor-upgrade-banner-name {
        font-size: 0.94rem;
    }
}
