:root {
    --tb-red: #ff5000;
    --tb-red-deep: #f40;
    --tb-orange: #ffd6c2;
    --ink: #1f1a17;
    --muted: #6c6c6c;
    --line: #e6e6e6;
    --bg: #f4efe8;
    --card: #fff;
}

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Hiragino Sans GB", "Microsoft YaHei", "PingFang SC", SimSun, serif;
}

.tb-top {
    background: #2b211b;
    color: #f3e6d8;
    font-size: 12px;
}

.tb-top .tb-wrap,
.tb-head .tb-wrap,
.tb-nav .tb-wrap,
.market,
.announce,
.stats {
    width: min(1220px, calc(100% - 24px));
    margin: 0 auto;
}

.tb-top .tb-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 32px;
    gap: 12px;
}

.inline-form {
    margin: 0;
}

.inline-form button,
.login-form button,
.tb-search button,
.buy button,
.filter-bar button,
.try-box button,
.pager button {
    border: 0;
    background: var(--tb-red-deep);
    color: #fff;
    cursor: pointer;
}

.inline-form button {
    padding: 2px 8px;
}

.tb-head {
    background: #fff7f0;
    padding: 18px 0 12px;
    border-bottom: 3px solid #ffd0b0;
}

.tb-head-row {
    display: grid;
    grid-template-columns: 180px 1fr 220px;
    gap: 16px;
    align-items: center;
}

.logo {
    color: var(--tb-red-deep);
    text-decoration: none;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo em {
    font-style: normal;
    color: #111;
}

.tb-search {
    display: flex;
    border: 3px solid var(--tb-red);
    background: #fff;
}

.tb-search input {
    flex: 1;
    border: 0;
    height: 36px;
    padding: 0 12px;
    outline: none;
    font-size: 14px;
}

.tb-search button {
    width: 88px;
    font-size: 16px;
}

.tb-extra {
    text-align: right;
    color: var(--tb-red);
    font-size: 12px;
    line-height: 1.4;
}

.tb-nav {
    background: var(--tb-red-deep);
}

.tb-nav a {
    display: inline-block;
    color: #fff;
    text-decoration: none;
    padding: 10px 16px;
    font-size: 14px;
}

.tb-nav a.on {
    background: #c40000;
}

.announce {
    display: none;
}

.stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 10px 12px;
}

.stat b {
    display: block;
    font-size: 18px;
    color: var(--tb-red-deep);
}

.stat span {
    color: var(--muted);
    font-size: 12px;
}

.market {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    padding: 16px 0 48px;
}

.side, .list-panel, .login-card, .drawer-card, .side-box {
    background: var(--card);
    border: 1px solid var(--line);
}

.side {
    padding: 12px;
}

.side h2, .list-toolbar h2, .docs h2 {
    margin: 0 0 10px;
    font-size: 16px;
}

.cat {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 8px 10px;
    margin-bottom: 4px;
    cursor: pointer;
    color: var(--ink);
}

.cat.on, .cat:hover {
    background: #fff1e8;
    color: var(--tb-red-deep);
}

.side-box {
    margin-top: 16px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.8;
    color: var(--muted);
}

.list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 14px 0;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 14px 4px;
}

.filter-bar select,
.try-field input {
    height: 32px;
    border: 1px solid #d7d7d7;
    padding: 0 8px;
    background: #fff;
}

.filter-bar button {
    padding: 0 12px;
}

.json-console {
    margin: 8px 14px 16px;
    border: 1px solid #2a2420;
    background: #161310;
}

.json-req {
    padding: 8px 12px;
    background: #241c18;
    color: #d7b89a;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    border-bottom: 1px solid #332820;
    word-break: break-all;
}

.json-body {
    margin: 0;
    padding: 14px 16px 18px;
    max-height: 68vh;
    overflow: auto;
    background: #161310;
    color: #f4e8dc;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre;
}

