:root {
    --bg: #F8F9FA;
    --surface: #FFFFFF;
    --surface2: #F1F3F5;
    --border: #DEE2E6;
    --border-light: #E9ECEF;
    --text: #1A1D21;
    --text-muted: #6C757D;
    --text-faint: #ADB5BD;
    --header-bg: #1A1D21;
    --header-fg: #F8F9FA;
    --tab-bar-bg: #FFFFFF;
    --def: #6A35B0;
    --def-light: #F3EEFF;
    --def-mid: #ae82e0;
    --ex: #2E86A0;
    --ex-light: #E4F5FA;
    --ex-mid: #72b8ce;
    --cmp: #A06000;
    --cmp-light: #FFF5DC;
    --cmp-mid: #f5ad42;
    --accent: #6A35B0;
    --radius: 8px;
    --radius-sm: 5px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
    --shadow: 0 2px 10px rgba(0, 0, 0, .08);
    --f: 'Inter', system-ui;
    --f-mono: 'Inconsolata', monospace;
    --header-h: 60px;
    --tabs-h: 48px;
    --filter-h: 50px;
    user-select: none;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    scroll-behavior: smooth
}

body {
    font-family: var(--f);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh
}

/* HEADER */
.hd {
    background: var(--header-bg);
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-h);
    display: flex;
    align-items: center
}

.hd-inner {
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px
}

.hd-left {
    flex: 1;
    min-width: 0
}

.hd-eye {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8A95A0;
    margin-bottom: 2px
}

.hd-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--header-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.hd-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0
}

.dl-group {
    display: grid;
    grid-template-columns:repeat(auto-fill, minmax(270px, 1fr));
    gap: 12px
}

.dl-btn {
    font-family: var(--f-mono);
    font-size: 11px;
    padding: 5px 9px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, .14);
    color: rgba(5, 5, 5, 0.6);
    background: rgba(0, 0, 0, .05);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all .13s;
    white-space: nowrap
}

.dl-btn:hover {
    background: rgba(0, 0, 0, .12);
    color: rgb(5, 5, 5);
    border-color: rgba(0, 0, 0, .28)
}

/* VIEW TAB BAR */
.tabs {
    background: var(--tab-bar-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-h);
    z-index: 190;
    height: var(--tabs-h)
}

.tabs-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 28px;
    height: 100%;
    display: flex;
    align-items: stretch;
    gap: 0
}

.tab {
    font-family: var(--f);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 0 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color .15s;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;

    svg {
        stroke: var(--text-muted);
        transition: stroke .15s;
    }
}

.tab:hover {
    color: var(--text);

    svg {
        stroke: var(--text)
    }
}

.tab.on {
    color: var(--accent);
    border-bottom-color: var(--accent)
}

.tab-num {
    font-family: var(--f-mono);
    font-size: 11px;
    background: var(--surface2);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 1px 7px;
    color: var(--text-faint);
    transition: all .14s
}

.tab.on .tab-num {
    background: var(--def-light);
    border-color: var(--def-mid);
    color: var(--def)
}

.tabs-fill {
    flex: 1
}

/* LOADING */
#ld {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 14px;
    color: var(--text-muted)
}

.spin {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--border);
    border-top-color: var(--def);
    border-radius: 50%;
    animation: spin .75s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.ld-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text)
}

.ld-files {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center
}

.lf {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    gap: 7px
}

.lf.ok {
    color: #1E7E34
}

.lf.err {
    color: #C0392B
}

.err-box {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--radius);
    padding: 22px 28px;
    max-width: 520px;
    text-align: center;
    margin-top: 8px
}

.err-box h3 {
    color: #9B1C1C;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px
}

.err-box p {
    font-size: 13px;
    color: #7F1D1D;
    line-height: 1.65
}

.err-box code {
    font-family: var(--f-mono);
    background: rgba(0, 0, 0, .07);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px
}

/* VIEWS */
.view {
    display: none
}

.view.on {
    display: block
}

/* FILTER BAR (sentences) */
.fb {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 9px 28px;
    position: sticky;
    top: calc(var(--header-h) + var(--tabs-h));
    z-index: 180;
    height: var(--filter-h)
}

.fb-inner {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: nowrap
}

.sw {
    position: relative
}

.si {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    pointer-events: none
}

