:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui, sans-serif; background: #10151b; color: #eef3f7; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
.shell { max-width: 1240px; margin: 0 auto; padding: 3rem 1.25rem 4rem; }
.hero { max-width: 760px; margin-bottom: 2rem; }
.eyebrow { color: #79d1ba; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: .25rem 0 .75rem; font-size: clamp(2.1rem, 5vw, 4.5rem); letter-spacing: -.055em; }
.hero > p:not(.eyebrow) { color: #b5c0ca; font-size: 1.05rem; line-height: 1.65; }
.tabs { display: flex; gap: .45rem; margin-bottom: 1.25rem; border-bottom: 1px solid #2b3742; }
.tab { position: relative; border: 0; border-radius: 9px 9px 0 0; background: transparent; color: #9aabba; padding: .75rem 1rem; }
.tab[aria-selected="true"] { color: #79d1ba; background: #161d25; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; height: 2px; left: .8rem; right: .8rem; bottom: 0; background: #79d1ba; }
.tab-panel[hidden] { display: none; }
.workspace { display: grid; grid-template-columns: minmax(270px, 350px) 1fr; gap: 1.25rem; }
.controls, .results, .factor-grid section { border: 1px solid #2b3742; border-radius: 18px; background: #161d25; }
.controls { padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.panel-intro { color: #b5c0ca; font-size: .9rem; line-height: 1.5; margin: 0 0 .3rem; }
label { font-size: .92rem; font-weight: 650; display: flex; justify-content: space-between; gap: .5rem; }
output { color: #79d1ba; font-variant-numeric: tabular-nums; }
input[type="range"] { accent-color: #79d1ba; width: 100%; }
.digit-control { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.digit-control input { position: absolute; opacity: 0; }
.digit-control label { cursor: pointer; justify-content: center; border: 1px solid #3d4d5b; border-radius: 9px; padding: .45rem; color: #c8d3db; }
.digit-control input:checked + label { background: #79d1ba; color: #10211d; border-color: #79d1ba; }
.sample-gallery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.sample-card { display: grid; gap: .25rem; padding: .35rem; color: #aeb9c4; font-size: .68rem; font-weight: 600; }
.sample-card img { width: 100%; aspect-ratio: 1; border-radius: 6px; background: #0c1116; image-rendering: pixelated; object-fit: contain; }
.sample-card.selected { border-color: #79d1ba; background: #1d332f; color: #79d1ba; }
.sample-dropzone { border: 1px dashed #526474; border-radius: 12px; padding: .8rem; color: #aeb9c4; font-size: .83rem; line-height: 1.4; text-align: center; transition: border-color .15s, background .15s; }
.sample-dropzone.drag-over { border-color: #79d1ba; background: #1d332f; color: #79d1ba; }
.sample-dropzone:focus-visible, .sample-card:focus-visible { outline: 2px solid #79d1ba; outline-offset: 2px; }
.hint { margin: -.2rem 0 .2rem; color: #8f9eaa; font-size: .78rem; line-height: 1.45; }
.actions { display: grid; gap: .55rem; margin-top: .35rem; }
button { border: 1px solid #526474; border-radius: 9px; background: #202a35; color: #eef3f7; cursor: pointer; font: inherit; font-weight: 650; padding: .7rem .85rem; }
button:hover:not(:disabled) { border-color: #79d1ba; }
button.primary { background: #79d1ba; color: #10211d; border-color: #79d1ba; }
button:disabled { cursor: wait; opacity: .55; }
.results { min-width: 0; padding: 1.25rem; }
.status { min-height: 1.4rem; margin: 0 0 1rem; color: #9aabba; font-size: .9rem; }
.status.error { color: #ff9c9c; }
.status.ready { color: #79d1ba; }
.image-grid, .factor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.image-grid.two-columns, .factor-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.factor-grid.one-column { grid-template-columns: minmax(0, 1fr); }
.single-image { max-width: min(100%, 480px); margin: 0 auto; }
figure { margin: 0; min-width: 0; }
.preview-canvas { position: relative; display: grid; width: 100%; aspect-ratio: 1; overflow: hidden; border: 1px solid #334150; border-radius: 12px; background-color: #0c1116; background-image: linear-gradient(#17212b 1px, transparent 1px), linear-gradient(90deg, #17212b 1px, transparent 1px); background-position: center; background-size: 12.5% 12.5%; }
.preview-canvas img { display: block; width: 100%; height: 100%; background: #0c1116; image-rendering: pixelated; object-fit: contain; }
.preview-canvas:not(.has-image) img { display: none; }
.canvas-empty { display: grid; place-content: center; gap: .5rem; color: #718392; font-size: .74rem; font-weight: 650; letter-spacing: .03em; text-align: center; }
.canvas-glyph { display: grid; place-items: center; width: 2rem; height: 2rem; margin: 0 auto; border: 1px dashed #526474; border-radius: 50%; color: #79d1ba; font-size: 1.3rem; font-weight: 400; }
figcaption { color: #aeb9c4; font-size: .82rem; margin-top: .45rem; text-align: center; }
.factor-grid { margin-top: 1.2rem; }
.factor-grid section { min-width: 0; padding: .8rem; }
h2 { color: #b5c0ca; font-size: .78rem; letter-spacing: .04em; margin: 0 0 .55rem; text-transform: uppercase; }
pre { color: #d7e0e7; font: .78rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; overflow-x: auto; white-space: pre-wrap; }
@media (max-width: 800px) { .workspace { grid-template-columns: 1fr; } .image-grid, .factor-grid { grid-template-columns: 1fr; } .shell { padding-top: 1.5rem; } }
