@font-face {
  font-family: "Barlow Condensed";
  src: url("./fonts/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("./fonts/barlow-condensed-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: Anton;
  src: url("./fonts/anton.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Doto;
  src: url("./fonts/doto.woff2") format("woff2");
  font-weight: 700 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --surface: #111110;
  --control: #1b1b19;
  --border: #343430;
  --muted: #b1b1a5;
  --accent: #faff37;
  background: var(--surface);
  color: #f6f6ee;
  font: 100%/1.45 system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, textarea, select, input { font: inherit; }
button, select, input { touch-action: manipulation; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.setup {
  width: min(100%, 610px);
  margin-inline: auto;
  padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 19px; }
.brand img { border: 1px solid #444531; border-radius: 11px; }
.brand h1 { margin: 0; font-size: 1.65rem; font-weight: 800; letter-spacing: -.055em; }

.preview {
  margin: 0 0 17px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #191917;
  overflow: hidden;
}
.preview figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 600;
}
.preview figcaption span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.preview-surface {
  position: relative;
  height: clamp(78px, 13svh, 116px);
  background: #000;
  border-top: 1px solid var(--border);
  overflow: hidden;
}
.preview-surface .stage { inset: 6px 0; }

form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field > label, .field-heading > label:first-child, legend { font-size: .875rem; font-weight: 650; }
textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  background-color: var(--control);
}
textarea { display: block; min-height: 66px; padding: 10px 12px; resize: vertical; font-weight: 600; }
textarea::placeholder { color: var(--muted); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  inset: 17px 14px auto auto;
  width: 7px;
  height: 7px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
select { appearance: none; min-height: 44px; padding: 7px 30px 7px 10px; }

.fill-row[data-fill="solid"] .field:first-child { grid-column: 1 / -1; }
#gradientEnd { width: 54px; }

.color-row { grid-template-columns: minmax(0, 1fr) auto; }
.color-options { display: flex; align-items: center; gap: clamp(1px, .8vw, 5px); min-height: 44px; flex-wrap: wrap; }
.swatch, .color-input {
  width: clamp(23px, 6vw, 38px);
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  flex: 0 0 auto;
}
.swatch::before {
  content: "";
  display: block;
  margin: auto;
  width: min(19px, 66%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--swatch);
}
.swatch[aria-pressed="true"]::before { outline: 1px solid #f6f6ee; outline-offset: 3px; }
.white { --swatch: #ffffff; }
.red { --swatch: #ff3838; }
.green { --swatch: #42ff70; }
.blue { --swatch: #4382ff; }
.yellow { --swatch: #faff37; }
.cyan { --swatch: #2ff8ff; }
.magenta { --swatch: #ff4edf; }
.orange { --swatch: #ff933d; }

.color-input {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  cursor: pointer;
}
.color-input::-webkit-color-swatch-wrapper { padding: 10px 4px; }
.color-input::-webkit-color-swatch { border: 1px solid #77776d; border-radius: 6px; }
.color-input::-moz-color-swatch { border: 1px solid #77776d; border-radius: 6px; }
.background-field .color-input { width: 54px; }
#foreground { border-left: 1px solid var(--border); border-radius: 0; margin-left: 4px; padding-left: 4px; }

.field-heading, .range-control { display: flex; align-items: center; gap: 7px; }
.field-heading { justify-content: space-between; min-height: 30px; }
.auto-toggle { display: flex; align-items: center; gap: 4px; font-size: .8125rem; color: var(--muted); cursor: pointer; }
.auto-toggle input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.range-control {
  min-height: 44px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--control);
}
.range-control input { width: 100%; min-width: 0; height: 40px; margin: 0; accent-color: var(--accent); }
.range-control input:disabled { opacity: .43; }
output { text-align: right; min-width: 2.8em; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }

.spacing-field { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }

.directions { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0 0 5px; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: #171715; }
.segments label { position: relative; cursor: pointer; }
.segments input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.segments span { display: grid; place-items: center; min-height: 44px; padding: 3px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); font-size: .875rem; }
.segments input:checked + span { border-color: #4b4b37; background: #2a2b21; color: #fafae2; font-weight: 650; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); }

.actions { display: grid; gap: 8px; margin-top: 3px; }
.actions p { margin: 0; text-align: center; color: var(--muted); font-size: .8125rem; }
#start {
  width: 100%;
  min-height: 57px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #111110;
  font-size: .9375rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
#start:active { background: #e3e82b; }
#start:disabled { opacity: .45; cursor: default; }

.site-footer { margin-top: 8px; text-align: center; font-size: .8125rem; }
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 8px;
  color: var(--muted);
  text-underline-offset: .22em;
}
.site-footer a:hover { color: #f6f6ee; }

html.playing, html.playing body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
}
#board {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background: #000;
  outline: none;
}
#board:fullscreen { width: 100%; height: 100%; }
#board:-webkit-full-screen { width: 100%; height: 100%; }
#board .stage {
  inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.stage { position: absolute; overflow: hidden; direction: ltr; }
.track { position: absolute; display: flex; width: max-content; left: 0; align-items: baseline; }
.word {
  flex: none;
  white-space: pre;
  line-height: 1;
  font-kerning: none;
}
.baseline { display: inline-block; width: 0; height: 0; }

@supports (background-clip: text) or (-webkit-background-clip: text) {
  [data-fill="gradient"] .word, [data-fill="pixels"] .word {
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
  }

  [data-fill="gradient"] .word {
    background-image: linear-gradient(var(--fill-primary), var(--fill-end));
  }

  [data-fill="pixels"] .word {
    background-image:
      conic-gradient(#42ffce 25%, #ff4edf 25% 50%, #74a7ff 50% 75%, var(--fill-primary) 75%);
    background-size: var(--pixel-tile) var(--pixel-tile);
  }
}

#rotate {
  position: absolute;
  left: 50%;
  top: max(16px, calc(env(safe-area-inset-top) + 8px));
  transform: translateX(-50%);
  width: max-content;
  max-width: 88%;
  padding: 8px 12px;
  border: 1px solid #6b6b61;
  border-radius: 8px;
  background: #1b1b19;
  color: #f6f6ee;
  font-size: .875rem;
  text-align: center;
  pointer-events: none;
}

@media (orientation: landscape) { #rotate { display: none; } }
@media (min-width: 600px) { .setup { padding-top: 32px; } }

@media (max-width: 599px) {
  .setup { padding-top: max(16px, env(safe-area-inset-top)); }
  .brand { margin-bottom: 14px; }
  .preview { margin-bottom: 13px; }
  .preview-surface { height: clamp(70px, 11svh, 100px); }
  form { gap: 10px; }
  textarea { min-height: 64px; padding-block: 8px; }
  .field-heading { min-height: 24px; }
}
