/* Class Skill Guide - public page */

.cs-page {
    --cs-bg: var(--ax-panel, #0a1018);
    --cs-card: var(--ax-card, #0e1622);
    --cs-card-2: var(--ax-card-2, #101a27);
    --cs-line: var(--ax-line, #16202f);
    --cs-line-2: var(--ax-line-2, #1d2a3c);
    --cs-text: var(--ax-text, #e6edf7);
    --cs-text-2: var(--ax-text-2, #9fb0c6);
    --cs-text-3: var(--ax-text-3, #6b7c93);
    --cs-accent: var(--ax-gold, #f0b429);
    --cs-accent-2: var(--ax-sky, #38a8f0);
    --cs-radius: var(--ax-radius, 10px);
    color: var(--cs-text);
    /* The template sets a fixed body line-height (v1.css: 26px). Inherited into
       10-12px pills it leaves a 26px line box and they balloon, so the component
       states its own and every small element below pins one explicitly. */
    line-height: 1.5;
}

.cs-head {
    margin: 0 0 18px;
}

.cs-head-title {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--cs-text);
}

.cs-head-sub {
    margin: 0;
    max-width: 74ch;
    font-size: 14px;
    line-height: 1.6;
    color: var(--cs-text-2);
}

.cs-empty-state {
    padding: 28px;
    border: 1px dashed var(--cs-line-2);
    border-radius: var(--cs-radius);
    background: var(--cs-card);
    color: var(--cs-text-2);
    text-align: center;
}

.cs-empty-detail {
    margin: 10px 0 0;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ax-red, #ef4444);
}

/* Layout ------------------------------------------------------------ */

.cs-wrap {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.cs-side {
    position: sticky;
    top: 16px;
    background: var(--cs-card);
    border: 1px solid var(--cs-line);
    border-radius: var(--cs-radius);
    overflow: hidden;
}

.cs-side-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--cs-line);
    font-size: 12px;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cs-text-3);
}

.cs-side-toggle {
    display: none;
}

.cs-class-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.cs-class-list > li {
    margin: 0;
}

.cs-class {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: 8px;
    color: var(--cs-text-2);
    text-decoration: none;
    transition: background .14s ease, color .14s ease;
}

.cs-class:hover,
.cs-class:focus-visible {
    background: var(--cs-card-2);
    color: var(--cs-text);
    text-decoration: none;
}

.cs-class.is-active {
    background: linear-gradient(90deg, rgba(240, 180, 41, .16), rgba(240, 180, 41, 0));
    box-shadow: inset 2px 0 0 var(--cs-accent);
    color: var(--cs-text);
}

.cs-class-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--cs-card-2);
}

.cs-class-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13.5px;
    line-height: 1.4;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-class-count {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--cs-card-2);
    border: 1px solid var(--cs-line-2);
    font-size: 11px;
    line-height: 16px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--cs-text-3);
}

.cs-class.is-active .cs-class-count {
    background: rgba(240, 180, 41, .14);
    border-color: rgba(240, 180, 41, .35);
    color: var(--cs-accent);
}

.cs-main {
    min-width: 0;
}

/* Hero -------------------------------------------------------------- */

.cs-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 14px;
    background: linear-gradient(90deg, var(--cs-card-2), var(--cs-card));
    border: 1px solid var(--cs-line);
    border-radius: var(--cs-radius);
}

.cs-hero-art {
    width: 76px;
    height: 76px;
    flex: 0 0 76px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45));
}

.cs-hero-text {
    min-width: 0;
}

.cs-hero-title {
    margin: 0 0 2px;
    font-size: 19px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--cs-text);
}

.cs-hero-count {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--cs-accent);
}

.cs-hero-evo {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
    color: var(--cs-text-3);
}

.cs-hero-where {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    font-size: 12px;
    line-height: 1.55;
}

.cs-where {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--cs-card);
    border: 1px solid var(--cs-line-2);
    color: var(--cs-text-2);
    line-height: 1.6;
}

.cs-where b {
    font-weight: 600;
    color: var(--cs-text);
}

.cs-where i {
    font-style: normal;
    color: var(--cs-text-3);
}

.cs-hero-evo-label {
    font-weight: 600;
    color: var(--cs-text-2);
}

/* Toolbar ----------------------------------------------------------- */

.cs-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.cs-search {
    flex: 1 1 240px;
    min-width: 0;
}

.cs-page .cs-search input,
.cs-page .cs-sort select {
    width: 100%;
    box-sizing: border-box;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--cs-line-2);
    border-radius: 8px;
    background: var(--cs-card);
    color: var(--cs-text);
    font-size: 13.5px;
    line-height: normal;
}

