/* ============================================================
   静态网站生成器 /tools/site
   适配桌面 / 平板 / 手机三端，支持站点深/浅色主题
   ============================================================ */
/* 占满整个电脑端屏幕：覆盖全站 .app / .main-content 的宽度限制 */
body.page-site-full .app { max-width: 100%; }
body.page-site-full .main-content { max-width: 100%; border-right: 0; }

.st-page {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 16px 48px;
}

/* ---------------- 标题区 ---------------- */
.st-hero {
    text-align: center;
    padding: 18px 0 26px;
}
.st-title {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
    background: linear-gradient(90deg, var(--accent, #136ce9), #7c4dff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.st-sub {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 760px;
    margin: 0 auto;
}

/* ---------------- 主工作区 ---------------- */
.st-layout {
    display: grid;
    grid-template-columns: minmax(340px, 440px) 1fr;
    gap: 18px;
    align-items: start;
}

.st-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.st-card-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.st-input-wrap {
    position: relative;
}
.st-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 340px;
    max-height: 70vh;
    resize: vertical;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-secondary);
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
}
.st-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.st-input::placeholder {
    color: var(--text-secondary);
    opacity: .75;
}
/* 拖拽手柄：位于文本框底部中央，鼠标/触摸均可调节高度 */
.st-resize-handle {
    position: absolute;
    left: 50%;
    bottom: -9px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 14px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 10px;
    line-height: 1;
    letter-spacing: 2px;
    cursor: ns-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    z-index: 2;
    transition: border-color .2s, color .2s, box-shadow .2s;
}
.st-resize-handle:hover,
.st-resize-handle.st-active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
body.st-resizing,
body.st-resizing * {
    cursor: ns-resize !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}
/* 原生缩放手柄的右下角提示更清晰 */
.st-input:not(:focus)::-webkit-resizer {
    background: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* 输入区辅助信息：字数 + 快捷键 */
.st-input-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}
.st-input-hint {
    white-space: nowrap;
}

/* 示例与清空按钮 */
.st-demos {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.st-demos-tip {
    font-size: 13px;
    color: var(--text-secondary);
}
.st-demo-btn {
    border: 1px dashed var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .2s;
}
.st-demo-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.st-clear-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .2s;
}
.st-clear-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
}

