/* 页面 DIY 编辑器 */

body .sb-diy {
    max-width: 1240px;
    margin: 0 auto;
}

body .sb-diy-head {
    margin-bottom: 16px;
}

body .sb-diy-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    color: var(--sb-muted);
    text-decoration: none;
}

body .sb-diy-back:hover {
    color: var(--color-primary-600);
}

body .sb-diy-back .material-symbols-outlined {
    font-size: 16px;
}

body .sb-diy-head h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--sb-text);
}

body .sb-diy-key {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    color: var(--sb-muted);
    background: var(--sb-surface-2);
    border: 1px solid var(--sb-border);
}

body .sb-diy-note {
    margin: 8px 0 0;
    font-size: 12.5px;
    color: var(--sb-muted);
}

body .sb-diy-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 16px;
    align-items: start;
}

body .sb-diy-panel {
    border-radius: 14px;
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    box-shadow: var(--sb-shadow-sm);
    overflow: hidden;
}

body .sb-diy-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--sb-muted);
    border-bottom: 1px solid var(--sb-border);
    background-image: linear-gradient(180deg, rgba(255, 117, 23, .06), rgba(255, 117, 23, 0));
}

body .sb-diy-count b {
    color: var(--sb-text);
    font-variant-numeric: tabular-nums;
}

body .sb-diy-hint {
    font-weight: 400;
    font-size: 11.5px;
    opacity: .8;
}

body .sb-diy-panel textarea {
    display: block;
    width: 100%;
    min-height: 470px;
    padding: 14px 16px;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--sb-surface) !important;
    color: var(--sb-text) !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    outline: none !important;
    box-shadow: none !important;
}

body .sb-diy-vars {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 10px;
    border-bottom: 1px solid var(--sb-border);
    background: var(--sb-surface-2);
}

body .sb-diy-vars-label {
    font-size: 11.5px;
    color: var(--sb-muted);
    margin-right: 2px;
}

body .sb-diy-chip {
    padding: 3px 9px;
    border-radius: 7px;
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    color: var(--sb-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

body .sb-diy-chip:hover {
    border-color: rgba(249, 115, 22, .5);
    color: var(--color-primary-600);
    background: rgba(249, 115, 22, .06);
}

/* Telegram 预览气泡 */
body .sb-tg {
    padding: 18px;
    background:
        radial-gradient(420px 240px at 100% 0%, rgba(56, 120, 255, .10), transparent 62%),
        #0e1621;
    min-height: 470px;
}

body .sb-tg-bubble {
    max-width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    background: #182533;
    color: #e9edf2;
    font-size: 13.5px;
    line-height: 1.62;
    white-space: normal;
    word-break: break-word;
    box-shadow: 0 10px 24px -18px rgba(0, 0, 0, .8);
}

body .sb-tg-bubble b,
body .sb-tg-bubble strong {
    color: #fff;
    font-weight: 700;
}

body .sb-tg-bubble i,
body .sb-tg-bubble em {
    color: #c8d3de;
}

body .sb-tg-bubble u {
    text-decoration: underline;
}

body .sb-tg-bubble s {
    color: #93a1b3;
}

body .sb-tg-bubble code {
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, .09);
    color: #ffd9a8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}

body .sb-tg-bubble pre {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    overflow-x: auto;
}

body .sb-diy-empty {
    color: #6b7a90;
}

body .sb-diy-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 0;
    background: linear-gradient(180deg, transparent, var(--sb-bg) 40%);
}

body .sb-diy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border-radius: 9px;
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    color: var(--sb-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, filter .15s ease;
}

body .sb-diy-btn:hover {
    border-color: var(--sb-border-strong);
}

body .sb-diy-btn--primary {
    border-color: transparent;
    color: #fff;
    background-image: linear-gradient(135deg, #ff9d4f, #f97316 55%, #ea580c);
}

body .sb-diy-btn--primary:hover {
    filter: brightness(1.05);
}

@media (max-width: 1100px) {
    body .sb-diy-grid {
        grid-template-columns: 1fr;
    }
}

/* 富文本工具条 */
body .sb-diy-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--sb-border);
    background: var(--sb-surface-2);
}

body .sb-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--sb-text);
    font-size: 13px;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease;
}

body .sb-tool:hover {
    background: var(--sb-surface);
    border-color: var(--sb-border);
}

body .sb-tool--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
}

body .sb-tool--wide {
    font-size: 12px;
}

body .sb-tool--emoji {
    font-size: 15px;
    padding: 0 4px;
}

body .sb-tool-sep {
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: var(--sb-border);
}

/* 页面卡片 */
body .sb-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

body .sb-page-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    box-shadow: var(--sb-shadow-sm);
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

body .sb-page-card:hover {
    transform: translateY(-2px);
    border-color: rgba(249, 115, 22, .42);
    box-shadow: var(--sb-shadow-md);
}

body .sb-page-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--sb-border);
    background-image: linear-gradient(180deg, rgba(255, 117, 23, .06), rgba(255, 117, 23, 0));
}

body .sb-page-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    font-size: 17px;
    color: var(--color-primary-600);
    background: rgba(255, 117, 23, .12);
}

body .sb-page-card-title b {
    display: block;
    font-size: 13.5px;
    font-weight: 650;
    color: var(--sb-text);
}

body .sb-page-card-title small {
    display: block;
    margin-top: 1px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px;
    color: var(--sb-muted);
}

body .sb-page-card-time {
    margin-left: auto;
    font-size: 11px;
    color: var(--sb-muted);
    white-space: nowrap;
}

body .sb-tg-mini {
    position: relative;
    margin: 12px 14px;
    padding: 12px 13px;
    max-height: 196px;
    overflow: hidden;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    background: #182533;
    color: #e9edf2;
    font-size: 12.5px;
    line-height: 1.6;
    word-break: break-word;
}

body .sb-tg-mini::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34px;
    background: linear-gradient(180deg, rgba(24, 37, 51, 0), #182533);
}

body .sb-tg-mini b {
    color: #fff;
}

body .sb-tg-mini i {
    color: #c8d3de;
}

body .sb-tg-mini code {
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, .09);
    color: #ffd9a8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
}

body .sb-page-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-top: 1px solid var(--sb-border);
    font-size: 11.5px;
    color: var(--sb-muted);
}

body .sb-page-card-foot .material-symbols-outlined {
    font-size: 16px;
}

body .sb-page-hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--sb-muted);
}