.si-inp {
    padding: 7px 10px 7px 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    width: 220px;
    transition: border-color .13s
}

.si-inp:focus {
    border-color: var(--def);
    background: #fff
}

.si-inp::placeholder {
    color: var(--text-faint)
}

.fdiv {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0
}

.cf {
    display: flex;
    gap: 4px;
    align-items: center
}

.cf-lbl {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: .07em;
    color: var(--text-faint);
    text-transform: uppercase;
    margin-right: 2px
}

.cb {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 100px;
    border: 1.5px solid;
    cursor: pointer;
    background: transparent;
    transition: all .12s;
    line-height: 1.5
}

.cb[data-c="DEF"] {
    border-color: var(--def-mid);
    color: var(--def)
}

.cb[data-c="EX"] {
    border-color: var(--ex-mid);
    color: var(--ex)
}

.cb[data-c="CMP"] {
    border-color: var(--cmp-mid);
    color: var(--cmp)
}

.cb[data-c="DEF"].on {
    background: var(--def-light);
    border-color: var(--def)
}

.cb[data-c="EX"].on {
    background: var(--ex-light);
    border-color: var(--ex)
}

.cb[data-c="CMP"].on {
    background: var(--cmp-light);
    border-color: var(--cmp)
}

.cb[data-c="CSV"] {
    color: #32A12F;
    background: #E4FAE3;
    border-color: #32A12F
}

.cb[data-c="ZIP"] {
    color: #A18600;
    background: #FFF9DB;
    border-color: #A18600
}

.cb[data-c="PDF"] {
    color: #A12F2F;
    background: #FAE3E3;
    border-color: #A12F2F
}

.cb:not(.on) {
    opacity: .35
}

.cb.display {
    pointer-events: none;
}

.ps {
    font-size: 13px;
    padding: 7px 26px 7px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ADB5BD'/%3E%3C/svg%3E") no-repeat right 9px center;
    appearance: none;
    -webkit-appearance: none;
    color: var(--text);
    outline: none;
    max-width: 240px;
    transition: border-color .13s;
    cursor: pointer
}

.ps:focus {
    border-color: var(--def)
}

.rc {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--text-faint);
    margin-left: auto;
    white-space: nowrap
}

/* MAIN */
.main {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px 28px
}

/* SENTENCE CARDS */
.cg {
    display: grid;
    grid-template-columns:repeat(auto-fill, minmax(360px, 1fr));
    gap: 12px
}

.sc {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .13s, transform .13s;
    animation: fu .18s ease both
}

.sc:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px)
}

@keyframes fu {
    from {
        opacity: 0;
        transform: translateY(5px)
    }
    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.sc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px
}

.sc-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap
}

.badge {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .05em;
    padding: 2px 8px;
    border-radius: 100px;
    border: 1px solid;
    line-height: 1.6
}

.badge.DEF {
    color: var(--def);
    background: var(--def-light);
    border-color: var(--def-mid)
}

.badge.EX {
    color: var(--ex);
    background: var(--ex-light);
    border-color: var(--ex-mid)
}

.badge.CMP {
    color: var(--cmp);
    background: var(--cmp-light);
    border-color: var(--cmp-mid)
}

.sc-sid {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--text-faint);
    flex-shrink: 0
}

.sc-text {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text);
    flex: 1
}

.sc-foot {
    border-top: 1px solid var(--border-light);
    padding-top: 9px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px
}

.sc-paper {
    flex: 1;
    min-width: 0
}

.sc-author {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.sc-ptitle {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.ext-lnk {
    flex-shrink: 0;
    color: var(--text-faint);
    text-decoration: none;
    transition: color .12s;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 4px
}

.ext-lnk:hover {
    color: var(--def);
    background: var(--def-light)
}

.empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-faint)
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 10px
}

.empty h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px
}

.empty p {
    font-size: 13px
}

/* CODES LAYOUT */
.cl {
    display: grid;
    grid-template-columns:268px 1fr;
    gap: 22px;
    align-items: start
}

.cs {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: calc(var(--header-h) + var(--tabs-h) + 16px)
}

.cs-hd {
    padding: 11px 14px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted)
}

.cs-sec {
    border-top: 1px solid var(--border-light)
}

.cs-sec:first-of-type {
    border-top: none
}

.cs-lbl {
    padding: 10px 14px 5px;
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-faint);
    background: var(--surface2);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border-light)
}

