* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: #020617;
  color: #e2e8f0;
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.setup-screen,
.player-screen {
  position: absolute;
  inset: 0;
}

.setup-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.76), rgba(2, 6, 23, 0.92)),
    radial-gradient(circle at top, rgba(56, 189, 248, 0.2), transparent 45%);
}

.setup-card {
  width: min(100%, 460px);
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.86);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

.setup-header {
  margin-bottom: 20px;
}

.setup-header h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.setup-header p {
  margin: 0;
  color: #93c5fd;
  font-size: 15px;
}

.setup-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.setup-fields label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.setup-fields input {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 14px 16px;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.85);
}

.primary-button,
.overlay-button {
  border: 0;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  padding: 14px 18px;
  color: #0f172a;
  background: linear-gradient(135deg, #38bdf8, #22d3ee);
}

.player-screen {
  background: #000;
}

#remoteVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.top-overlay {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  pointer-events: none;
  z-index: 3;
}

.status-pill {
  max-width: 48vw;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px);
  font-size: 14px;
  pointer-events: auto;
}

.mode-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.mode-button {
  min-width: 60px;
  padding: 9px 12px;
  border: 0;
  border-radius: 999px;
  color: #cbd5e1;
  background: transparent;
  font-weight: 700;
}

.mode-button.active {
  color: #0f172a;
  background: linear-gradient(135deg, #38bdf8, #22d3ee);
}

.top-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

#exitPhotoModeButton {
  pointer-events: auto;
}

.overlay-button {
  padding: 10px 14px;
  color: #e2e8f0;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px);
}

.orientation-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(12px);
  z-index: 4;
}

.controls-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.move-zone,
.look-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  touch-action: none;
}

.move-zone {
  left: 0;
  width: 44vw;
  --joystick-x: 34%;
  --joystick-y: 68%;
}

.look-zone {
  right: 0;
  width: 56vw;
}

.move-base {
  position: absolute;
  left: var(--joystick-x);
  top: var(--joystick-y);
  width: 136px;
  height: 136px;
  margin-left: -68px;
  margin-top: -68px;
  border: 2px solid rgba(226, 232, 240, 0.2);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.stick {
  position: absolute;
  left: var(--joystick-x);
  top: var(--joystick-y);
  width: 74px;
  height: 74px;
  margin-left: -37px;
  margin-top: -37px;
  border-radius: 50%;
  border: 2px solid rgba(226, 232, 240, 0.92);
  background: rgba(56, 189, 248, 0.32);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.look-tag {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.42);
  font-size: 13px;
  opacity: 0.8;
  pointer-events: none;
}

@media (orientation: portrait) {
  .top-overlay {
    justify-content: flex-start;
  }

  .status-pill {
    max-width: none;
  }

  .mode-selector {
    order: 3;
  }

  .move-zone {
    width: 48vw;
  }

  .look-zone {
    width: 52vw;
  }
}
