/* ======================================================================
 *  艺术二维码生成器（qrcode-design.css）
 *  设计：左侧控制面板 + 右侧预览舞台；模板 / 码点 / 定位角 / 中心标
 *  视觉语言与 qrcode-gen.css 完全统一；深色模式适配
 * ====================================================================== */
.qd-hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 28px;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #eef1f6);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(16, 24, 40, 0.06));
}
/* 顶部氛围光 */
.qd-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(560px 200px at 12% -10%, rgba(124, 58, 237, 0.08), transparent 65%),
        radial-gradient(480px 200px at 95% -12%, rgba(37, 99, 235, 0.08), transparent 65%);
    pointer-events: none;
}

/* ===== 头部 ===== */
.qd-head {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    margin-bottom: 22px;
}
.qd-logo {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    font-size: 26px;
    border-radius: 16px;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.30);
}
.qd-title { font-size: 24px; font-weight: 800; color: var(--c-text, #111827); letter-spacing: 0.5px; }
.qd-sub { font-size: 13px; color: var(--c-text-muted, #6b7280); margin-top: 2px; }

/* ===== 布局 ===== */
.qd-layout {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 22px;
    position: relative;
}
@media (max-width: 900px) {
    .qd-layout { grid-template-columns: 1fr; }
}

/* ===== 左侧面板 ===== */
.qd-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.qd-group {
    background: var(--c-bg-soft, #f8fafc);
    border: 1px solid var(--c-border, #eef1f6);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.25s;
}
.qd-group:focus-within { border-color: rgba(124, 58, 237, 0.45); }
.qd-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.qd-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text, #111827);
}
.qd-tip { font-size: 11px; color: var(--c-text-muted, #9ca3af); }
.qd-count { font-size: 11px; color: var(--c-text-muted, #9ca3af); }
.qd-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--c-primary, #2563eb);
    background: var(--c-primary-soft, rgba(37, 99, 235, 0.10));
    padding: 2px 8px;
    border-radius: 999px;
}

/* 输入框 */
.qd-textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--c-text, #111827);
    background: var(--c-bg-card, #fff);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.6;
}
.qd-textarea:focus {
    border-color: var(--c-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.qd-textarea:disabled {
    background: var(--c-bg, #f1f5f9);
    color: var(--c-text-muted, #9ca3af);
    cursor: not-allowed;
}

/* 快捷内容 chips */
.qd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qd-chips button {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-card, #fff);
    color: var(--c-text-sub, #4b5563);
    cursor: pointer;
    transition: all 0.2s;
}
.qd-chips button:hover {
    border-color: var(--c-primary, #2563eb);
    color: var(--c-primary, #2563eb);
    background: var(--c-primary-soft, rgba(59, 130, 246, 0.08));
}

/* ===== 艺术模板网格 ===== */
.qd-tpls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
}
.qd-tpl {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 7px;
    border-radius: 11px;
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-card, #fff);
    cursor: pointer;
    transition: all 0.18s;
}
.qd-tpl:hover { transform: translateY(-2px); border-color: rgba(124, 58, 237, 0.55); }
.qd-tpl.active {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18);
}
.qd-tpl-bar {
    height: 22px;
    border-radius: 7px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}
.qd-tpl-name {
    font-size: 11px;
    text-align: center;
    color: var(--c-text-sub, #4b5563);
    white-space: nowrap;
}
.qd-tpl.active .qd-tpl-name { color: #7c3aed; font-weight: 700; }

/* 分段选择器 */
.qd-seg {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    background: var(--c-bg, #f1f5f9);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--c-border, #eef1f6);
}
.qd-seg button {
    font-size: 12px;
    font-weight: 600;
    padding: 7px 6px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--c-text-sub, #6b7280);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.qd-seg button:hover { color: var(--c-primary, #2563eb); }
.qd-seg button.active {
    background: var(--c-bg-card, #fff);
    color: var(--c-primary, #2563eb);
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
}

/* 滑块 */
.qd-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, #7c3aed, rgba(37, 99, 235, 0.9));
    outline: none;
    cursor: pointer;
}
.qd-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #7c3aed;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
    cursor: grab;
    transition: transform 0.15s;
}
.qd-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.qd-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #7c3aed;
    cursor: grab;
}

/* 颜色行 */
.qd-color-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}
.qd-color-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.qd-color-item input[type="color"] {
    width: 100%;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 9px;
    background: var(--c-bg-card, #fff);
    cursor: pointer;
}
.qd-color-item input[type="color"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.qd-color-item small {
    font-size: 11px;
    color: var(--c-text-muted, #9ca3af);
}

/* 复选框 */
.qd-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--c-text-sub, #4b5563);
    cursor: pointer;
    user-select: none;
}
.qd-check input {
    width: 15px;
    height: 15px;
    accent-color: #7c3aed;
    cursor: pointer;
}

/* Emoji 选择 */
.qd-emojis {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.qd-emojis button {
    font-size: 18px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-card, #fff);
    cursor: pointer;
    transition: all 0.18s;
}
.qd-emojis button:hover { transform: translateY(-2px); border-color: #7c3aed; }
.qd-emojis button.active {
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.10);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
.qd-emojis button[data-e=""] { font-size: 13px; color: var(--c-text-muted, #9ca3af); }

/* 文字中心标输入框 */
.qd-badge-text {
    width: 100%;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--c-text, #111827);
    background: var(--c-bg-card, #fff);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.qd-badge-text:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.qd-upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qd-file-btn {
    font-size: 12px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 9px;
    border: 1px dashed #7c3aed;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.06);
    cursor: pointer;
    transition: all 0.2s;
}
.qd-file-btn:hover { background: rgba(124, 58, 237, 0.14); }
.qd-clear-btn {
    font-size: 12px;
    padding: 7px 14px;
    border-radius: 9px;
    border: 1px solid var(--c-border, #e5e7eb);
    background: transparent;
    color: var(--c-text-muted, #6b7280);
    cursor: pointer;
    transition: all 0.2s;
}
.qd-clear-btn:hover { border-color: #ef4444; color: #ef4444; }

/* ===== 右侧舞台 ===== */
.qd-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.qd-frame {
    position: relative;
    width: 100%;
    max-width: 430px;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(124, 58, 237, 0.10) 0%, transparent 60%),
        var(--c-bg-soft, #f1f5f9);
    border: 1px solid var(--c-border, #eef1f6);
    padding: 26px;
}
.qd-frame canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    border-radius: 12px;
    animation: qdFloat 6s ease-in-out infinite;
    box-shadow: 0 18px 44px rgba(16, 24, 40, 0.16);
    display: block;
}
@keyframes qdFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

/* 扫描角标 */
.qd-corner {
    position: absolute;
    width: 34px;
    height: 34px;
    pointer-events: none;
}
.qd-corner--tl { top: 12px; left: 12px; border-top: 4px solid #7c3aed; border-left: 4px solid #7c3aed; border-top-left-radius: 10px; }
.qd-corner--tr { top: 12px; right: 12px; border-top: 4px solid #7c3aed; border-right: 4px solid #7c3aed; border-top-right-radius: 10px; }
.qd-corner--bl { bottom: 12px; left: 12px; border-bottom: 4px solid #7c3aed; border-left: 4px solid #7c3aed; border-bottom-left-radius: 10px; }
.qd-corner--br { bottom: 12px; right: 12px; border-bottom: 4px solid #7c3aed; border-right: 4px solid #7c3aed; border-bottom-right-radius: 10px; }

/* 空状态 */
.qd-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 14px;
    color: var(--c-text-muted, #9ca3af);
    background: transparent;
    pointer-events: none;
}

/* meta 行 */
.qd-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
    max-width: 430px;
}
.qd-meta { font-size: 12px; color: var(--c-text-muted, #6b7280); }
.qd-local-badge {
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    background: rgba(5, 150, 105, 0.10);
    padding: 3px 10px;
    border-radius: 999px;
}

/* 操作按钮 */
.qd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
    max-width: 430px;
}
.qd-btn {
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 11px;
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-card, #fff);
    color: var(--c-text, #111827);
    cursor: pointer;
    transition: all 0.2s;
}
.qd-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 24, 40, 0.12)); }
.qd-btn:active { transform: translateY(0); }
.qd-btn.primary {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    border: 0;
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.30);
}
.qd-btn.ghost { background: transparent; }

/* 扫码自检提示 */
.qd-scan-tip {
    width: 100%;
    max-width: 430px;
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--c-text-muted, #9ca3af);
    text-align: center;
}

/* ===== 下方信息区间距 ===== */
.qd-info { margin-top: 26px; }

/* ===== 工具类 ===== */
.hidden { display: none !important; }

/* ===== 深色模式 ===== */
[data-theme="dark"] .qd-hero { background: var(--c-bg-card); }
[data-theme="dark"] .qd-hero::before { opacity: 0.7; }
[data-theme="dark"] .qd-group { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .qd-seg { background: var(--c-surface-2, #0b1221); }
[data-theme="dark"] .qd-seg button.active {
    background: var(--c-bg-card);
    color: #a78bfa;
}
[data-theme="dark"] .qd-tpl { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .qd-frame {
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(124, 58, 237, 0.18) 0%, transparent 60%),
        var(--c-surface-2, #0b1221);
}
[data-theme="dark"] .qd-btn:not(.primary):not(.ghost) {
    background: var(--c-surface-soft);
    color: var(--c-text);
}
[data-theme="dark"] .qd-color-item input[type="color"] { background: var(--c-bg-soft); }
[data-theme="dark"] .qd-textarea:disabled { background: var(--c-surface-2, #0b1221); }

/* ===== 模式切换栏 ===== */
.qd-mode-bar {
    display: flex;
    align-items: center;
    position: relative;
    margin-bottom: 18px;
}
.qd-mode { max-width: 320px; }

/* ===== 批量面板 ===== */
.qd-batch {
    position: relative;
    margin-bottom: 20px;
    padding: 18px;
    border-radius: 16px;
    border: 1px dashed rgba(124, 58, 237, 0.4);
    background:
        radial-gradient(560px 200px at 12% -10%, rgba(124, 58, 237, 0.08), transparent 65%),
        var(--c-bg-soft, #f8fafc);
    animation: qdBatchIn 0.3s ease;
}
@keyframes qdBatchIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.qd-batch .qd-group { background: var(--c-bg-card, #fff); }
.qd-batch-textarea {
    min-height: 140px;
    font-family: "Consolas", "JetBrains Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.7;
}
.qd-batch-tip {
    font-size: 12px;
    color: var(--c-text-muted, #6b7280);
    line-height: 1.7;
}
.qd-batch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* 批量结果网格 */
.qd-batch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.qd-batch-grid:empty { display: none; }
.qd-batch-item {
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #eef1f6);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.qd-batch-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 24, 40, 0.12));
}
.qd-batch-item canvas {
    width: 100%;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
    border-radius: 8px;
    background: #fff;
}
.qd-batch-item-text {
    width: 100%;
    font-size: 11px;
    color: var(--c-text-sub, #4b5563);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qd-batch-dl {
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    padding: 7px 0;
    border-radius: 9px;
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-soft, #f8fafc);
    color: var(--c-primary, #2563eb);
    cursor: pointer;
    transition: all 0.2s;
}
.qd-batch-dl:hover {
    background: var(--c-primary-soft, rgba(59, 130, 246, 0.10));
    border-color: var(--c-primary, #2563eb);
}
[data-theme="dark"] .qd-batch {
    background: var(--c-surface-soft, rgba(255, 255, 255, 0.03));
}
[data-theme="dark"] .qd-batch .qd-group { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .qd-batch-item { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .qd-batch-dl { background: transparent; }

/* 响应式 */
@media (max-width: 520px) {
    .qd-hero { padding: 16px; }
    .qd-title { font-size: 20px; }
    .qd-frame { padding: 18px; }
    .qd-mode { max-width: 100%; }
    .qd-batch { padding: 14px; }
    .qd-tpls { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
