/* ============================================
   pixel.css —— 像素画生成器
   ============================================ */

.app-main {
    padding: calc(var(--topbar-h) + 1.25rem) 1.25rem 2rem;
}

.px-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1.25rem;
    max-width: 1320px;
    margin: 0 auto;
    align-items: start;
}

/* ===== 控制面板 ===== */
.control-panel {
    position: sticky;
    top: calc(var(--topbar-h) + 1.25rem);
}

.form-row-inline {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 58%;
}

.form-row-inline input[type="range"] {
    flex: 1;
}

.w-55 {
    width: 58%;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

/* ===== 主色调 ===== */
.palette-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.palette-cell {
    aspect-ratio: 1;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform var(--transition-fast);
    position: relative;
}

.palette-cell:hover {
    transform: scale(1.18);
    z-index: 2;
    border-color: #fff;
}

.palette-tip {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
}

/* ===== 画布区 ===== */
.canvas-panel {
    min-width: 0;
}

.canvas-body {
    padding: 0.85rem;
}

.drop-zone {
    position: relative;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.drop-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.07);
}

.drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    padding: 2rem;
    text-align: center;
}

.drop-icon {
    color: var(--text-muted);
    opacity: 0.7;
}

.drop-inner h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-inner p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.px-canvas {
    display: none;
    max-width: 100%;
    max-height: 68vh;
    border-radius: 8px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    box-shadow: var(--shadow-md);
}

.drop-zone.has-image {
    border-style: solid;
    border-color: transparent;
    background: transparent;
    padding: 0.5rem;
}

.drop-zone.has-image .drop-inner {
    display: none;
}

.drop-zone.has-image .px-canvas {
    display: block;
}

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

    .control-panel {
        position: static;
        order: 2;
    }

    .canvas-panel {
        order: 1;
    }

    .drop-zone {
        min-height: 300px;
    }

    .px-canvas {
        max-height: 52vh;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: calc(var(--topbar-h) + 0.75rem) 0.75rem 1.5rem;
    }

    .form-row-inline,
    .w-55 {
        width: 50%;
    }

    .palette-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}