/* apex-v2 forces appearance:none + padding-right:34px on every select and paints
   its own caret, so leave room for it and let the browser centre the label. */
.cs-page .cs-sort select {
    padding-right: 34px;
}

.cs-page .cs-search input:focus,
.cs-page .cs-sort select:focus {
    outline: none;
    border-color: var(--cs-accent-2);
}

.cs-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--cs-text-3);
    white-space: nowrap;
}

.cs-page .cs-sort select {
    width: auto;
    min-width: 150px;
}

.cs-no-result {
    padding: 22px;
    border: 1px dashed var(--cs-line-2);
    border-radius: var(--cs-radius);
    text-align: center;
    color: var(--cs-text-3);
}

/* Cards ------------------------------------------------------------- */

.cs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
    gap: 12px;
}

.cs-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--cs-card);
    border: 1px solid var(--cs-line);
    border-radius: var(--cs-radius);
    transition: border-color .14s ease, transform .14s ease;
}

.cs-card:hover {
    border-color: var(--cs-line-2);
    transform: translateY(-1px);
}

.cs-card-top {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.cs-card-img {
    flex: 0 0 52px;
    width: 52px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(56, 168, 240, .12), transparent 70%);
    border-radius: 6px;
}

.cs-card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cs-card-head {
    min-width: 0;
    flex: 1 1 auto;
}

.cs-card-name {
    margin: 0 0 3px;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--cs-text);
}

.cs-card-skill {
    margin: 0 0 4px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--cs-text-3);
}

.cs-card-skill strong {
    color: var(--cs-text-2);
    font-weight: 600;
}

.cs-elem {
    display: inline-block;
    padding: 2px 7px;
    line-height: 1.3;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .9;
}

.cs-elem-fire      { color: #ff7a45; }
.cs-elem-water     { color: #38bdf8; }
.cs-elem-earth     { color: #a3a635; }
.cs-elem-wind      { color: #4ade80; }
.cs-elem-darkness  { color: #a78bfa; }

.cs-req,
.cs-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cs-req > li {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 62px;
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--cs-card-2);
    border: 1px solid var(--cs-line);
}

.cs-req-label {
    font-size: 10px;
    line-height: 1.3;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--cs-text-3);
}

.cs-req-value {
    /* Labels wrap at different lengths ("CẤP ĐỘ" vs "NĂNG LƯỢNG"), so drop the
       values to the bottom of the box to keep them on one line across the row. */
    margin-top: auto;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--cs-text);
}

.cs-price {
    color: var(--cs-accent);
}

.cs-stats {
    padding-top: 10px !important;
    border-top: 1px solid var(--cs-line);
}

.cs-stats > li {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 5px;
    background: rgba(56, 168, 240, .07);
    font-size: 11.5px;
    line-height: 1.3;
    color: var(--cs-text-3);
}

.cs-stats > li b {
    font-variant-numeric: tabular-nums;
    color: var(--cs-text-2);
}

.cs-npcs {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    padding-top: 9px;
    border-top: 1px solid var(--cs-line);
}

.cs-npcs-label {
    font-size: 10px;
    line-height: 1.6;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--cs-text-3);
}

.cs-npc {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--cs-text-2);
}

.cs-npc + .cs-npc::before {
    content: "";
    width: 1px;
    height: 10px;
    margin-right: 3px;
    background: var(--cs-line-2);
    align-self: center;
}

.cs-npc b {
    font-weight: 600;
    color: var(--cs-text);
}

.cs-npc i {
    font-style: normal;
    color: var(--cs-text-3);
}

.cs-npc-vip {
    font-style: normal;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(240, 180, 41, .15);
    color: var(--cs-accent);
    font-size: 10px;
    line-height: 16px;
    font-weight: 600;
}

/* Which tab of the NPC's shop window the item sits in. */
.cs-npc-tab {
    font-style: normal;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(56, 168, 240, .16);
    border: 1px solid rgba(56, 168, 240, .3);
    color: var(--cs-accent-2);
    font-size: 10px;
    line-height: 16px;
    font-weight: 600;
    white-space: nowrap;
}

/* Responsive -------------------------------------------------------- */