.al, .tl, .fl {
    padding: 5px 7px
}

.ab, .tb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: all .12s;
    gap: 6px
}

.ab {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted)
}

.tb {
    font-size: 12.5px;
    color: var(--text-muted)
}

.ab:hover, .tb:hover {
    background: var(--bg);
    color: var(--text)
}

.ab.on {
    background: var(--header-bg);
    color: #fff
}

.bc {
    font-family: var(--f-mono);
    font-size: 11px;
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .06);
    color: var(--text-faint)
}

.ab.on .bc {
    background: rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .7)
}

.tb-txt {
    flex: 1
}

/* codes category filter */
.codes-cf {
    display: flex;
    gap: 4px;
    padding: 8px 7px;
    flex-wrap: wrap
}

/* aspect/theme tree */
.tree-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    color: var(--text-muted);
    gap: 6px;
    transition: all .12s
}

.tree-all:hover {
    background: var(--bg);
    color: var(--text)
}

.tree-all.on {
    background: var(--header-bg);
    color: #fff;
    font-weight: 600
}

.tree-all.on .bc {
    background: rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .7)
}

.asp-group {
    margin-bottom: 1px
}

.asp-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 7px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    gap: 6px;
    transition: all .12s
}

.asp-btn:hover {
    background: var(--bg);
    color: var(--text)
}

.asp-btn.on {
    background: var(--header-bg);
    color: #fff;
    font-weight: 600
}

.asp-btn.on .bc {
    background: rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .7)
}

.asp-btn.par {
    color: var(--text)
}

.asp-chev {
    font-size: 10px;
    width: 10px;
    text-align: center;
    flex-shrink: 0;
    transition: transform .15s
}

.asp-label {
    flex: 1
}

.asp-themes {
    display: none;
    padding-left: 10px;
    padding-bottom: 2px
}

.asp-themes.open {
    display: block
}

.th-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 5px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    gap: 6px;
    transition: all .12s
}

.th-btn:hover {
    background: var(--bg);
    color: var(--text)
}

.th-btn.on {
    background: var(--def-light);
    color: var(--def);
    font-weight: 600
}

.th-btn.on .bc {
    background: var(--def-mid);
    color: #fff
}

/* CODES CONTENT */
.cc-hd {
    margin-bottom: 18px
}

.cc-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px
}

.cc-desc {
    font-size: 13px;
    color: var(--text-muted)
}

.tg {
    margin-bottom: 26px
}

.tg-hdr {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding-bottom: 7px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 9px;
    flex-wrap: wrap
}

.tg-asp-pill {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: .04em;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    color: var(--text-muted);
    flex-shrink: 0
}

.tg-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text)
}

.tg-meta {
    font-size: 11px;
    color: var(--text-faint)
}

.codes-list {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.code-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns:52px 1fr;
    gap: 12px;
    align-items: start;
    transition: box-shadow .12s;
    animation: fu .18s ease both
}

.code-card:hover {
    box-shadow: var(--shadow)
}

.cc-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding-top: 2px
}

.cc-count {
    font-size: 22px;
    font-weight: 700;
    line-height: 1
}

.cc-count.DEF {
    color: var(--def)
}

.cc-count.EX {
    color: var(--ex)
}

.cc-count.CMP {
    color: var(--cmp)
}

.cc-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    flex-wrap: wrap
}

.cc-id {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--text-faint)
}

.cc-tag {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--surface2);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.6
}

.cc-contrary {
    font-family: var(--f-mono);
    font-size: 11px;
    color: #C0392B;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 4px;
    padding: 0 4px;
    line-height: 1.6;
    cursor: help
}

.cc-text {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text)
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 5px
}

::-webkit-scrollbar-track {
    background: var(--bg)
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint)
}

/* RESPONSIVE */
@media (max-width: 960px) {
    .cl {
        grid-template-columns:1fr
    }

    .cs {
        position: static
    }
}

@media (max-width: 700px) {
    .cg {
        grid-template-columns:1fr
    }

    .fb-inner {
        flex-wrap: wrap
    }

    .si-inp {
        width: 160px
    }

    .main, .fb {
        padding-left: 14px;
        padding-right: 14px
    }

    .hd {
        padding: 0 14px
    }

    .tabs-inner {
        padding: 0 14px
    }
}