html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: black;
  font-family: monospace;
  height: 100vh;
  width: 100vw;
}

.layer {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Properly scaled camera input */
video#input_video {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  background-color: black;
}

/* Canvas matches video */
canvas#output_canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  pointer-events: none;
}

.keyboard {
  position: absolute;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 15px;
}

.row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.key {
  padding: 15px 20px;
  border: 2px solid red;
  background: rgba(255, 0, 0, 0.1);
  color: red;
  font-size: 24px;
  border-radius: 8px;
  box-shadow: 0 0 12px red;
  transition: all 0.2s ease;
  min-width: 20px;
  text-align: center;
  user-select: none;
}

.key.hovered {
  background: rgba(80, 0, 0, 0.7);
  color: #fff;
  box-shadow: 0 0 8px #800;
}

.key.space {
  width: 200px;
}

.key.enter {
  width: 80px;
}

.key.glow {
  background: red;
  color: white;
  box-shadow: 0 0 30px red;
  transform: scale(1.1);
}

.text-preview {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #00ffcc;
  padding: 12px 24px;
  font-size: 1.8rem;
  border-radius: 10px;
  z-index: 5;
  min-width: 200px;
  text-align: center;
}

@media (max-width: 740px) {
  .keyboard {
    width: 95vw;
    max-width: 98vw;
    padding: 6px;
    bottom: 35%;
  }
  .key {
    font-size: 16px;
    padding: 8px 10px;
    min-width: 24px;
    max-width: 40px;
  }
  .key.space {
    width: 40vw;
    min-width: 60px;
    max-width: 98vw;
    font-size: 18px;
  }
  .key.enter {
    width: 14vw;
    min-width: 40px;
    max-width: 60px;
    font-size: 16px;
  }
}

@media (max-width: 550px) {
  .keyboard {
    width: 99vw;
    max-width: 100vw;
    padding: 2px;
    bottom: 40%;
  }
  .key {
    font-size: 12px;
    padding: 4px 6px;
    min-width: 18px;
    max-width: 28px;
  }
  .key.space {
    width: 50vw;
    min-width: 40px;
    max-width: 99vw;
    font-size: 14px;
  }
  .key.enter {
    width: 10vw;
    min-width: 24px;
    max-width: 40px;
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .keyboard {
    width: 100vw;
    max-width: 100vw;
    padding: 1px;
    bottom: 45%;
  }
  .key {
    font-size: 9px;
    padding: 2px 3px;
    min-width: 10px;
    max-width: 18px;
  }
  .key.space {
    width: 60vw;
    min-width: 20px;
    max-width: 100vw;
    font-size: 10px;
  }
  .key.enter {
    width: 8vw;
    min-width: 12px;
    max-width: 20px;
    font-size: 9px;
  }
}

.social-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  z-index: 1000;
  text-align: center;
  padding: 18px 0 8px 0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.5);
}

.footer-heading {
  margin: 0 0 8px 0;
  font-size: 1.3rem;
  color: #00ffcc;
  letter-spacing: 1px;
}

.social-icons {
  margin-bottom: 8px;
}

.social-click {
  color: #fff;
  margin: 0 10px;
  font-size: 1.6rem;
  transition: color 0.2s;
}

.social-click:hover {
  color: #00ffcc;
}

.credit {
  font-size: 1rem;
  margin: 0;
  color: #aaa;
}
