:root {
  --ink: #17131c;
  --ink-soft: #211b28;
  --paper: #f6f1e8;
  --paper-dim: #d3c9bc;
  --line: rgba(246, 241, 232, .16);
  --line-dark: rgba(23, 19, 28, .16);
  --acid: #c8ef52;
  --coral: #ff826d;
  --muted: #9c929e;
  --shadow: 0 24px 80px rgba(0, 0, 0, .22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--paper);
  background: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 20; padding: .65rem .9rem; background: var(--acid); color: var(--ink); font-weight: 800; }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .page-shell, .site-footer { width: min(1420px, calc(100% - 48px)); margin: 0 auto; }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--paper); text-decoration: none; font-size: .88rem; font-weight: 850; letter-spacing: .02em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); gap: 3px; transform: rotate(8deg); }
.brand-mark i { display: block; background: var(--acid); }
.brand-mark i:nth-child(2) { background: var(--coral); }
.brand-mark i:nth-child(3) { background: var(--paper); }
.privacy-note { color: var(--muted); font: 700 .7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.privacy-note span { color: var(--acid); margin-right: .3rem; }
.page-shell { padding: 4.1rem 0 5rem; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding-bottom: 2.5rem; }
.eyebrow { margin: 0 0 .75rem; color: var(--acid); font: 800 .68rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .17em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; white-space: nowrap; font-size: clamp(3rem, 7vw, 7.4rem); line-height: .88; letter-spacing: -.09em; font-weight: 900; }
h1 em { color: var(--coral); font-style: normal; }
.intro-copy { max-width: 20rem; margin: 0 0 .3rem; color: var(--paper-dim); font-size: .95rem; line-height: 1.55; }
.workbench { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); gap: 1px; border: 1px solid var(--line); background: var(--line); box-shadow: var(--shadow); }
.preview-column { min-width: 0; padding: clamp(1rem, 2vw, 1.6rem); background: #1b1721; }
.preview-bar, .results-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.label { display: block; color: var(--paper); font-size: .76rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.muted { display: block; margin-top: .35rem; color: var(--muted); font-size: .76rem; }
.tile-count { padding: .35rem .5rem; background: var(--acid); color: var(--ink); font: 850 .7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.preview-frame { position: relative; display: grid; place-items: center; min-height: 420px; margin-top: 1rem; overflow: hidden; background: #100d14; }
.preview-frame { cursor: pointer; }
.preview-frame:hover, .preview-frame:focus-visible, .preview-frame.dragging { outline: none; border-color: var(--paper); }
.preview-frame.empty { min-height: clamp(220px, 28vw, 360px); border: 1px dashed rgba(246, 241, 232, .28); }
.preview-frame.empty #previewCanvas { display: none; }
#previewCanvas { display: block; max-width: 100%; max-height: 680px; width: auto; height: auto; }
.preview-empty { position: absolute; display: grid; justify-items: center; gap: .45rem; color: var(--paper-dim); text-align: center; pointer-events: none; }
.preview-empty strong { color: var(--paper); font-size: 1rem; }
.preview-empty span { color: var(--muted); font-size: .75rem; }
.preview-help { margin: .8rem 0 0; color: var(--muted); font-size: .72rem; }
.control-column { min-width: 0; background: var(--paper); color: var(--ink); }
.control-group { padding: 1.35rem 1.4rem; border-bottom: 1px solid var(--line-dark); }
.control-group:last-child { border-bottom: 0; }
.group-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.group-heading h2 { margin: 0; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 950; }
.step-number { color: #847a70; font: 800 .68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.dimension-inputs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: .55rem; }
.dimension-inputs label { display: grid; gap: .35rem; color: #6e655d; font-size: .68rem; font-weight: 850; }
.dimension-inputs input { width: 100%; height: 2.55rem; border: 1px solid rgba(23,19,28,.22); background: #fffaf2; color: var(--ink); padding: .4rem .55rem; font-size: 1.15rem; font-weight: 850; }
.dimension-inputs input:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.multiply { padding-bottom: .65rem; color: #91867c; font-weight: 900; }
.preset-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .35rem; margin-top: .75rem; }
.preset-list button { padding: .5rem .2rem; border: 1px solid rgba(23,19,28,.18); background: transparent; color: #655c54; font-size: .68rem; font-weight: 850; }
.preset-list button:hover, .preset-list button:focus-visible { border-color: var(--ink); background: #e9e0d3; outline: none; }
.range-label { display: flex; justify-content: space-between; gap: 1rem; margin: .2rem 0 .5rem; color: #615850; font-size: .74rem; font-weight: 850; }
.range-label output { color: #978b80; font: 800 .68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
input[type="range"] { width: 100%; accent-color: var(--ink); }
.primary-button, .secondary-button { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 0; font-weight: 900; }
.primary-button { width: 100%; margin-top: 1.2rem; padding: .85rem .95rem; background: var(--coral); color: var(--ink); }
.primary-button:hover:not(:disabled), .primary-button:focus-visible:not(:disabled) { background: var(--acid); outline: none; }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .4; }
.status { min-height: 2.3em; margin: .75rem 0 0; color: #82786e; font-size: .7rem; line-height: 1.4; }
.status.error { color: #a33e31; }
.status.success { color: #3e7035; }
.results-section { margin-top: 1px; padding: clamp(1.1rem, 2vw, 1.6rem); background: var(--paper); color: var(--ink); }
.results-heading { align-items: end; }
.results-heading h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.4rem); letter-spacing: -.05em; }
.results-heading .eyebrow { margin-bottom: .45rem; color: #8d8177; }
.results-heading .muted { margin: 0; color: #857970; }
.download-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }
.secondary-button { padding: .7rem .8rem; border: 1px solid rgba(23,19,28,.22); background: transparent; color: var(--ink); font-size: .73rem; }
.secondary-button:hover:not(:disabled), .secondary-button:focus-visible:not(:disabled) { border-color: var(--ink); background: #e9e0d3; outline: none; }
.tile-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: .7rem; margin-top: 1rem; }
.tile-card { min-width: 0; border: 1px solid rgba(23,19,28,.16); background: #fffaf2; }
.tile-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #e9e0d3; }
.tile-card-footer { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .45rem .5rem; }
.tile-card-footer span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #776d64; font: 800 .65rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.tile-card-footer button { padding: .25rem .35rem; border: 0; background: var(--ink); color: var(--acid); font-size: .64rem; font-weight: 850; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.4rem 0 2.2rem; color: var(--muted); font-size: .7rem; }
.site-footer a { color: inherit; }

@media (max-width: 860px) {
  .intro h1 { white-space: normal; }
  .workbench { grid-template-columns: 1fr; }
  .preview-frame { min-height: min(62vw, 520px); }
}

@media (max-width: 560px) {
  .header-inner, .page-shell, .site-footer { width: min(100% - 28px, 1420px); }
  .page-shell { padding-top: 2.7rem; }
  .intro { display: block; padding-bottom: 1.6rem; }
  .intro-copy { margin-top: 1rem; }
  .preview-frame { min-height: 300px; }
  .preview-frame.empty { min-height: 260px; }
  .preset-list { grid-template-columns: repeat(3, 1fr); }
  .site-footer { display: block; }
  .site-footer a { display: block; margin-top: .5rem; }
}