/* 设置项 */
.st-setting {
    margin-bottom: 12px;
}
.st-setting:last-child {
    margin-bottom: 0;
}
.st-setting-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 7px;
}
.st-setting-inline {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}
.st-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}
.st-check input {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

/* 分段控件 */
.st-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.st-seg button {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.st-seg button:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.st-seg button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* 配色小圆点 */
.st-seg-theme button {
    width: 34px;
    padding: 0;
    height: 30px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.st-seg-theme button[data-theme="tech-blue"] { color: #0b5fff; }
.st-seg-theme button[data-theme="violet"]   { color: #6c4cf1; }
.st-seg-theme button[data-theme="emerald"]  { color: #0e9f6e; }
.st-seg-theme button[data-theme="orange"]   { color: #ea6a12; }
.st-seg-theme button[data-theme="rose"]     { color: #d42054; }
.st-seg-theme button[data-theme="crimson"]  { color: #c62828; }
.st-seg-theme button[data-theme="navy"]     { color: #10316b; }
.st-seg-theme button[data-theme="mono"]     { color: #111827; }
.st-seg-theme button.active {
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

/* 操作按钮 */
.st-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.st-btn {
    flex: 1;
    min-width: 150px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 9px;
    cursor: pointer;
    transition: all .2s;
}
.st-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.st-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.st-btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.st-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* 状态提示 */
.st-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.st-status.st-error {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

/* ---------------- 使用说明（可折叠） ---------------- */
.st-help {
    margin-top: 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.st-help summary {
    list-style: none;
    cursor: pointer;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: background .2s;
}
.st-help summary:hover {
    background: var(--bg-secondary);
}
.st-help summary::-webkit-details-marker {
    display: none;
}
.st-help-toggle {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform .25s ease;
}
.st-help[open] .st-help-toggle {
    transform: rotate(180deg);
}
.st-help ul {
    margin: 0;
    padding: 0 18px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 2;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}
.st-help code {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    color: var(--text-primary);
}

/* ---------------- 预览区 ---------------- */
.st-preview-panel {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.st-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-wrap: wrap;
}
.st-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.st-preview-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success, #00ba7c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #00ba7c) 25%, transparent);
}
.st-preview-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.st-fs-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: all .2s;
}
.st-fs-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* 全屏预览：iframe 保持设备模拟宽度，深色背景居中 */
.st-frame-stage:fullscreen,
.st-frame-stage:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    padding: 24px !important;
    background: #101318;
    box-sizing: border-box;
}
.st-frame-stage.st-fs-pseudo {
    position: fixed;
    inset: 0;
    z-index: 99999;
    width: 100vw;
    height: 100vh;
    padding: 24px;
    background: #101318;
    box-sizing: border-box;
}
.st-frame-stage:fullscreen .st-frame,
.st-frame-stage:-webkit-full-screen .st-frame,
.st-frame-stage.st-fs-pseudo .st-frame {
    border-radius: 8px;
}
.st-fs-exit {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 100000;
    border: 1px solid rgba(255, 255, 255, .3);
    background: rgba(15, 20, 25, .78);
    color: #fff;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: all .2s;
}
.st-fs-exit:hover {
    background: rgba(15, 20, 25, .95);
}

.st-devices {
    display: flex;
    gap: 6px;
}
.st-devices button {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: all .2s;
}
.st-devices button:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.st-devices button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.st-preview-scroll {
    height: calc(100vh - 320px);
    min-height: 460px;
    max-height: 760px;
    overflow: auto;
    background-color: var(--bg-secondary);
    background-image: repeating-conic-gradient(
        color-mix(in srgb, var(--text-primary) 5%, transparent) 0 25%,
        transparent 0 50%
    );
    background-size: 22px 22px;
    padding: 20px;
    display: flex;
    justify-content: center;
}
.st-frame-stage {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    transition: max-width .3s ease;
}
.st-frame {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .18);
    transition: max-width .3s ease;
}
.st-frame.st-frame-tablet { max-width: 768px; }
.st-frame.st-frame-mobile { max-width: 375px; }

/* 空态提示 */
.st-preview-empty {
    position: absolute;
    inset: 0;
    top: 53px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
    pointer-events: none;
}
.st-preview-empty-icon {
    font-size: 42px;
    opacity: .6;
}

/* ---------------- 平板适配（≤991px 单栏） ---------------- */
@media (max-width: 991px) {
    .st-layout {
        grid-template-columns: 1fr;
    }
    .st-preview-scroll {
        height: 68vh;
        min-height: 420px;
        max-height: 700px;
    }
}

/* ---------------- 手机适配 ---------------- */
@media (max-width: 767px) {
    .st-page {
        padding: 12px 12px 36px;
    }
    .st-title {
        font-size: 24px;
    }
    .st-sub {
        font-size: 14px;
    }
    .st-card {
        padding: 13px;
        margin-bottom: 11px;
    }
    .st-input {
        min-height: 280px;
        max-height: 65vh;
        font-size: 16px; /* 避免 iOS 聚焦自动缩放 */
    }
    .st-input-meta {
        font-size: 11px;
    }
    .st-actions {
        flex-direction: column;
    }
    .st-btn {
        width: 100%;
        min-width: 0;
    }
    .st-seg-theme button {
        width: 30px;
        height: 28px;
    }
    .st-demos-tip {
        display: block;
        width: 100%;
    }
    .st-preview-head {
        padding: 9px 12px;
    }
    .st-dev-label {
        display: none; /* 手机上仅显示图标 */
    }
    .st-devices button {
        padding: 6px 11px;
        font-size: 14px;
    }
    .st-preview-scroll {
        height: 62vh;
        min-height: 380px;
        padding: 12px;
    }
    .st-frame.st-frame-tablet { max-width: 100%; }
    .st-frame.st-frame-mobile { max-width: 90%; }
    .st-help {
        margin-top: 14px;
    }
    .st-help ul {
        font-size: 12px;
    }
    .st-preview-title::before {
        display: none;
    }
}

/* ---------------- 超小屏（≤400px）微调 ---------------- */
@media (max-width: 400px) {
    .st-seg-theme button {
        width: 27px;
        height: 26px;
        font-size: 11px;
    }
    .st-demo-btn,
    .st-clear-btn {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* ---------------- 发送到邮箱弹窗 ---------------- */
.st-no-scroll {
    overflow: hidden;
}
.st-mask {
    position: fixed;
    inset: 0;
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.st-mask:not([hidden]) {
    display: flex;
}
.st-mask[hidden] {
    display: none !important;
}
.st-mailbox {
    width: 100%;
    max-width: 420px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
    overflow: hidden;
    animation: st-mail-pop .18s ease-out;
}
@keyframes st-mail-pop {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to { opacity: 1; transform: none; }
}
.st-mailbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}
.st-mailbox-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.st-mailbox-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background .2s, color .2s;
}
.st-mailbox-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}
.st-mailbox-body {
    padding: 16px 18px 18px;
}
.st-mail-info {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.st-mail-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
.st-mail-req {
    font-size: 11px;
    font-weight: 400;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 0 5px;
    margin-left: 6px;
}
.st-mail-field input {
    width: 100%;
    box-sizing: border-box;
    height: 42px;
    padding: 0 12px;
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.st-mail-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.st-mail-error {
    display: none;
    margin-top: 10px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    border-radius: 6px;
    background: color-mix(in srgb, #e5484d 10%, transparent);
    color: #e5484d;
}
.st-mail-error.show {
    display: block;
}
.st-mailbox-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}
.st-mailbox-actions .st-btn {
    flex: 0 0 auto;
    min-width: 96px;
    width: auto;
}

/* 发送中禁用遮罩关闭入口按钮的视觉反馈 */
.st-mailbox-actions .st-btn:disabled {
    opacity: .6;
}
