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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  color: #fff;
}

.container {
  width: 100%;
  max-width: 420px;
  padding: 8px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
}

/* ---- Dialer ---- */
.dialer {
  background: #222;
  border-radius: 28px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 94vh;
  height: 94dvh;
  justify-content: space-evenly;
}

.display {
  width: 100%;
}

.code-input {
  width: 100%;
  height: 52px;
  font-size: 28px;
  text-align: center;
  letter-spacing: 8px;
  padding: 8px;
  border-radius: 12px;
  border: none;
  background: #333;
  color: #fff;
  font-weight: 600;
  display: block;
}

.code-input::placeholder { color: #555; letter-spacing: 8px; }

.keypad {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  justify-items: center;
  margin: 16px 0;
}

.key {
  width: 100%;
  max-width: 80px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  background: #333;
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.key:active { background: #555; }
.key:disabled { opacity: 0.35; cursor: default; }
.key svg { pointer-events: none; }

/* Bigger info icon */
#infoBtn svg {
  width: 30px;
  height: 30px;
}

.controls {
  width: 100%;
  display: flex;
  flex-direction: row;
  gap: 14px;
}

.control-btn {
  flex: 1;
  padding: 14px 0;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.control-btn:active { filter: brightness(0.85); }
.control-btn.clear { background: #e8706a; }
.control-btn.call  { background: #4cd964; }

/* ---- Call Screen ---- */
.call-screen {
  background: #222;
  border-radius: 28px;
  padding: 60px 28px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  height: 94vh;
  height: 94dvh;
  justify-content: center;
}
.call-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.call-status {
  font-size: 18px;
  font-weight: 600;
  color: #aaa;
  letter-spacing: 1px;
}
.call-duration {
  font-size: 48px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.call-controls {
  display: flex;
  justify-content: center;
  width: 100%;
}
.control-btn.end-call {
  background: #e8706a;
  width: 100%;
  padding: 16px 0;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  min-width: 0;
  flex: none;
}

/* ---- Modal (Info) ---- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  padding: 20px;
}
.card {
  background: #fff;
  color: #222;
  padding: 24px;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  position: relative;
  line-height: 1.5;
}
.card h3 { margin-bottom: 8px; }

/* ---- Close X button ---- */
.overlay-x {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: rgba(0,0,0,0.45);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
}
.overlay-x:hover { background: rgba(0,0,0,0.7); }
.modal-close {
  top: 12px;
  left: auto;
  right: 12px;
  background: rgba(0,0,0,0.12);
  color: #333;
}
.modal-close:hover { background: rgba(0,0,0,0.25); }

/* ---- Camera Overlay (AR) ---- */
#cameraOverlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
  background: #000;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#cameraContainer {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#overlayLayers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#overlayLayers .overlay-image {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 1;
}

.bottom-controls {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 5;
  padding: 0 4px;
}

.photo-slider {
  width: 100%;
  height: 44px;
  accent-color: #fff;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.photo-slider::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.15);
}
.photo-slider::-moz-range-track {
  height: 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.15);
}

.photo-slider::-moz-range-progress {
  height: 12px;
  border-radius: 6px;
  background: #fff;
}

.photo-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: none;
  margin-top: -10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.photo-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

#cameraOverlay .overlay-x {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  width: 36px;
  height: 36px;
}

#thumbSidebar {
  display: none !important;
}

@media (orientation: landscape) {
  #cameraContainer {
    width: 100%;
    height: 100%;
  }
  .bottom-controls {
    left: 25%;
    right: 25%;
    bottom: 16px;
  }
  #cameraOverlay .overlay-x {
    top: 12px;
    left: 12px;
  }
}
