:root {
    --bg: #140d0a;
    --bg-soft: #21140f;
    --panel: #281811;
    --panel-2: #342016;
    --ink: #fff7ec;
    --muted: #d6b7a0;
    --faint: #a77d65;
    --line: #4b2a1d;
    --brand: #ff6a3d;
    --brand-2: #d11f2d;
    --accent: #ffb02e;
    --accent-soft: rgba(255, 176, 46, .14);
    --pill-bg: var(--bg);
    --radius: 16px;
    --glow: 0 0 0 1px rgba(255, 106, 61, .22), 0 24px 60px rgba(0, 0, 0, .48);
    --bg-grad-1: rgba(255, 106, 61, .18);
    --bg-grad-2: rgba(255, 176, 46, .12);
    --side-grad: linear-gradient(180deg, var(--bg-soft), rgba(20, 13, 10, .62));
}

:root[data-theme="light"] {
    --bg: #fff7ec;
    --bg-soft: #fffdf8;
    --panel: #ffffff;
    --panel-2: #fff0e3;
    --ink: #2b1711;
    --muted: #765341;
    --faint: #a77d65;
    --line: #f0d2bf;
    --brand: #ff6a3d;
    --brand-2: #d11f2d;
    --accent: #b3361f;
    --accent-soft: rgba(255, 106, 61, .12);
    --pill-bg: #fff2e6;
    --glow: 0 0 0 1px rgba(255, 106, 61, .22), 0 24px 60px rgba(120, 56, 28, .16);
    --bg-grad-1: rgba(255, 106, 61, .14);
    --bg-grad-2: rgba(255, 176, 46, .14);
    --side-grad: linear-gradient(180deg, #ffffff, rgba(255, 247, 236, .72));
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(1100px 600px at 85% -10%, var(--bg-grad-1), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, var(--bg-grad-2), transparent 55%),
        var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s, color .3s;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-2);
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.side {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    padding: 28px 22px;
    border-right: 1px solid var(--line);
    background: var(--side-grad);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    transition: background .3s, border-color .3s;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.brand .logo {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    background: transparent;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 24px rgba(209, 31, 45, .28);
    overflow: hidden;
}

.brand .logo img {
    width: 100%;
    height: 100%;
    display: block;
}

.brand b {
    font-size: 17px;
}

.brand span {
    display: block;
    color: var(--faint);
    font-size: 12px;
    font-weight: 500;
}

.side-meta {
    margin: 22px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    transition: background .3s, border-color .3s;
}

.side-meta .num {
    font-size: 30px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent), var(--brand));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.side-meta .lbl,
.nav-title {
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.nav-title {
    margin: 20px 6px 10px;
}

.nav,
.lang-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.nav button,
.lang-list button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: .18s;
}

.lang-list button {
    gap: 10px;
    padding: 9px 13px;
    border-radius: 10px;
}

.nav button:hover,
.lang-list button:hover {
    background: var(--panel);
    color: var(--ink);
}

.nav button.active {
    background: linear-gradient(135deg, rgba(255, 176, 46, .18), rgba(209, 31, 45, .13));
    border-color: rgba(255, 106, 61, .42);
    color: var(--ink);
}

.lang-list button.active {
    background: var(--accent-soft);
    border-color: rgba(255, 106, 61, .38);
    color: var(--ink);
}

.nav .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: none;
    background: var(--brand);
}

.nav .cnt,
.lang-list .lcode {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    color: var(--faint);
    background: var(--pill-bg);
    padding: 2px 8px;
    border-radius: 999px;
}

.lang-list .lcode {
    letter-spacing: .04em;
    border-radius: 6px;
    text-transform: uppercase;
}

.nav button.active .cnt,
.lang-list button.active .lcode {
    color: var(--accent);
}

.side-foot {
    margin-top: 24px;
    color: var(--faint);
    font-size: 12px;
}

.main {
    padding: 40px clamp(20px, 4vw, 56px);
}

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.top h1 {
    margin: 0;
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 800;
    letter-spacing: 0;
}

.top p {
    margin: 6px 0 0;
    color: var(--muted);
    max-width: 680px;
}

