:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --gray: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --violet-line: #ddd6fe;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgb(0 113 227 / 0.15);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgb(0 0 0 / 0.06);
  background: rgb(255 255 255 / 0.72);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav-brand {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: transparent;
  padding: 0.45rem 1.05rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}

.nav-signin:hover {
  background: rgb(0 113 227 / 0.06);
  border-color: var(--blue);
}

.sign-in {
  width: min(420px, calc(100vw - 2rem));
  border: 0;
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 16px 50px rgb(0 0 0 / 0.18);
}

.sign-in::backdrop {
  background: rgb(0 0 0 / 0.35);
}

.sign-in h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.sign-in p {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.sign-in label {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.sign-in input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-weight: 400;
}

.password-row {
  position: relative;
  display: block;
}

.password-row input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 4.4rem;
}

.show-password {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.forgot {
  display: block;
  margin: -0.35rem 0 0.75rem;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--blue);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.sign-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.sign-in .buy,
.sign-in .make {
  width: 100%;
}

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1.5rem;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--violet-line);
  border-radius: 980px;
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 0.875rem;
  font-weight: 500;
}

.eyebrow svg {
  width: 1rem;
  height: 1rem;
}

h1 {
  margin: 1.35rem 0 0;
  font-size: clamp(2.15rem, 5vw, 3.35rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.subtitle,
.lede,
.hint,
.scale,
.status,
.meta {
  color: var(--muted);
}

.subtitle {
  max-width: 36rem;
  margin: 1.1rem auto 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.004em;
}

main {
  padding-bottom: 4rem;
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 1.25rem;
  align-items: start;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 0;
}

.pad,
.controls,
.results,
.card {
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 2px 16px rgb(0 0 0 / 0.06);
}

.pad {
  padding: 1rem;
}

.pad.is-dragging {
  box-shadow: 0 0 0 2px var(--blue), 0 8px 28px rgb(0 113 227 / 0.12);
}

.pad.is-erasing canvas {
  cursor: cell;
}

.sketch-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.attr-band,
.primary-tools {
  box-sizing: border-box;
  height: 48px;
}

.attr-band {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.15rem;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 0 0.45rem;
}

.sketch-tools[data-mode="draw"] .attr-band,
.pad-bar[data-mode="draw"] .attr-band {
  border-color: rgb(0 113 227 / 0.38);
  background: rgb(0 113 227 / 0.05);
}

.sketch-tools[data-mode="erase"] .attr-band[data-uses="both"],
.pad-bar[data-mode="erase"] .attr-band[data-uses="both"] {
  border-color: rgb(29 29 31 / 0.28);
  background: rgb(29 29 31 / 0.04);
}

.sketch-tools[data-mode="erase"] .attr-band[data-uses="draw"],
.pad-bar[data-mode="erase"] .attr-band[data-uses="draw"] {
  opacity: 0.38;
}

.primary-tools {
  display: inline-flex;
  align-items: stretch;
  gap: 0.2rem;
  padding: 4px;
  border-radius: 980px;
  background: rgb(0 0 0 / 0.05);
}

.primary-tools .tool {
  min-width: 4.6rem;
  height: auto;
  padding: 0 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.primary-tools .tool.is-on {
  background: var(--blue);
  color: #fff;
}

.pad-bar[data-mode="erase"] .primary-tools .tool.is-on {
  background: #1d1d1f;
  color: #fff;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.tool-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: normal;
  color: var(--text);
}

.sizes,
.inks {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.inks {
  margin-left: 0.7rem;
}

.size-dot,
.ink {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 980px;
  background: transparent;
  cursor: pointer;
}

.size-dot span {
  display: block;
  border-radius: 980px;
  background: var(--text);
}

.size-dot[data-size="2"] span {
  width: 3px;
  height: 3px;
}

.size-dot[data-size="8"] span {
  width: 7px;
  height: 7px;
}

.size-dot[data-size="18"] span {
  width: 12px;
  height: 12px;
}

.size-dot[data-size="36"] span {
  width: 18px;
  height: 18px;
}

.size-dot.is-on {
  border-color: var(--blue);
  background: rgb(0 113 227 / 0.08);
}

.ink.is-on {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue);
}

.ink {
  width: 25.6px;
  height: 25.6px;
  background: #161616;
}

.ink-blue {
  background: #1d4ed8;
}

.ink-red {
  background: #b42318;
}

.ink-custom {
  position: relative;
  background: #0f766e;
}

.ink-custom input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}

.pad-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.tool,
.upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 980px;
  background: transparent;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
}

.tool:hover,
.upload:hover {
  color: var(--text);
  background: rgb(0 0 0 / 0.04);
}

.tool.is-on {
  background: rgb(0 113 227 / 0.1);
  color: var(--blue);
}

.upload input {
  display: none;
}

.pen {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.pen input,
.field input[type="range"] {
  width: 92px;
  height: 4px;
  margin: 0;
  appearance: none;
  border-radius: 980px;
  background: var(--border-light);
  accent-color: var(--blue);
}

.pen input::-webkit-slider-thumb,
.field input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.2);
  cursor: pointer;
}

