/* ======= 像素画生成器 pixel-art-generator ======= */

.tool-page .tool-container {
    max-width: 1200px;
}

.tool-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-light);
}

.tool-title-wrapper i {
    font-size: 2rem;
    color: var(--primary-color);
}

.tool-title-wrapper .tool-title {
    margin-bottom: 0;
    border-bottom: none;
}

/* ---------- 提示条 ---------- */
.pa-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    background: #f0f7ff;
    border: 1px solid #cfe4ff;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.75;
    color: #1a4b7a;
}

.pa-warning i {
    color: var(--primary-color);
    font-size: 18px;
    flex: 0 0 auto;
    margin-top: 1px;
}

/* ---------- 布局 ---------- */
.pa-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.pa-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.pa-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pa-field > label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pa-field > label span {
    font-weight: 500;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.pa-panel input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

.pa-panel input[type="range"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pa-panel .form-input {
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-primary);
}

/* 分段按钮组 */
.pa-seg {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pa-seg-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 6px;
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    text-align: center;
}

.pa-seg-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pa-seg-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* 上传按钮组 */
.pa-upload {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pa-upload .btn {
    width: 100%;
    justify-content: center;
    padding: 8px 6px;
    font-size: 13px;
}

#paFile {
    display: none;
}

/* ---------- 预览 ---------- */
.pa-stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pa-drop {
    position: relative;
    padding: 10px;
    background: var(--bg-white);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.pa-drop.dragging {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.pa-canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    max-height: 560px;
    padding: 8px;
    background:
        linear-gradient(45deg, #eef0f3 25%, transparent 25%) 0 0/16px 16px,
        linear-gradient(-45deg, #eef0f3 25%, transparent 25%) 0 8px/16px 16px,
        linear-gradient(45deg, transparent 75%, #eef0f3 75%) 8px -8px/16px 16px,
        linear-gradient(-45deg, transparent 75%, #eef0f3 75%) -8px 0/16px 16px,
        #ffffff;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

#paCanvas {
    display: block;
    max-width: 100%;
    /* 关键：放大时必须用最近邻，否则边缘会被插值糊掉。
       具体显示尺寸由 JS 按容器等比算出（见 fitPreview） */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.pa-drop-hint {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.pa-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pa-actions select {
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
}

.pa-spacer {
    flex: 1 1 auto;
}

.pa-info {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.pa-hint {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-muted);
}

/* ---------- 速查表 ---------- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.data-table th,
.data-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
    color: var(--text-secondary);
}

.data-table thead th {
    background: var(--bg-light);
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.table-note {
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .pa-layout {
        grid-template-columns: 1fr;
    }

    .pa-stage {
        order: -1;
    }

    .pa-canvas-wrap {
        min-height: 200px;
    }
}

@media (max-width: 560px) {
    .pa-actions {
        justify-content: center;
    }

    .pa-spacer {
        display: none;
    }
}
