@font-face {
  font-family: "InterFallback";
  src: local("Helvetica Neue");
}

:root {
  --paper: #f2f0e9;
  --ink: #161613;
  --muted: #8c8a82;
  --guide: rgba(22, 22, 19, .18);
  --accent: #ef5b2a;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: InterFallback, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { color: inherit; font: inherit; }

main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 30px 20px;
}

header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  min-height: 44px;
}

.wordmark {
  width: max-content;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .01em;
}

button {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 26px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px 12px 19px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover { background: var(--accent); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.985); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.workspace {
  flex: 1;
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 36px -30px 22px;
  padding: 30px;
}
.workspace::-webkit-scrollbar { display: none; }

.alphabet {
  width: 100%;
  min-width: 1050px;
  display: grid;
  grid-template-columns: repeat(26, minmax(38px, 1fr));
  grid-template-rows: repeat(2, 150px);
  border-left: 1px solid rgba(22,22,19,.08);
  border-top: 1px solid rgba(22,22,19,.08);
}

.glyph {
  position: relative;
  min-width: 0;
  border-right: 1px solid rgba(22,22,19,.08);
  border-bottom: 1px solid rgba(22,22,19,.08);
  cursor: ew-resize;
  touch-action: none;
}

.glyph svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.guide {
  stroke: var(--guide);
  stroke-width: .8;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

.letter-form {
  fill: none;
  stroke: var(--ink);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: stroke 100ms ease;
}

.glyph:hover .letter-form,
.glyph.is-dragging .letter-form { stroke: var(--accent); }

.handle-line {
  stroke: var(--accent);
  stroke-width: .8;
  stroke-dasharray: 2 2;
  vector-effect: non-scaling-stroke;
}

.handle {
  fill: var(--paper);
  stroke: var(--accent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 130ms ease;
}

.width-handle:hover { transform: rotate(45deg) scale(1.25); }
.curve-handle:hover { transform: scale(1.25); }
.controls {
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
}
.glyph:hover .controls,
.glyph.is-dragging .controls { opacity: 1; pointer-events: auto; }
.handle { pointer-events: all; }

.glyph-label {
  font: 500 9px/1 InterFallback, sans-serif;
  fill: var(--muted);
  text-anchor: middle;
  user-select: none;
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

#status { color: var(--ink); }

@media (max-width: 720px) {
  main { padding: 18px 16px 16px; }
  header { grid-template-columns: 1fr auto; }
  header p { display: none; }
  .workspace { margin-left: -16px; margin-right: -16px; padding: 16px; }
  .alphabet { min-width: 1040px; }
  footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
