/* 流量联盟 · 嵌入代码生成页：左设置、右代码 + 实时预览，全部 tld- 前缀 */
.tld {
    --tld-ink: #0f172a;
    --tld-mut: #64748b;
    --tld-line: #e2e8f0;
    --tld-soft: #f8fafc;
    --tld-brand: #0d9488;
    --tld-accent: #0ea5e9;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 22px 0 48px;
    color: var(--tld-ink);
    font-size: 14px;
    line-height: 1.7;
}

.tld * { box-sizing: border-box; }
.tld a { text-decoration: none; }
.tld h1, .tld p { margin: 0; }

/* ---------- 首屏：与内容区同宽的扁横幅 ---------- */
.tld-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 20px;
    padding: 18px 26px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(120deg, #0ea5e9 0%, #14b8a6 100%);
    box-shadow: 0 18px 40px -32px rgba(13, 116, 144, .7);
}

.tld-hero::before,
.tld-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.tld-hero::before {
    width: 220px;
    height: 220px;
    right: -70px;
    top: -120px;
    background: rgba(255, 255, 255, .12);
}

.tld-hero::after {
    width: 150px;
    height: 150px;
    right: 150px;
    bottom: -108px;
    background: rgba(255, 255, 255, .08);
}

.tld-hero-tx {
    position: relative;
    z-index: 1;
    max-width: 640px;
    min-width: 0;
}

.tld-kicker {
    display: inline-block;
    margin-bottom: 3px;
    font-size: 10px;
    letter-spacing: .26em;
    opacity: .8;
}

.tld-title {
    margin: 0 0 5px;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .02em;
    color: #fff;
}

.tld-sub {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.65;
    color: rgba(255, 255, 255, .9);
}

.tld-chips {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex: 0 0 auto;
    margin: 0;
}

.tld-chip {
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .24);
    background: rgba(255, 255, 255, .14);
    font-size: 11.5px;
    white-space: nowrap;
}

.tld-chip b { font-weight: 700; }

/* ---------- 两栏 ---------- */
.tld-cols {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.tld-form {
    padding: 18px;
    border: 1px solid var(--tld-line);
    border-radius: 16px;
    background: #fff;
}

.tld-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    position: sticky;
    top: 84px;
}

/* ---------- 设置面板 ---------- */
.tld-fhd {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--tld-line);
    font-size: 14px;
    font-weight: 700;
    color: var(--tld-ink);
}

.tld-group {
    margin: 14px 0 2px;
    padding-left: 9px;
    border-left: 3px solid #14b8a6;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #0f766e;
}

.tld-frow {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px dashed var(--tld-line);
}

.tld-frow:last-child { border-bottom: 0; }
.tld-frow.is-dim { opacity: .45; }

.tld-flb {
    padding-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tld-ink);
}

.tld-fctl {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.tld-note {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--tld-mut);
}

.tld-in {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--tld-line);
    border-radius: 9px;
    background: #fff;
    color: var(--tld-ink);
    font: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.tld-in:hover { border-color: #cbd5e1; }

.tld-in:focus {
    border-color: var(--tld-accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}

.tld-in:disabled {
    cursor: not-allowed;
    background: var(--tld-soft);
}

/* 开关 */
.tld-sw {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--tld-ink);
    cursor: pointer;
}

.tld-sw input {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    position: relative;
    width: 32px;
    height: 17px;
    margin: 0;
    border: 0;
    border-radius: 9px;
    background: #cbd5e1;
    cursor: pointer;
    transition: background-color .15s;
}

.tld-sw input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .2);
    transition: transform .15s;
}

.tld-sw input:checked { background: var(--tld-brand); }
.tld-sw input:checked::after { transform: translateX(15px); }

/* 分段按钮（预览底色） */
.tld-seg {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--tld-line);
    border-radius: 10px;
    background: var(--tld-soft);
}

.tld-seg-b {
    padding: 5px 13px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--tld-mut);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color .15s, color .15s, box-shadow .15s;
}

.tld-seg-b:hover { color: var(--tld-brand); }

.tld-seg-b.is-on {
    background: #fff;
    color: var(--tld-brand);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.tld-btn2 {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--tld-line);
    border-radius: 9px;
    background: #fff;
    color: var(--tld-brand);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

.tld-btn2:hover {
    border-color: #14b8a6;
    background: rgba(20, 184, 166, .07);
}

/* ---------- 右侧卡片 ---------- */
.tld-card {
    padding: 16px 18px;
    border: 1px solid var(--tld-line);
    border-radius: 16px;
    background: #fff;
    min-width: 0;
}

.tld-card-hd {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px 14px;
    flex-wrap: wrap;
    margin-bottom: 11px;
}

.tld-lb {
    font-size: 14px;
    font-weight: 700;
    color: var(--tld-ink);
}

.tld-hint {
    font-size: 12px;
    color: var(--tld-mut);
}

.tld-code {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.tld-code textarea {
    flex: 1 1 420px;
    min-height: 66px;
    padding: 10px 12px;
    border: 1px solid var(--tld-line);
    border-radius: 10px;
    background: var(--tld-soft);
    color: #0f172a;
    font: 13px/1.6 Consolas, Monaco, "Courier New", monospace;
    resize: vertical;
}

.tld-code textarea:focus {
    outline: none;
    border-color: var(--tld-accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}

.tld-copy {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #14b8a6, #0ea5e9);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}

.tld-copy:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(14, 165, 233, .22);
}

/* 联盟块自己的宽度由嵌入代码里的 max-width 决定，这里只提供浅色 / 深色两种页面底色 */
.tld-stage {
    margin: 0 auto;
    padding: 16px;
    border: 1px solid var(--tld-line);
    border-radius: 12px;
    background: #fff;
    overflow: auto;
}

.tld-stage.is-dark {
    background: #0f1420;
    border-color: #243044;
}

.tld-empty {
    padding: 18px;
    border: 1px dashed var(--tld-line);
    border-radius: 10px;
    font-size: 14px;
    color: var(--tld-mut);
}

.tld-tip {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--tld-mut);
}

.tld-tip b { font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .tld-hero { width: 100%; }
}

@media (max-width: 900px) {
    .tld-cols { grid-template-columns: minmax(0, 1fr); }
    .tld-side { position: static; }
}

@media (max-width: 640px) {
    .tld { padding: 16px 0 36px; }
    .tld-hero { padding: 16px 18px; border-radius: 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
    .tld-title { font-size: 21px; }
    .tld-chips { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .tld-form { padding: 14px; }
    .tld-frow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .tld-flb { padding-top: 0; }
    .tld-stage { padding: 10px; }
    .tld-copy { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .tld-in,
    .tld-btn2,
    .tld-copy,
    .tld-seg-b {
        transition: none;
    }
}
