*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0f;
  color: #fff;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: #000;
}

#mode-label {
  position: absolute;
  top: max(env(safe-area-inset-top), 16px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 10;
}

#mode-label.visible {
  opacity: 1;
}

#permission-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 70%);
  z-index: 20;
}

#permission-prompt[hidden] {
  display: none;
}

#permission-prompt p {
  margin: 0;
  font-size: 16px;
  max-width: 18em;
  line-height: 1.4;
}

#permission-prompt button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 17px;
  font-weight: 600;
  color: #0a0a0f;
  background: linear-gradient(135deg, #ffd86b, #ff7eb6);
  cursor: pointer;
}

#permission-prompt button:active {
  transform: scale(0.97);
}

#permission-error {
  color: #ff9d9d;
  font-size: 14px;
}

#bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px max(env(safe-area-inset-left), 10px) max(env(safe-area-inset-bottom), 10px)
    max(env(safe-area-inset-right), 10px);
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  z-index: 5;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}

.emoji-btn,
.control-btn {
  appearance: none;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 80ms ease;
}

.emoji-btn:active,
.control-btn:active {
  transform: scale(0.88);
}

.control-btn {
  background: rgba(255, 255, 255, 0.18);
  font-weight: 700;
}

#capture {
  background: rgba(255, 255, 255, 0.92);
  color: #0a0a0f;
}

@media (max-width: 380px) {
  .emoji-btn,
  .control-btn {
    width: 38px;
    height: 38px;
    font-size: 19px;
  }
  #bottom-bar {
    gap: 4px;
  }
}