@media (max-width: 900px) {
    .cs-wrap {
        grid-template-columns: minmax(0, 1fr);
    }

    .cs-side {
        position: static;
    }

    .cs-side-head > span {
        display: none;
    }

    .cs-side-head {
        padding: 0;
        border-bottom: 0;
    }

    .cs-side-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        padding: 12px 14px;
        border: 0;
        background: transparent;
        color: var(--cs-text);
        font-size: 14px;
        line-height: 1.4;
        font-weight: 600;
        text-align: left;
        cursor: pointer;
    }

    .cs-caret {
        width: 8px;
        height: 8px;
        border-right: 2px solid var(--cs-text-3);
        border-bottom: 2px solid var(--cs-text-3);
        transform: rotate(45deg) translateY(-2px);
        transition: transform .16s ease;
    }

    .cs-side-toggle[aria-expanded="true"] .cs-caret {
        transform: rotate(-135deg) translateY(-2px);
    }

    .cs-class-list {
        display: none;
        max-height: 60vh;
        border-top: 1px solid var(--cs-line);
    }

    .cs-class-list.is-open {
        display: block;
    }

    .cs-hero-art {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
    }
}

@media (max-width: 560px) {
    .cs-head-title {
        font-size: 21px;
    }

    .cs-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cs-sort {
        flex: 1 1 100%;
    }

    .cs-page .cs-sort select {
        flex: 1 1 auto;
        width: auto;
    }
}

/* Skill detail page ------------------------------------------------- */

.cs-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 11px;
    border-radius: 999px;
    background: var(--cs-card);
    border: 1px solid var(--cs-line-2);
    color: var(--cs-text-2);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .14s ease, color .14s ease;
}

.cs-back:hover,
.cs-back:focus-visible {
    border-color: var(--cs-accent);
    color: var(--cs-text);
    text-decoration: none;
}

/* Chevron drawn from borders so no icon font is needed. */
.cs-back-arrow {
    width: 7px;
    height: 7px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: .75;
}

.cs-detail-foot {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--cs-line);
}

.cs-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--cs-text-3);
}

.cs-crumbs a {
    color: var(--cs-text-2);
    text-decoration: none;
}

.cs-crumbs a:hover {
    color: var(--cs-accent-2);
    text-decoration: underline;
}

.cs-crumb-sep {
    opacity: .5;
}

.cs-crumb-current {
    color: var(--cs-text);
}

.cs-detail-main {
    max-width: 880px;
}

.cs-detail-head {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 18px;
    background: linear-gradient(90deg, var(--cs-card-2), var(--cs-card));
    border: 1px solid var(--cs-line);
    border-radius: var(--cs-radius);
}

.cs-detail-img {
    flex: 0 0 84px;
    width: 84px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(56, 168, 240, .14), transparent 70%);
    border-radius: 8px;
}

.cs-detail-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cs-detail-title {
    min-width: 0;
}

.cs-detail-name {
    margin: 0 0 6px;
    font-size: 24px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--cs-text);
}

.cs-detail-skill {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--cs-text-3);
}

.cs-detail-skill strong {
    font-weight: 600;
    color: var(--cs-text-2);
}

.cs-detail-classes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

.cs-class-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 4px;
    border-radius: 999px;
    background: var(--cs-card);
    border: 1px solid var(--cs-line-2);
    color: var(--cs-text-2);
    font-size: 12px;
    line-height: 1.6;
    text-decoration: none;
}

.cs-class-chip:hover {
    border-color: var(--cs-accent);
    color: var(--cs-text);
    text-decoration: none;
}

.cs-class-chip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.cs-detail-section {
    margin-top: 18px;
}

.cs-detail-h2 {
    margin: 0 0 9px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cs-text-3);
}

.cs-req-wide > li {
    flex: 0 1 132px;
}

.cs-buy-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--cs-card);
    border: 1px solid var(--cs-line);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--cs-text-2);
}

.cs-buy-npc {
    font-weight: 600;
    color: var(--cs-text);
}

.cs-buy-map {
    color: var(--cs-text-2);
}

.cs-buy-pos {
    font-variant-numeric: tabular-nums;
    color: var(--cs-text-3);
}

.cs-related {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}

.cs-related a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    background: var(--cs-card);
    border: 1px solid var(--cs-line);
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--cs-text-2);
    text-decoration: none;
}

.cs-related a:hover {
    border-color: var(--cs-line-2);
    color: var(--cs-text);
    text-decoration: none;
}

.cs-related img {
    width: 26px;
    height: 32px;
    flex: 0 0 26px;
    object-fit: contain;
}

.cs-card-name a {
    color: inherit;
    text-decoration: none;
}

.cs-card-name a:hover {
    color: var(--cs-accent-2);
    text-decoration: none;
}

@media (max-width: 560px) {
    .cs-detail-head {
        gap: 12px;
        padding: 14px;
    }

    .cs-detail-img {
        flex-basis: 60px;
        width: 60px;
        height: 72px;
    }

    .cs-detail-name {
        font-size: 19px;
    }
}
