html, body {
    margin: 0;
    min-height: 100%;
    background: #0b1018;
    color: rgba(235, 242, 252, .94);
    font-family: "Microsoft YaHei", system-ui, sans-serif;
}
* {
    box-sizing: border-box;
}
button, input, textarea {
    font-family: "Microsoft YaHei", system-ui, sans-serif;
}
.shell {
    width: min(1500px, calc(100vw - 28px));
    margin: 14px auto;
}
.topbar {
    height: 58px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    border: 1px solid rgba(145, 178, 215, .14);
    border-radius: 14px;
    background: #101722;
}
.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(75, 137, 238, .18);
    border: 1px solid rgba(129, 183, 255, .20);
    color: rgba(222, 238, 255, .96);
    font-weight: 700;
}
.brand-title {
    font-size: 17px;
    line-height: 21px;
    font-weight: 700;
    letter-spacing: .3px;
}
.brand-subtitle {
    margin-top: 2px;
    color: rgba(190, 207, 230, .58);
    font-size: 12px;
}
.top-link {
    color: rgba(159, 205, 255, .84);
    text-decoration: none;
    font-size: 13px;
}
.top-link:hover {
    text-decoration: underline;
}
button {
    height: 34px;
    border: 1px solid rgba(137, 180, 235, .24);
    border-radius: 10px;
    padding: 0 12px;
    color: rgba(244, 249, 255, .96);
    background: #1d5bd7;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease, transform .08s ease;
}
button:hover {
    border-color: rgba(170, 212, 255, .50);
    background: #2369ef;
}
button:active {
    transform: translateY(1px);
}
button.ghost {
    background: rgba(255,255,255,.055);
}
button.ghost:hover {
    background: rgba(255,255,255,.09);
}
.layout {
    display: grid;
    grid-template-columns: minmax(560px, 1fr) 540px;
    gap: 14px;
    margin-top: 14px;
    align-items: start;
}
.panel {
    border: 1px solid rgba(145, 178, 215, .14);
    border-radius: 16px;
    background: #101722;
    overflow: hidden;
}
.gallery-panel {
    padding: 14px;
}
.detail-panel {
    padding: 14px;
    position: sticky;
    top: 14px;
}
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.toolbar-right span {
    color: rgba(190, 207, 230, .62);
    font-size: 12px;
    white-space: nowrap;
}
input {
    width: 180px;
    height: 34px;
    border: 1px solid rgba(145, 178, 215, .18);
    outline: none;
    border-radius: 10px;
    padding: 0 11px;
    color: rgba(241, 248, 255, .96);
    background: #0b1018;
}
input:focus {
    border-color: rgba(113, 177, 255, .58);
}
.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.category {
    height: 30px;
    padding: 0 11px;
    border-radius: 10px;
    font-size: 12px;
    background: rgba(255,255,255,.045);
    color: rgba(218, 231, 248, .88);
}
.category.active {
    background: rgba(65, 126, 230, .25);
    border-color: rgba(129, 183, 255, .36);
}
.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}
.component-card {
    min-height: 104px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(145, 178, 215, .12);
    background: #0d131d;
    cursor: pointer;
}
.component-card:hover {
    border-color: rgba(145, 190, 245, .34);
    background: #121b29;
}
.component-card.active {
    border-color: rgba(92, 157, 255, .62);
    background: rgba(50, 101, 190, .18);
}
.component-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
}
.component-title span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.component-title span:last-child {
    color: rgba(189, 210, 236, .56);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.component-desc {
    height: 36px;
    margin-top: 7px;
    color: rgba(197, 214, 236, .66);
    line-height: 18px;
    font-size: 12px;
    overflow: hidden;
}
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 9px;
}
.tag {
    color: rgba(205, 225, 250, .80);
    border: 1px solid rgba(145, 178, 215, .12);
    background: rgba(255,255,255,.035);
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 11px;
}
.detail-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    margin-bottom: 10px;
}
.detail-head h1 {
    margin: 0;
    font-size: 18px;
    line-height: 24px;
}
.detail-head p {
    margin: 4px 0 0;
    color: rgba(190, 207, 230, .64);
    font-size: 12px;
    line-height: 1.55;
}
.detail-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.size-bar {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.size-btn {
    height: 30px;
    padding: 0 9px;
    background: rgba(255,255,255,.05);
    font-size: 12px;
}
.size-btn.active {
    background: rgba(65, 126, 230, .28);
    border-color: rgba(129, 183, 255, .42);
}
.size-btn.primary {
    background: rgba(65, 126, 230, .20);
}
.preview-wrap {
    display: grid;
    place-items: center;
    height: min(560px, calc(100vh - 260px));
    min-height: 360px;
    border-radius: 14px;
    background: #080d14;
    border: 1px solid rgba(145, 178, 215, .12);
    overflow: auto;
    padding: 16px;
}
.preview-wrap.portrait {
    height: min(640px, calc(100vh - 220px));
}
.preview-wrap::-webkit-scrollbar,
textarea::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
.preview-wrap::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
    background: rgba(145, 178, 215, .28);
    border-radius: 99px;
}
.preview-wrap::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
    background: rgba(255,255,255,.04);
    border-radius: 99px;
}
.preview-box {
    width: 569px;
    height: 246px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 14px 36px rgba(0,0,0,.34);
    flex: 0 0 auto;
}
iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}
.code-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: end;
    margin: 12px 0 8px;
}
.code-head h2 {
    margin: 0;
    font-size: 15px;
}
.code-head span {
    color: rgba(190, 207, 230, .56);
    font-size: 12px;
}
textarea {
    width: 100%;
    height: 140px;
    resize: vertical;
    border: 1px solid rgba(145, 178, 215, .14);
    border-radius: 14px;
    outline: none;
    padding: 12px;
    color: rgba(233, 243, 255, .92);
    background: #080d14;
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 12px;
    line-height: 1.55;
}
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding: 0 4px;
    color: rgba(190, 207, 230, .48);
    font-size: 12px;
}
.footer a {
    color: rgba(159, 205, 255, .82);
    text-decoration: none;
}
.footer a:hover {
    text-decoration: underline;
}
.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) translateY(18px);
    opacity: 0;
    pointer-events: none;
    padding: 9px 13px;
    border-radius: 999px;
    background: rgba(20, 30, 48, .94);
    border: 1px solid rgba(142, 203, 255, .20);
    color: rgba(238, 247, 255, .95);
    transition: .18s ease;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
@media (max-width: 1180px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .detail-panel {
        position: static;
    }
}
@media (max-width: 720px) {
    .shell {
        width: calc(100vw - 18px);
        margin: 9px auto;
    }
    .topbar {
        height: auto;
        align-items: flex-start;
        flex-direction: column;
    }
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .toolbar-right {
        justify-content: space-between;
    }
    input {
        width: 100%;
    }
    .component-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .detail-head {
        grid-template-columns: 1fr;
    }
    .detail-actions {
        justify-content: flex-start;
    }
    .preview-wrap {
        height: 380px;
    }
    .meta-row {
        grid-template-columns: 1fr;
    }
}
