/* ════════════════════════════════════════════════════════════════════════
   styles-workshop.css — 弹窗工作坊样式
   纯黑白灰韩系风：无渐变、无 emoji、克制留白、细线描边、SVG 图标。
   作用域统一前缀 #layer-atelier / .ws-* ，不污染主产品其他模块。
   ════════════════════════════════════════════════════════════════════════ */

#layer-atelier {
    --ws-bg:        #ffffff;   /* 主背景：纯白 */
    --ws-bg-soft:   #f5f5f5;   /* 次背景：浅灰 */
    --ws-line:      #e3e3e3;   /* 分隔线 */
    --ws-line-soft: #ededed;   /* 更浅的线 */
    --ws-ink:       #1a1a1a;   /* 主文字：近黑 */
    --ws-ink-2:     #6b6b6b;   /* 次文字：中灰 */
    --ws-ink-3:     #9a9a9a;   /* 三级文字：浅灰 */
    --ws-accent:    #1a1a1a;   /* 强调=黑（按钮底） */
    --ws-radius:    14px;
    --ws-radius-sm: 10px;

    background: var(--ws-bg);
    color: var(--ws-ink);
    font-family: -apple-system, 'Pretendard', 'Apple SD Gothic Neo', 'PingFang SC', 'Hiragino Sans', sans-serif;
}

/* ── 顶部导航栏 — [FIX-弹性保护带] padding-top适配状态栏 ── */
#layer-atelier .ws-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 8px;
    padding-top: var(--guard-top, env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--ws-line);
    background: var(--ws-bg);
    box-sizing: border-box;
}
#layer-atelier .ws-nav-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ws-ink);
    cursor: pointer;
}
#layer-atelier .ws-nav-icon svg { width: 22px; height: 22px; }
#layer-atelier .ws-nav-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ── 主体滚动区 ── */
/* .layer 为 flex column，nav 固定高度，home 用 flex:1 填充剩余空间并滚动 */
#layer-atelier .ws-home {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#layer-atelier .ws-home-list {
    padding: 16px;
}

/* ── key 状态条 ── */
.ws-keybar {
    border: 1px solid var(--ws-line);
    border-radius: var(--ws-radius-sm);
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ws-ink-2);
    background: var(--ws-bg-soft);
    margin-bottom: 18px;
}
.ws-keybar-ok {
    border-color: var(--ws-ink);
    color: var(--ws-ink);
    background: var(--ws-bg);
}

/* ── 分区标题 ── */
.ws-section-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ws-ink-3);
    letter-spacing: 1px;
    margin: 18px 2px 10px;
    text-transform: none;
}

/* ── 弹窗卡片 ── */
.ws-card {
    border: 1px solid var(--ws-line);
    border-radius: var(--ws-radius);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    background: var(--ws-bg);
    transition: border-color .18s ease, transform .12s ease;
}
.ws-card:active {
    transform: scale(0.992);
    border-color: var(--ws-ink);
}
.ws-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.ws-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ws-ink);
}
.ws-card-tag {
    font-size: 11px;
    color: var(--ws-ink-3);
    border: 1px solid var(--ws-line);
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}
.ws-card-desc {
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ws-ink-2);
}

/* ════════════════════════════════════════════════════════════════════
   弹窗模态外壳
   ════════════════════════════════════════════════════════════════════ */
.ws-popup-mask {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 20, 0.32);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 60;
    padding: 24px;
}
.ws-popup-mask.show { display: flex; }