.top-actions {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.theme-toggle {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}

.theme-toggle:hover {
    border-color: var(--brand);
    color: var(--brand);
    transform: translateY(-1px);
}

.theme-toggle .svg-icon {
    width: 16px;
    height: 16px;
    color: currentColor;
}

.theme-toggle .to-light,
.theme-toggle .to-dark {
    align-items: center;
    gap: 7px;
}

.theme-toggle .to-light {
    display: none;
}

.theme-toggle .to-dark {
    display: inline-flex;
}

:root[data-theme="light"] .theme-toggle .to-light {
    display: inline-flex;
}

:root[data-theme="light"] .theme-toggle .to-dark {
    display: none;
}

.svg-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    flex: none;
    vertical-align: -0.14em;
}

.flag-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    flex: none;
}

.lang-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    transition: background .3s, border-color .3s;
}

.lang-bar .lb-label {
    color: var(--faint);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-right: 4px;
}

.lang-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 13px;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--pill-bg);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: .16s;
}

.lang-chip:hover {
    color: var(--ink);
    border-color: var(--brand);
}

.lang-chip.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    border-color: transparent;
}

.lang-chip .lc-cnt {
    font-size: 11px;
    opacity: .85;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 30px;
}

.stat {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    transition: background .3s, border-color .3s;
}

.stat .v {
    font-size: 26px;
    font-weight: 800;
}

.stat .k {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.stat .bar {
    margin-top: 12px;
    height: 6px;
    border-radius: 99px;
    background: var(--pill-bg);
    overflow: hidden;
}

.stat .bar i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), var(--brand));
}

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

.card {
    position: relative;
    min-height: 238px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    cursor: pointer;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s, border-color .2s, background .3s;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
    opacity: .8;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glow);
    border-color: rgba(255, 106, 61, .45);
}

.card .ico {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 22px;
    margin-bottom: 14px;
}

.card .ico .svg-icon {
    width: 23px;
    height: 23px;
}

.card h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 750;
}

.card .desc {
    margin: 8px 0 14px;
    color: var(--muted);
    font-size: 13px;
    min-height: 38px;
}

.card .langs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 14px;
}

.card .langs .lg {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--pill-bg);
    color: var(--faint);
    text-transform: uppercase;
}

.card .foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card .pill {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    background: var(--pill-bg);
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.card .go {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--brand);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.card .go .svg-icon,
.back .svg-icon {
    width: 16px;
    height: 16px;
}

.detail {
    display: none;
}

.detail.show {
    display: block;
}

.grid.hide,
.stat-row.hide,
.top .index-only.hide {
    display: none;
}

.back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: .18s;
}

.back:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.detail-head {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(255, 176, 46, .12), rgba(209, 31, 45, .07));
    margin-bottom: 22px;
}

.detail-head h2 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 800;
}

.detail-head .sub {
    color: var(--muted);
    font-size: 14px;
    max-width: 560px;
}

.detail-head .chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chip {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--pill-bg);
    color: var(--accent);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.chip.code {
    color: var(--brand);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.url-list {
    display: grid;
    gap: 10px;
}

.url-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    transition: background .16s, border-color .16s;
}

.url-item:hover {
    background: var(--panel-2);
    border-color: rgba(255, 106, 61, .35);
}

.url-item .lang-badge {
    flex: none;
    min-width: 40px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 5px 8px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
}

.url-item .link {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.url-item .hreflang {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.url-item .hreflang .hl {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--pill-bg);
    color: var(--faint);
    text-transform: uppercase;
}

.url-item .date {
    color: var(--muted);
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: nowrap;
}

.empty {
    padding: 40px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .02);
}

@media (max-width: 880px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .side {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .nav,
    .lang-list {
        grid-template-columns: 1fr 1fr;
    }

    .top-actions {
        justify-content: flex-start;
    }

    .url-item {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px;
    }

    .url-item .hreflang,
    .url-item .date {
        grid-column: 2;
        justify-self: start;
    }
}

@media (max-width: 560px) {
    .main,
    .side {
        padding: 22px 16px;
    }

    .nav,
    .lang-list {
        grid-template-columns: 1fr;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .lang-chip,
    .theme-toggle {
        width: 100%;
        justify-content: center;
    }
}
