@font-face {
	font-family: ZpixLocal;
	src: url(zpix.ttf);
    font-display: swap;
}

:root {
    --bg-screen: #d0e0d0;
    --bg-panel: #eefee4;
    --fg-dark: #1a3b00;
    --fg-accent: #2f5a00;
    --border-width: 3px;
}

/* 全局直角 & 盒子模型 */
* { border-radius: 0 !important; box-sizing: border-box; }

[v-cloak] { display: none !important; }

/* 滚动条样式 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background-color: var(--bg-panel); border-left: 1px solid var(--fg-dark); margin: 0; }
::-webkit-scrollbar-thumb { background-color: var(--fg-dark); border: none; }
::-webkit-scrollbar-thumb:hover { background-color: var(--fg-accent); }
::-webkit-scrollbar-corner { background-color: var(--bg-panel); border-left: 1px solid var(--fg-dark); }

html, body {
    margin: 0; padding: 0; height: 100%;
    font-family: 'ZpixLocal', 'Courier New', monospace;
    background-color: var(--fg-dark); color: var(--fg-dark);
    -webkit-font-smoothing: none; overflow: hidden; 
}

.app { height: 100vh; width: 100vw; display: flex; flex-direction: column; }
.main-container { display: flex; flex-direction: row; width: 100%; height: 100%; overflow: hidden; }

.preview-pane {
    flex: 1; display: flex; flex-direction: column; overflow: hidden; 
    background: var(--bg-panel); border-right: var(--border-width) solid var(--fg-dark);
    padding: 30px; min-width: 0;
}

header { flex-shrink: 0; margin-bottom: 20px; border-bottom: 2px solid var(--fg-dark); padding-bottom: 15px; }
header h1 { font-size: 36px; margin: 0; letter-spacing: 2px; line-height: 1.2; }
header p { margin: 5px 0 0 0; font-size: 14px; opacity: 0.8; font-weight: bold; }

.section-title-block { border-left: 5px solid var(--fg-dark); padding-left: 10px; font-size: 16px; font-weight: 900; margin-bottom: 15px; display: block; line-height: 1; }

.output-wrapper { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.output-box { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; flex: 1; min-height: 0; margin-bottom: 15px; }

/* 图片容器 */
.img-container {
    display: flex; flex-direction: column; position: relative;
    border: 2px dashed var(--fg-dark); background: rgba(26, 59, 0, 0.05);
    padding: 4px; height: 100%; width: 100%; overflow: hidden;
}
.img-container:hover { background: rgba(26, 59, 0, 0.1); border-style: solid; }

.img-scroll-box {
    width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;
    overflow: hidden; 
    /* 找回棋盘格背景 */
    background-color: #e0e0e0;
    background-image: 
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
}

/* PC端图片适配 */
.output-box img {
    max-width: 100%; max-height: 100%; width: auto; height: auto;
    object-fit: contain; display: block; image-rendering: pixelated;
}

.placeholder {
    width: 100%; height: 100%; display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center;
    color: var(--fg-dark); font-weight: bold; background: var(--bg-panel);
}

.label { position: absolute; top: 0; left: 0; background: var(--fg-dark); color: var(--bg-panel); padding: 4px 8px; font-weight: bold; font-size: 14px; z-index: 10; }

.status-bar { flex-shrink: 0; margin-bottom: 15px; height: 40px; border: 2px solid var(--fg-dark); position: relative; overflow: hidden; background: rgba(26, 59, 0, 0.05); }
.status-progress { position: absolute; top: 0; left: 0; height: 100%; background: #99b599; transition: width 0.1s linear; z-index: 1; }
.status-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 10px; z-index: 2; font-size: 12px; font-weight: bold; color: var(--fg-dark); font-family: monospace; }

.action-buttons { flex-shrink: 0; display: flex; gap: 20px; margin-top: 0; border: none; flex-wrap: wrap; padding: 2px 10px 15px 2px; }

