:root {
  --paper: #fff7e6;
  --card: #ffffff;
  --ink: #111111;
  --ink-2: #3d3a35;
  --muted: #6f6a60;
  --yellow: #ffd23f;
  --pink: #ff8fab;
  --blue: #7aa7ff;
  --green: #3ddc97;
  --red: #ff5a5f;
  --lilac: #c3b1ff;
  --line: 2.5px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(17, 17, 17, 0.13) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--yellow); padding: 1px 5px; border-radius: 5px; border: 1.5px solid var(--ink); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  background: var(--paper);
  border-bottom: var(--line);
}
.back, .top-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border: var(--line); border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow-sm);
  font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.back:hover, .top-cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.back:active, .top-cta:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.tag {
  font-family: var(--mono); font-style: normal; font-size: 11px; font-weight: 700; text-transform: uppercase;
  background: var(--lilac); border: 2px solid var(--ink); border-radius: 6px; padding: 2px 7px; transform: rotate(-3deg);
}
.top-cta { margin-left: auto; background: var(--yellow); }

/* ---------- intro ---------- */
.intro { max-width: 1320px; margin: 0 auto; padding: 44px 28px 30px; }
.intro h1 { font-size: clamp(34px, 5.4vw, 68px); line-height: 1.02; letter-spacing: -0.04em; font-weight: 700; max-width: 900px; }
.intro mark {
  background: var(--green); color: var(--ink); padding: 0 10px; border: var(--line); border-radius: 10px;
  box-shadow: var(--shadow-sm); display: inline-block; transform: rotate(-1.5deg); line-height: 1.05;
}
.intro p { margin-top: 18px; font-size: 18px; color: var(--ink-2); max-width: 680px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; list-style: none; }
.chips li {
  font-family: var(--mono); font-size: 13px; font-weight: 700; padding: 5px 12px;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--card);
}
.chips li:nth-child(1) { background: var(--pink); }
.chips li:nth-child(2) { background: var(--blue); }
.chips li:nth-child(3) { background: var(--yellow); }

/* ---------- workspace ---------- */
.workspace {
  max-width: 1320px; margin: 0 auto; padding: 10px 28px 60px;
  display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 28px; align-items: start;
}
.controls { display: flex; flex-direction: column; gap: 20px; }
.panel {
  background: var(--card); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px;
}
.panel h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; letter-spacing: -0.01em; margin-bottom: 14px; }
.num {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  font-family: var(--mono); font-size: 14px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px;
}
.panel:nth-child(2) .num { background: var(--blue); }
.panel:nth-child(3) .num { background: var(--pink); }
.panel:nth-child(4) .num { background: var(--green); }

/* dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 22px 16px; border: 2.5px dashed var(--ink); border-radius: 12px;
  background: repeating-linear-gradient(-45deg, #fffdf7, #fffdf7 10px, #fff3d1 10px, #fff3d1 20px);
  cursor: pointer; transition: background-color .15s ease, transform .12s ease;
}
.dropzone:hover, .dropzone.over { transform: rotate(-0.6deg) scale(1.01); }
.dropzone.over { background: var(--yellow); }
.dropzone.loaded { background: #e6fbf1; border-style: solid; }
.dropzone b { font-size: 15px; }
.dropzone span { font-size: 13px; color: var(--muted); }
.source-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.source-info { font-size: 13px; color: var(--muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border: var(--line); border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow-sm);
  font-weight: 700; font-size: 15px; cursor: pointer; user-select: none;
  transition: transform .1s ease, box-shadow .1s ease, background-color .15s ease;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 7px 12px; font-size: 13px; border-width: 2px; border-radius: 10px; box-shadow: 2px 2px 0 var(--ink); }
.btn.ghost { background: transparent; }
.btn.primary { width: 100%; padding: 16px; font-size: 17px; background: var(--yellow); box-shadow: var(--shadow); }
.btn.primary:hover:not(:disabled) { box-shadow: 7px 7px 0 var(--ink); }
.btn.danger { background: var(--pink); }
.btn.flash { background: var(--green); }
.actions { display: flex; flex-direction: column; gap: 12px; background: var(--lilac); }
.actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* segmented */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; height: 100%; padding: 10px 12px; border: var(--line); border-radius: 12px; background: var(--card);
  transition: transform .1s ease, box-shadow .1s ease, background-color .15s ease;
}
.segmented b { display: block; font-size: 15px; }
.segmented small { font-size: 12px; color: var(--muted); }
.segmented input:checked + span { background: var(--blue); box-shadow: var(--shadow-sm); transform: translate(-2px, -2px); }
.segmented input:checked + span small { color: var(--ink-2); }
.segmented input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 3px; }

