/* ======================================================================
 *  二维码生成器 v2（qrcode-gen.css）
 *  设计：左侧控制面板 + 右侧扫描舞台；深色模式适配
 * ====================================================================== */
.qg-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));
}
/* 顶部氛围光 */
.qg-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(560px 200px at 12% -10%, rgba(59, 130, 246, 0.08), transparent 65%),
        radial-gradient(480px 200px at 95% -12%, rgba(6, 182, 212, 0.08), transparent 65%);
    pointer-events: none;
}

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

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

/* ===== 左侧面板 ===== */
.qg-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.qg-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;
}
.qg-group:focus-within { border-color: rgba(59, 130, 246, 0.45); }
.qg-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.qg-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text, #111827);
}
.qg-tip { font-size: 11px; color: var(--c-text-muted, #9ca3af); }
.qg-count { font-size: 11px; color: var(--c-text-muted, #9ca3af); }
.qg-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;
}

/* 输入框 */
.qg-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;
}
.qg-textarea:focus {
    border-color: var(--c-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* 快捷内容 chips */
.qg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qg-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;
}
.qg-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));
}

/* 分段选择器 */
.qg-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);
}
.qg-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;
}
.qg-seg button:hover { color: var(--c-primary, #2563eb); }
.qg-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);
}

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

