:root{--bg: #f2f2f2;--panel: #ffffff;--text: #101010;--muted: #5b5b5b;--border: #d7d7d7;--accent: #0f172a;--accent-text: #ffffff;--radius: 12px}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:16px/1.5 Arial,Helvetica,sans-serif}.app{max-width:1200px;margin:0 auto;padding:24px 16px 40px}.panel{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:18px;margin-bottom:18px}h2{margin:0 0 16px;font-size:clamp(1.4rem,2vw,2rem)}.input-row{display:flex;gap:12px;align-items:center}input[type=text]{flex:1;width:100%;padding:12px 14px;border:1px solid var(--border);border-radius:10px;font:inherit;background:#fff;color:var(--text)}button{border:1px solid var(--border);background:#fff;color:var(--text);border-radius:10px;padding:12px 18px;font:inherit;cursor:pointer}button.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-text);font-weight:600}.previews{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;align-items:start}figure{margin:0;display:grid;gap:8px}figure canvas{width:100%;height:auto;border:1px solid var(--border);background:#fff;image-rendering:pixelated;display:block}figcaption{font-size:1rem;font-weight:600;color:var(--text)}#results[hidden]{display:none}.print-actions{display:flex;align-items:center;flex-wrap:wrap;gap:12px;justify-content:center;margin-top:20px}.print-note{color:var(--muted);margin:0 0 14px}.algorithm-section+.algorithm-section{border-top:1px solid var(--border);margin-top:28px;padding-top:24px}.algorithm-section>button{margin-top:16px}.algorithm-section>p{color:var(--muted);margin:-6px 0 14px}html[data-orientation=portrait] .app{max-width:860px}html[data-orientation=portrait] .algorithm-section .previews{grid-template-columns:minmax(0,1fr)}html[data-orientation=landscape] .app{max-width:1440px}html[data-orientation=landscape] .algorithm-section .previews{grid-template-columns:repeat(3,minmax(0,1fr))}@media(max-width:700px){html[data-orientation=landscape] .algorithm-section .previews{grid-template-columns:repeat(2,minmax(0,1fr))}}#print-root{display:none}@media print{@page{size:A4 landscape;margin:10mm}body{margin:0;background:#fff}body>:not(#print-root){display:none!important}#print-root{display:block;width:277mm;height:190mm}#print-root.algorithm-print{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:center;gap:8mm}.print-sheet{display:flex;width:100%;justify-content:center;align-items:center;break-inside:avoid;page-break-inside:avoid}.print-sheet img{display:block;width:auto;max-width:100%;max-height:170mm;height:auto;object-fit:contain;image-rendering:pixelated}#print-root.algorithm-print .print-sheet{height:170mm}#print-root.algorithm-print .print-sheet img{width:auto;height:170mm;max-height:170mm}}