/* fields */
.fields { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.field em { font-style: normal; text-transform: none; font-weight: 500; color: var(--muted); }
.field output { margin-left: auto; background: var(--yellow); border: 2px solid var(--ink); border-radius: 6px; padding: 0 6px; }
input[type="text"], input[type="url"], .preview-select {
  width: 100%; min-width: 0; padding: 10px 12px; border: var(--line); border-radius: 10px; background: #fffdf7; font-size: 15px;
  transition: box-shadow .12s ease, background-color .12s ease;
}
input[type="text"]:focus, input[type="url"]:focus, .preview-select:focus { outline: none; background: #fff; box-shadow: var(--shadow-sm); }
#unlock-code { font-family: var(--mono); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
#unlock-code::placeholder { text-transform: none; font-weight: 500; letter-spacing: 0; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline input { flex: 1; }
.note { font-size: 13px; color: var(--muted); }
.test-result { font-size: 13px; font-weight: 600; }
.test-result.good { color: #0f7a4f; }
.test-result.bad { color: #c0262d; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }

/* switches */
.switches { display: flex; flex-direction: column; gap: 4px; }
.switch { display: flex; align-items: center; gap: 14px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.switch:hover { background: #fff7e0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track {
  position: relative; flex-shrink: 0; width: 52px; height: 30px;
  border: var(--line); border-radius: 999px; background: #ece6d8;
  transition: background-color .15s ease;
}
.track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--card);
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .18s cubic-bezier(.3, 1.5, .6, 1);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--ink); outline-offset: 3px; }
.lbl b { display: block; font-size: 15px; }
.lbl small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; }

/* swatches */
.swatches { display: flex; align-items: center; gap: 8px; height: 44px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.swatches i {
  display: block; width: 30px; height: 30px; border-radius: 8px; border: var(--line); background: var(--c);
  transition: transform .12s ease, box-shadow .12s ease;
}
.swatches input:checked + i, .swatches .custom input[type="radio"]:checked + input { transform: translate(-2px, -2px) rotate(-6deg); box-shadow: var(--shadow-sm); }
.swatches input:focus-visible + i { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatches .custom input[type="color"] {
  width: 30px; height: 30px; padding: 0; border: var(--line); border-radius: 8px; background: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.swatches .custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.swatches .custom input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 14px; margin: 15px 0;
  border: var(--line); border-radius: 999px; background: linear-gradient(90deg, #fff, var(--pink)); cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border: var(--line); border-radius: 7px; background: var(--yellow); box-shadow: 2px 2px 0 var(--ink);
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: var(--line); border-radius: 7px; background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }

/* ---------- preview ---------- */
.preview-col { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.browser { border: var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 8px 8px 0 var(--ink); overflow: hidden; }
.browser-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: var(--line); background: var(--yellow);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 13px; height: 13px; border: 2px solid var(--ink); border-radius: 50%; background: var(--red); }
.dots i:nth-child(2) { background: var(--card); }
.dots i:nth-child(3) { background: var(--green); }
.url {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 12.5px; padding: 5px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card);
}
.mode-badge { font-family: var(--mono); font-size: 11.5px; font-weight: 700; text-transform: uppercase; padding: 4px 9px; border: 2px solid var(--ink); border-radius: 7px; background: var(--green); white-space: nowrap; }
.mode-badge[data-mode="server"] { background: var(--blue); }
.preview-select { border-width: 0 0 2.5px; border-radius: 0; font-family: var(--mono); font-size: 13px; }
#preview-frame { display: block; width: 100%; height: min(72vh, 680px); border: 0; background: #fff; }
.preview-hint { font-size: 14px; color: var(--ink-2); padding: 0 4px; }

.log-card { border: var(--line); border-radius: var(--radius); background: #161616; color: #f5f0e6; box-shadow: var(--shadow); overflow: hidden; }
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; border-bottom: 2px solid #333; font-family: var(--mono); font-size: 12px; text-transform: uppercase; }
.log-head button { background: none; border: 0; color: #aaa; cursor: pointer; font-family: var(--mono); font-size: 12px; }
.log-head button:hover { color: var(--yellow); }
.log { list-style: none; max-height: 170px; overflow-y: auto; padding: 8px 14px 12px; font-family: var(--mono); font-size: 12.5px; }
.log li { padding: 3px 0; }
.log li::before { content: "› "; color: #777; }
.log li.ok { color: var(--green); }
.log li.done { color: var(--yellow); font-weight: 700; }
.log li.warn { color: #ffb45c; }
.log li.error { color: #ff7b80; }

/* ---------- how ---------- */
.how { max-width: 1320px; margin: 0 auto; padding: 20px 28px 70px; }
.how h2 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.03em; margin-bottom: 22px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.steps article { position: relative; padding: 24px; border: var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.steps article:nth-child(1) { background: var(--pink); }
.steps article:nth-child(2) { background: var(--blue); }
.steps article:nth-child(3) { background: var(--green); }
.big { position: absolute; right: 14px; top: 2px; font-family: var(--mono); font-size: 64px; font-weight: 700; opacity: .18; }
.steps h3 { font-size: 21px; margin-bottom: 8px; }
.steps p { font-size: 15px; color: var(--ink-2); }
.honest { margin-top: 22px; padding: 14px 18px; border: 2.5px dashed var(--ink); border-radius: 12px; background: #fffdf7; font-size: 14.5px; color: var(--ink-2); max-width: 900px; }

/* ---------- footer ---------- */
.footer { background: var(--ink); color: var(--paper); border-top: var(--line); }
.foot-inner { max-width: 1320px; margin: 0 auto; padding: 26px 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.foot-name { font-weight: 700; font-size: 16px; }
.foot-name span { font-weight: 400; color: #a8a295; }
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.foot-links a, .copy-email {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 2px solid var(--paper); border-radius: 999px; background: transparent;
  color: var(--paper); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.foot-links a:hover, .copy-email:hover { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.copy-email { position: relative; background: var(--paper); color: var(--ink); }
.copy-email .ic-done { display: none; }
.copy-email.copied { background: var(--green); border-color: var(--green); }
.copy-email.copied .ic-copy { display: none; }
.copy-email.copied .ic-done { display: inline; }
.copy-email .tip {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 4px);
  padding: 4px 9px; border: 2px solid var(--paper); border-radius: 7px; background: var(--yellow); color: var(--ink);
  font-family: var(--mono); font-size: 11.5px; font-weight: 700; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
.copy-email:hover .tip, .copy-email:focus-visible .tip, .copy-email.copied .tip { opacity: 1; transform: translate(-50%, 0); }
.copy-email.copied .tip { background: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; order: -1; }
  #preview-frame { height: 460px; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .back-text, .tag, .top-cta { display: none; }
  .logo { font-size: 17px; }
  .intro, .workspace, .how { padding-left: 16px; padding-right: 16px; }
  .intro { padding-top: 30px; }
  .intro p { font-size: 16px; }
  .grid2, .actions .row { grid-template-columns: 1fr; }
  .panel { padding: 16px; box-shadow: 4px 4px 0 var(--ink); }
  #preview-frame { height: 380px; }
  .foot-inner { padding: 22px 16px; flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