.ws-popup {
    width: 100%;
    max-width: 360px;
    max-height: 80%;
    background: var(--ws-bg, #fff);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.ws-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ws-line, #e3e3e3);
    flex-shrink: 0;
}
.ws-popup-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ws-ink, #1a1a1a);
}
.ws-popup-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ws-ink-2, #6b6b6b);
    cursor: pointer;
    border-radius: 8px;
}
.ws-popup-close:active { background: var(--ws-bg-soft, #f5f5f5); }
.ws-popup-body {
    padding: 18px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

/* ════════════════════════════════════════════════════════════════════
   积木通用样式
   ════════════════════════════════════════════════════════════════════ */
.ws-block { margin-bottom: 16px; }
.ws-block:last-child { margin-bottom: 0; }

.ws-block-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ws-ink, #1a1a1a);
}

.ws-input-label {
    display: block;
    font-size: 12.5px;
    color: var(--ws-ink-2, #6b6b6b);
    margin-bottom: 6px;
}
.ws-input-field {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ws-line, #e3e3e3);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--ws-ink, #1a1a1a);
    background: var(--ws-bg, #fff);
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color .15s ease;
}
.ws-input-field:focus { border-color: var(--ws-ink, #1a1a1a); }

/* 按钮：黑底白字，韩系极简 */
.ws-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--ws-accent, #1a1a1a);
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity .15s ease;
}
.ws-btn:active { opacity: 0.82; }
.ws-btn-disabled,
.ws-btn:disabled {
    background: var(--ws-bg-soft, #f5f5f5);
    color: var(--ws-ink-3, #9a9a9a);
    cursor: not-allowed;
}
.ws-btn-loading { opacity: 0.6; cursor: wait; }

/* AI 输出区 */
.ws-ai-output {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--ws-ink, #1a1a1a);
    min-height: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}
.ws-random-output {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ws-ink, #1a1a1a);
}

/* 无 key 提示 */
.ws-nokey-tip {
    font-size: 12px;
    line-height: 1.6;
    color: var(--ws-ink-2, #6b6b6b);
    background: var(--ws-bg-soft, #f5f5f5);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
}

/* ════════════════════════════════════════════════════════════════════
   倒计时
   ════════════════════════════════════════════════════════════════════ */
.ws-countdown { text-align: center; }
.ws-cd-title {
    font-size: 13px;
    color: var(--ws-ink-2, #6b6b6b);
    margin-bottom: 8px;
    letter-spacing: 1px;
}
.ws-cd-number {
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    color: var(--ws-ink, #1a1a1a);
    letter-spacing: -1px;
}
.ws-cd-number.ws-cd-small { font-size: 32px; }
.ws-cd-unit {
    font-size: 14px;
    color: var(--ws-ink-2, #6b6b6b);
    margin-top: 6px;
}
.ws-cd-date {
    font-size: 12px;
    color: var(--ws-ink-3, #9a9a9a);
    margin-top: 12px;
}
.ws-cd-empty {
    font-size: 13px;
    color: var(--ws-ink-3, #9a9a9a);
    padding: 20px 0;
}
.ws-cd-form {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--ws-line-soft, #ededed);
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}
.ws-cd-form .ws-btn { align-self: stretch; }

/* ════════════════════════════════════════════════════════════════════
   心情打卡
   ════════════════════════════════════════════════════════════════════ */
.ws-mood-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.ws-mood-chip {
    border: 1px solid var(--ws-line, #e3e3e3);
    background: var(--ws-bg, #fff);
    color: var(--ws-ink, #1a1a1a);
    font-size: 13px;
    padding: 12px 4px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s ease;
}
.ws-mood-chip:active {
    background: var(--ws-ink, #1a1a1a);
    color: #fff;
    border-color: var(--ws-ink, #1a1a1a);
}
.ws-mood-reply {
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ws-ink, #1a1a1a);
    min-height: 4px;
}
.ws-mood-history { margin-top: 4px; }
.ws-mood-row {
    display: flex;
    justify-content: space-between;
    padding: 9px 2px;
    border-bottom: 1px solid var(--ws-line-soft, #ededed);
    font-size: 13px;
}
.ws-mood-row:last-child { border-bottom: none; }
.ws-mood-row-date { color: var(--ws-ink-3, #9a9a9a); }
.ws-mood-row-mood { color: var(--ws-ink, #1a1a1a); font-weight: 500; }

/* ════════════════════════════════════════════════════════════════════
   占卜抽签
   ════════════════════════════════════════════════════════════════════ */
.ws-divine { text-align: center; }
.ws-divine-result { margin: 18px 0; min-height: 4px; }
.ws-divine-key {
    font-size: 40px;
    font-weight: 700;
    color: var(--ws-ink, #1a1a1a);
    letter-spacing: 4px;
}
.ws-divine-base {
    font-size: 13px;
    color: var(--ws-ink-2, #6b6b6b);
    margin-top: 8px;
}
.ws-divine .ws-ai-output { text-align: left; }
.ws-divine-btn { margin-top: 8px; min-width: 120px; }

/* ════════════════════════════════════════════════════════════════════
   主界面：制作入口按钮组 / 联动入口
   ════════════════════════════════════════════════════════════════════ */
.ws-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.ws-action-btn {
    flex: 1 1 auto;
    min-width: 88px;
    border: 1px solid var(--ws-line, #e3e3e3);
    background: var(--ws-bg, #fff);
    color: var(--ws-ink, #1a1a1a);
    font-size: 13px;
    padding: 11px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s ease;
}
.ws-action-btn:active {
    background: var(--ws-ink, #1a1a1a);
    color: #fff;
    border-color: var(--ws-ink, #1a1a1a);
}
.ws-link-entry {
    width: 100%;
    margin: 4px 0 4px;
    text-align: left;
    color: var(--ws-ink-2, #6b6b6b);
}
.ws-clear-entry {
    width: 100%;
    margin: 4px 0 4px;
    text-align: left;
    color: #b00020;
}
.ws-clear-entry:active {
    background: #b00020;
    color: #fff;
}

/* 卡片操作（编辑/导出/删除） */
.ws-card-ops {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--ws-line-soft, #ededed);
}
.ws-card-op {
    border: 1px solid var(--ws-line, #e3e3e3);
    background: var(--ws-bg, #fff);
    color: var(--ws-ink-2, #6b6b6b);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}
.ws-card-op:active { background: var(--ws-bg-soft, #f5f5f5); }

/* ════════════════════════════════════════════════════════════════════
   按钮分支块（运行时）
   ════════════════════════════════════════════════════════════════════ */
.ws-block-button {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ws-branch-btn {
    width: 100%;
    background: var(--ws-bg, #fff);
    color: var(--ws-ink, #1a1a1a);
    border: 1px solid var(--ws-ink, #1a1a1a);
}
.ws-branch-btn:active {
    background: var(--ws-ink, #1a1a1a);
    color: #fff;
}

/* ════════════════════════════════════════════════════════════════════
   编辑器
   ════════════════════════════════════════════════════════════════════ */
.ws-editor-row { margin-bottom: 12px; }
.ws-editor-tip {
    margin: 2px 0 10px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ws-sub, #888);
    background: var(--ws-tip-bg, #f6f6f6);
    border-left: 3px solid var(--ws-line, #d8d8d8);
    border-radius: 0 8px 8px 0;
}
.ws-editor-meta { margin-bottom: 8px; }
.ws-editor-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ws-ink, #1a1a1a);
    margin: 10px 0;
    cursor: pointer;
}
.ws-editor-check input { width: 16px; height: 16px; accent-color: #1a1a1a; }

.ws-editor-blocks { margin-bottom: 12px; }
.ws-editor-block {
    border: 1px solid var(--ws-line, #e3e3e3);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--ws-bg-soft, #f5f5f5);
}
.ws-editor-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.ws-editor-block-type {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ws-ink, #1a1a1a);
}
.ws-editor-block-ctrls { display: flex; gap: 4px; }

/* ════════════════════════════════════════════════════════════════════
   代码区 / iframe 沙箱
   ════════════════════════════════════════════════════════════════════ */
.ws-code-area {
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre;
    overflow-x: auto;
}
.ws-sandbox-frame {
    width: 100%;
    height: 420px;
    max-height: 60vh;
    border: 1px solid var(--ws-line, #e3e3e3);
    border-radius: 10px;
    background: #fff;
}

/* 记忆行（联动设置里展示） */
.ws-mem-row {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ws-ink-2, #6b6b6b);
    padding: 8px 10px;
    border-bottom: 1px solid var(--ws-line-soft, #ededed);
}
.ws-mem-row:last-child { border-bottom: none; }

/* ════════════════════════════════════════════════════════════════════
   新增：步骤条 / 分支选项 / 搜索 / 可点提示 / 沙箱报错 / 心情记录
   ════════════════════════════════════════════════════════════════════ */

/* 步骤条 */
.ws-step-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.ws-step-chip {
    font-size: 12px; padding: 5px 12px; border-radius: 16px;
    border: 1px solid var(--ws-line, #e3e3e3); background: var(--ws-bg, #fff);
    color: var(--ws-ink-2, #6b6b6b); cursor: pointer;
}
.ws-step-chip-active { background: var(--ws-ink, #1a1a1a); color: #fff; border-color: var(--ws-ink, #1a1a1a); }
.ws-step-add { border-style: dashed; }
.ws-step-del { color: #c0392b; border-color: #e6c9c4; margin-left: auto; }

/* 按钮分支块的选项编辑 */
.ws-btn-opts { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.ws-btn-opt {
    border: 1px dashed var(--ws-line, #d8d8d8);
    border-radius: 8px; padding: 10px; background: var(--ws-bg, #fff);
}

/* 我做的：搜索框 */
.ws-home-search { margin: 4px 0 10px; }

/* 可点击的提示条（无 key 引导去设置） */
.ws-keybar-link, .ws-nokey-tip-link { cursor: pointer; }
.ws-keybar-action { color: #2d6cdf; font-weight: 600; white-space: nowrap; }

/* 沙箱运行出错提示 */
.ws-sandbox-error {
    margin-bottom: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5;
    color: #8a1f11; background: #fdecea; border: 1px solid #f5c6c0; border-radius: 8px;
}

/* 心情记录：标题行 + 清空 + 单条删除 */
.ws-mood-hist-head { display: flex; align-items: center; justify-content: space-between; }
.ws-mood-clear { font-size: 12px; color: #c0392b; cursor: pointer; font-weight: 500; }
.ws-mood-row { position: relative; }
.ws-mood-row-del {
    color: var(--ws-ink-3, #9a9a9a); cursor: pointer; font-size: 15px;
    padding: 0 6px; margin-left: 8px; line-height: 1;
}
.ws-mood-row-del:hover { color: #c0392b; }

/* 卡片置顶标记 */
.ws-card-pinned .ws-card-name::before { content: '★ '; color: #d99a00; }
