/* PixelArt Web 版 · 样式
   无外部字体/CDN，中文用系统字体栈（dev 文档 §6） */

:root {
    --bg: #0a0a12;
    --panel: #141420;
    --panel-2: #1d1d2e;
    --line: #2a2a3e;
    --text: #e8e8f0;
    --muted: #9a9ab0;
    --accent: #ff4000;
    --accent-2: #ff6a33;
    --accent-dark: #d83600;
    --ok: #4ec98a;
    --warn: #f0b429;
    --err: #ff6b6b;
    --radius: 12px;
    --glow: 0 0 12px rgba(255,64,0,.25);
    --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
}

.site-header {
    padding: 22px 20px 10px;
    max-width: 900px;
    margin: 0 auto;
}

.site-header h1 {
    margin: 0 0 6px;
    font-size: 22px;
    letter-spacing: .5px;
}

.site-header h1 .dot {
    color: var(--accent);
    margin: 0 6px;
}

.tagline {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
    max-width: 70ch;
}

.layout {
    max-width: 900px;
    margin: 0 auto;
    padding: 12px 20px 30px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.panel-title {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--accent-2);
    font-weight: 600;
}

/* ---------- 表单 ---------- */

.group {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px 12px;
    margin: 0 0 12px;
    background: var(--panel-2);
    border-left: 3px solid var(--line);
}

.group legend {
    padding: 0 6px;
    font-size: 13px;
    color: var(--muted);
}

/* 功能分组色标：相近功能同色，差异功能不同色 */
.group--image  { border-left-color: var(--accent); }
.group--preview { border-left-color: #06b6d4; }
.group--canvas { border-left-color: #3b82f6; }
.group--color  { border-left-color: #8b5cf6; }
.group--action { border-left-color: var(--ok); }
.group--export { border-left-color: var(--accent-2); }

.field-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.field-row:last-child { margin-bottom: 0; }

.field-row label {
    flex: 0 0 84px;
    font-size: 13.5px;
}

input[type="number"], select {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 40px;
    padding: 6px 12px;
    background: #0e0e18;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

input[type="number"]:focus, select:focus, .drop-zone:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    box-shadow: var(--glow);
}

.radio, .check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    font-size: 13.5px;
    cursor: pointer;
}

.radio input, .check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* 比例模式：三个选项横排紧凑排列 */
.radio-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 0;
}
.radio-row .radio {
    min-height: 34px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0e0e18;
    font-size: 12.5px;
}
.radio-row .radio:has(input:checked) {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, .1);
}

/* ---------- 图片选择区 ---------- */

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 60px;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
    background: #0e0e18;
    cursor: pointer;
    text-align: center;
    padding: 8px 12px;
    transition: border-color .15s, background .15s;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: #1a1420;
}

.drop-main { font-size: 14px; }
.drop-sub { font-size: 12px; color: var(--muted); }

.drop-preview {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
    border-radius: 4px;
}
.drop-zone.has-image .drop-sub { display: none; }

.file-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0 4px;
    font-size: 12.5px;
    font-family: var(--mono);
    word-break: break-all;
}

.muted { color: var(--muted); }

.hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- 按钮 ---------- */

.btn {
    min-height: 40px;
    padding: 8px 18px;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
}

