/* ============================================================
   斜着看图片生成器 slant-view — 样式自包含（sv- 前缀）
   设计语言与全站一致：白卡、#eff2f8 底、品牌蓝 #4f6ef7
   ============================================================ */

.sv-wrap { max-width: 1100px; margin: 0 auto; }

.sv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 344px;
    gap: 14px;
    align-items: start;
}
@media (max-width: 900px) {
    .sv-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 卡片 ---------- */
.sv-card {
    background: #fff;
    border: 1px solid var(--z-line, #e2e8f0);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
}
.sv-card-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 700; color: #0f172a;
    margin: 0 0 12px;
}
.sv-card-title .svg-icon { color: #4f6ef7; flex: none; }
.sv-title-hint {
    margin-left: auto; font-weight: 400; font-size: 12px; color: #94a3b8;
}

/* ---------- 预览台 ---------- */
.sv-stage-card { padding: 14px; }
.sv-stage-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px; flex-wrap: wrap;
}
.sv-stage-head > b { font-size: 14px; color: #0f172a; }

.sv-ratios { display: flex; gap: 5px; margin-left: auto; }
.sv-ratios button {
    min-width: 44px; height: 28px; padding: 0 9px;
    border: 1px solid #e2e8f0; border-radius: 8px;
    background: #fff; color: #475569;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all .15s;
}
.sv-ratios button:hover { border-color: #c7d2fe; color: #4f6ef7; }
.sv-ratios button.is-on {
    background: #4f6ef7; border-color: #4f6ef7; color: #fff;
    box-shadow: 0 2px 6px rgba(79, 110, 247, .28);
}

.sv-canvas-box {
    display: flex; align-items: center; justify-content: center;
    /* 输出是不透明 PNG，不用棋盘格（否则会让人以为图有透明区域） */
    background: #f4f7fb;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    padding: 14px;
    min-height: 240px;
    overflow: hidden;
}
.sv-canvas-box canvas {
    display: block;
    max-width: 100%;
    max-height: 58vh;
    width: auto; height: auto;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .1);
    transform-origin: center center;
    transition: transform .08s linear;
}

/* 模拟斜看时的辅助框 */
.sv-canvas-box.is-sim {
    box-shadow: inset 0 0 0 2px rgba(79, 110, 247, .35);
}

/* ---------- 斜视模拟条 ---------- */
.sv-sim {
    display: flex; align-items: center; gap: 10px;
    margin-top: 12px; padding: 9px 12px;
    background: #f8faff;
    border: 1px solid #e8eeff;
    border-radius: 10px;
    flex-wrap: wrap;
}
.sv-sim-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 600; color: #475569;
    white-space: nowrap;
}
.sv-sim-label .svg-icon { color: #4f6ef7; }
.sv-sim input[type="range"] { flex: 1 1 120px; min-width: 90px; }
.sv-sim-angle {
    font-size: 12px; font-weight: 700; color: #4f6ef7;
    font-variant-numeric: tabular-nums;
    background: #fff; padding: 2px 8px; border-radius: 6px;
    border: 1px solid #dbe4ff;
    min-width: 46px; text-align: center;
}
.sv-sim-reset {
    height: 26px; padding: 0 10px;
    border: 1px solid #dbe2ea; border-radius: 7px;
    background: #fff; color: #64748b;
    font-size: 12px; cursor: pointer;
}
.sv-sim-reset:hover { border-color: #b9c6d8; color: #334155; }
.sv-sim-tip {
    flex: 1 1 100%;
    font-size: 11.5px; color: #94a3b8; line-height: 1.5;
}

.sv-size {
    font-size: 12px; color: #94a3b8;
    font-variant-numeric: tabular-nums;
}
.sv-stage-foot {
    display: flex; align-items: center; gap: 10px;
    margin-top: 12px; flex-wrap: wrap;
}
.sv-stage-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
@media (max-width: 560px) {
    .sv-stage-actions { margin-left: 0; width: 100%; }
    .sv-stage-actions .sv-btn { flex: 1 1 auto; }
    .sv-canvas-box { padding: 10px; }
    .sv-canvas-box canvas { max-height: 40vh; }
}

/* ---------- 按钮 ---------- */
.sv-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border-radius: 9px; border: 1px solid transparent;
    font-size: 13px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
    user-select: none;
}
.sv-btn:active { transform: translateY(1px); }
.sv-btn-primary {
    background: #4f6ef7; color: #fff;
    box-shadow: 0 2px 8px rgba(79, 110, 247, .26);
}
.sv-btn-primary:hover { background: #4360e8; }
.sv-btn-outline { background: #fff; color: #334155; border-color: #dbe2ea; }
.sv-btn-outline:hover { border-color: #b9c6d8; background: #f8fafc; }
.sv-btn-ghost { background: #f1f5f9; color: #475569; }
.sv-btn-ghost:hover { background: #e6ecf4; }

/* ---------- 表单 ---------- */
.sv-field { margin-bottom: 13px; }
.sv-field:last-child { margin-bottom: 0; }
.sv-field > label {
    display: flex; align-items: baseline; gap: 6px;
    font-size: 13px; font-weight: 600; color: #334155;
    margin-bottom: 7px;
}
.sv-sub { font-weight: 400; font-size: 11px; color: #94a3b8; }
.sv-val {
    margin-left: auto; font-size: 12px; font-weight: 700; color: #4f6ef7;
    font-variant-numeric: tabular-nums;
    background: #f2f5ff; padding: 1px 7px; border-radius: 5px;
}

.sv-input, .sv-textarea {
    width: 100%; box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid #dfe6ee; border-radius: 9px;
    font-size: 13.5px; line-height: 1.55; color: #0f172a;
    font-family: inherit;
    background: #fcfdff;
    transition: border-color .15s, box-shadow .15s;
}
.sv-textarea { min-height: 62px; resize: vertical; }
.sv-input:focus, .sv-textarea:focus {
    outline: none; border-color: #4f6ef7;
    box-shadow: 0 0 0 3px rgba(79, 110, 247, .12);
    background: #fff;
}
.sv-count {
    text-align: right; font-size: 11px; color: #94a3b8;
    margin-top: 4px; font-variant-numeric: tabular-nums;
}

.sv-range {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px; border-radius: 3px;
    background: #e6ecf4; outline: none; margin: 0; cursor: pointer;
}
.sv-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; border: 2px solid #4f6ef7;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
    cursor: pointer;
}
.sv-range::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: #fff; border: 2px solid #4f6ef7;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
    cursor: pointer;
}
.sv-range:focus-visible { outline: 2px solid #4f6ef7; outline-offset: 4px; }
.sv-scale-hint {
    display: flex; justify-content: space-between;
    font-size: 11px; color: #a8b3c4; margin-top: 5px;
}

.sv-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sv-color-item { display: flex; align-items: center; gap: 8px; }
.sv-color-item input[type="color"] {
    -webkit-appearance: none; appearance: none;
    width: 36px; height: 30px; padding: 0;
    border: 1px solid #dfe6ee; border-radius: 7px;
    background: #fff; cursor: pointer;
}
.sv-color-item input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.sv-color-item input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
.sv-color-item span { font-size: 12px; color: #64748b; }

.sv-select {
    width: 100%; height: 34px; padding: 0 10px;
    border: 1px solid #dfe6ee; border-radius: 9px;
    background: #fff; color: #0f172a;
    font-size: 13px; font-family: inherit; cursor: pointer;
}
.sv-select:focus { outline: none; border-color: #4f6ef7; box-shadow: 0 0 0 3px rgba(79, 110, 247, .12); }

/* 开关行 */
.sv-switch-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0;
}
.sv-switch-row > span { font-size: 13px; color: #334155; font-weight: 600; }
.sv-switch-row .sv-sub2 { font-size: 11.5px; color: #94a3b8; font-weight: 400; }
.sv-switch {
    position: relative; margin-left: auto;
    width: 40px; height: 22px; flex: none;
    border-radius: 12px; border: none;
    background: #dbe2ea; cursor: pointer;
    transition: background .18s;
}
.sv-switch::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .2);
    transition: transform .18s;
}
.sv-switch.is-on { background: #4f6ef7; }
.sv-switch.is-on::after { transform: translateX(18px); }

/* ---------- 说明 ---------- */
.sv-note {
    font-size: 12.5px; line-height: 1.75; color: #64748b;
    background: #f8fafc; border: 1px solid #eef2f7;
    border-radius: 10px; padding: 12px 14px;
}
.sv-note b { color: #334155; }
.sv-note code {
    background: #eef2f7; padding: 1px 5px; border-radius: 4px;
    font-size: 11.5px; color: #4f6ef7;
}

/* 生成中遮罩 */
.sv-stage-card.is-busy .sv-canvas-box::after {
    content: "";
    position: absolute; inset: 0;
    background: rgba(255, 255, 255, .4);
    pointer-events: none;
}
.sv-canvas-box { position: relative; }

/* ---------- 桌面端：预览吸顶，滚参数时效果始终可见 ---------- */
@media (min-width: 901px) {
    .sv-stage-card { position: sticky; top: 74px; }
}

/* ---------- 移动端：预览吸顶 ---------- */
@media (max-width: 900px) {
    .sv-stage-card {
        position: sticky; top: 54px; z-index: 6;
        margin-bottom: 10px;
        box-shadow: 0 6px 20px rgba(15, 23, 42, .08);
    }
    .sv-canvas-box canvas { max-height: 32vh; }
    .sv-sim { margin-top: 9px; padding: 8px 10px; }
    .sv-sim-tip { display: none; }
}

/* 窄屏：窄到放不下时，让滑块换到第二行独占整行，不要和角度/复位挤在一起 */
@media (max-width: 620px) {
    .sv-sim-label  { order: 1; }
    .sv-sim-angle  { order: 2; margin-left: auto; }
    .sv-sim-reset  { order: 3; }
    .sv-sim input.sv-range { order: 4; flex: 1 1 100%; }
}
@media (max-width: 900px) and (max-height: 700px) {
    .sv-canvas-box canvas { max-height: 22vh; }
}

/* ---------- 暗色外壳适配 ---------- */
html.dark .sv-card { background: #161a22; border-color: #262c38; }
html.dark .sv-card-title, html.dark .sv-stage-head > b { color: #e2e8f0; }
html.dark .sv-input, html.dark .sv-textarea, html.dark .sv-select {
    background: #1c222c; border-color: #2c3442; color: #e2e8f0;
}
html.dark .sv-range { background: #2c3442; }
html.dark .sv-btn-outline { background: #1c222c; color: #cbd5e1; border-color: #2c3442; }
html.dark .sv-btn-ghost { background: #232a36; color: #cbd5e1; }
html.dark .sv-ratios button { background: #1c222c; border-color: #2c3442; color: #cbd5e1; }
html.dark .sv-sim { background: #1a2030; border-color: #26304a; }
html.dark .sv-sim-label { color: #cbd5e1; }
html.dark .sv-sim-angle { background: #1c222c; border-color: #2c3442; }
html.dark .sv-sim-reset { background: #1c222c; border-color: #2c3442; color: #94a3b8; }
html.dark .sv-note { background: #1a1f29; border-color: #262c38; color: #94a3b8; }
html.dark .sv-note b { color: #cbd5e1; }
html.dark .sv-note code { background: #232a36; }
html.dark .sv-canvas-box { border-color: #262c38; background: #12161d; }
html.dark .sv-field > label { color: #cbd5e1; }
html.dark .sv-switch-row > span { color: #cbd5e1; }
html.dark .sv-color-item span { color: #94a3b8; }
