@font-face {
  font-family: Inter;
  src: url("?asset=inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("?asset=inter-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("?asset=jetbrains-mono.ttf") format("truetype");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #191919;
  --border: #353535;
  --text: #f6f5f1;
  --muted: #a3a3a3;
  --accent: #ff9000;
  --error: #ff8787;
  font: 100%/1.4 Inter, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
header {
  position: relative;
  flex: none;
  height: 88px;
  margin-inline: clamp(20px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto;
  height: 1px;
  background: var(--border);
  opacity: .62;
}
.context, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.context {
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: -.02em;
}
main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px 20px;
  overflow-x: clip;
  isolation: isolate;
}
.challenge { width: min(100%, 400px); min-height: 240px; }
.sample {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title change" "word word";
  align-items: center;
}
.sample form { grid-area: change; justify-self: end; }
.sample h1 {
  grid-area: title;
  margin: 0;
  font-size: 1.4375rem;
  font-weight: 500;
  line-height: 1.75rem;
  letter-spacing: -.02em;
}
#word { grid-area: word; justify-self: center; width: min(100%, 320px); }
#word img { display: block; width: 100%; height: auto; user-select: none; }
.wave-word {
  --letter-inset: .08em;
  position: relative;
  margin: 0;
  font: 500 3.875rem/1.32 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: -.05em;
}
.wave-word::before, .wave-word::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  top: 55%;
  transform: translateY(-50%);
  /* Each strand runs from the viewport edge to the ink of the current word. */
  min-width: calc(50vw - 50% + var(--letter-inset));
  aspect-ratio: 1.55;
  max-height: min(50vh, clamp(120px, 50vw - 260px, 430px));
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.wave-word::before {
  right: calc(100% - var(--letter-inset));
  background-image: url("?asset=wave-desktop.svg#left");
}
.wave-word::after {
  left: calc(100% - var(--letter-inset));
  background-image: url("?asset=wave-desktop.svg#right");
}
.success {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
/* Figma measures the word without the negative tracking after its last letter. */
.success .wave-word { padding-inline-end: .05em; }
.success .check { padding: 8px; border-radius: 50%; background: var(--accent); }
.success a { color: var(--muted); line-height: 1.375rem; text-decoration: none; }
.success a:is(:hover, :focus-visible) { text-decoration: underline; }
input, button { font: inherit; }
button { border: 0; cursor: pointer; }
.change {
  min-height: 44px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 500;
}
.change:hover { color: var(--text); text-decoration: underline; }
.verify {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  grid-template-areas: "answer enter" "message message";
  column-gap: 8px;
  margin-top: 24px;
}
#answer, .enter {
  min-height: 52px;
  border-radius: 8px;
}
#answer {
  grid-area: answer;
  min-width: 0;
  width: 100%;
  padding: 0 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}
#answer::placeholder { color: var(--muted); opacity: 1; }
#answer[aria-invalid="true"] { border-color: var(--error); }
#message {
  grid-area: message;
  margin: 10px 0 0;
  color: var(--error);
  font-size: .8125rem;
  line-height: 1.0625rem;
}
#message:empty { display: none; }
.enter {
  grid-area: enter;
  gap: 9px;
  padding: 0 16px;
  background: var(--accent);
  color: #14100a;
  font-weight: 600;
}
.enter:hover { background: #ffa323; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 640px) {
  header { height: 64px; margin-inline: 20px; }
  header::after { inset: auto 0 0; }
  main { min-height: 416px; padding-inline: 0; }
  .challenge { width: 100%; }
  .challenge, .success { min-height: 368px; }
  .sample {
    min-height: 212px;
    padding: 17px 0;
    grid-template-columns: 1fr;
    grid-template-areas: "title" "word" "change";
    align-content: start;
    text-align: center;
  }
  .sample form { justify-self: center; }
  .sample h1 {
    font-size: 1.1875rem;
    line-height: 1.625rem;
    letter-spacing: normal;
    opacity: .9;
  }
  #word { margin-top: 6px; }
  .wave-word { font-size: min(4.375rem, 22vw); }
  .wave-word::before, .wave-word::after { aspect-ratio: .7; max-height: 200px; }
  .wave-word::before { background-image: url("?asset=wave-mobile.svg#left"); }
  .wave-word::after { background-image: url("?asset=wave-mobile.svg#right"); }
  .change { font-size: .875rem; }
  .verify {
    display: flex;
    flex-direction: column;
    margin: 6px 20px 0;
  }
  #answer, .enter { min-height: 56px; border-radius: 10px; }
  #message { margin-top: 7px; font-size: .875rem; line-height: 1.1875rem; }
  .enter { margin-top: 12px; }
}
