/* ── Squares config modal ─────────────────────────────────────────
 *
 * Two-column layout: controls on the left, live preview on the right.
 * Collapses to single-column on narrow screens. Re-uses the global
 * .modal-overlay / .card chrome; everything below is squares-specific.
 */

.squares-modal-card {
    max-width: 720px;
    width: 100%;
}

.squares-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.squares-modal-head h1 {
    margin: 0;
    font-size: 1.4rem;
}

.squares-modal-intro {
    margin: .4rem 0 1.25rem;
    color: var(--text-soft, #6b6453);
    line-height: 1.5;
    font-size: .95rem;
}

.squares-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 600px) {
    .squares-modal-body { grid-template-columns: 1fr; }
}

/* ── Controls column ──────────────────────────────────────────── */

.squares-modal-controls {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.squares-control {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.squares-control-label {
    font-weight: 600;
    font-size: .92rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.squares-control-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    background: #fffaf3;
    border: 1.5px solid #b8845c;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    color: #8c5a2f;
}

.squares-control input[type="range"] {
    width: 100%;
    accent-color: #b8845c;
}

.squares-control-hint {
    display: flex;
    justify-content: space-between;
    font-size: .76rem;
    color: var(--text-soft, #8a8270);
}
.squares-control-hint-single {
    font-size: .78rem;
    color: var(--text-soft, #8a8270);
    line-height: 1.4;
}

/* Segmented control (grid resolution) */
.squares-seg {
    display: inline-flex;
    border: 1.5px solid var(--border, #d8d1c1);
    border-radius: .6rem;
    overflow: hidden;
    width: fit-content;
}
.squares-seg-btn {
    background: #fff;
    border: 0;
    border-right: 1.5px solid var(--border, #d8d1c1);
    padding: .45rem .9rem;
    font: inherit;
    font-size: .88rem;
    cursor: pointer;
    color: var(--text);
    transition: background 120ms ease;
}
.squares-seg-btn:last-child { border-right: 0; }
.squares-seg-btn:hover { background: #faf6ee; }
.squares-seg-btn.is-active {
    background: #b8845c;
    color: #fff;
    font-weight: 600;
}

/* Rectangles toggle — checkbox + two-line label */
.squares-control-toggle {
    flex-direction: row;
    align-items: flex-start;
    gap: .7rem;
}
.squares-control-toggle input[type="checkbox"] {
    margin-top: .15rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #b8845c;
    flex-shrink: 0;
}
.squares-control-toggle > span {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.squares-modal-warning {
    margin: 0;
    padding: .7rem .85rem;
    background: #f6efdc;
    border-left: 3px solid #c99a3f;
    border-radius: .35rem;
    font-size: .82rem;
    color: #6b551f;
    line-height: 1.45;
}

/* ── Preview column ───────────────────────────────────────────── */

.squares-modal-preview {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.squares-preview-frame {
    position: relative;
    aspect-ratio: 1 / 1;
    background:
        repeating-conic-gradient(#eee 0% 25%, #f8f8f8 0% 50%)
        50% / 16px 16px;  /* checkerboard so transparent edges read */
    border: 1px solid var(--border, #e5dfd0);
    border-radius: .6rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.squares-preview-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.squares-preview-spinner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(184, 132, 92, .25);
    border-top-color: #b8845c;
    border-radius: 50%;
    animation: sq-spin .8s linear infinite;
    z-index: 2;
}
@keyframes sq-spin {
    to { transform: rotate(360deg); }
}

.squares-preview-stats {
    margin: 0;
    text-align: center;
    font-size: .82rem;
    color: var(--text-soft, #8a8270);
    min-height: 1.1rem;
}

.squares-modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
}
