html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0f1220;
  color: #ffffff;
}

.app-shell {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

.fanfare {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 0, 150, 0.55), transparent 45%),
    radial-gradient(circle at 80% 25%, rgba(0, 200, 255, 0.55), transparent 45%),
    radial-gradient(circle at 50% 70%, rgba(255, 220, 0, 0.55), transparent 45%),
    radial-gradient(circle at 15% 80%, rgba(0, 255, 140, 0.55), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(160, 120, 255, 0.55), transparent 40%);
  mix-blend-mode: screen;
}

.fanfare--active {
  animation: fanfareFlash 1.8s ease-out;
}

@keyframes fanfareFlash {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  15% {
    opacity: 1;
    transform: scale(1.02);
  }
  35% {
    opacity: 0.2;
    transform: scale(1.05);
  }
  55% {
    opacity: 1;
    transform: scale(1.03);
  }
  75% {
    opacity: 0.15;
    transform: scale(1.07);
  }
  100% {
    opacity: 0;
    transform: scale(1.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fanfare--active {
    animation: none;
    opacity: 0.6;
  }
}

.typed-area {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
}

.target-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.target-word {
  font-size: 96px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1.05;
  color: #ffffff;
}

.target-letter {
  display: inline-block;
  transition: opacity 0.2s ease;
}

.target-letter--dim {
  opacity: 0.35;
}

.typed-label {
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 8px;
}

.typed-text {
  min-height: 128px;
  padding: 0 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 56px;
  line-height: 1;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  word-break: normal;
}

.keyboard {
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.keyboard-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.key {
  flex: 1;
  border: 0;
  border-radius: 14px;
  padding: 14px 10px;
  font-size: 36px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.8);
  background: var(--key-bg, hsl(200 90% 58%));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.key:active {
  transform: translateY(1px);
}

.key--space {
  flex: 5;
  font-size: 16px;
}

.key--backspace {
  flex: 1;
}

@media (min-width: 768px) {
  .target-word {
    font-size: 132px;
  }

  .typed-text {
    font-size: 72px;
  }

  .key {
    padding: 18px 12px;
    font-size: 40px;
  }
}