/* 颜色行 */
.qg-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.qg-color-row input[type="color"] {
    width: 42px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 9px;
    background: var(--c-bg-card, #fff);
    cursor: pointer;
    flex-shrink: 0;
}
.qg-swatches {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}
.qg-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--c-bg-card, #fff);
    box-shadow: 0 0 0 1px var(--c-border, #e5e7eb);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.qg-swatch:hover { transform: scale(1.18); box-shadow: 0 0 0 2px var(--c-primary, #2563eb); }
.qg-swatch.active { box-shadow: 0 0 0 2px var(--c-primary, #2563eb); }

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

/* Emoji 选择 */
.qg-emojis {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.qg-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;
}
.qg-emojis button:hover { transform: translateY(-2px); border-color: var(--c-primary, #2563eb); }
.qg-emojis button.active {
    border-color: var(--c-primary, #2563eb);
    background: var(--c-primary-soft, rgba(59, 130, 246, 0.10));
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.qg-emojis button[data-e=""] { font-size: 13px; color: var(--c-text-muted, #9ca3af); }

.qg-upload-row { display: flex; gap: 8px; align-items: center; }
.qg-file-btn {
    font-size: 12px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 9px;
    border: 1px dashed var(--c-primary, #2563eb);
    color: var(--c-primary, #2563eb);
    background: var(--c-primary-soft, rgba(59, 130, 246, 0.06));
    cursor: pointer;
    transition: all 0.2s;
}
.qg-file-btn:hover { background: var(--c-primary-soft, rgba(59, 130, 246, 0.14)); }
.qg-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;
}
.qg-clear-btn:hover { border-color: #ef4444; color: #ef4444; }

/* ===== 右侧舞台 ===== */
.qg-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.qg-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(59, 130, 246, 0.10) 0%, transparent 60%),
        var(--c-bg-soft, #f1f5f9);
    border: 1px solid var(--c-border, #eef1f6);
    padding: 26px;
}
.qg-frame canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    border-radius: 12px;
    animation: qgFloat 6s ease-in-out infinite;
    box-shadow: 0 18px 44px rgba(16, 24, 40, 0.16);
    display: block;
}
@keyframes qgFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

/* 扫描角标 */
.qg-corner {
    position: absolute;
    width: 34px;
    height: 34px;
    pointer-events: none;
}
.qg-corner--tl { top: 12px; left: 12px; border-top: 4px solid var(--c-primary, #2563eb); border-left: 4px solid var(--c-primary, #2563eb); border-top-left-radius: 10px; }
.qg-corner--tr { top: 12px; right: 12px; border-top: 4px solid var(--c-primary, #2563eb); border-right: 4px solid var(--c-primary, #2563eb); border-top-right-radius: 10px; }
.qg-corner--bl { bottom: 12px; left: 12px; border-bottom: 4px solid var(--c-primary, #2563eb); border-left: 4px solid var(--c-primary, #2563eb); border-bottom-left-radius: 10px; }
.qg-corner--br { bottom: 12px; right: 12px; border-bottom: 4px solid var(--c-primary, #2563eb); border-right: 4px solid var(--c-primary, #2563eb); border-bottom-right-radius: 10px; }

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

/* 操作按钮 */
.qg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
    max-width: 430px;
}
.qg-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;
}
.qg-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 24, 40, 0.12)); }
.qg-btn:active { transform: translateY(0); }
.qg-btn.primary {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: #fff;
    border: 0;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.30);
}
.qg-btn.ghost { background: transparent; }

/* 历史记录 */
.qg-history {
    width: 100%;
    max-width: 430px;
}
.qg-history-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--c-text-sub, #4b5563);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.qg-history-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--c-border, #eef1f6);
}
.qg-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
}
.qg-history-item {
    position: relative;
    border: 1px solid var(--c-border, #eef1f6);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: var(--c-bg-card, #fff);
    transition: all 0.2s;
    padding: 0;
    display: block;
}
.qg-history-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 24, 40, 0.14)); }
.qg-history-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    image-rendering: pixelated;
}
.qg-history-item .qg-history-del {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 0;
    background: rgba(17, 24, 39, 0.55);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: grid;
    place-items: center;
}
.qg-history-item:hover .qg-history-del { opacity: 1; }
.qg-history-empty {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--c-text-muted, #9ca3af);
    text-align: center;
    padding: 18px 0;
    border: 1px dashed var(--c-border, #e5e7eb);
    border-radius: 10px;
}

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

/* ===== 深色模式 ===== */
[data-theme="dark"] .qg-hero { background: var(--c-bg-card); }
[data-theme="dark"] .qg-hero::before { opacity: 0.7; }
[data-theme="dark"] .qg-group { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .qg-seg { background: var(--c-surface-2, #0b1221); }
[data-theme="dark"] .qg-seg button.active {
    background: var(--c-bg-card);
    color: #60a5fa;
}
[data-theme="dark"] .qg-frame {
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(59, 130, 246, 0.16) 0%, transparent 60%),
        var(--c-surface-2, #0b1221);
}
[data-theme="dark"] .qg-btn:not(.primary):not(.ghost) {
    background: var(--c-surface-soft);
    color: var(--c-text);
}
[data-theme="dark"] .qg-history-item { background: var(--c-surface-soft); }
[data-theme="dark"] .qg-swatch { border-color: var(--c-surface-2); }
[data-theme="dark"] .qg-color-row input[type="color"] { background: var(--c-bg-soft); }

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

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

/* 批量结果网格 */
.qg-batch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.qg-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;
}
.qg-batch-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 24, 40, 0.12));
}
.qg-batch-item canvas {
    width: 100%;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
    border-radius: 8px;
    background: #fff;
}
.qg-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;
}
.qg-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;
}
.qg-batch-dl:hover {
    background: var(--c-primary-soft, rgba(59, 130, 246, 0.10));
    border-color: var(--c-primary, #2563eb);
}
[data-theme="dark"] .qg-batch {
    background: var(--c-surface-soft, rgba(255, 255, 255, 0.03));
}
[data-theme="dark"] .qg-batch .qg-group { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .qg-batch-item { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .qg-batch-dl { background: transparent; }

/* 响应式 */
@media (max-width: 520px) {
    .qg-hero { padding: 16px; }
    .qg-title { font-size: 20px; }
    .qg-frame { padding: 18px; }
    .qg-mode { max-width: 100%; }
    .qg-batch { padding: 14px; }
}
