:root {
  --black: #080806;
  --panel: #0e0d09;
  --panel-2: #151207;
  --cream: #efe7d5;
  --gold: #efbd46;
  --gold-2: #9c6613;
  --line: rgba(221, 164, 46, .36);
  --muted: #756f61;
  --acid: #d7fb31;
  --shadow: 14px 14px 0 rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html { background: var(--black); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 13% 17%, rgba(181, 112, 15, .09), transparent 27rem),
    linear-gradient(rgba(223, 165, 50, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(223, 165, 50, .025) 1px, transparent 1px),
    var(--black);
  background-size: auto, 52px 52px, 52px 52px, auto;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: .03em;
}

button, input, label { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.topbar {
  min-height: 112px;
  padding: 22px clamp(22px, 4vw, 70px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 3, .94);
}

.brand { display: flex; align-items: center; gap: 18px; }
.brand img { width: 66px; height: 66px; border: 1px solid var(--line); border-radius: 7px; }
.brand div { display: grid; gap: 8px; }
.brand strong { font-size: 20px; letter-spacing: .22em; }
.brand span, .privacy, .eyebrow, .label, .source-meta span, .dropzone small, .site-footer, .control footer, .pad small {
  font-family: "Courier New", monospace;
  font-size: 11px;
  letter-spacing: .16em;
}
.brand span { color: var(--gold); }
.privacy { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.privacy i, .section-title p i { width: 8px; height: 8px; background: var(--acid); border-radius: 50%; box-shadow: 0 0 15px rgba(215,251,49,.55); }

main { width: min(1760px, 100%); margin: 0 auto; padding: clamp(26px, 4vw, 76px); }
main > section { margin-bottom: clamp(34px, 5vw, 80px); }

.introduction {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(500px, 1.18fr);
  grid-template-areas: "eyebrow art" "title art" "copy art" "upload art" "drop art";
  gap: 20px 6vw;
  align-items: start;
}
.introduction > * { min-width: 0; }
.introduction > .eyebrow { grid-area: eyebrow; }
.introduction h1 {
  grid-area: title;
  width: 100%;
  margin: 8px 0 0;
  font-size: clamp(58px, 4.9vw, 104px);
  line-height: .88;
  letter-spacing: -.07em;
  white-space: nowrap;
}
.introduction p {
  grid-area: copy;
  max-width: 620px;
  margin: 10px 0 0;
  color: #858176;
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(14px, 1.15vw, 18px);
  font-weight: 600;
  line-height: 1.75;
  letter-spacing: .105em;
  text-transform: uppercase;
}
.eyebrow, .label { color: var(--gold); font-weight: 700; letter-spacing: .2em; }

.hero-art {
  grid-area: art;
  align-self: stretch;
  min-height: 590px;
  margin: 0;
  display: grid;
  grid-template-rows: 1fr 65px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #050503;
  box-shadow: var(--shadow);
}
.hero-art img { width: 100%; height: 100%; min-height: 0; object-fit: cover; display: block; }
.hero-art figcaption { padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
.hero-art figcaption strong { font-size: 13px; letter-spacing: .18em; }
.hero-art figcaption span { color: var(--gold); font: 10px "Courier New", monospace; letter-spacing: .17em; }

.upload {
  grid-area: upload;
  position: relative;
  min-height: 136px;
  padding: 31px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(115deg, #f4cf73, #c87812);
  border: 1px solid #ffdf87;
  color: #090806;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .18s ease, filter .18s ease;
}
.upload:hover { transform: translate(-3px, -3px); filter: brightness(1.08); }
.upload span { font-size: clamp(25px, 3vw, 46px); font-weight: 900; letter-spacing: .08em; }
.upload small { margin-top: 8px; font-family: "Courier New", monospace; letter-spacing: .19em; }
.dropzone {
  grid-area: drop;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 25px;
  border: 1px dashed var(--line);
  color: #aaa294;
  transition: border-color .2s, background .2s;
}
.dropzone.dragging { border-color: var(--gold); background: rgba(239,189,70,.08); }
.dropzone small { color: var(--muted); text-align: right; }

.machine, .performance { border: 1px solid var(--line); background: rgba(8, 8, 5, .88); box-shadow: var(--shadow); }
.machine-head {
  min-height: 126px;
  padding: 27px clamp(22px, 3vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(100deg, rgba(93,56,9,.16), transparent 55%);
}
.machine-head h2 { margin: 11px 0 0; font-size: clamp(26px, 3vw, 48px); letter-spacing: -.025em; overflow-wrap: anywhere; }
.source-meta { min-width: 115px; display: grid; justify-items: end; gap: 9px; }
.source-meta strong { color: var(--gold); font-size: 24px; }
.source-meta span { color: var(--muted); }

.progress-wrap { padding: 18px 28px; border-bottom: 1px solid var(--line); background: rgba(239,189,70,.05); }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--gold); font: 700 12px "Courier New", monospace; letter-spacing: .15em; }
.progress-track { height: 4px; background: rgba(255,255,255,.07); overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--gold); box-shadow: 0 0 15px var(--gold); transition: width .16s linear; }

.wave-section { position: relative; min-height: 340px; background: #050604; overflow: hidden; }
.wave-section::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(239,189,70,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(239,189,70,.09) 1px, transparent 1px);
  background-size: 100% 28px, 25% 100%;
}
#sourceWave { position: absolute; inset: 0; width: 100%; height: 100%; }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); }
.empty-state[hidden] { display: none; }
.empty-state strong { color: #aaa294; letter-spacing: .17em; }
.empty-state small { font: 10px "Courier New", monospace; letter-spacing: .15em; }
.blade { width: 118px; height: 12px; margin-bottom: 14px; background: linear-gradient(90deg, transparent, var(--gold), transparent); transform: skewX(-28deg); box-shadow: 0 0 30px rgba(239,189,70,.4); }

.transport { position: relative; min-height: 90px; display: flex; align-items: center; gap: 24px; padding: 14px 28px; border-top: 1px solid var(--line); }
.transport-button { width: 58px; height: 58px; flex: 0 0 auto; border-radius: 50%; border: 1px solid #ffd878; background: var(--gold); color: #080806; cursor: pointer; font-size: 18px; }
.transport-button:disabled, button:disabled { opacity: .28; cursor: not-allowed; }
.time { flex: 1; font: 15px "Courier New", monospace; color: #beb6a7; }
.text-button, .replace { padding: 14px 18px; border: 1px solid var(--line); background: none; color: var(--gold); cursor: pointer; font: 700 11px "Courier New", monospace; letter-spacing: .13em; }
.cut-methods { display: flex; border: 1px solid var(--line); }
.cut-mode { min-height: 42px; padding: 0 13px; border: 0; border-right: 1px solid var(--line); background: #090906; color: var(--muted); cursor: pointer; font: 700 9px "Courier New", monospace; letter-spacing: .12em; }
.cut-mode:last-child { border-right: 0; }
.cut-mode.active { background: var(--gold); color: #080806; }

.performance { padding: clamp(22px, 3vw, 42px); }
.section-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; margin-bottom: 28px; }
.section-title h2 { margin: 8px 0 0; font-size: clamp(30px, 4vw, 64px); letter-spacing: -.04em; }
.section-title p { display: flex; align-items: center; gap: 10px; margin: 0 0 7px; color: var(--muted); font: 11px "Courier New", monospace; letter-spacing: .12em; text-align: right; }
.fx-rack { margin-bottom: 20px; border: 1px solid var(--line); background: linear-gradient(105deg, rgba(93,56,9,.18), rgba(8,8,5,.96) 42%); }
.fx-heading { min-height: 72px; padding: 16px 20px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.fx-heading span, .fx-heading small, .fx-control span, .fx-control output, .fx-control small { font-family: "Courier New", monospace; letter-spacing: .13em; }
.fx-heading span { color: var(--gold); font-size: 10px; font-weight: 700; }
.fx-heading strong { font-size: 15px; letter-spacing: .12em; }
.fx-heading small { color: var(--muted); font-size: 9px; text-align: right; }
.fx-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fx-control { min-width: 0; min-height: 142px; padding: 18px; display: grid; grid-template-columns: 1fr auto; align-content: space-between; gap: 8px 12px; border-right: 1px solid var(--line); }
.fx-control:last-child { border-right: 0; }
.fx-control span { color: var(--cream); font-size: 11px; font-weight: 700; }
.fx-control output { color: var(--gold); font-size: 11px; }
.fx-control input[type="range"] { grid-column: 1 / -1; height: 32px; margin: 9px 0; }
.fx-control small { grid-column: 1 / -1; color: #5f5a4f; font-size: 8px; }
.slice-inspector {
  min-height: 84px;
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(220px, 1fr) minmax(300px, 1.25fr) auto auto;
  align-items: stretch;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: linear-gradient(100deg, rgba(93,56,9,.17), rgba(8,8,5,.94) 55%);
}
.slice-inspector > * {
  min-width: 0;
  margin: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}
.slice-inspector > *:last-child { border-right: 0; }
.slice-inspector > div { display: grid; align-content: center; gap: 7px; }
.slice-inspector span, .slice-inspector p, .slice-inspector output, .slice-inspector button {
  font: 700 10px "Courier New", monospace;
  letter-spacing: .13em;
}
.slice-inspector span { color: var(--gold); }
.slice-inspector strong { overflow: hidden; color: var(--cream); font-size: 15px; letter-spacing: .1em; text-overflow: ellipsis; white-space: nowrap; }
.slice-inspector p { display: flex; align-items: center; color: var(--muted); line-height: 1.55; }
.slice-inspector button { min-width: 122px; border: 0; background: transparent; color: var(--gold); cursor: pointer; }
.slice-inspector button:hover:not(:disabled) { background: rgba(239,189,70,.08); }
.slice-inspector button.active { background: var(--gold); color: #080806; }
.slice-inspector button b { display: block; margin-top: 6px; font-size: 9px; }
.slice-level {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.slice-level output { min-width: 52px; color: var(--gold); text-align: right; }
.slice-level input[type="range"] { height: 32px; margin: 0; }
.workbench { display: grid; grid-template-columns: 1.25fr .75fr; border: 1px solid var(--line); }
.pads {
  display: grid;
  grid-template-columns: repeat(26, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(105px, 1fr));
  gap: 7px;
  min-height: 520px;
  padding: 7px;
  background: #050503;
}
.pad {
  position: relative;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #080906;
  cursor: pointer;
  text-align: left;
  transition: background .08s, transform .08s;
}
.pad::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform .18s; }
.pad:hover { background: #111006; }
.pad.selected { outline: 2px solid var(--cream); outline-offset: -3px; z-index: 2; }
.pad.reversed::before { content: "REV"; position: absolute; z-index: 3; top: 9px; right: 8px; color: #080806; background: var(--gold); padding: 3px 4px; font: 700 7px "Courier New", monospace; letter-spacing: .09em; }
.pad.active { background: rgba(239,189,70,.16); transform: scale(.985); }
.pad.active::after { transform: scaleX(1); }
.pad strong { z-index: 2; color: var(--gold); font: 700 13px "Courier New", monospace; overflow: hidden; text-overflow: ellipsis; }
.pad small { z-index: 2; color: var(--muted); }
.pad canvas { position: absolute; inset: 27px 9px 23px; width: calc(100% - 18px); height: calc(100% - 50px); opacity: .9; }
.pad.placeholder { cursor: default; opacity: .35; }

.controls { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); }
.control { min-height: 260px; padding: 28px 24px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.control:nth-child(3n) { border-right: 0; }
.control:nth-last-child(-n+3) { border-bottom: 0; }
.control > div { display: flex; justify-content: space-between; gap: 15px; }
.control strong { letter-spacing: .1em; }
.control output { color: var(--gold); font: 13px "Courier New", monospace; }
.control footer { display: flex; justify-content: space-between; color: #5f5a4f; }
input[type="range"] { width: 100%; height: 40px; margin: 25px 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, var(--gold) 0 var(--fill, 50%), #302f29 var(--fill, 50%)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 32px; height: 32px; margin-top: -14px; border-radius: 50%; background: var(--gold); border: 3px solid #080806; outline: 2px solid var(--gold); box-shadow: 0 0 20px rgba(239,189,70,.2); }
input[type="range"]::-moz-range-track { height: 4px; background: #302f29; }
input[type="range"]::-moz-range-progress { height: 4px; background: var(--gold); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); border: 3px solid #080806; outline: 2px solid var(--gold); }

.actions { display: grid; grid-template-columns: .65fr 1fr; gap: 18px; margin-top: 22px; }
.actions button { position: relative; min-height: 104px; padding: 24px 28px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; border: 1px solid var(--line); cursor: pointer; text-align: left; }
.actions span { font-size: 20px; font-weight: 900; letter-spacing: .12em; }
.actions small { margin-top: 8px; font: 10px "Courier New", monospace; letter-spacing: .17em; }
.secondary-action { background: #0b0a06; color: var(--cream); }
.download-action { background: linear-gradient(110deg, #f0c967, #bd6810); color: #080806; border-color: #ffe18b !important; }
.download-action b { position: absolute; right: 28px; font-size: 30px; }

.site-footer { min-height: 80px; padding: 25px clamp(22px, 4vw, 70px); display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: var(--muted); }
.site-footer span:first-child { color: var(--gold); font-weight: 700; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 130px); padding: 15px 20px; background: var(--cream); color: #080806; font: 700 12px "Courier New", monospace; letter-spacing: .1em; box-shadow: 8px 8px 0 #000; transition: transform .25s ease; }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .fx-controls { grid-template-columns: repeat(3, 1fr); }
  .fx-control { border-bottom: 1px solid var(--line); }
  .fx-control:nth-child(3n) { border-right: 0; }
  .fx-control:nth-last-child(-n+2) { border-bottom: 0; }
  .slice-inspector { grid-template-columns: 1fr 1fr; }
  .slice-inspector > * { padding: 15px; }
  .slice-inspector > * { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .slice-inspector > div, .slice-inspector > p, .slice-level { grid-column: 1 / -1; }
  .slice-inspector > p, .slice-level { border-right: 0; }
  .slice-inspector button { min-height: 62px; }
  .slice-inspector button:nth-last-child(-n+2) { border-bottom: 0; }
  .slice-inspector button:last-child { border-right: 0; }
  .workbench { grid-template-columns: 1fr; }
  .pads { min-height: 500px; border-bottom: 1px solid var(--line); }
  .controls { grid-template-columns: repeat(3, 1fr); }
  .control { min-height: 200px; }
}

@media (max-width: 900px) {
  .introduction { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .introduction > .eyebrow { order: 0; }
  .introduction h1 { order: 1; font-size: clamp(58px, 11vw, 86px); }
  .upload { order: 2; }
  .hero-art { order: 3; width: 100%; min-height: 0; aspect-ratio: 3 / 2; grid-template-rows: 1fr 48px; }
  .introduction p { order: 4; }
}

@media (max-width: 720px) {
  .topbar { min-height: 82px; padding: 13px 16px; }
  .brand { gap: 11px; }
  .brand img { width: 49px; height: 49px; }
  .brand strong { font-size: 14px; }
  .brand span { font-size: 8px; }
  .privacy { display: none; }
  main { padding: 22px 14px calc(25px + env(safe-area-inset-bottom)); }
  main > section { margin-bottom: 30px; }
  .introduction { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .introduction > .eyebrow { order: 0; }
  .introduction h1 { order: 1; font-size: 70px; }
  .upload { order: 2; min-height: 96px; padding: 21px; }
  .hero-art { order: 3; width: 100%; min-height: 0; aspect-ratio: 3 / 2; grid-template-rows: 1fr 48px; }
  .hero-art figcaption { padding: 0 13px; }
  .hero-art figcaption strong { font-size: 10px; }
  .hero-art figcaption span { font-size: 8px; }
  .introduction p { order: 4; font-size: 13px; line-height: 1.7; letter-spacing: .09em; }
  .upload span { font-size: 25px; }
  .dropzone { display: none; }
  .machine-head { min-height: 100px; padding: 20px; align-items: flex-start; }
  .machine-head h2 { font-size: 23px; }
  .source-meta strong { font-size: 17px; }
  .wave-section { min-height: 210px; }
  .transport { min-height: 76px; padding: 10px 13px; gap: 10px; }
  .transport-button { width: 48px; height: 48px; }
  .time { font-size: 11px; }
  .cut-methods { position: absolute; left: 13px; right: 13px; top: 86px; margin: 0; z-index: 2; }
  .cut-mode { flex: 1; min-height: 38px; }
  .machine { margin-bottom: 78px; }
  .text-button { display: none; }
  .replace { padding: 12px 10px; font-size: 9px; }
  .performance { padding: 18px 12px; }
  .section-title { display: block; }
  .section-title h2 { font-size: 37px; }
  .section-title p { margin-top: 12px; text-align: left; }
  .fx-heading { grid-template-columns: 1fr; gap: 7px; }
  .fx-heading small { text-align: left; }
  .fx-controls { grid-template-columns: 1fr 1fr; }
  .fx-control { min-height: 126px; padding: 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .fx-control:nth-child(3n) { border-right: 1px solid var(--line); }
  .fx-control:nth-child(2n) { border-right: 0; }
  .fx-control:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .fx-control:last-child { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .pads { min-height: 720px; grid-template-columns: repeat(6, 1fr); grid-template-rows: none; }
  .pad { grid-column: auto !important; grid-row: auto !important; min-height: 82px; padding: 8px; }
  .pad strong { font-size: 11px; }
  .pad small { font-size: 8px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .control { min-height: 160px; padding: 19px 15px; border-bottom: 1px solid var(--line); }
  .control:nth-child(3n) { border-right: 1px solid var(--line); }
  .control:nth-child(2n) { border-right: 0; }
  .control:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .control:nth-last-child(-n+2) { border-bottom: 0; }
  .control strong { font-size: 13px; }
  .control footer { font-size: 8px; }
  input[type="range"]::-webkit-slider-thumb { width: 38px; height: 38px; margin-top: -17px; }
  .actions { grid-template-columns: .7fr 1.3fr; gap: 8px; position: sticky; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 8; }
  .actions button { min-height: 76px; padding: 16px; box-shadow: 0 -8px 30px rgba(0,0,0,.65); }
  .actions span { font-size: 14px; }
  .actions small { font-size: 8px; }
  .download-action b { right: 14px; }
  .site-footer { padding: 20px 16px; font-size: 8px; }
  .site-footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
