* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Apple SD Gothic Neo, Malgun Gothic, sans-serif;
  background: #0e1216;
  color: #1c2126;
  overflow: hidden;
}

.app {
  position: fixed;
  inset: 0;
  display: block;
  padding: 0;
}

.camera {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0e1216;
  overflow: hidden;
}

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
  pointer-events: none;
}

.start-btn {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 3;
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.start-btn[hidden] {
  display: none;
}

.start-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.error {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  max-width: calc(100% - 24px);
  font-size: 12.5px;
  line-height: 1.5;
  color: #ff9a90;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.error[hidden] {
  display: none;
}

.lives {
  position: fixed;
  right: 12px;
  top: 8px;
  z-index: 3;
  margin: 0;
  display: flex;
  gap: 4px;
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.85);
}

.lives[hidden] {
  display: none;
}

.lives .heart {
  color: #ff4d5e;
}

.lives .heart.lost {
  color: rgba(255, 255, 255, 0.32);
}

.restart-btn {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 3;
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.restart-btn[hidden] {
  display: none;
}

.user {
  position: fixed;
  right: 12px;
  top: 38px;
  z-index: 3;
  margin: 0;
  max-width: 42%;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: #ffffff;
  text-align: right;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.user[hidden] {
  display: none;
}

.ranking {
  position: fixed;
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  max-width: calc(100% - 32px);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
  color: #ffe066;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.ranking[hidden] {
  display: none;
}
