@font-face { font-family: "Martian Mono"; src: url("/fonts/martian-mono.woff2") format("woff2"); font-weight: 100 800; font-stretch: 75% 112.5%; font-display: swap; }

:root {
  --bg-solid: #0b2273;
  --bg: radial-gradient(120% 95% at 82% -8%, #9cc4ff 0%, #4b7df2 22%, #2149c9 45%, #0e2b8a 70%, #061445 100%);
  --ink: #ffffff;
  --glow: rgba(140, 185, 255, .35);
  --big-a: rgba(255, 255, 255, .30);
  --big-b: rgba(255, 255, 255, .02);
  --panel-bg: rgba(8, 20, 64, .62);
  --panel-ink: #eef3ff;
  --panel-soft: rgba(238, 243, 255, .64);
  --panel-line: rgba(255, 255, 255, .16);
  --chip-on: #ffffff;
  --chip-on-ink: #0b1f66;
  --hw: 50vw;
  color-scheme: dark;
}
:root[data-theme="night"] {
  --bg-solid: #070b18;
  --bg: radial-gradient(120% 95% at 82% -8%, #24386b 0%, #121d3d 38%, #080d1d 72%, #04060d 100%);
  --ink: #e8eeff;
  --glow: rgba(120, 150, 255, .25);
  --big-a: rgba(170, 196, 255, .22);
  --big-b: rgba(170, 196, 255, .01);
  --panel-bg: rgba(10, 14, 30, .72);
  --chip-on: #e8eeff;
  --chip-on-ink: #0a1230;
}
:root[data-theme="paper"] {
  --bg-solid: #e6ecf5;
  --bg: radial-gradient(120% 95% at 82% -8%, #ffffff 0%, #f1f4f9 40%, #dfe6f1 100%);
  --ink: #0b1530;
  --glow: rgba(255, 255, 255, 0);
  --big-a: rgba(26, 56, 140, .16);
  --big-b: rgba(26, 56, 140, .01);
  --panel-bg: rgba(255, 255, 255, .8);
  --panel-ink: #0b1530;
  --panel-soft: rgba(11, 21, 48, .62);
  --panel-line: rgba(11, 21, 48, .14);
  --chip-on: #0b1530;
  --chip-on-ink: #ffffff;
  color-scheme: light;
}
:root[data-theme="amber"] {
  --bg-solid: #0d0702;
  --bg: radial-gradient(110% 90% at 50% 45%, #2b1707 0%, #170c03 55%, #090401 100%);
  --ink: #ffc14d;
  --glow: rgba(255, 160, 0, .5);
  --big-a: rgba(255, 176, 0, .18);
  --big-b: rgba(255, 176, 0, .01);
  --panel-bg: rgba(24, 13, 3, .8);
  --panel-ink: #ffd27a;
  --panel-soft: rgba(255, 210, 122, .62);
  --panel-line: rgba(255, 176, 0, .22);
  --chip-on: #ffc14d;
  --chip-on-ink: #1a0d02;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { background: var(--bg-solid); }
body {
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  background-color: var(--bg-solid);
  color: var(--ink);
  font-family: "Google Sans Flex", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
:root[data-theme="amber"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    radial-gradient(120% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, .55) 100%);
}

#field { position: fixed; inset: 0; z-index: 0; display: block; }

/* Big frosted glyph behind the headline */
.big {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--hw) + 5vw);
  pointer-events: none;
  transition: gap .7s cubic-bezier(.2, .7, .2, 1);
  will-change: transform;
}
.big > span { display: none; }
.big__glyph {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-weight: 200;
  line-height: 1;
  color: transparent;
  background: linear-gradient(to bottom, var(--big-a), var(--big-b));
  -webkit-background-clip: text;
  background-clip: text;
  filter: blur(.6px);
}
:root[data-big="braces"] .big__l,
:root[data-big="braces"] .big__r { display: block; font-size: var(--brace, 40vh); }
:root[data-big="braces"][data-braces="behind"] .big { gap: calc(var(--hw) * 0.5); }
:root[data-big="semi"] .big__semi { display: block; font-size: min(110vh, 90vw); }
:root[data-big="cursor"] .big { gap: 0; }
:root[data-big="cursor"] .big__cursor {
  display: block;
  width: min(30vh, 22vw);
  height: min(60vh, 44vw);
  border-radius: 1vmin;
  background: linear-gradient(to bottom, var(--big-a), var(--big-b));
  filter: blur(.6px);
  animation: breathe 3.6s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .45; } }

/* Headline */
.stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.stage > * { grid-area: 1 / 1; }
.hello {
  margin: 0;
  display: flex;
  align-items: center;
  white-space: pre;
  color: var(--ink);
  text-shadow: 0 0 40px var(--glow);
  pointer-events: auto;
  cursor: default;
  user-select: none;
}
.hello.measure { position: absolute; visibility: hidden; pointer-events: none; }
:root[data-type="mono"] .hello {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-weight: 330;
  font-size: clamp(1.9rem, 6.4vw, 6.4rem);
  letter-spacing: -0.03em;
}
:root[data-type="sans"] .hello {
  font-family: "Google Sans Flex", system-ui, sans-serif;
  font-weight: 440;
  font-size: clamp(2.6rem, 8.4vw, 8.4rem);
  letter-spacing: -0.035em;
}
:root[data-theme="amber"] .hello { text-shadow: 0 0 14px rgba(255, 160, 0, .55), 0 0 2px rgba(255, 210, 140, .9); }
.ch { display: inline-block; white-space: pre; }
.ch.is-scr { opacity: .55; }
.caret {
  display: inline-block;
  margin-left: .08em;
  background: var(--ink);
  animation: blink 1.06s steps(1) infinite;
}
:root[data-type="mono"] .caret { width: .56em; height: .92em; opacity: .9; }
:root[data-type="sans"] .caret { width: .05em; height: .95em; }
@keyframes blink { 50% { opacity: 0; } }

#led { display: none; pointer-events: auto; }
:root[data-type="led"] #led { display: block; }
:root[data-type="led"] .hello:not(.measure) { visibility: hidden; position: absolute; }

/* Design panel (preview only) */
.design-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 13px;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: var(--panel-bg);
  color: var(--panel-ink);
  font: 500 14px/1 "Google Sans Flex", system-ui, sans-serif;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  cursor: pointer;
}
.design-toggle svg { width: 16px; height: 16px; }
.panel {
  position: fixed;
  right: 16px;
  bottom: 68px;
  z-index: 10;
  width: 336px;
  max-height: calc(100dvh - 96px);
  overflow: auto;
  padding: 16px 16px 14px;
  border: 1px solid var(--panel-line);
  border-radius: 20px;
  background: var(--panel-bg);
  color: var(--panel-ink);
  font-size: 14px;
  line-height: 1.35;
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
}
.panel[hidden] { display: none; }
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel__title { margin: 0; font-size: 16px; font-weight: 600; }
.panel__close {
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: transparent; color: var(--panel-ink); font-size: 20px; line-height: 1; cursor: pointer;
}
.row { padding: 10px 0; border-top: 1px solid var(--panel-line); }
.row:first-of-type { border-top: 0; }
.row[hidden] { display: none; }
.row__label { display: block; margin-bottom: 8px; color: var(--panel-soft); font-size: 13px; }
.row__hint { margin: 8px 0 0; color: var(--panel-soft); font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  padding: 7px 11px;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: transparent;
  color: var(--panel-ink);
  font: 450 13px/1.1 "Google Sans Flex", system-ui, sans-serif;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--chip-on); border-color: var(--chip-on); color: var(--chip-on-ink); }
