:root {
  color-scheme: dark;
  --bg: #070707;
  --panel: #111213;
  --panel-2: #171819;
  --line: rgba(255,255,255,.1);
  --muted: rgba(255,255,255,.58);
  --accent: #facc15;
  --accent-2: #f97316;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 300px; background: radial-gradient(circle at 50% -15%, rgba(250,204,21,.12), transparent 34%), var(--bg); color: #fff; }
button, input { font: inherit; }
button { cursor: pointer; }
.numbers-app { min-height: 100vh; padding: 20px; }
.intro { max-width: 1240px; margin: 0 auto 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.eyebrow, .step { margin: 0 0 6px; color: var(--accent); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 900; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 58px); line-height: .95; letter-spacing: -.04em; font-weight: 1000; text-transform: uppercase; font-family: Impact, "Arial Black", sans-serif; }
.intro p:last-child { margin: 10px 0 0; max-width: 680px; color: var(--muted); line-height: 1.5; }
.quick-presets { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.quick-presets button { min-height: 38px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.05); color: #fff; font-weight: 900; }
.quick-presets button:hover { border-color: var(--accent); color: var(--accent); }
.workspace { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 16px; align-items: start; }
.preview-column { position: sticky; top: 14px; min-width: 0; }
.canvas-shell { position: relative; overflow: hidden; aspect-ratio: 14/9; border-radius: 20px; border: 1px solid var(--line); background: #0d0d0d; box-shadow: 0 28px 80px rgba(0,0,0,.48); }
canvas { display: block; width: 100%; height: 100%; }
.canvas-badge { position: absolute; left: 12px; bottom: 12px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(0,0,0,.62); backdrop-filter: blur(10px); color: rgba(255,255,255,.78); font-size: 10px; font-weight: 1000; letter-spacing: .15em; }
.download-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.download-row button { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: #151515; color: #fff; font-weight: 900; }
.download-row button:hover { border-color: var(--accent); }
.download-row .primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #111; }
.controls-column { display: grid; gap: 12px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02)); padding: 15px; }
.panel label[for="numberInput"] { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .13em; }
.input-line { display: flex; gap: 8px; }
#numberInput { width: 100%; min-width: 0; min-height: 52px; border: 2px solid rgba(255,255,255,.15); border-radius: 12px; background: #080808; color: #fff; padding: 8px 13px; outline: none; font-size: 21px; font-weight: 1000; letter-spacing: .04em; }
#numberInput:focus { border-color: var(--accent); }
#clearInput { width: 52px; flex: 0 0 52px; border: 1px solid var(--line); border-radius: 12px; background: #171717; color: #fff; font-size: 26px; }
#inputHelp { margin: 8px 0 10px; color: rgba(255,255,255,.38); font-size: 11px; line-height: 1.4; }
.digit-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.digit-grid button { aspect-ratio: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #191919; color: #fff; font-weight: 1000; }
.digit-grid button:hover { background: var(--accent); color: #111; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
h2 { margin: 0; font-size: 18px; line-height: 1.2; }
.text-button { border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 900; }
.style-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.style-card { position: relative; min-height: 74px; overflow: hidden; border: 2px solid transparent; border-radius: 12px; background: #090909; color: #fff; text-align: left; padding: 10px; }
.style-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(250,204,21,.1); }
.style-card strong { display: block; margin-bottom: 3px; font-size: 13px; }
.style-card span { color: rgba(255,255,255,.42); font-size: 10px; }
.style-sample { position: absolute; right: 8px; bottom: -8px; color: var(--sample, #fff); font-family: Impact, "Arial Black", sans-serif; font-size: 38px; font-style: var(--italic, normal); transform: skewX(var(--skew, 0deg)); opacity: .7; text-shadow: 2px 2px 0 #000; }
.color-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.color-grid label { min-width: 0; }
.color-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.color-grid input[type="color"] { width: 100%; height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #0a0a0a; }
.range-row { display: grid; grid-template-columns: 105px minmax(0,1fr) 42px; gap: 8px; align-items: center; min-height: 36px; }
.range-row span { color: var(--muted); font-size: 11px; font-weight: 800; }
.range-row input { width: 100%; accent-color: var(--accent); }
.range-row output { color: rgba(255,255,255,.72); text-align: right; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.option-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin-top: 12px; }
.check { display: flex; gap: 7px; align-items: center; min-height: 42px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.check input { accent-color: var(--accent); }
.check span { color: rgba(255,255,255,.68); font-size: 11px; font-weight: 800; }
.number-set-section { max-width: 1240px; margin: 18px auto 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); }
.section-copy { margin-bottom: 12px; }
.section-copy p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.number-set { display: grid; grid-template-columns: repeat(10,minmax(0,1fr)); gap: 8px; }
.number-tile { overflow: hidden; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; background: #0a0a0a; }
.number-tile canvas { width: 100%; height: 100%; }
@media (max-width: 900px) {
  .numbers-app { padding: 12px; }
  .intro { align-items: flex-start; flex-direction: column; }
  .quick-presets { justify-content: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .preview-column { position: sticky; top: 0; z-index: 40; padding: 8px 0 10px; background: linear-gradient(180deg,#070707 86%,rgba(7,7,7,.92)); border-bottom: 1px solid rgba(255,255,255,.08); }
  .canvas-shell { aspect-ratio: 16/10; }
  .number-set { grid-template-columns: repeat(5,minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .numbers-app { padding: 9px; }
  .intro { margin-bottom: 12px; }
  h1 { font-size: 34px; }
  .intro p:last-child { font-size: 13px; }
  .quick-presets { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; }
  .quick-presets button { min-width: 0; padding: 8px 5px; }
  .download-row { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; margin-top: 6px; }
  .download-row button { min-height: 40px; padding: 6px 4px; font-size: 10px; line-height: 1.1; }
  .panel { padding: 12px; }
  .digit-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .style-grid { grid-template-columns: 1fr 1fr; }
  .style-card { min-height: 70px; padding: 8px; }
  .color-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .range-row { grid-template-columns: 92px minmax(0,1fr) 38px; }
  .option-grid { grid-template-columns: 1fr; }
  .number-set-section { padding: 12px; }
}

.background-panel { margin: 0 0 12px; }
.background-label { display:block; margin-bottom:6px; color: var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; }
.background-presets { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:8px; }
.bg-preset { display:flex; align-items:center; gap:8px; min-height:46px; padding:8px; border:1px solid var(--line); border-radius:12px; background:#0d0d0d; color:#fff; text-align:left; }
.bg-preset.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(250,204,21,.1); }
.bg-preset span { display:block; font-size:11px; font-weight:800; line-height:1.1; }
.bg-preset i { display:block; width:26px; height:26px; border-radius:8px; border:1px solid rgba(255,255,255,.12); flex: 0 0 26px; }
.bg-brick { background: repeating-linear-gradient(0deg,#3a1d18 0 12px,#2c1510 12px 14px), repeating-linear-gradient(90deg,#8b3b2e 0 42px,#5d241c 42px 44px); }
.bg-concrete { background: linear-gradient(135deg,#8b8b8b,#4b4b4b); }
.bg-asphalt { background: linear-gradient(135deg,#111,#2f2f33,#111); }
.bg-neonwall { background: linear-gradient(135deg,#120b25,#05060f); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 0 8px rgba(168,85,247,.3); }
.bg-metal { background: linear-gradient(180deg,#6b7280,#d1d5db,#4b5563); }
@media (max-width: 560px) { .background-presets { grid-template-columns: repeat(2,minmax(0,1fr)); } }

html, body { min-height: 100%; }
body { overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.preview-column { align-self: start; }
@media (max-width: 900px) {
  .workspace { align-items: stretch; }
  .preview-column { margin: 0 -2px; }
  .canvas-shell { max-height: 38vh; min-height: 190px; }
  .controls-column { padding-bottom: 24px; }
}
@media (max-width: 560px) {
  .canvas-shell { aspect-ratio: 16/9; max-height: 34vh; min-height: 178px; border-radius: 14px; }
  .canvas-badge { left: 8px; bottom: 8px; padding: 5px 7px; font-size: 8px; }
}