/* 按钮样式 */
.primary-btn {
    background: var(--bg-panel); border: 2px solid var(--fg-dark); color: var(--fg-dark);
    height: 48px; min-height: 48px; max-height: 48px; 
    display: flex; align-items: center; justify-content: center;
    font-family: inherit; font-size: 16px; cursor: pointer; font-weight: bold; flex: 1;
    transition: all 0.1s; box-shadow: 6px 6px 0 var(--fg-dark); position: relative;
    top: 0; left: 0; min-width: 120px; padding: 0 10px;
    white-space: nowrap; overflow: hidden;
}
.primary-btn:hover { background: #fff; top: -2px; left: -2px; box-shadow: 8px 8px 0 var(--fg-dark); }
.primary-btn:active { top: 2px; left: 2px; box-shadow: 2px 2px 0 var(--fg-dark); }
.primary-btn.disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; background: #d0e0d0; box-shadow: none; top: 2px; left: 2px; color: #666; border-color: #666; }

.save-btn { background: var(--fg-dark); color: var(--bg-panel); text-decoration: none; }
.save-btn:hover { background: #000; color: #fff; }

/* 底部信息栏优化 */
.footer-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between; /* 空间足够时两端对齐 */
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.8;
    user-select: none;
    border-top: 1px dashed rgba(26, 59, 0, 0.3);
    padding-top: 10px;
    flex-wrap: wrap; /* 允许换行 */
    gap: 8px 20px; /* 行间距8px，列间距20px */
}
.footer-tips { font-weight: bold; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.footer-credits { white-space: nowrap; }
.footer-credits a { color: inherit; text-decoration: none; font-weight: bold; border-bottom: 1px solid transparent; }
.footer-credits a:hover { border-bottom-color: var(--fg-dark); }

.settings-pane { width: 400px; flex-shrink: 0; display: block; background: var(--bg-panel); overflow-y: scroll; height: 100%; }
.settings-inner { padding: 30px 25px; padding-bottom: 30px; }
.settings-card h2 { margin: 0 0 30px 0; font-size: 28px; background: transparent; color: var(--fg-dark); padding: 0 0 10px 0; text-align: left; border-bottom: 4px solid var(--fg-dark); letter-spacing: 2px; line-height: 1; }

.section-group { margin-bottom: 35px; padding-bottom: 10px; border-bottom: 1px dashed rgba(26, 59, 0, 0.3); }
.section-group:last-child { border-bottom: none; }
.section-title { background: transparent; color: var(--fg-dark); padding: 0; font-size: 16px; font-weight: 900; margin-bottom: 15px; display: block; border-left: 5px solid var(--fg-dark); padding-left: 10px; line-height: 1; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }
.preset-btn { background: transparent; border: 2px solid var(--fg-dark); color: var(--fg-dark); padding: 8px 0; font-family: inherit; font-size: 12px; font-weight: bold; cursor: pointer; flex: 1; transition: all 0.1s; }
.preset-btn:hover { transform: translateY(-2px); box-shadow: 3px 3px 0 rgba(26, 59, 0, 0.3); }
.preset-btn.active { background: var(--fg-dark); color: var(--bg-panel); box-shadow: inset 3px 3px 0 rgba(0,0,0,0.3); transform: none; }

.control-row { margin-bottom: 20px; }
.label-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; font-size: 14px; font-weight: bold; }

.position-grid-wrapper { display: flex; align-items: flex-start; gap: 15px; }
.grid-3x3 { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 30px); gap: 4px; }
.grid-cell { width: 30px; height: 30px; background: transparent; border: 2px solid var(--fg-dark); cursor: pointer; transition: all 0.1s; }
.grid-cell:hover { background: rgba(26, 59, 0, 0.1); }
.grid-cell.active { background: var(--fg-dark); box-shadow: inset 2px 2px 0 rgba(0,0,0,0.3); }
.grid-actions { display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.text-btn { background: transparent; border: none; color: var(--fg-dark); font-size: 12px; text-decoration: underline; cursor: pointer; text-align: left; padding: 2px 0; font-family: inherit; }
.text-btn:hover { color: #000; }

input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; margin: 10px 0; display: block; touch-action: pan-y; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 12px; cursor: pointer; background: rgba(26, 59, 0, 0.1); border: 2px solid var(--fg-dark); }
input[type=range]::-webkit-slider-thumb { height: 24px; width: 16px; background: var(--fg-dark); cursor: pointer; -webkit-appearance: none; margin-top: -8px; border: 2px solid var(--bg-panel); box-shadow: 2px 2px 0 rgba(0,0,0,0.2); }
input[type=range]:hover::-webkit-slider-thumb { background: var(--fg-accent); }

/* === 移动设备交互优化 (基于 JS 检测) === */
/* 
   禁用 Range 轨道的点击事件，防止误触导致参数跳变。
   只允许拖拽滑块（Thumb）。
   适用于所有被识别为 Mobile 的设备（包括 iPad 等宽屏触摸设备）。
*/
.is-mobile input[type=range] { pointer-events: none; }
.is-mobile input[type=range]::-webkit-slider-thumb { pointer-events: auto; transform: scale(1.2); }
.is-mobile input[type=range]::-moz-range-thumb { pointer-events: auto; transform: scale(1.2); }


.checkbox-row label { display: flex; align-items: center; cursor: pointer; font-weight: bold; font-size: 14px; user-select: none; padding: 5px 0; }
.checkbox-row input[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { height: 20px; width: 20px; background-color: transparent; border: 2px solid var(--fg-dark); margin-right: 12px; position: relative; flex-shrink: 0; }
.checkbox-row input:checked ~ .checkmark { background-color: var(--fg-dark); }
.checkbox-row input:checked ~ .checkmark:after { content: '✓'; font-family: sans-serif; color: var(--bg-panel); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 14px; font-weight: bold; border: none; width: auto; height: auto; display: block; line-height: 1; }

.retro-textarea { width: 100%; height: 120px; background: var(--bg-panel); border: 2px solid var(--fg-dark); color: var(--fg-dark); font-family: inherit; padding: 10px; resize: vertical; box-sizing: border-box; font-size: 13px; line-height: 1.5; outline: none; transition: all 0.2s; overflow-y: scroll; }
.retro-textarea:focus { background: #f4fff0; box-shadow: inset 3px 3px 0 rgba(0,0,0,0.05); }
.hint-text { font-size: 12px; margin-top: 8px; color: #d64541; font-weight: bold; }
.advanced-box { border: 2px solid var(--fg-dark); padding: 15px; margin-top: -10px; margin-bottom: 25px; background: rgba(0,0,0,0.05); }

/* === 移动端适配 (布局相关) === */
@media (max-width: 768px) {
    html, body { height: auto; overflow-x: hidden; overflow-y: auto; }
    .app { height: auto; width: 100%; overflow: visible; }
    .main-container { flex-direction: column; height: auto; }
    
    .preview-pane { 
        width: 100%; height: auto; flex: none; border-right: none; 
        border-bottom: 3px solid var(--fg-dark); padding: 15px; 
    }

    header { margin-bottom: 10px; padding-bottom: 10px; display: flex; justify-content: space-between; align-items: flex-end; }
    header h1 { font-size: 20px; margin: 0; }
    header p { font-size: 12px; text-align: right; }

    .output-box { 
        grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; 
        display: flex; flex-direction: column; 
    }

    .img-container { 
        height: 32vh; 
        min-height: 200px;
        display: flex;
        flex-direction: column;
    }

    .img-scroll-box {
        flex: 1; 
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
    }

    .img-scroll-box img {
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important; 
    }

    .label { font-size: 12px; padding: 2px 6px; }

    .action-buttons { 
        display: grid; 
        grid-template-columns: 1fr 1fr; 
        gap: 10px; 
        padding-bottom: 5px; 
    }
    
    .primary-btn { 
        width: auto; 
        flex: 1; 
        height: 44px !important;
        min-height: 44px;
        max-height: 44px;
        font-size: 14px; 
        margin-bottom: 0; 
    }
    
    .save-btn { grid-column: span 1; }

    .settings-pane { width: 100%; height: auto; border: none; overflow: visible; }
    .settings-inner { padding: 20px; }

    /* 注意：此处的布局控制依然保留，但 input[type=range] 的逻辑已移至上方 .is-mobile 块 */
    .control-row { margin-bottom: 30px; }
    
    .footer-bar {
        font-size: 10px;
        padding-top: 8px;
    }
}