.range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; }
.range label { color: var(--panel-soft); font-size: 13px; }
.range output { font-size: 12px; color: var(--panel-soft); font-variant-numeric: tabular-nums; }
.range input { grid-column: 1 / -1; width: 100%; accent-color: var(--chip-on); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--panel-line); }
.actions button {
  padding: 8px 12px;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: transparent;
  color: var(--panel-ink);
  font: 500 13px/1 "Google Sans Flex", system-ui, sans-serif;
  cursor: pointer;
}
.actions .is-primary { background: var(--chip-on); border-color: var(--chip-on); color: var(--chip-on-ink); }
.panel__note { min-height: 1em; margin: 10px 0 0; color: var(--panel-soft); font-size: 12px; }
#cfgOut { width: 100%; margin-top: 8px; padding: 8px; border: 1px solid var(--panel-line); border-radius: 10px; background: transparent; color: var(--panel-ink); font: 12px/1.4 "Martian Mono", monospace; }
#cfgOut[hidden] { display: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--panel-ink); outline-offset: 2px; }

@media (max-width: 560px) {
  :root[data-type="mono"] .hello { font-size: max(1.9rem, 8.6vw); }
  :root[data-type="sans"] .hello { font-size: max(2.6rem, 11vw); }
  .panel { left: 12px; right: 12px; width: auto; bottom: 64px; max-height: 62dvh; }
  .design-toggle { right: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .caret, .big__cursor { animation: none; }
  .big { transition: none; }
}

/* 404 page */
.nf { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; padding: 1rem; text-align: center; }
.nf p { margin: 0; font-family: "Martian Mono", ui-monospace, monospace; font-size: clamp(.9rem, 1.6vw, 1.1rem); color: var(--ink); opacity: .75; }
.nf a { color: var(--ink); text-underline-offset: .25em; }
.nf a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