.btn:hover:not(:disabled) { background: #252538; border-color: #3a3a50; }

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn.primary:hover:not(:disabled) {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: var(--glow);
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.small { min-height: 34px; padding: 4px 10px; font-size: 12.5px; }

.btn.wide { width: 100%; margin-top: 8px; }

.actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.actions .btn { flex: 1 1 0; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; }

.presets .btn { min-height: 34px; font-size: 12.5px; padding: 4px 10px; }

/* ---------- 预览 ---------- */

.previews {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.preview { margin: 0; }

.preview figcaption {
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 5px;
}

.canvas-box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 210px;
    padding: 6px;
    background: #06060a;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: auto;
}

.canvas-box canvas {
    max-width: 100%;
    max-height: 380px;
    display: block;
}

/* 结果预览必须最近邻放大，否则像素点会被插值糊掉（PRD §7.6）
   顺序要紧：crisp-edges 在前只作老浏览器兜底，pixelated 在后才是生效值 */
canvas.pixelated {
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.status {
    margin: 4px 0 8px;
    font-size: 13px;
    font-family: var(--mono);
    color: var(--text);
}

.message {
    margin: 0 0 10px;
    padding: 9px 11px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid;
}

.message.error { color: var(--err); border-color: #5a2a2a; background: #2a1616; }
.message.warn { color: var(--warn); border-color: #5a4a1e; background: #2a2412; }
.message.info { color: var(--ok); border-color: #24503a; background: #12241b; }

/* ---------- 颜色参考 ---------- */

.ref-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 14px 0 4px;
}

.ref-head h3 { margin: 0; font-size: 14px; color: var(--accent-2); }

#ref-info { font-size: 12.5px; margin: 0 0 8px; }

.ref-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 62px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #06060a;
}

.swatch {
    width: 96px;
    min-height: 66px;
    padding: 5px 6px;
    border: 1px solid #00000055;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 1px;
    overflow: hidden;
}

.swatch .no { font-weight: 700; font-size: 11.5px; }
.swatch .name { font-weight: 600; }
.swatch .hex { font-family: var(--mono); font-size: 10.5px; opacity: .9; }

.site-footer {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 26px;
    color: var(--muted);
    font-size: 12px;
}

/* ---------- 社交引流 ---------- */

.social-footer {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.social-cta {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text);
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.social-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.social-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: transform .15s;
}

.social-logo:hover { transform: scale(1.1); }
.social-logo.xiaohongshu { background: #FF2442; }
.social-logo.taobao { background: #FF5000; }
.social-logo.wechat { background: #07C160; }
.social-logo.gobricks { background: #2E6FF2; color: #FFD200; }

.social-label {
    font-size: 11px;
    color: var(--muted);
}

/* 二维码弹窗 */
.qrcode-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.qrcode-modal.hidden { display: none; }

.qrcode-modal-box {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 2rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    max-width: 85vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}

.qrcode-modal-img {
    width: 200px;
    height: 200px;
    max-width: 100%;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    padding: 8px;
}

.qrcode-modal-fallback {
    width: 200px;
    height: 200px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-2);
    border-radius: 8px;
    color: var(--muted);
    font-size: .9rem;
    text-align: center;
    padding: 1rem;
}

.qrcode-modal-label {
    color: var(--muted);
    font-size: .9rem;
}

.qrcode-modal-link {
    display: inline-block;
    padding: .35rem 1rem;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-size: .85rem;
    text-decoration: none;
    transition: background .15s;
}

.qrcode-modal-link:hover { background: var(--accent-dark); }

.qrcode-modal-close {
    position: absolute;
    top: .4rem;
    right: .75rem;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: .25rem;
}

.qrcode-modal-close:hover { color: var(--accent); }

/* ---------- 窄屏：单列（PRD §3.4 / F10） ---------- */

@media (max-width: 768px) {
    .layout { gap: 12px; padding: 10px 12px 22px; }
    .previews { grid-template-columns: 1fr; }
    .canvas-box { min-height: 160px; }
    .canvas-box canvas { max-height: 46vh; }
    .site-header { padding: 16px 12px 8px; }
    .site-header h1 { font-size: 18px; }
    .field-row label { flex-basis: 72px; }
    .swatch { width: calc(50% - 4px); }
    /* 触屏可点区域 ≥ 40px（dev 文档 §6）。这里必须带上 .presets .btn / .btn.small
       这类更高优先级的组合选择器，否则桌面端的 34px 规则会赢过媒体查询里的 .btn */
    .btn, .btn.small, .presets .btn,
    input[type="number"], select, .radio, .check { min-height: 42px; }
}