.stage {
  position: relative;
}

.grid {
  position: absolute;
  inset: 2px;
  border-radius: 10px;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgb(0 0 0 / 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(0 0 0 / 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
}

.grid::before,
.grid::after {
  content: "";
  position: absolute;
  background: rgb(0 113 227 / 0.35);
}

.grid::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.grid::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.pad.is-dragging canvas {
  border-color: var(--blue);
  background: rgb(0 113 227 / 0.04);
}

.hint {
  margin: 0.75rem 0 0.15rem;
  font-size: 0.9rem;
  text-align: center;
}

.controls {
  padding: 1.25rem 1.2rem 1.3rem;
  display: grid;
  gap: 0.95rem;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  margin-bottom: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.styles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.styles label {
  border: 1px solid var(--border);
  border-radius: 980px;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.styles label:has(input:checked) {
  border-color: var(--blue);
  background: rgb(0 113 227 / 0.08);
  color: var(--blue);
}

.styles input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.field-row,
.scale {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.field-row span:last-child,
.scale {
  font-size: 0.8rem;
  font-weight: 400;
}

.field input[type="range"] {
  width: 100%;
}

textarea,
input[type="number"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
  font-weight: 400;
  outline: none;
}

textarea {
  resize: vertical;
}

textarea:focus,
input[type="number"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgb(0 113 227 / 0.15);
}

textarea::placeholder {
  color: #86868b;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.make {
  border: 0;
  border-radius: 980px;
  background: var(--blue);
  color: #fff;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.make:hover:not(:disabled) {
  background: var(--blue-hover);
}

.make:disabled {
  opacity: 0.45;
  cursor: progress;
}

.redraw-offer {
  display: grid;
  gap: 0.55rem;
}

.redraw-offer[hidden] {
  display: none;
}

.redraw-offer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.redraw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.buy {
  border: 1px solid var(--border);
  border-radius: 980px;
  background: #fff;
  color: var(--text);
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.buy:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
}

.status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.9rem;
}

.status.is-error {
  color: #b42318;
}

.results {
  max-width: 1080px;
  margin: 1.25rem auto 0;
  padding: 1.25rem;
}

.results h2 {
  margin-bottom: 0.9rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}

.card {
  padding: 0.85rem;
  display: grid;
  gap: 0.6rem;
  box-shadow: none;
  background: var(--gray);
}

.preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 0.5rem;
  border-radius: 12px;
  background: #fff;
}

.preview svg {
  width: min(100%, 640px);
  height: auto;
  display: block;
}

.meta {
  margin: 0;
  font-size: 0.85rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.card-actions button {
  border: 1px solid var(--border);
  border-radius: 980px;
  background: #fff;
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  color: var(--blue);
  cursor: pointer;
}

.card-actions button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.card-actions button.primary:hover {
  background: var(--blue-hover);
}

@media (max-width: 860px) {
  .hero {
    padding-top: 2.25rem;
  }

  .studio {
    grid-template-columns: 1fr;
  }
}