.json-body .jk { color: #8be0ff; }
.json-body .js { color: #f0c674; }
.json-body .jn { color: #c5e38a; }
.json-body .jb { color: #d787ff; }
.json-body .ju { color: #888; }

.product {
    display: none;
}

.product {
    border: 1px solid #f0e4d8;
    background: #fffdf9;
    padding: 8px;
    cursor: pointer;
}

.product:hover {
    border-color: var(--tb-red);
}

.product img,
.no-img {
    width: 100%;
    height: 92px;
    object-fit: cover;
    background: #111;
    display: block;
}

.no-img {
    display: grid;
    place-items: center;
    color: #bbb;
    font-size: 12px;
}

.p-top {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 14px;
}

.p-top span {
    color: var(--tb-red-deep);
    font-weight: 700;
}

.p-meta, .p-id, .auth-line {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.p-tags {
    margin-top: 6px;
}

.p-tags em {
    display: inline-block;
    margin: 0 4px 4px 0;
    padding: 1px 6px;
    background: #ffe8d6;
    color: #9a3d00;
    font-style: normal;
    font-size: 11px;
}

.pager {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 14px 16px;
    font-size: 13px;
}

.pager button {
    padding: 6px 10px;
}

.iface-list {
    padding: 8px 8px 16px;
}

.iface {
    display: grid;
    grid-template-columns: 72px 1fr 160px;
    gap: 12px;
    padding: 14px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.iface:hover {
    background: #fffaf6;
}

.method {
    height: 28px;
    line-height: 28px;
    text-align: center;
    background: #ffe4d2;
    color: var(--tb-red-deep);
    font-size: 12px;
    font-weight: 700;
}

.method.m-POST {
    background: #d7ecff;
    color: #0b5cab;
}

.iface h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.iface p, .login-tips, #list-count {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.path {
    color: #111;
    font-family: Consolas, "Courier New", monospace;
}

.mini-table, .doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 12px;
}

.mini-table th, .mini-table td,
.doc-table th, .doc-table td {
    border: 1px solid #f0e4d8;
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.doc-table th {
    background: #fff4ea;
    width: 120px;
}

.buy {
    align-self: center;
    justify-self: end;
}

.buy button {
    padding: 8px 14px;
}

.docs {
    padding: 16px;
    border-top: 1px solid var(--line);
}

.docs pre, .drawer-card pre, .inline-pre {
    background: #1b1613;
    color: #f3e6d8;
    padding: 12px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.6;
    min-height: 0;
}

.drawer-card pre:empty {
    display: none;
}

.login-page {
    min-height: 100vh;
}

.login-card {
    width: min(520px, calc(100% - 24px));
    margin: 64px auto;
    padding: 28px;
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
}

.logo-mark {
    width: 58px;
    height: 58px;
    background: var(--tb-red-deep);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.login-brand h1 {
    margin: 0 0 6px;
    font-size: 22px;
}

.login-brand p, .login-form label {
    margin: 0;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 8px;
}

.login-form input {
    height: 40px;
    border: 1px solid #ccc;
    padding: 0 10px;
}

.login-form button {
    height: 40px;
}

.login-error {
    color: #c40000;
    margin-bottom: 10px;
}

.login-tips {
    margin-top: 14px;
}

.drawer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    place-items: center;
    padding: 16px;
    z-index: 80;
}

.drawer.is-open,
.drawer:not([hidden]) {
    display: grid;
}

.drawer[hidden] {
    display: none !important;
}

.drawer-card {
    width: min(980px, 100%);
    max-height: 86vh;
    overflow: auto;
    padding: 16px;
    position: relative;
}

.drawer-close {
    position: absolute;
    right: 12px;
    top: 12px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}

.drawer-tabs {
    display: flex;
    gap: 8px;
    margin: 28px 0 10px;
}

.drawer-tabs button {
    border: 1px solid #efd2bb;
    background: #fff;
    color: #7a3e00;
    padding: 6px 10px;
    cursor: pointer;
}

.drawer-tabs button.on {
    background: var(--tb-red-deep);
    color: #fff;
    border-color: var(--tb-red-deep);
}

.drawer-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.drawer-images img {
    max-width: 100%;
    max-height: 160px;
    background: #111;
}

.try-box {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 10px 0;
}

.try-field {
    display: grid;
    gap: 4px;
    font-size: 12px;
}

.try-field small {
    color: var(--muted);
}

.try-box button {
    grid-column: 1 / -1;
    height: 36px;
}

@media (max-width: 980px) {
    .tb-head-row,
    .market,
    .iface,
    .stats,
    .product-grid,
    .try-box {
        grid-template-columns: 1fr;
    }
    .tb-extra, .buy {
        justify-self: start;
        text-align: left;
    }
}
