/* ======================================================================
 *  渐变壁纸生成器 v2（gradient-wallpaper.css）
 *  设计：左侧控制面板 + 右侧画布预览；深色模式适配
 * ====================================================================== */
.gw-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));
}
.gw-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(560px 200px at 90% -10%, rgba(236, 72, 153, 0.08), transparent 65%),
        radial-gradient(480px 200px at 4% -12%, rgba(139, 92, 246, 0.08), transparent 65%);
    pointer-events: none;
}

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

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

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

/* 分段选择器 */
.gw-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);
}
.gw-seg.small { grid-auto-columns: minmax(0, 1fr); }
.gw-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;
}
.gw-seg button:hover { color: var(--c-primary, #2563eb); }
.gw-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);
}

/* 滑块 */
.gw-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, #ec4899, #8b5cf6);
    outline: none;
    cursor: pointer;
}
.gw-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #ec4899;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.35);
    cursor: grab;
    transition: transform 0.15s;
}
.gw-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.gw-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #ec4899;
    cursor: grab;
}

/* 颜色停靠点 */
.gw-stops { display: flex; flex-direction: column; gap: 8px; }
.gw-stop {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #eef1f6);
    border-radius: 10px;
    animation: gwIn 0.25s ease;
}
@keyframes gwIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.gw-stop-idx {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    flex-shrink: 0;
}
.gw-stop input[type="color"] {
    width: 34px;
    height: 30px;
    padding: 1px;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 8px;
    background: var(--c-bg-card, #fff);
    cursor: pointer;
    flex-shrink: 0;
}
.gw-stop-pos {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gw-stop-pos input[type="range"] {
    flex: 1;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(236, 72, 153, 0.35), rgba(139, 92, 246, 0.35));
    outline: none;
    cursor: pointer;
}
.gw-stop-pos input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #8b5cf6;
    cursor: grab;
}
.gw-stop-pos b {
    font-size: 10px;
    color: var(--c-text-muted, #9ca3af);
    min-width: 26px;
    text-align: right;
}
.gw-stop-del {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--c-text-muted, #9ca3af);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.gw-stop-del:hover { color: #ef4444; background: rgba(239, 68, 68, 0.10); }
.gw-add-stop {
    font-size: 12px;
    font-weight: 600;
    padding: 8px;
    border-radius: 9px;
    border: 1px dashed var(--c-primary, #8b5cf6);
    color: var(--c-primary, #8b5cf6);
    background: var(--c-primary-soft, rgba(139, 92, 246, 0.06));
    cursor: pointer;
    transition: all 0.2s;
}
.gw-add-stop:hover { background: var(--c-primary-soft, rgba(139, 92, 246, 0.14)); }

/* 灵感预设 */
.gw-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.gw-preset {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    padding: 0;
}
.gw-preset::after {
    content: attr(data-name);
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 10px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gw-preset:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 8px 18px rgba(16, 24, 40, 0.18); }
.gw-preset.active { border-color: var(--c-primary, #8b5cf6); }

/* 特效 */
.gw-fx { display: flex; flex-direction: column; gap: 10px; }
.gw-fx-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.gw-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--c-text-sub, #4b5563);
    cursor: pointer;
    user-select: none;
}
.gw-check input {
    width: 15px;
    height: 15px;
    accent-color: var(--c-primary, #8b5cf6);
    cursor: pointer;
}
.gw-fx-slider {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 190px;
}
.gw-fx-slider input[type="range"] {
    flex: 1;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(236, 72, 153, 0.35), rgba(139, 92, 246, 0.35));
    outline: none;
    cursor: pointer;
}
.gw-fx-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #8b5cf6;
    cursor: grab;
}
.gw-seg.small button { font-size: 11px; padding: 5px 4px; }

/* 尺寸 */
.gw-wh { display: flex; align-items: center; gap: 8px; }
.gw-wh input[type="number"] {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 9px;
    padding: 8px 10px;
    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;
}
.gw-wh input[type="number"]:focus {
    border-color: var(--c-primary, #8b5cf6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}
.gw-wh .gw-x { color: var(--c-text-muted, #9ca3af); font-size: 13px; }
.gw-swap {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--c-border, #e5e7eb);
    background: var(--c-bg-card, #fff);
    color: var(--c-text-sub, #6b7280);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.gw-swap:hover { border-color: var(--c-primary, #8b5cf6); color: var(--c-primary, #8b5cf6); }

/* 操作按钮 */
.gw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.gw-btn {
    font-size: 13px;
    font-weight: 600;
    padding: 10px 18px;
    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;
}
.gw-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 24, 40, 0.12)); }
.gw-btn:active { transform: translateY(0); }
.gw-btn.primary {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    border: 0;
    box-shadow: 0 6px 18px rgba(236, 72, 153, 0.30);
}
.gw-btn.ghost { background: transparent; }

/* ===== 预览舞台 ===== */
.gw-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.gw-frame {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 9 / 16;
    border-radius: 18px;
    overflow: hidden;
    background: var(--c-bg-soft, #f1f5f9);
    border: 1px solid var(--c-border, #eef1f6);
    box-shadow: 0 18px 44px rgba(16, 24, 40, 0.16);
    display: grid;
    place-items: center;
}
.gw-frame canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gw-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}
.gw-meta { font-size: 12px; color: var(--c-text-muted, #6b7280); }
.gw-local-badge {
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    background: rgba(5, 150, 105, 0.10);
    padding: 3px 10px;
    border-radius: 999px;
}

/* 生成记录 */
.gw-history { width: 100%; max-width: 400px; }
.gw-history-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--c-text-sub, #4b5563);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.gw-history-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--c-border, #eef1f6);
}
.gw-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
}
.gw-history-item {
    position: relative;
    border: 1px solid var(--c-border, #eef1f6);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    aspect-ratio: 9 / 16;
    padding: 0;
}
.gw-history-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 24, 40, 0.16)); }
.gw-history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gw-history-del {
    position: absolute;
    top: 4px;
    right: 4px;
    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;
}
.gw-history-item:hover .gw-history-del { opacity: 1; }
.gw-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"] .gw-hero { background: var(--c-bg-card); }
[data-theme="dark"] .gw-group { background: var(--c-surface-soft, rgba(255, 255, 255, 0.03)); }
[data-theme="dark"] .gw-seg { background: var(--c-surface-2, #0b1221); }
[data-theme="dark"] .gw-seg button.active { background: var(--c-bg-card); color: #f472b6; }
[data-theme="dark"] .gw-stop { background: var(--c-surface-soft); }
[data-theme="dark"] .gw-frame { background: var(--c-surface-2, #0b1221); }
[data-theme="dark"] .gw-btn:not(.primary):not(.ghost) { background: var(--c-surface-soft); color: var(--c-text); }
[data-theme="dark"] .gw-history-item { background: var(--c-surface-soft); }
[data-theme="dark"] .gw-wh input[type="number"] { background: var(--c-bg-soft); }
[data-theme="dark"] .gw-stop input[type="color"] { background: var(--c-bg-soft); }

/* 响应式 */
@media (max-width: 520px) {
    .gw-hero { padding: 16px; }
    .gw-title { font-size: 20px; }
    .gw-presets { grid-template-columns: repeat(3, 1fr); }
}
