:root {
  --bg: #0a0b0d;
  --bg-elev: #15171b;
  --line: #262a30;
  --text: #ecebe6;
  --muted: #80868f;
  --accent: #e8b86d;
  --good: #6ee7b7;
  --bad: #fb7185;
  --slow: #fbbf24;
  --focus: #7dd3fc;
}
body {
  background: var(--bg);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
 font-family: Outfit, system-ui, sans-serif;
  color: var(--text);
  min-height: 100%;
  background: var(--bg);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 32px;
}

.header {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.modes {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-inline: auto;
}

.mode {
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

.mode.is-active {
  color: var(--bg);
  background: var(--text);
  font-weight: 600;
}

.mode:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.soon {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 4px;
}

.restart {
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

.restart:hover {
  color: var(--text);
  border-color: var(--muted);
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  outline: none;
  border-radius: 24px;
  margin: 16px 0;
}

.stage:focus-visible {
  box-shadow: 0 0 0 2px var(--focus);
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.word-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 140px;
}
.word {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  display: flex;
}

.letter {
  position: relative;
   color: #5b6372;
  transition: color 0.08s ease;
}

.letter.is-correct {
  color: var(--accent);
  text-shadow: 0 0 18px rgba(232, 184, 109, 0.55),
               0 0 40px rgba(232, 184, 109, 0.25);
}
.letter.is-wrong {
  color: var(--bad);
}

.letter.is-caret::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 4px;
  width: 2px;
  height: 0.78em;
  background: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.speed {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 7rem;
  justify-content: center;
}

.speed-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 2rem;
  font-weight: 600;
  color: var(--muted);
}

.speed.is-good .speed-value {
  color: var(--good);
}

.speed.is-slow .speed-value {
  color: var(--slow);
}

.speed.is-miss .speed-value {
  color: var(--bad);
}

.speed-unit {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.charge-wrap {
  width: min(420px, 90%);
}

.charge-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.charge {
  display: flex;
  gap: 8px;
}

.pip {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #1e222b;
  border: 1px solid var(--line);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.pip.is-filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent);
}

.stage.is-miss {
  animation: shake 0.28s ease;
}

.stage.is-unlock {
  animation: pulse 0.35s ease;
}

@keyframes shake {
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes pulse {
  50% {
    filter: brightness(1.15);
  }
}

.controls {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.control-label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chips {
  display: flex;
  gap: 6px;
}

.chip {
  font: inherit;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}

.chip.is-active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

@media (max-width: 640px) {
  .header {
    justify-content: space-between;
  }

  .modes {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-inline: 0;
  }
}
.chunk-letter {
  color: #525a6b;
  font-weight: 500;
  transition: color 0.08s ease;
  position: relative;
}

.chunk-letter.is-correct { color: var(--text); }
.chunk-letter.is-wrong { color: var(--bad); }

.chunk-letter.is-caret::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 2px;
  height: 0.78em;
  background: var(--accent);
  animation: blink 1s step-end infinite;
}

#burstMode {
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
}

.pip.is-new {
  animation: pip-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes pip-pop {
  0% {
    transform: scaleX(0.6) scaleY(1);
    box-shadow: 0 0 0 rgba(232, 184, 109, 0);
  }
  50% {
    transform: scaleX(1.06) scaleY(1.9);
    box-shadow: 0 0 22px rgba(232, 184, 109, 0.9);
  }
  100% {
    transform: scale(1);
  }
}

.pip.is-new {
  animation: pip-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

#charge.is-full .pip {
  background: #fff3d6;
  border-color: #fff3d6;
  box-shadow: 0 0 16px #e8b86d, 0 0 34px rgba(125, 211, 252, 0.55);
  animation: pip-full 0.8s ease-out;
}

@keyframes pip-full {
  0% { filter: brightness(2.4); }
  100% { filter: brightness(1); }
}

.word.is-surge .letter {
  animation: letter-surge 0.55s ease-out both;
}

@keyframes letter-surge {
  0% { transform: translateY(0) scale(1); }
  35% {
    transform: translateY(-12px) scale(1.14);
    color: #ffffff;
    text-shadow: 0 0 12px #ffffff, 0 0 32px #7dd3fc, 0 0 64px rgba(232, 184, 109, 0.9);
  }
  100% { transform: translateY(0) scale(1); }
}

.shock-ring {
  position: fixed;
  width: 40px;
  height: 40px;
  border: 2px solid #7dd3fc;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 0 18px rgba(125, 211, 252, 0.7);
  transform: translate(-50%, -50%) scale(0.2);
  animation: ring-expand 0.7s ease-out forwards;
}

@keyframes ring-expand {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(11); opacity: 0; }
}

.spark {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 0 10px 2px rgba(232, 184, 109, 0.7);
  transform: translate(-50%, -50%);
  animation: spark-fly 0.8s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}

@keyframes spark-fly {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spark, .shock-ring { display: none; }
  .word.is-surge .letter { animation: none; }
}

.stats {
  display: flex;
  gap: 44px;
  justify-content: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 6ch;
  text-align: center;
}

.stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}