/* Chinese Remainder Theorem Solver (/chinese-remainder-theorem): the rows of equations, the solutions and checks, the
   conflict, the picture and the working (lines, the construction table, substitution steps, the Euclidean working in
   a details box). Tiles, panels, buttons and the segmented controls come from the app kit (css/app-kit,
   docs/app-kit.md). Loaded only on this app's page (StylePaths). */

.crt-landing-app .crt-panel { display: flex; flex-direction: column; gap: var(--ak-space-2, 0.6rem); min-width: 0; }
.crt-landing-app .crt-story { display: block; }
.crt-landing-app .crt-conflict {
    border-color: color-mix(in srgb, var(--ak-danger) 45%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-danger) 8%, var(--ak-panel));
}
.crt-landing-app .crt-conflict > .ak-icon { flex: none; color: var(--ak-danger); }
.crt-landing-app .crt-conflict strong { color: var(--ak-danger); }

/* The equations: x ≡ [a] (mod [n]) ×, one per row. */
.crt-landing-app .crt-rows { display: flex; flex-direction: column; gap: 0.35rem; }
.crt-landing-app .crt-row {
    display: grid;
    grid-template-columns: 1.1rem auto minmax(0, 1fr) auto minmax(0, 1.2fr) auto auto;
    align-items: center;
    gap: 0.3rem;
}
.crt-landing-app .crt-idx { color: var(--ak-muted); font-size: var(--ak-fs-xs, 0.75rem); text-align: end; font-variant-numeric: tabular-nums; }
.crt-landing-app .crt-sym { color: var(--ak-muted); font-size: var(--ak-fs-sm, 0.88rem); white-space: nowrap; }
.crt-landing-app .crt-row .ak-field { min-width: 0; width: 100%; padding-inline: 0.45rem; font-variant-numeric: tabular-nums; }
.crt-landing-app .crt-del { padding: 0.2rem; min-width: 1.9rem; }
.crt-landing-app .crt-add { align-self: flex-start; margin-top: 0.15rem; }

/* The solutions and the check of every equation. */
.crt-landing-app .crt-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ak-space-2, 0.5rem); }
.crt-landing-app .crt-solutions {
    margin: 0;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.crt-landing-app .crt-x { color: var(--ak-accent); font-weight: 700; }
.crt-landing-app .crt-solutions--long .crt-sol { display: block; font-size: 0.95rem; }
.crt-landing-app .crt-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.2rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm, 0.88rem);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.crt-landing-app .crt-checks li { min-width: 0; }

/* The picture. */
.crt-landing-app .crt-pair { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ak-muted); font-size: var(--ak-fs-sm, 0.88rem); }
.crt-landing-app .crt-pair[hidden] { display: none; }
.crt-landing-app .crt-pair-select { width: auto; min-width: 5.5rem; padding-block: 0.2rem; }
.crt-landing-app .crt-canvas-wrap { min-width: 0; }
.crt-landing-app .crt-canvas { display: block; width: 100%; }
.crt-landing-app .crt-canvas[hidden] { display: none; }

/* The working. */
.crt-landing-app .crt-work { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.crt-landing-app .crt-line {
    margin: 0;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.crt-landing-app .crt-text { line-height: 1.45; }
.crt-landing-app .crt-strong { font-weight: 700; color: var(--ak-accent); }
.crt-landing-app .crt-muted { color: var(--ak-muted); font-size: var(--ak-fs-sm, 0.88rem); }
.crt-landing-app .crt-bad { font-weight: 700; color: var(--ak-danger); }
.crt-landing-app .crt-table-wrap { max-height: none; }
.crt-landing-app .crt-table td, .crt-landing-app .crt-table th { white-space: nowrap; }
.crt-landing-app .crt-steps { display: flex; flex-direction: column; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.crt-landing-app .crt-step {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--ak-border);
    border-inline-start: 3px solid var(--ak-accent);
    border-radius: var(--ak-radius-sm, 6px);
    background: var(--ak-bg);
    min-width: 0;
}
.crt-landing-app .crt-step-head { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.crt-landing-app .crt-euclids { display: flex; flex-direction: column; gap: 0.3rem; }
.crt-landing-app .crt-euclid { min-width: 0; font-size: var(--ak-fs-sm, 0.88rem); }
.crt-landing-app .crt-euclid > summary { cursor: pointer; color: var(--ak-muted); overflow-wrap: anywhere; }
.crt-landing-app .crt-euclid > summary:hover { color: var(--ak-text); }
.crt-landing-app .crt-euclid-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin: 0.3rem 0 0.2rem;
    padding-inline-start: 0.8rem;
    border-inline-start: 2px solid var(--ak-grid);
}
