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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

a-scene {
  position: fixed;
  inset: 0;
}

#ui {
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
}

.ui-btn {
  position: absolute;
  pointer-events: auto;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: transform 0.1s ease, background 0.2s ease;
}

.ui-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.3);
}

.capture-btn {
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.9);
}

.capture-btn svg {
  width: 52px;
  height: 52px;
  fill: #ff8fb3;
  stroke: #fff;
  stroke-width: 1.5;
}

.capture-btn:active {
  transform: translateX(-50%) scale(0.9);
}

.hud {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  top: calc(28px + env(safe-area-inset-top));
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

#flash.on {
  animation: flash 0.4s ease-out;
}

@keyframes flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

.settings-btn {
  right: calc(20px + env(safe-area-inset-right));
  top: calc(24px + env(safe-area-inset-top));
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.settings-btn svg {
  width: 24px;
  height: 24px;
}

.version {
  position: absolute;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#settings {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: none;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.4);
}

#settings.on {
  display: flex;
}

.sheet {
  width: min(340px, 92vw);
  height: 100%;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  background: rgba(20, 20, 24, 0.96);
  color: #eee;
  overflow-y: auto;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 18px;
}

.sheet-header button {
  background: none;
  border: none;
  color: #aaa;
  font-size: 18px;
  cursor: pointer;
}

.row {
  display: block;
  margin-bottom: 18px;
}

.row-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #bbb;
  margin-bottom: 6px;
}

.row-label b {
  color: #ff8fb3;
}

.row input[type="range"] {
  width: 100%;
  accent-color: #ff8fb3;
}

.row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: #ff8fb3;
}

#preview {
  position: fixed;
  inset: 0;
  z-index: 1000001;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.92);
}

#preview.on {
  display: flex;
}

#preview-img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
}

.preview-actions {
  display: flex;
  gap: 14px;
}

.preview-actions button {
  padding: 12px 22px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.preview-actions .primary {
  background: #ff8fb3;
  border-color: #ff8fb3;
  color: #1a1a1a;
  font-weight: 600;
}
