:root {
  --bg: #1f3bff;
  --fg: #ffe94a;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #fff;
  color: #000;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}
[hidden] { display: none !important; }

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 4vw, 48px);
  background: var(--bg);
  color: var(--fg);
  transition: color 350ms linear 250ms;
  overflow: hidden;
}
#sweep {
  position: absolute;
  inset: 0;
  background: var(--next, transparent);
  clip-path: circle(0 at 0 0);
}
#stage > :not(#sweep) { position: relative; }

#wait {
  margin: 0;
  font-size: min(11vw, 17vh, 8.5rem);
  font-weight: 400;
  line-height: 1.02;
}
.word { display: block; white-space: nowrap; }
.letter {
  display: inline-block;
  width: 0.78em;
  text-align: center;
  transition: transform 320ms cubic-bezier(.2, 1.6, .4, 1);
}
.t0 { font: italic 400 1em Georgia, "Times New Roman", serif; }
.t1 { font: 900 1em Impact, "Arial Black", system-ui, sans-serif; }
.t2 { font: 700 .92em ui-monospace, Menlo, Consolas, monospace; }
.t3 { font: 700 1.04em Didot, "Bodoni 72", "Times New Roman", serif; }
.t4 { font: 400 1em "Courier New", Courier, monospace; }
.t5 { font: 800 1em Futura, "Avenir Next", "Trebuchet MS", sans-serif; }
.t6 { font: 700 1em "American Typewriter", Rockwell, Cambria, serif; }
.t7 { font: italic 700 1.06em "Snell Roundhand", "Brush Script MT", "Segoe Script", cursive; }

#status {
  margin: clamp(16px, 3vh, 32px) 0 12px;
  min-height: 1.4em;
  font-size: clamp(1rem, 2.4vw, 1.5rem);
  font-weight: 600;
  line-height: 1.4;
}
#meter {
  height: 6px;
  flex: none;
  background: color-mix(in srgb, currentColor 25%, transparent);
}
#fill {
  height: 100%;
  width: 0;
  background: currentColor;
  transition: width 500ms ease-out;
}
#code {
  flex: 1;
  min-height: 0;
  margin: 12px 0 0;
  overflow: hidden;
  opacity: .6;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column-reverse;
}

#card {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

#plain {
  display: none;
  padding: 16px;
  max-width: 60ch;
  overflow: auto;
  height: 100%;
}
#plain img { display: block; object-fit: cover; margin-top: 16px; }
#plain h2 { font-size: clamp(2rem, 6vw, 4rem); margin: 0.5em 0 0.2em; line-height: 1.05; }
#plain ul { padding: 0 0 72px; list-style: none; }
#plain li { margin: 0.5em 0; }
#plain a { color: inherit; }
body.plain #plain { display: block; }

#bar {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
#note {
  margin: 0;
  max-width: 44ch;
  padding: 8px 12px;
  background: #fff;
  color: #000;
  outline: 2px solid #000;
  font-size: 14px;
  line-height: 1.35;
}
#note:empty { display: none; }
#actions { display: flex; gap: 8px; }
button {
  pointer-events: auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: #fff;
  color: #000;
  outline: 2px solid #000;
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #000; color: #fff; }
button:focus-visible { outline: 3px solid #06f; outline-offset: 2px; }
button:disabled { color: #6b6b6b; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  #stage, .letter, #fill { transition: none; }
}
