/* src/styles/global.css */
:root {
  --bg: #1a1b2e;
  --bg-card: #242640;
  --bg-hover: #2d2f52;
  --text: #e8e8f0;
  --text-dim: #8888a8;
  --accent: #7c6ff7;
  --accent-glow: #7c6ff766;
  --success: #2ecc71;
  --error: #e74c3c;
  --warning: #f1c40f;
  --radius: 12px;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
}

#root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button {
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius);
  border: none;
  padding: 10px 20px;
  transition: all .15s;
  font-family: inherit;
  font-size: 14px;
}

button:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 8px var(--accent-glow);
  }

  50% {
    box-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn .3s ease;
}

/* src/styles/typing.css */
.typingArea {
  background: var(--bg-card);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  cursor: text;
  outline: none;
  position: relative;
  border: 2px solid #0000;
  min-height: 120px;
  padding: 30px;
  transition: border-color .2s;
  font-size: 22px;
  line-height: 1.8;
}

.typingArea:focus {
  border-color: var(--accent);
}

.typingArea.blurred:after {
  content: "Click here to start typing...";
  position: absolute;
  display: flex;
  border-radius: var(--radius);
  color: var(--text-dim);
  background: #1a1b2ecc;
  justify-content: center;
  align-items:  center;
  font-size: 16px;
  inset: 0;
}

.char {
  position: relative;
  letter-spacing: 1px;
}

.correct {
  color: var(--success);
}

.incorrect {
  color: var(--error);
  background: #e74c3c26;
  border-radius: 3px;
}

.current {
  border-left: 2px solid var(--accent);
  animation: blink 1s step-end infinite;
  margin-left: -1px;
  padding-left: 1px;
}

.pending {
  color: var(--text-dim);
}

@keyframes blink {
  50% {
    border-color: #0000;
  }
}

.stats {
  display: flex;
  gap: 30px;
  padding: 16px 0;
}

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

.statValue {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}

.statLabel {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
}

.lessonSelect {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.lessonCard {
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  border: 2px solid #0000;
  padding: 20px;
  transition: all .2s;
}

.lessonCard:hover:not(.locked) {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.locked {
  opacity: .4;
  cursor: not-allowed;
}

.completed {
  border-color: var(--success);
}

.lessonId {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
}

.lessonName {
  margin: 6px 0;
  font-size: 18px;
  font-weight: 600;
}

.lessonKeys {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 14px;
}

.lessonStatus {
  color: var(--text-dim);
  margin-top: 8px;
  font-size: 12px;
}

.modal {
  position: fixed;
  display: flex;
  z-index: 100;
  animation: fadeIn .2s ease;
  background: #000000b3;
  justify-content: center;
  align-items:  center;
  inset: 0;
}

.modalContent {
  background: var(--bg-card);
  border-radius: var(--radius);
  text-align: center;
  animation: fadeIn .3s ease;
  width: 90%;
  max-width: 440px;
  padding: 40px;
}

.modalTitle {
  margin-bottom: 20px;
  font-size: 28px;
  font-weight: 700;
}

.modalStats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 24px 0;
}

.unlockText {
  color: var(--success);
  margin: 16px 0;
  font-size: 16px;
}

.modalButtons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.primaryBtn {
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
}

.primaryBtn:hover {
  filter: brightness(1.1);
  background: var(--accent);
}

.secondaryBtn {
  background: var(--bg-hover);
  padding: 12px 28px;
  font-size: 16px;
}

.modeHeader {
  margin-bottom: 24px;
}

.modeTitle {
  font-size: 24px;
  font-weight: 700;
}

.modeSubtitle {
  color: var(--text-dim);
  margin-top: 4px;
}

/* src/styles/keyboard.css */
.keyboard {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius);
  user-select: none;
  flex-direction: column;
  align-items:  center;
  gap: 6px;
  padding: 20px;
}

.row {
  display: flex;
  gap: 5px;
}

.row:nth-child(2) {
  margin-left: 20px;
}

.row:nth-child(3) {
  margin-left: 35px;
}

.row:nth-child(4) {
  margin-left: 55px;
}

.key {
  display: flex;
  font-family: var(--font-mono);
  position: relative;
  text-transform: uppercase;
  border: 2px solid #0000;
  border-radius: 8px;
  justify-content: center;
  align-items:  center;
  width: 44px;
  height: 44px;
  transition: all .15s;
  font-size: 14px;
  font-weight: 600;
}

.key:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

.space {
  width: 280px;
}

.active {
  animation: pulse 1s ease-in-out infinite;
  filter: brightness(1.3);
  z-index: 1;
  transform: translateY(-2px);
}

.pressed {
  transition: all 50ms;
  filter: brightness(.8) !important;
  transform: translateY(2px) !important;
}

.fingerLabel {
  position: absolute;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s;
  font-size: 9px;
  bottom: -18px;
}

.key:hover .fingerLabel {
  opacity: 1;
}

/* src/styles/game.css */
.gameContainer {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  outline: none;
  border: 2px solid #0000;
  height: 500px;
  transition: border-color .2s;
}

