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

body {
  margin: 0;
  overflow: hidden;
  background-color: #000;
  color: #fff;
  font-family: 'ABCDiatype', monospace;
}

#asciiCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.control-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.control-inline input[type="range"] {
  width: 120px;
  height: 20px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.control-inline input[type="range"]::-webkit-slider-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.control-inline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  margin-top: -5px;
}

.control-inline input[type="range"]::-moz-range-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.control-inline input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: white;
  border: none;
  border-radius: 50%;
}

.hud button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: 'ABCDiatype', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.hud button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hud button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hud a {
  color: white;
  text-decoration: none;
  cursor: pointer;
}

.hud a:hover {
  text-decoration: underline;
}

.hud {
  position: fixed;
  bottom: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 12px;
  user-select: none;
  cursor: default;
  pointer-events: auto;
}

.hud span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.status {
  margin-left: 16px;
  min-width: 140px;
  text-align: right;
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.status.show {
  opacity: 0.9;
}

@media (max-width: 720px) {
  .hud {
    flex-wrap: wrap;
    gap: 8px;
    bottom: 10px;
    left: 10px;
    max-width: calc(100vw - 20px);
  }

  .status {
    margin-left: 0;
    flex-basis: 100%;
    text-align: left;
  }

  .control-inline input[type="range"] {
    width: 80px;
  }
}

.camera-preview {
  position: fixed;
  bottom: 10px;
  right: 10px;
  width: 240px;
  height: 180px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 20;
}

.camera-preview.active {
  display: block;
}

.camera-preview video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.2);
  opacity: 0.9;
  transform: scaleX(-1);
}

.camera-preview canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scaleX(-1);
}

@media (max-width: 720px) {
  .camera-preview {
    width: 180px;
    height: 135px;
    bottom: 10px;
    right: 10px;
  }
}