.gameContainer:focus {
  border-color: var(--accent);
}

.gameContainer.blurred:after {
  content: "Click to play!";
  position: absolute;
  display: flex;
  border-radius: var(--radius);
  color: var(--text-dim);
  z-index: 5;
  background: #1a1b2ecc;
  justify-content: center;
  align-items:  center;
  font-size: 18px;
  inset: 0;
}

.gameHud {
  position: absolute;
  display: flex;
  z-index: 2;
  font-family: var(--font-mono);
  background: linear-gradient(#1a1b2ee6, #0000);
  justify-content: space-between;
  padding: 16px 20px;
  top: 0;
  left: 0;
  right: 0;
}

.hudItem {
  display: flex;
  flex-direction: column;
  align-items:  center;
}

.hudLabel {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-size: 10px;
}

.hudValue {
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
}

.dangerZone {
  position: absolute;
  background: var(--error);
  opacity: .6;
  height: 4px;
  bottom: 0;
  left: 0;
  right: 0;
}

.word {
  position: absolute;
  font-family: var(--font-mono);
  background: var(--bg-hover);
  border: 2px solid var(--accent);
  color: var(--text);
  white-space: nowrap;
  border-radius: 8px;
  padding: 6px 14px;
  transition: transform 50ms linear;
  font-size: 20px;
  font-weight: 600;
}

.wordMatched {
  border-color: var(--success);
}

.wordMatchedChar {
  color: var(--success);
}

.inputDisplay {
  position: absolute;
  background: var(--bg);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  color: var(--accent);
  border: 2px solid var(--accent);
  text-align: center;
  z-index: 3;
  min-width: 200px;
  padding: 10px 24px;
  font-size: 20px;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.lives {
  letter-spacing: 4px;
  font-size: 20px;
}

.gameOver {
  position: absolute;
  display: flex;
  z-index: 10;
  animation: fadeIn .3s ease;
  background: #1a1b2ef2;
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  inset: 0;
}

.gameOverTitle {
  margin-bottom: 16px;
  font-size: 36px;
  font-weight: 700;
}

.gameOverScore {
  color: var(--text-dim);
  margin-bottom: 8px;
  font-size: 20px;
}

.highScore {
  color: var(--warning);
  font-weight: 600;
}

.gameOverButtons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.statsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.statsCard {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
}

.statsCardTitle {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 16px;
  font-size: 14px;
}

.progressBar {
  background: var(--bg);
  overflow: hidden;
  border-radius: 6px;
  height: 12px;
}

.progressFill {
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 6px;
  height: 100%;
  transition: width .5s;
}

.wordExploding {
  animation: wordExplode .45s ease-out forwards;
  pointer-events: none;
  border-color: var(--success) !important;
  background: var(--success) !important;
  color: #fff !important;
}

@keyframes wordExplode {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }

  30% {
    transform: scale(1.3);
    opacity: 1;
    filter: brightness(2);
  }

  100% {
    transform: scale(.2);
    opacity: 0;
    filter: brightness(3) blur(4px);
  }
}

.particle {
  position: absolute;
  pointer-events: none;
  animation: particleFly var(--duration) ease-out forwards;
  z-index: 20;
  border-radius: 50%;
  width: 8px;
  height: 8px;
}

@keyframes particleFly {
  0% {
    transform: translate(0)scale(1);
    opacity: 1;
  }

  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

.scorePopup {
  position: absolute;
  font-family: var(--font-mono);
  color: var(--success);
  pointer-events: none;
  z-index: 20;
  text-shadow: 0 0 12px var(--success), 0 0 24px #2ecc7166;
  animation: scoreFloat .8s ease-out forwards;
  font-size: 24px;
  font-weight: 800;
}

@keyframes scoreFloat {
  0% {
    transform: translateY(0)scale(.5);
    opacity: 0;
  }

  20% {
    transform: translateY(-10px)scale(1.2);
    opacity: 1;
  }

  100% {
    transform: translateY(-60px)scale(.8);
    opacity: 0;
  }
}

.screenFlash {
  position: absolute;
  pointer-events: none;
  z-index: 15;
  animation: flash .3s ease-out forwards;
  border-radius: var(--radius);
  inset: 0;
}

@keyframes flash {
  0% {
    background: #2ecc7133;
  }

  100% {
    background: none;
  }
}

.comboText {
  position: absolute;
  font-family: var(--font-mono);
  pointer-events: none;
  z-index: 20;
  animation: comboPop .6s ease-out forwards;
  background: linear-gradient(135deg, var(--accent), #e84393, var(--warning));
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 20px var(--accent));
  -webkit-background-clip: text;
  font-size: 48px;
  font-weight: 800;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes comboPop {
  0% {
    transform: translate(-50%, -50%)scale(.3)rotate(-10deg);
    opacity: 0;
  }

  30% {
    transform: translate(-50%, -50%)scale(1.3)rotate(3deg);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%)scale(.8)rotate(0);
    opacity: 0;
  }
}

/* src/styles/missile.css */
.wrapper {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  outline: none;
  border: 2px solid #0000;
  height: 500px;
  transition: border-color .2s;
}

.wrapper:focus {
  border-color: var(--accent);
}

.wrapper.blurred:after {
  content: "Click to focus!";
  position: absolute;
  display: flex;
  border-radius: var(--radius);
  color: var(--text-dim);
  z-index: 5;
  background: #1a1b2ecc;
  justify-content: center;
  align-items:  center;
  font-size: 18px;
  inset: 0;
}

.canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  display: flex;
  z-index: 2;
  font-family: var(--font-mono);
  pointer-events: none;
  justify-content: space-between;
  align-items:  flex-start;
  padding: 12px 20px;
  top: 0;
  left: 0;
  right: 0;
}

.hudLeft, .hudRight {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hudLabel {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-size: 10px;
}

.hudValue {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}

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

.missilePip {
  opacity: .3;
  font-size: 18px;
}

.missilePip.active {
  opacity: 1;
}

.hpPips {
  display: flex;
  gap: 4px;
}

.hpPip {
  background: var(--error);
  opacity: .25;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  transition: opacity .3s;
}

.hpPip.filled {
  opacity: 1;
  box-shadow: 0 0 6px var(--error);
}

.wordPrompt {
  position: absolute;
  background: var(--bg);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  color: var(--text);
  border: 2px solid var(--accent);
  text-align: center;
  z-index: 3;
  pointer-events: none;
  min-width: 220px;
  padding: 10px 24px;
  font-size: 22px;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.typedChar {
  color: var(--success);
}

.cursor {
  border-bottom: 2px solid var(--accent);
  animation: blink .8s step-end infinite;
}

@keyframes blink {
  50% {
    border-color: #0000;
  }
}

.progressWrap {
  position: absolute;
  z-index: 2;
  background: #ffffff0d;
  height: 6px;
  bottom: 0;
  left: 0;
  right: 0;
}

.progressFill {
  background: linear-gradient(90deg, var(--accent), var(--success));
  height: 100%;
  transition: width .4s;
}

.overlay {
  position: absolute;
  display: flex;
  z-index: 10;
  animation: fadeIn .3s ease;
  background: #1a1b2ef2;
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  inset: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.overlayTitle {
  margin-bottom: 16px;
  font-size: 36px;
  font-weight: 700;
}

.overlaySubtitle {
  color: var(--text-dim);
  margin-bottom: 8px;
  font-size: 20px;
}

.newHighScore {
  color: var(--warning);
  font-weight: 600;
}

.overlayBtn {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  margin-top: 24px;
  padding: 14px 36px;
  font-size: 18px;
  font-weight: 600;
}

.shake {
  animation: shake .3s ease-out;
}

@keyframes shake {
  0%, 100% {
    transform: translate(0);
  }

  15% {
    transform: translate(-4px, 2px);
  }

  30% {
    transform: translate(4px, -2px);
  }

  45% {
    transform: translate(-3px, 3px);
  }

  60% {
    transform: translate(3px, -1px);
  }

  75% {
    transform: translate(-2px, 1px);
  }
}

.selector {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
  padding: 40px 20px;
}

.selectorCard {
  background: var(--bg-card);
  border: 2px solid var(--bg-hover);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  flex: 1;
  max-width: 280px;
  padding: 32px 28px;
  transition: border-color .2s, transform .15s;
}

.selectorCard:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.selectorIcon {
  margin-bottom: 16px;
  font-size: 48px;
}

.selectorTitle {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 700;
}

.selectorDesc {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

/* src/styles/auth.css */
.auth-container {
  display: flex;
  background: var(--bg);
  justify-content: center;
  align-items:  center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  text-align: center;
  width: 100%;
  max-width: 400px;
  padding: 40px;
}

.auth-title {
  margin-bottom: 8px;
  font-size: 28px;
  font-weight: 800;
}

.auth-subtitle {
  color: var(--text-dim);
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--bg-hover);
  gap: 0;
  margin-bottom: 24px;
}

.auth-tab {
  color: var(--text-dim);
  cursor: pointer;
  background: none;
  border: none;
  flex: 1;
  padding: 10px;
  transition: background .2s, color .2s;
  font-size: 14px;
  font-weight: 600;
}

.auth-tab:hover {
  background: var(--bg-hover);
}

.auth-tabActive {
  background: var(--accent);
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-input {
  border-radius: var(--radius);
  border: 1px solid var(--bg-hover);
  background: var(--bg);
  color: var(--text);
  outline: none;
  padding: 12px 16px;
  transition: border-color .2s;
  font-family: inherit;
  font-size: 16px;
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-btn {
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  border: none;
  padding: 14px;
  transition: opacity .2s;
  font-size: 16px;
  font-weight: 600;
}

.auth-btn:hover {
  opacity: .9;
}

.auth-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.auth-error {
  color: var(--error);
  margin-top: 4px;
  font-size: 14px;
}

.auth-passkey {
  margin-bottom: 16px;
  font-size: 48px;
}

.auth-hint {
  color: var(--text-dim);
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}
